]>
src.bluestatic.org Git - bugdar.git/blob - includes/init.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]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
= 'Bugdar';
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 require_once('./includes/functions_datastore.php');
58 require_once('./includes/functions.php');
60 // ###################################################################
62 $bugsys->options
= array();
63 $bugsys->userinfo
= array();
64 $bugsys->datastore
= array();
66 // ###################################################################
68 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
69 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
70 header("Cache-Control: no-store, no-cache, must-revalidate");
71 header("Cache-Control: post-check=0, pre-check=0", false);
72 header("Pragma: no-cache");
74 // ###################################################################
75 // populate our caches
76 $datastoretemp = $db->query("SELECT * FROM " . TABLE_PREFIX
. "datastore");
77 while ($store = $db->fetch_array($datastoretemp))
79 $bugsys->datastore
["$store[title]"] = unserialize($store['data']);
81 $bugsys->options
= $bugsys->datastore
['setting'];
82 unset($bugsys->datastore
['setting']);
84 // ###################################################################
86 $userid = intval($bugsys->in
[COOKIE_PREFIX
. 'userid']);
90 $userinfo = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "user WHERE userid = $userid");
91 if (is_array($userinfo) AND $bugsys->in[COOKIE_PREFIX . 'authkey'] == $userinfo['authkey'])
93 $userinfo['permissions'] = (int)$bugsys->datastore['usergroup']["$userinfo[usergroupid
]"]['permissions'];
94 $userinfo['displaytitle'] = $bugsys->datastore['usergroup']["$userinfo[usergroupid
]"]['displaytitle'];
95 $bugsys->userinfo = $userinfo;
96 $funct->cookie(COOKIE_PREFIX . 'userid', $bugsys->userinfo['userid']);
97 $funct->cookie(COOKIE_PREFIX . 'authkey', $bugsys->userinfo['authkey']);
103 $funct->cookie(COOKIE_PREFIX . 'userid');
104 $funct->cookie(COOKIE_PREFIX . 'authkey');
105 $bugsys->userinfo = array(
111 'permissions' => $bugsys->datastore['usergroup'][1]['permissions'],
112 'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'],
116 // ###################################################################
117 // initialize localization system
118 $bugsys->load('localize');
120 require_once('./includes/language.php');
122 $LANGDATA = fetch_user_language();
123 $lang->init_with_table(fetch_strings($LANGDATA['id']));
125 $stylevar['lang'] = $LANGDATA['code'];
126 $stylevar['lang_dir'] = $LANGDATA['direction'];
127 $stylevar['charset'] = $LANGDATA['charset'];
129 // ###################################################################
130 // initialize the date system
131 $bugsys->load('date');
132 $datef->usertz = $bugsys->userinfo['timezone'];
133 $datef->fetch_offset();
135 // ###################################################################
137 $bugsys->load('mail');
138 $mail->from = $bugsys->options['webmasteremail'];
139 $mail->fromname = $lang->string('Bugdar Notification');
141 // ###################################################################
144 require_once('./includes/permissions.php');
146 /*=====================================================================*\
147 || ###################################################################
150 || ###################################################################
151 \*=====================================================================*/