connect($servername, $username, $password, $database);
if ($utf8)
{
$db->query("SET NAMES utf8");
}
define('DEVDEBUG', $debug);
define('TABLE_PREFIX', $tableprefix);
define('COOKIE_PREFIX', $cookieprefix);
unset($database, $servername, $theuser, $password, $thepass, $usepconnect, $tableprefix, $cookieprefix);
require_once('./includes/functions_datastore.php');
require_once('./includes/functions.php');
require_once('./includes/language.php');
// ###################################################################
// init the big three
class bugdar
{
public static $options = array();
public static $userinfo = array();
public static $datastore = array();
public static $permissions = array();
public static $emailOptions = array();
private function __construct() {}
}
// ###################################################################
// send nocache
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
if ($utf8)
{
header("Content-Type: text/html; charset=\"utf8\"");
}
header("Pragma: no-cache");
// ###################################################################
// populate our caches
$db->showerrors = false;
$datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX . "datastore");
$db->showerrors = true;
if (!$datastoretemp)
{
echo '
Notice: This error could be caused if you have not installed Bugdar. If this is the case, you can run the installer
here.
';
$db->error('Invalid SQL error');
}
foreach ($datastoretemp as $store)
{
bugdar::$datastore["$store[title]"] = unserialize($store['data']);
}
bugdar::$options = bugdar::$datastore['setting'];
bugdar::$options['columnoptions'] = unserialize(bugdar::$options['columnoptions']);
unset(bugdar::$datastore['setting']);
// ###################################################################
// load permissions
require_once('./includes/permissions.php');
// ###################################################################
// load userinfo
$authMethod = ((defined('USE_DEFAULT_AUTH_METHOD') AND constant('USE_DEFAULT_AUTH_METHOD') == 1) ? 'default' : bugdar::$options['authmethod']);
require_once('./includes/auth/auth_' . $authMethod . '.php');
$authClass = 'Authentication' . str_replace(' ', '', ucwords(str_replace('_', ' ', $authMethod)));
$bugsys->auth = $auth = new $authClass();
if ($auth->authenticateCookies())
{
bugdar::$userinfo = $auth->fetchBugdarUser();
bugdar::$userinfo['permissions'] = FetchUserPermissions(bugdar::$userinfo);
bugdar::$userinfo['displaytitle'] = bugdar::$datastore['usergroup'][ bugdar::$userinfo['usergroupid'] ]['displaytitle'];
bugdar::$userinfo['columnoptions'] = unserialize(bugdar::$userinfo['columnoptions']);
}
else
{
bugdar::$userinfo = fetch_guest_user();
}
// ###################################################################
// initialize localization system
$language = fetch_user_language();
$stylevar['lang'] = $language['langcode'];
$stylevar['lang_dir'] = $language['direction'];
$stylevar['charset'] = $language['charset'];
$stylevar['left'] = ($language['direction'] == 'ltr' ? 'left' : 'right');
$stylevar['right'] = ($language['direction'] == 'ltr' ? 'right' : 'left');
// start gettext engine
if (!bugdar::$options['devgettext'])
{
putenv("LANG=$language[langcode]");
putenv("LANGUAGE=$language[langcode]");
setlocale(LC_ALL, $language['langcode']);
bindtextdomain('MESSAGES', $bugsys->apppath . 'locale/');
textdomain('MESSAGES');
bind_textdomain_codeset('MESSAGES', $language['charset']);
}
else
{
BSApp::debug("using custom MOReader instead of Gettext");
}
// ###################################################################
// initialize the date system
require_once ISSO . '/Date.php';
$datef = BSApp::$date = new BSDate();
$datef->setUserTimeZone(bugdar::$userinfo['timezone'] + (bugdar::$userinfo['usedst'] * 1));
BSApp::debug('user tz = ' . bugdar::$userinfo['timezone'] . '; use version = ' . $datef->usertz);
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>