The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Problem including global.php in my own scripts.
Hi,
Trying to call some vBulletin methods from my own scripts. This is vB 3.5.4 under WinXP localhost w/ Apache 1.3.33 and PHP 5.0.4. I am executing the following inside one of my wrapper class methods: Code:
$current_dir = getcwd(); chdir( '../../htdocs/forums' ); require_once( './global.php' ); require_once( './includes/class_dm.php' ); * MY CODE GOES HERE * chdir( $current_dir ); Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\functions.php on line 3277 Warning: Invalid argument supplied for foreach() in \includes\functions.php on line 3277 Fatal error: Call to a member function query_read() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 2502 Fatal error: Call to a member function unlock_tables() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 4419 Fatal error: Call to a member function unlock_tables() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 4419 ...what other environment type setup do I need? Everyone else seems to happily do a chdir() and require_once of global.php and everything works from there. Are there other vBulletin directory assumptions beyond the chdir? TIA, - John |
#2
|
|||
|
|||
Hey iafraid, welcome to the forums!
So the problem seems to be that you are trying to neatly encapsulate things into a wrapper class, which global.php (and the called init.php) was never meant to do. What you need to do is take that require_once of global.php and put it at the header of every PHP page that will ever call these wrapper classes. Some may say that having to do this on the page level instead of a class level is a crock, but I've made some pretty tasty dishes in my crock pot I must say! Please let us know if you have any more problems, since we're here to help! |
#3
|
|||
|
|||
The only reason I am bumping this up is because I have always had this problem and whenever I google a solution, this comes up first; so I figure this will help someone else who is experiencing the same issue:
http://www.lampwrights.com/showthrea...=1069#post1069 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|