0eb51e08c6740bbcdb78035d5f3244f08c505751
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 error_reporting(E_ALL
& ~E_NOTICE
);
24 // ###################################################################
25 // initialize the database
27 define('ISSO_MT_START', microtime());
28 define('ISSO_CHECK_POST_REFERER', 1);
30 require_once('./framework/kernel.php');
33 $bugsys->set('application', 'Bugdar');
34 $bugsys->set('appversion', '[#]verson[#]');
36 if (!file_exists('./includes/config.php'))
38 echo 'includes/config.php needs to be present!';
42 require_once('./includes/config.php');
44 $bugsys->set('debug', $debug);
46 define('ISSO_DB_LAYER', 'db_mysql');
47 $bugsys->load('db_mysql', 'db', true
);
48 $db->connect($servername, $username, $password, $database, $usepconnect);
50 $bugsys->load('functions', 'funct', true
);
51 $bugsys->exec_sanitize_data();
53 $bugsys->load('xml', 'xml', true
);
55 // change cookie expiration to one hour
56 $funct->cookieexp
= 3600;
58 define('DEVDEBUG', $debug);
59 define('TABLE_PREFIX', $tableprefix);
60 define('COOKIE_PREFIX', $cookieprefix);
62 unset($database, $servername, $theuser, $password, $thepass, $usepconnect, $tableprefix, $cookieprefix);
64 require_once('./includes/functions_datastore.php');
65 require_once('./includes/functions.php');
67 // ###################################################################
69 $bugsys->options
= array();
70 $bugsys->userinfo
= array();
71 $bugsys->datastore
= array();
73 // ###################################################################
75 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
76 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
77 header("Cache-Control: no-store, no-cache, must-revalidate");
78 header("Cache-Control: post-check=0, pre-check=0", false
);
79 header("Pragma: no-cache");
81 // ###################################################################
82 // populate our caches
83 $db->showerrors
= false
;
84 $datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX
. "datastore");
85 $db->showerrors
= true
;
89 echo '<div style="font-size: 18px"><strong>Notice:</strong> This error could be caused if you have not installed Bugdar. If this is the case, you can run the installer <a href="install/install.php">here</a>.</div><br />';
90 $db->error('Invalid SQL error');
93 while ($store = $db->fetch_array($datastoretemp))
95 $bugsys->datastore
["$store[title]"] = unserialize($store['data']);
97 $bugsys->options
= $bugsys->datastore
['setting'];
98 unset($bugsys->datastore
['setting']);
100 // ###################################################################
102 $userid = intval($bugsys->in
[COOKIE_PREFIX
. 'userid']);
106 $userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE userid = $userid");
107 if (is_array($userinfo) AND $bugsys->in
[COOKIE_PREFIX
. 'authkey'] == $userinfo['authkey'])
109 $userinfo['permissions'] = (int)$bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['permissions'];
110 $userinfo['displaytitle'] = $bugsys->datastore
['usergroup']["$userinfo[usergroupid]"]['displaytitle'];
111 $bugsys->userinfo
= $userinfo;
112 $funct->cookie(COOKIE_PREFIX
. 'userid', $bugsys->userinfo
['userid']);
113 $funct->cookie(COOKIE_PREFIX
. 'authkey', $bugsys->userinfo
['authkey']);
119 $funct->cookie(COOKIE_PREFIX
. 'userid');
120 $funct->cookie(COOKIE_PREFIX
. 'authkey');
121 $bugsys->userinfo
= array(
127 'permissions' => $bugsys->datastore
['usergroup'][1]['permissions'],
128 'displaytitle' => $bugsys->datastore
['usergroup'][1]['displaytitle'],
132 // ###################################################################
133 // initialize localization system
134 $bugsys->load('localize', 'lang', true
);
136 require_once('./includes/language.php');
138 $LANGDATA = fetch_user_language();
139 $lang->init_with_table(fetch_strings($LANGDATA['id']));
141 $stylevar['lang'] = $LANGDATA['code'];
142 $stylevar['lang_dir'] = $LANGDATA['direction'];
143 $stylevar['charset'] = $LANGDATA['charset'];
145 // ###################################################################
146 // initialize the date system
147 $bugsys->load('date', 'datef', true
);
148 $datef->usertz
= $bugsys->userinfo
['timezone'];
149 $datef->fetch_offset();
151 // ###################################################################
153 $bugsys->load('mail', 'mail', true
);
154 $mail->set('from', $bugsys->options
['webmasteremail']);
155 $mail->set('fromname', $lang->string('Bugdar Notification'));
157 // ###################################################################
160 require_once('./includes/permissions.php');
162 /*=====================================================================*\
163 || ###################################################################
166 || ###################################################################
167 \*=====================================================================*/