PDA

View Full Version : vB_DataManager_Thread_FirstPost and Cookies


Saberhagen
02-15-2009, 09:39 PM
Hello,

i want to use this code for external postings in my forum:

chdir('foo');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
require_once('./includes/functions_databuild.php');

$forumid = '10';
$userid = '1000';
$title = 'blubb';
$pagetext = 'blubb';
$open = '1';
$allow_smilie = '1';
$visible = '1';

// fetch userinfo
if (!$userinfo = fetch_userinfo($userid))
{
die("Invalid User!");
}

// initialize datamanager
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);

// set data
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum',$foruminfo);
$threaddm->set_info('user',$userinfo);
$threaddm->set('forumid', $forumid);
$threaddm->set('userid',$userinfo['userid']);
$threaddm->set('title', $title);
$threaddm->set('pagetext', $pagetext);
$threaddm->set('open', $open);
$threaddm->set('allowsmilie', $allow_smilie);
$threaddm->set('visible', $visible);

// error checks
$threaddm->pre_save();
if (!empty($threaddm->errors))
{
echo ($threaddm->errors);
}

// save
$threadid = $threaddm->save();
unset($threaddm);

// rebuild caches
build_thread_counters($threadid);
build_forum_counters($forumid);



Problem: Cookies are needed. But why?
The script sets the following cookies:
bblastactivity
bblastvisit
sessionCookie
wooTracker (Woopra Plugin)

Is there a way to avoid that?

Thanks

Lynne
02-15-2009, 09:53 PM
Those cookies are set because you included global.php and it has functions that set cookies. (At least, I think that is it.)

Dismounted
02-16-2009, 04:49 AM
Lynne is correct, the first two cookies "lastactivity/lastvisit" are set by global.php.