The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Using data manager outside forum directory
Hello,
I'm currently running an application script that involves a function that will create a new thread on my forum. The script seems to run if I put the php file inside the root directory of my forum but if I try to move the file anywhere else on the server, it doesn't work. I'm using require() function with the correct paths pointing to the global.php and includes. Directory structure of when myfile.php works: /test/forumstest/myfile.php (works) /test/forumstest/application/myfile.php (doesn't work) /test/application/myfile.php (doesn't work) Heres the code: Code:
// CREATE THREAD IN PUBLIC RECRUITING $forumURL = "/var/www/html/test/forumstest"; // no forward slash require_once($forumURL.'/global.php'); require_once($forumURL.'/includes/class_dm.php'); require_once($forumURL.'/includes/class_dm_threadpost.php'); require_once($forumURL.'/includes/functions_databuild.php'); $threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost'); /* vars */ $forumid = 31; // can also be a number ;) $forumdid= 12; $title = $charNames.' '.$charClass; $pagetext = $message; $foruminfo = fetch_foruminfo($forumid); $threaddm->set_info('forum', $foruminfo); /* strip */ $forum_id = (int)$forum_id; $pagetext = (string)strip_tags($pagetext); $title = (string)strip_tags($title); // $threaddm->set('forumid', $foruminfo['forumid']); $threaddm->set('userid', 3963); $threaddm->set('title', $title); $threaddm->set('pagetext', $pagetext); $threaddm->set('allowsmilie', 1); $threaddm->set('visible', 1); $threaddm->set('dateline', TIMENOW); $threaddm->pre_save(); if (count($threaddm->errors) > 0) { print_r($threaddm->errors); } else { $threaddm->save(); build_forum_counters($forum_id); echo 'Yay!'; } |
#2
|
|||
|
|||
PHP Code:
|
#3
|
||||
|
||||
It's better to change the directory back to normal at the end of your little bit of script - it may stop a few nasty bugs.
|
#4
|
|||
|
|||
Thanks for the examples. I'll test them out.
|
#5
|
|||
|
|||
Quote:
It's work. But i have a problem. If i set HTML Tags on 'pagetext', it will delete Tags!!! I set the HTML permission to True on the destination forum, but ... what can i to do?! (sry for my bad english) |
#6
|
|||
|
|||
See the following:
http://us2.php.net/strip-tags Now view your code: /* strip *///What is it with the (int) AND (string) $forum_id = (int)$forum_id; $pagetext = (string)strip_tags($pagetext); $title = (string)strip_tags($title); // If you change $pagetext = ... to: $pagetext = (string)$pagetext; Does this resolve the stripping of tags? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|