TeknoSounds
09-19-2011, 07:22 AM
Greetings, I'm (still) attempting to create a new thread outside VB, but now I'm getting the following errors (echoes 0 & 1 happen previously in the code):
012
Fatal error: MGCCbEvo_core::Registry object is not an object in [path]/mgc_cb_evo/classes/class_core.php on line 21
As you can see, this is from MGC chatbox. When the chatbox is disabled from the ACP, I then get the following error:
0123
Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 205
I can't seem to figure out why its not able to create the registry object for either MGC or the datamanager. Code below.
//Create New VB Thread from Event Info
public function CreateNewVBThread($date, $name, $venue, $city, $state) {
//Variables
echo 2;
$postip = "127.0.0.1";
$userid = 243;
$username = 'Events Announcer';
$title = ($date . ' - ' . $name . ' @ ' . $venue . ' - ' . $city . ', ' . $state);
$threadinfo = array();
$forumdir = "/myforumdirectory";
$specialtemplates = array();
$actiontemplates = array();
$globaltemplates = array();
chdir($forumdir);
require($forumdir . '/global.php');
require($forumdir . '/includes/functions_databuild.php');
//Determine City/Forum
if ($state = "TX") {
switch ($city) {
case "Austin":
$forumid = 70;
break;
case "Dallas":
$forumid = 77;
break;
case "Houston":
$forumid = 78;
break;
case "San Antonio":
$forumid = 79;
break;
default:
$forumid = 80;
break;
}
}
else {
$forumid = 81;
}
echo 3;
//Create new thread given info below
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', $forumid);
$threaddm->setr('userid', $userid);
$threaddm->setr('title', $title);
$threaddm->set('username', $username);
$threaddm->set('pagetext', 'This is a test');
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->set('ipaddress', $postip);
$threaddm->set('dateline', TIMENOW);
$threaddm->pre_save();
if(count($threaddm->errors) < 1)
{
$threadid = $threaddm->save();
unset($threaddm);
build_thread_counters($threadid);
}
else
{
print "Error making new thread! " . $threaddm->errors[0] . $threaddm->errors[1] . $threaddm->errors[2] ;
}
build_forum_counters($forumid);
} //end CreateNewVBThread() */
The file does live in a folder outside of vb currently, though plans are to remove this section and place it in its own file in the vb folder later.
012
Fatal error: MGCCbEvo_core::Registry object is not an object in [path]/mgc_cb_evo/classes/class_core.php on line 21
As you can see, this is from MGC chatbox. When the chatbox is disabled from the ACP, I then get the following error:
0123
Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 205
I can't seem to figure out why its not able to create the registry object for either MGC or the datamanager. Code below.
//Create New VB Thread from Event Info
public function CreateNewVBThread($date, $name, $venue, $city, $state) {
//Variables
echo 2;
$postip = "127.0.0.1";
$userid = 243;
$username = 'Events Announcer';
$title = ($date . ' - ' . $name . ' @ ' . $venue . ' - ' . $city . ', ' . $state);
$threadinfo = array();
$forumdir = "/myforumdirectory";
$specialtemplates = array();
$actiontemplates = array();
$globaltemplates = array();
chdir($forumdir);
require($forumdir . '/global.php');
require($forumdir . '/includes/functions_databuild.php');
//Determine City/Forum
if ($state = "TX") {
switch ($city) {
case "Austin":
$forumid = 70;
break;
case "Dallas":
$forumid = 77;
break;
case "Houston":
$forumid = 78;
break;
case "San Antonio":
$forumid = 79;
break;
default:
$forumid = 80;
break;
}
}
else {
$forumid = 81;
}
echo 3;
//Create new thread given info below
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', $forumid);
$threaddm->setr('userid', $userid);
$threaddm->setr('title', $title);
$threaddm->set('username', $username);
$threaddm->set('pagetext', 'This is a test');
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->set('ipaddress', $postip);
$threaddm->set('dateline', TIMENOW);
$threaddm->pre_save();
if(count($threaddm->errors) < 1)
{
$threadid = $threaddm->save();
unset($threaddm);
build_thread_counters($threadid);
}
else
{
print "Error making new thread! " . $threaddm->errors[0] . $threaddm->errors[1] . $threaddm->errors[2] ;
}
build_forum_counters($forumid);
} //end CreateNewVBThread() */
The file does live in a folder outside of vb currently, though plans are to remove this section and place it in its own file in the vb folder later.