Jump to content

Using API


NoMansLand

Recommended Posts

Posted

So I am working on the API and attempting to get this to work, but when I utilize the site, it crashes out and gives me the error.

 

When I include another part of the site I get Fatal Errors. Any help will be appreciated.

 

function SUBMITnewtopic($username,$id) {
    require('connection.php');
    
    $query = "SELECT * FROM application_classifield WHERE id='$id'";
    
    $result = $mysqli->query($query);
    
    while($row = $result->fetch_array()) {
        $position = $row['position'];
    }
    
    require_once('/home/myfallen/public_html/forums/initdata.php' );
    require_once('/home/myfallen/public_html/forums/admin/sources/base/ipsRegistry.php' );
    require_once('/home/myfallen/public_html/forums/admin/sources/base/ipsController.php');

    $registry = ipsRegistry::instance();
    $registry->init();
    
    //---------------------------------------------------------
// Get some libraries we need
//---------------------------------------------------------

ipsRegistry::getAppClass( 'forums' );

$classToLoad            = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php', 'classPost', 'forums' );
$classToLoad            = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->post                = new $classToLoad( $this->registry );

try
{
    $this->post->setBypassPermissionCheck( true );
    $this->post->setIsAjax( false );
    $this->post->setPublished( true );
    $this->post->setForumID( 85 );
    $this->post->setAuthor( IPSMember::load( 899 ) );
    $this->post->setPostContentPreFormatted( "There has been a new application to <strong>" . $position . "</strong>.<p>Please use MySupport <a href=\"http://support.myfallen.net/scp/viewapp\">here</a></p><p>This forum is for discussion about this application and will be closed and moved when completed.</p>" );
    $this->post->setTopicTitle( "[New Application] - " . $username );
    $this->post->setSettings( array( 'enableSignature' => 1,
                               'enableEmoticons' => 1,
                               'post_htmlstatus' => 0 ) );
    
    if( $this->post->addTopic() === false )
    {
        print_r( $this->post->getPostError() );

        return false;
    }
    
    $topic = $this->post->getTopicData();
}
catch( Exception $e )
{
    print $e->getMessage();

    return false;
}
}

 

Untitled.png

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...