vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   vB_DataManager_Thread_FirstPost and Cookies (https://vborg.vbsupport.ru/showthread.php?t=205493)

Saberhagen 02-15-2009 09:39 PM

vB_DataManager_Thread_FirstPost and Cookies
 
Hello,

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

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($vbulletinERRTYPE_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.


All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02118 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete