r1583: - If the version is bad, send them to upgrade16.php in hopes of fixing the...
[bugdar.git] / install / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 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 // needed for API validation
55 $bugsys->load('functions', 'funct');
56
57 define('DEVDEBUG', $debug);
58 define('TABLE_PREFIX', $tableprefix);
59 define('COOKIE_PREFIX', $cookieprefix);
60
61 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
62
63 require_once('./includes/functions_datastore.php');
64 require_once('./includes/functions.php');
65 require_once('./includes/language.php');
66 require_once('./includes/permissions.php');
67
68 // ###################################################################
69 // init the big three
70
71 $bugsys->options = array();
72 $bugsys->userinfo = array();
73 $bugsys->datastore = array();
74
75 // ###################################################################
76
77 $bugsys->versions = array(
78 '1.0.0' => 1,
79 '1.0.1' => 2,
80 '1.1.0 Beta 1' => 3,
81 '1.1.0 Beta 2' => 4,
82 '1.1.0 Release Candidate 1' => 5,
83 '1.1.0' => 6,
84 '1.1.1' => 7,
85 '1.1.2' => 8,
86 '1.1.3' => 9,
87 '1.1.4' => 10,
88 '1.1.5' => 11,
89 '1.2.0 Beta 1' => 12,
90 '1.2.0 Beta 2' => 13,
91 '1.2.0 Beta 3' => 14,
92 '1.2.0 Release Candidate 1' => 15,
93 '1.2.0' => 16,
94 '1.2.1' => -1
95 );
96
97 // ###################################################################
98
99 $bugsys->load('installer', null);
100
101 $bugsys->input_clean('mark', TYPE_UINT);
102
103 if ($bugsys->in['mark'] == STOP_MARK)
104 {
105 if (!preg_match('#^upgrade([0-9]*)\.php$#i', ACTIVE_SITE, $matches))
106 {
107 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
108 }
109 else
110 {
111 $temp = array_values($bugsys->versions);
112 if ($temp["$matches[1]"] != -1)
113 {
114 header("Location: upgrade.php");
115 }
116 else
117 {
118 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
119 }
120 }
121 }
122
123 /*=====================================================================*\
124 || ###################################################################
125 || # $HeadURL$
126 || # $Id$
127 || ###################################################################
128 \*=====================================================================*/
129 ?>