Happy 2009! Updating copyright years.
[bugdar.git] / install / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2009 Blue Static
6 || #
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 2 of the License.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 error_reporting(E_ALL & ~E_NOTICE);
23
24 // ###################################################################
25 // load system
26
27 chdir('./../');
28
29 define('ISSO_MT_START', microtime());
30 define('ISSO_CHECK_POST_REFERER', 1);
31
32 require_once('./includes/version.php');
33
34 require_once('./framework/kernel.php');
35 $bugsys = new ISSO;
36 $bugsys->setAppPath(getcwd());
37 $bugsys->setApplication('Bugdar');
38 $bugsys->setAppVersion(BUGDAR_VERSION);
39
40 if (!file_exists('./includes/config.php'))
41 {
42 echo 'includes/config.php needs to be present!';
43 exit;
44 }
45
46 require_once('./includes/config.php');
47
48 $bugsys->setDebug($debug);
49
50 define('ISSO_DB_LAYER', 'db_mysql');
51 $bugsys->load('db_mysql', 'db', true);
52 $db->connect($servername, $username, $password, $database, $usepconnect);
53
54 if ($utf8)
55 {
56 $db->query("SET NAMES utf8");
57 }
58
59 // needed for API validation
60 $bugsys->load('functions', 'funct');
61
62 define('DEVDEBUG', $debug);
63 define('TABLE_PREFIX', $tableprefix);
64 define('COOKIE_PREFIX', $cookieprefix);
65
66 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
67
68 require_once('./includes/functions_datastore.php');
69 require_once('./includes/functions.php');
70 require_once('./includes/language.php');
71 require_once('./includes/permissions.php');
72
73 // ###################################################################
74 // init the big three
75
76 bugdar::$options = array();
77 bugdar::$userinfo = array();
78 bugdar::$datastore = array();
79
80 // ###################################################################
81
82 $bugsys->versions = array(
83 '1.0.0' => 1,
84 '1.0.1' => 2,
85 '1.1.0 Beta 1' => 3,
86 '1.1.0 Beta 2' => 4,
87 '1.1.0 Release Candidate 1' => 5,
88 '1.1.0' => 6,
89 '1.1.1' => 7,
90 '1.1.2' => 8,
91 '1.1.3' => 9,
92 '1.1.4' => 10,
93 '1.1.5' => 11,
94 '1.2.0 Beta 1' => 12,
95 '1.2.0 Beta 2' => 13,
96 '1.2.0 Beta 3' => 14,
97 '1.2.0 Release Candidate 1' => 15,
98 '1.2.0' => 16,
99 '1.2.1' => 17,
100 '1.2.2' => -1
101 );
102
103 // ###################################################################
104
105 $bugsys->load('installer', null);
106
107 $input->inputClean('mark', TYPE_UINT);
108
109 if ($input->in['mark'] == STOP_MARK)
110 {
111 if (!preg_match('#^upgrade([0-9]*)\.php$#i', ACTIVE_SITE, $matches))
112 {
113 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
114 }
115 else
116 {
117 $temp = array_values($bugsys->versions);
118 if ($temp["$matches[1]"] != -1)
119 {
120 header("Location: upgrade.php");
121 }
122 else
123 {
124 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
125 }
126 }
127 }
128
129 ?>