Switch the 'modify' code of admin/field.php to use templates
[bugdar.git] / install / upgrade.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 require_once('./global.php');
23
24 // ###################################################################
25
26 if (!isset($input->in['next']))
27 {
28 $db->showerrors = false;
29
30 $version = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = 'trackerversion'");
31 $version = $version['value'];
32
33 if ($version == '[#]version[#]')
34 {
35 header('Location: upgrade16.php');
36 exit;
37 }
38
39 if (!$version)
40 {
41 die('You have done something to your database and this script cannot determine Bugdar\'s version... or you have no upgrade to perform...');
42 }
43
44 if ($bugsys->versions["$version"] == -1)
45 {
46 page_start();
47
48 echo "<h1>Bugdar Upgrade System</h1>\n\n";
49
50 echo "<p>Your Bugdar installation is up-to-date!</p>\n\n";
51
52 page_end(false);
53 }
54 else
55 {
56 header("Location: upgrade.php?next=$version");
57 }
58
59 $db->showerrors = true;
60 }
61
62 // ###################################################################
63
64 else
65 {
66 if ($bugsys->versions[ $input->in['next'] ] == -1)
67 {
68 die('Bugdar is up-to-date already');
69 }
70
71 header("Location: upgrade" . $bugsys->versions[ $input->in['next'] ] . ".php");
72 }
73
74 ?>