]>
src.bluestatic.org Git - bugdar.git/blob - includes/init.php
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());
29 if (!file_exists('./includes/config.php'))
31 echo 'includes/config.php needs to be present!';
35 require_once('./includes/config.php');
36 $thepass = $password; // GAH register_globals
39 define('ISSO_ESCAPE_STRINGS', 1);
40 define('ISSO_CHECK_POST_REFERER', 1);
42 require_once($pathtoisso . 'kernel.php');
44 $bugsys->application
= 'Bugdar';
45 $bugsys->apppath
= $bugsys->fetch_sourcepath(getcwd());
46 $bugsys->appversion
= '[#]version[#]';
47 $bugsys->debug
= $debug;
48 $bugsys->sourcepath
= $bugsys->fetch_sourcepath($pathtoisso);
50 $bugsys->load('db_mysql');
51 $db->database
= $database;
52 $db->connect($servername, $username, $thepass, $usepconnect);
54 $bugsys->load('functions');
55 $bugsys->exec_sanitize_data();
59 // change cookie expiration to one hour
60 $funct->cookieexp
= 3600;
62 define('DEVDEBUG', $debug);
63 define('TABLE_PREFIX', $tableprefix);
64 define('COOKIE_PREFIX', $cookieprefix);
66 unset($database, $servername, $theuser, $password, $thepass, $usepconnect, $tableprefix, $cookieprefix);
68 require_once('./includes/functions_datastore.php');
69 require_once('./includes/functions.php');
71 // ###################################################################
73 $bugsys->options
= array();
74 $bugsys->userinfo
= array();
75 $bugsys->datastore
= array();
77 // ###################################################################
79 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
80 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
81 header("Cache-Control: no-store, no-cache, must-revalidate");
82 header("Cache-Control: post-check=0, pre-check=0", false);
83 header("Pragma: no-cache");
85 // ###################################################################
86 // populate our caches
87 $datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX
. "datastore");
88 while ($store = $db->fetch_array($datastoretemp))
90 $bugsys->datastore
["$store[title]"] = unserialize($store['data']);
92 $bugsys->options
= $bugsys->datastore
['setting'];
93 unset($bugsys->datastore
['setting']);
95 // ###################################################################
97 $userid = intval($bugsys->in
[COOKIE_PREFIX
. 'userid']);
101 $userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE userid = $userid");
102 if (is_array($userinfo) AND $bugsys->in[COOKIE_PREFIX . 'authkey'] == $userinfo['authkey'])
104 $userinfo['permissions'] = (int)$bugsys->datastore['usergroup']["$userinfo[usergroupid
]"]['permissions'];
105 $userinfo['displaytitle'] = $bugsys->datastore['usergroup']["$userinfo[usergroupid
]"]['displaytitle'];
106 $bugsys->userinfo = $userinfo;
107 $funct->cookie(COOKIE_PREFIX . 'userid', $bugsys->userinfo['userid']);
108 $funct->cookie(COOKIE_PREFIX . 'authkey', $bugsys->userinfo['authkey']);
114 $funct->cookie(COOKIE_PREFIX . 'userid');
115 $funct->cookie(COOKIE_PREFIX . 'authkey');
116 $bugsys->userinfo = array(
122 'permissions' => $bugsys->datastore['usergroup'][1]['permissions'],
123 'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'],
127 // ###################################################################
128 // initialize localization system
129 $bugsys->load('localize');
131 require_once('./includes/language.php');
133 $LANGDATA = fetch_user_language();
134 $lang->init_with_table(fetch_strings($LANGDATA['id']));
136 $stylevar['lang'] = $LANGDATA['code'];
137 $stylevar['lang_dir'] = $LANGDATA['direction'];
138 $stylevar['charset'] = $LANGDATA['charset'];
140 // ###################################################################
141 // initialize the date system
142 $bugsys->load('date');
143 $datef->usertz = $bugsys->userinfo['timezone'];
144 $datef->fetch_offset();
146 // ###################################################################
148 $bugsys->load('mail');
149 $mail->from = $bugsys->options['webmasteremail'];
150 $mail->fromname = $lang->string('Bugdar Notification');
152 // ###################################################################
155 require_once('./includes/permissions.php');
157 /*=====================================================================*\
158 || ###################################################################
161 || ###################################################################
162 \*=====================================================================*/