2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 error_reporting(E_ALL
& ~E_NOTICE
);
15 // ###################################################################
16 // initialize the database
18 define('ISSO_MT_START', microtime());
20 if (!file_exists('./includes/config.php'))
22 echo 'includes/config.php needs to be present!';
26 require_once('./includes/config.php');
28 define('ISSO_ESCAPE_STRINGS', 1);
29 define('ISSO_CHECK_POST_REFERER', 1);
31 require_once($pathtoisso . 'kernel.php');
33 $bugsys->application
= 'BugStrike';
34 $bugsys->apppath
= $bugsys->fetch_sourcepath(getcwd());
35 $bugsys->appversion
= '[#]version[#]';
36 $bugsys->debug
= $debug;
37 $bugsys->sourcepath
= $bugsys->fetch_sourcepath($pathtoisso);
39 $bugsys->load('db_mysql');
40 $db->database
= $database;
41 $db->connect($servername, $username, $password, $usepconnect);
43 $bugsys->load('functions');
44 $bugsys->exec_sanitize_data();
48 // change cookie expiration to one hour
49 $funct->cookieexp
= 3600;
51 define('DEVDEBUG', $debug);
52 define('TABLE_PREFIX', $tableprefix);
53 define('COOKIE_PREFIX', $cookieprefix);
55 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
57 define('LOG_TIME', time());
59 require_once('./includes/functions_datastore.php');
60 require_once('./includes/functions.php');
62 // ###################################################################
64 $bugsys->options
= array();
65 $bugsys->userinfo
= array();
66 $bugsys->datastore
= array();
68 // ###################################################################
69 // populate our caches
70 $datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX
. "datastore");
71 while ($store = $db->fetch_array($datastoretemp))
73 $bugsys->datastore
["$store[title]"] = unserialize($store['data']);
75 $bugsys->options
= $bugsys->datastore
['setting'];
76 unset($bugsys->datastore
['setting']);
78 // ###################################################################
80 $userid = intval($bugsys->in
[COOKIE_PREFIX
. 'userid']);
84 $userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE userid = $userid");
85 if (is_array($userinfo) AND $bugsys->in
[COOKIE_PREFIX
. 'authkey'] == $userinfo['authkey'])
87 $userinfo['permissions'] = (int)$bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['permissions'];
88 $userinfo['displaytitle'] = $bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['displaytitle'];
89 fetch_user_display_name($userinfo);
90 $userinfo['mdisplayname'] = $bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['opentag'] . $userinfo['displayname'] . $bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['closetag'];
91 $bugsys->userinfo
= $userinfo;
92 $funct->cookie(COOKIE_PREFIX
. 'userid', $bugsys->userinfo
['userid']);
93 $funct->cookie(COOKIE_PREFIX
. 'authkey', $bugsys->userinfo
['authkey']);
99 $funct->cookie(COOKIE_PREFIX
. 'userid');
100 $funct->cookie(COOKIE_PREFIX
. 'authkey');
101 $bugsys->userinfo
= array(
107 'permissions' => $bugsys->datastore
['usergroup'][1]['permissions'],
108 'displaytitle' => $bugsys->datastore
['usergroup'][1]['displaytitle'],
109 'mdisplayname' => $bugsys->datastore
['usergroup'][1]['opentag'] . '' . $bugsys->datastore
['usergroup'][1]['closetag']
113 // ###################################################################
114 // initialize localization system
115 $bugsys->load('localize');
117 require_once('./includes/language.php');
119 $LANGDATA = fetch_user_language();
120 $lang->init_with_table(fetch_strings($LANGDATA['id']));
122 $stylevar['lang'] = $LANGDATA['code'];
124 // ###################################################################
125 // initialize the date system
126 $bugsys->load('date');
127 $datef->usertz
= $bugsys->userinfo
['timezone'];
128 $datef->fetch_offset();
130 // ###################################################################
132 $bugsys->load('mail');
133 $mail->from
= $bugsys->options
['webmasteremail'];
134 $mail->fromname
= $lang->string('BugStrike Notification');
136 // ###################################################################
137 // Initialize usergroup system
138 $_PERMISSION = array(
139 'canviewbugs' => 1, // can view bugs
140 'cansearch' => 2, // can use the search
141 'cansubscribe' => 4, // can email subscribe
142 'canvote' => 8, // can vote on bugs
143 'cansubmitbugs' => 16, // can submit new bugs
144 'canpostcomments' => 32, // can post new comments
145 'cangetattach' => 64, // can dl attachments
146 'canputattach' => 128, // can ul attachments
147 'caneditown' => 256, // can edit own comments
148 'caneditothers' => 512, // can edit others' comments
149 'caneditinfo' => 1024, // can edit bug info -- works in conjunction with canedit(own|others)
150 'canassign' => 2048, // can assign bug
151 'canchangestatus' => 4096, // can change bug status
152 'canadminpanel' => 8192, // can view admin panel
153 'canadminbugs' => 16384, // can administrate bug functions
154 'canadminversions' => 32768, // can admin version info
155 'canadminusers' => 65536, // can admin users
156 'canadmingroups' => 131072, // can admin permission masks
157 'canadmintools' => 262144, // can use admin tools
158 'canadminfields' => 524288, // can admin custom bug fields
159 'canbeassignedto' => 1048576, // can be assigned bugs,
160 'caneditattach' => 2097152, // can edit attachments
161 'canviewhidden' => 4194304 // can see hidden bugs
164 foreach ($_PERMISSION AS $name => $maskvalue)
166 define(strtoupper($name), $maskvalue);
169 /*=====================================================================*\
170 || ###################################################################
173 || ###################################################################
174 \*=====================================================================*/