PDA

View Full Version : Minimum initialization for $vbulletin variable?


mhoutz
03-02-2007, 06:49 PM
Can anybody clue me in as to the very minimum amount of junk I have to load to get the $vbulletin variable up and running? I need to use it to unify a login across 2 sites, and given the amount of ridiculous globals that vBulletin decides to set, I need to do it conditionally only when needed.

Several people have pointed out this method:

$curdir = getcwd();
$forumDir = SITE_ROOT.'forum';
chdir($forumDir);
require_once('./global.php');
require_once(DIR . '/includes/functions_login.php');
chdir($curdir);

But what I really need is the ability to run this all in a function so vBulletin doesn't always saddle the rest of my application with its prehistoric code architecture. I need something like this:

function initPoorlyWrittenNativeVBEnvironment() {

global $vbulletin;

$curdir = getcwd();
$forumDir = SITE_ROOT.'forum';
chdir($forumDir);
require_once('./global.php');
require_once(DIR . '/includes/functions_login.php');
chdir($curdir);

}

But doing so seems to lose all the referenced $db connections at the point a new session is built. Anybody actually solve this, or should I just bill vBulletin directly for the debugging time?