r1471: Fix for bug://report/69: In install/global.php, move the loading of the includ...
[bugdar.git] / install / global.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] 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 [#]gpl[#] 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('./framework/kernel.php');
33 $bugsys = new ISSO;
34 $bugsys->setAppPath(getcwd());
35 $bugsys->setApplication('Bugdar');
36 $bugsys->setAppVersion('[#]version[#]');
37
38 if (!file_exists('./includes/config.php'))
39 {
40 echo 'includes/config.php needs to be present!';
41 exit;
42 }
43
44 require_once('./includes/config.php');
45
46 $bugsys->setDebug($debug);
47
48 define('ISSO_DB_LAYER', 'db_mysql');
49 $bugsys->load('db_mysql', 'db', true);
50 $db->connect($servername, $username, $password, $database, $usepconnect);
51
52 // needed for API validation
53 $bugsys->load('functions', 'funct');
54
55 define('DEVDEBUG', $debug);
56 define('TABLE_PREFIX', $tableprefix);
57 define('COOKIE_PREFIX', $cookieprefix);
58
59 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
60
61 require_once('./includes/functions_datastore.php');
62 require_once('./includes/functions.php');
63 require_once('./includes/language.php');
64 require_once('./includes/permissions.php');
65
66 // ###################################################################
67 // init the big three
68
69 $bugsys->options = array();
70 $bugsys->userinfo = array();
71 $bugsys->datastore = array();
72
73 // ###################################################################
74
75 $bugsys->versions = array(
76 '1.0.0' => 1,
77 '1.0.1' => 2,
78 '1.1.0 Beta 1' => 3,
79 '1.1.0 Beta 2' => 4,
80 '1.1.0 Release Candidate 1' => 5,
81 '1.1.0' => 6,
82 '1.1.1' => 7,
83 '1.1.2' => 8,
84 '1.1.3' => 9,
85 '1.1.4' => 10,
86 '1.1.5' => 11,
87 '1.2.0 Beta 1' => -1
88 );
89
90 // ###################################################################
91
92 $bugsys->load('installer', null);
93
94 $bugsys->input_clean('mark', TYPE_UINT);
95
96 if ($bugsys->in['mark'] == STOP_MARK)
97 {
98 if (!preg_match('#^upgrade([0-9]*)\.php$#i', ACTIVE_SITE, $matches))
99 {
100 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
101 }
102 else
103 {
104 $temp = array_values($bugsys->versions);
105 if ($temp["$matches[1]"] != -1)
106 {
107 header("Location: upgrade.php");
108 }
109 else
110 {
111 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
112 }
113 }
114 }
115
116 /*=====================================================================*\
117 || ###################################################################
118 || # $HeadURL$
119 || # $Id$
120 || ###################################################################
121 \*=====================================================================*/
122 ?>