application = 'BugStrike'; $bugsys->apppath = $bugsys->fetch_sourcepath(getcwd()); $bugsys->appversion = '[#]version[#]'; $bugsys->debug = $debug; $bugsys->sourcepath = $bugsys->fetch_sourcepath($pathtoisso); $bugsys->load('db_mysql'); $db->database = $database; $db->connect($servername, $username, $password, $usepconnect); $bugsys->load('functions'); $bugsys->load('mail'); define('DEVDEBUG', $debug); define('TABLE_PREFIX', $tableprefix); define('COOKIE_PREFIX', $cookieprefix); unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix); require_once('./includes/functions_datastore.php'); require_once('./includes/functions.php'); // ################################################################### // init the big four $bugsys->options = array(); $bugsys->userinfo = array(); $bugsys->language = array(); $bugsys->datastore = array(); // ################################################################### // populate our caches $datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX . "datastore"); while ($store = $db->fetch_array($datastoretemp)) { $bugsys->datastore["$store[title]"] = unserialize($store['data']); } $bugsys->options = $bugsys->datastore['setting']; unset($bugsys->datastore['setting']); $mail->from = $bugsys->options['webmasteremail']; $mail->fromname = 'BugStrike Notification'; // ################################################################### // load userinfo $userid = intval($_COOKIE[COOKIE_PREFIX . 'userid']); $userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $userid"); if (is_array($userinfo) AND $_COOKIE[COOKIE_PREFIX . 'authkey'] == $userinfo['authkey']) { $userinfo['permissions'] = (int)$bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['permissions']; $userinfo['displaytitle'] = $bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['displaytitle']; fetch_user_display_name($userinfo); $userinfo['mdisplayname'] = $bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['opentag'] . $userinfo['displayname'] . $bugsys->datastore['usergroup']["$userinfo[usergroupid]"]['closetag']; $bugsys->userinfo = $userinfo; } else { mysetcookie(COOKIE_PREFIX . 'userid'); mysetcookie(COOKIE_PREFIX . 'authkey'); $bugsys->userinfo = array( 'usergroupid' => 1, 'userid' => 0, 'email' => '', 'displayname' => '', 'permissions' => $bugsys->datastore['usergroup'][1]['permissions'], 'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'], 'mdisplayname' => $bugsys->datastore['usergroup'][1]['opentag'] . '' . $bugsys->datastore['usergroup'][1]['closetag'] ); } // ################################################################### // pull our languageid if ($bugsys->userinfo['userid']) { $languageid = $bugsys->userinfo['languageid']; $language = $bugsys->datastore['language']["$languageid"]; } if (!$languageid) { foreach ($bugsys->datastore['language'] AS $language) { if ($language['default']) { $languageid = $language['languageid']; $language = $bugsys->datastore['language']["$languageid"]; break; } } } $bugsys->options['lang_id'] = $language['languageid']; $bugsys->options['lang_charset'] = $language['charset']; $bugsys->options['lang_dir'] = $language['direction']; $bugsys->options['lang_code'] = $language['languagecode']; // ################################################################### // load master language /* // can't use this because not everyone has MySQL >= 4.0.17 ... one day, one day $phrases = $db->query(" (SELECT varname, phrasetext FROM " . TABLE_PREFIX . "phrase) UNION DISTINCT (SELECT varname AS lvarname, phrasetext AS lphrasetext FROM " . TABLE_PREFIX . "locale AS locale WHERE languageid = " . $bugsys->options['lang_id'] . ")" ); while ($phrase = $db->fetch_array($phrases)) { $bugsys->language["$phrase[varname]"] = $phrase['phrasetext']; } $db->free_result($phrases); */ $phrases = $db->query("SELECT * FROM " . TABLE_PREFIX . "phrase"); while ($phrase = $db->fetch_array($phrases)) { $bugsys->language["$phrase[varname]"] = $phrase['phrasetext']; } $db->free_result($phrases); // ################################################################### // load locale data $locale = $db->query("SELECT * FROM " . TABLE_PREFIX . "locale WHERE languageid = " . $bugsys->options['lang_id']); while ($phrase = $db->fetch_array($locale)) { $bugsys->language["$phrase[varname]"] = $phrase['phrasetext']; } $db->free_result($phrases); // ################################################################### // get the templateset if ($bugsys->userinfo['userid']) { $templatesetid = $bugsys->userinfo['templatesetid']; $templateset = $bugsys->datastore['templateset']["$templatesetid"]; } if (!$templatesetid) { foreach ($bugsys->datastore['templateset'] AS $templateset) { if ($templateset['default']) { $templatesetid = $templateset['templatesetid']; $templateset = $bugsys->datastore['templateset']["$templatesetid"]; } } } // ################################################################### // load the template system if (file_exists("./templates/$templateset[shortname]/tsinfo.php")) { $bugsys->options['ts_includepath'] = "./templates/$templateset[shortname]/"; } else { echo "template set info (templates/$templateset[shortname]/tsinfo.php) could not be loaded!"; exit; } // ################################################################### // Initialize usergroup system $_PERMISSION = array( 'canviewbugs' => 1, // can view bugs 'cansearch' => 2, // can use the search 'cansubscribe' => 4, // can email subscribe 'canvote' => 8, // can vote on bugs 'cansubmitbugs' => 16, // can submit new bugs 'canpostcomments' => 32, // can post new comments 'cangetattach' => 64, // can dl attachments 'canputattach' => 128, // can ul attachments 'caneditown' => 256, // can edit own comments 'caneditothers' => 512, // can edit others' comments 'caneditinfo' => 1024, // can edit bug info -- works in conjunction with canedit(own|others) 'canassign' => 2048, // can assign bug 'canchangestatus' => 4096, // can change bug status 'canadminpanel' => 8192, // can view admin panel 'canadminbugs' => 16384, // can administrate bug functions 'canadminversions' => 32768, // can admin version info 'canadminusers' => 65536, // can admin users 'canadmingroups' => 131072, // can admin permission masks 'canadmintools' => 262144, // can use admin tools 'canadminfields' => 524288, // can admin custom bug fields 'canbeassignedto' => 1048576 // can be assigned bugs ); foreach ($_PERMISSION AS $name => $maskvalue) { define(strtoupper($name), $maskvalue); } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>