set('apppath', getcwd());
$bugsys->set('application', 'Bugdar');
$bugsys->set('appversion', '[#]verson[#]');
if (!file_exists('./includes/config.php'))
{
echo 'includes/config.php needs to be present!';
exit;
}
require_once('./includes/config.php');
$bugsys->set('debug', $debug);
define('ISSO_DB_LAYER', 'db_mysql');
$bugsys->load('db_mysql', 'db', true);
$db->connect($servername, $username, $password, $database, $usepconnect);
$bugsys->load('functions', 'funct', true);
$bugsys->load('xml', 'xml', true);
// change cookie expiration to one hour
$funct->cookieexp = 3600;
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');
// ###################################################################
// init the big three
$bugsys->options = array();
$bugsys->userinfo = array();
$bugsys->datastore = array();
// ###################################################################
// 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);
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');
}
while ($store = $db->fetch_array($datastoretemp))
{
$bugsys->datastore["$store[title]"] = unserialize($store['data']);
}
$bugsys->options = $bugsys->datastore['setting'];
unset($bugsys->datastore['setting']);
$bugsys->set('appversion', $bugsys->options['trackerversion']);
// ###################################################################
// load userinfo
$userid = $bugsys->input_clean(COOKIE_PREFIX . 'userid', TYPE_UINT);
if ($userid)
{
$userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $userid");
if (is_array($userinfo) AND $bugsys->in[COOKIE_PREFIX . 'authkey'] == $userinfo['authkey'])
{
$userinfo['permissions'] = (int)$bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['permissions'];
$userinfo['displaytitle'] = $bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['displaytitle'];
$bugsys->userinfo = $userinfo;
$funct->cookie(COOKIE_PREFIX . 'userid', $bugsys->userinfo['userid']);
$funct->cookie(COOKIE_PREFIX . 'authkey', $bugsys->userinfo['authkey']);
}
}
if (!$userinfo)
{
$funct->cookie(COOKIE_PREFIX . 'userid');
$funct->cookie(COOKIE_PREFIX . 'authkey');
$bugsys->userinfo = fetch_guest_user();
}
// ###################################################################
// initialize localization system
$bugsys->load('localize', 'lang', true);
require_once('./includes/language.php');
$language = fetch_user_language();
$stylevar['lang_code'] = $language['langcode'];
$stylevar['lang_dir'] = $language['direction'];
$stylevar['charset'] = $language['charset'];
// start gettext engine
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']);
// ###################################################################
// initialize the date system
$bugsys->load('date', 'datef', true);
$datef->usertz = $bugsys->userinfo['timezone'] + ($bugsys->userinfo['usedst'] * 1);
$bugsys->debug('user tz = ' . $bugsys->userinfo['timezone'] . '; use version = ' . $datef->usertz);
$datef->fetch_offset();
// ###################################################################
// mail system
$bugsys->load('mail', 'mail', true);
$mail->set('from', $bugsys->options['webmasteremail']);
$mail->set('fromname', _('Bugdar Notification'));
// ###################################################################
// load permissions
require_once('./includes/permissions.php');
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>