Disable MySQL strict mode so that errors do not occur if the server has it set. Fixes...
[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 // don't use sql strict mode
60 $db->query("SET sql_mode = ''");
61
62 // needed for API validation
63 $bugsys->load('functions', 'funct');
64
65 define('DEVDEBUG', $debug);
66 define('TABLE_PREFIX', $tableprefix);
67 define('COOKIE_PREFIX', $cookieprefix);
68
69 unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix);
70
71 require_once('./includes/functions_datastore.php');
72 require_once('./includes/functions.php');
73 require_once('./includes/language.php');
74 require_once('./includes/permissions.php');
75
76 // ###################################################################
77 // init the big three
78
79 bugdar::$options = array();
80 bugdar::$userinfo = array();
81 bugdar::$datastore = array();
82
83 // ###################################################################
84
85 $bugsys->versions = array(
86 '1.0.0' => 1,
87 '1.0.1' => 2,
88 '1.1.0 Beta 1' => 3,
89 '1.1.0 Beta 2' => 4,
90 '1.1.0 Release Candidate 1' => 5,
91 '1.1.0' => 6,
92 '1.1.1' => 7,
93 '1.1.2' => 8,
94 '1.1.3' => 9,
95 '1.1.4' => 10,
96 '1.1.5' => 11,
97 '1.2.0 Beta 1' => 12,
98 '1.2.0 Beta 2' => 13,
99 '1.2.0 Beta 3' => 14,
100 '1.2.0 Release Candidate 1' => 15,
101 '1.2.0' => 16,
102 '1.2.1' => 17,
103 '1.2.2' => 18,
104 '1.2.3' => -1
105 );
106
107 // ###################################################################
108
109 $bugsys->load('installer', null);
110
111 $input->inputClean('mark', TYPE_UINT);
112
113 if ($input->in['mark'] == STOP_MARK)
114 {
115 if (!preg_match('#^upgrade([0-9]*)\.php$#i', ACTIVE_SITE, $matches))
116 {
117 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
118 }
119 else
120 {
121 $temp = array_values($bugsys->versions);
122 if ($temp["$matches[1]"] != -1)
123 {
124 header("Location: upgrade.php");
125 }
126 else
127 {
128 define('STOP_LINK', '<a href="../admin/">Go to the Administrative Control Panel</a>');
129 }
130 }
131 }
132
133 ?>