Small bug fix.
[iDB.git] / install.php
blobb07f1b314861677b3400bf371cd62bb6009edd81
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2011 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
13 iDB Installer made by Game Maker 2k - http://idb.berlios.de/support/category.php?act=view&id=2
15 $FileInfo: install.php - Last Update: 07/30/2011 SVN 730 - Author: cooldude2k $
16 *//*
17 if(ini_get("register_globals")) {
18 require_once('inc/misc/killglobals.php'); }
19 *//* Some ini setting changes uncomment if you need them.
20 Display PHP Errors */
21 $disfunc = @ini_get("disable_functions");
22 $disfunc = @trim($disfunc);
23 $disfunc = @preg_replace("/([\\s+|\\t+|\\n+|\\r+|\\0+|\\x0B+])/i", "", $disfunc);
24 if($disfunc!="ini_set") { $disfunc = explode(",",$disfunc); }
25 if($disfunc=="ini_set") { $disfunc = array("ini_set"); }
26 if(!in_array("ini_set", $disfunc)) {
27 @ini_set("html_errors", false);
28 @ini_set("track_errors", false);
29 @ini_set("display_errors", false);
30 @ini_set("report_memleaks", false);
31 @ini_set("display_startup_errors", false);
32 //@ini_set("error_log","logs/error.log");
33 //@ini_set("log_errors","On");
34 @ini_set("docref_ext", "");
35 @ini_set("docref_root", "http://php.net/"); }
36 @error_reporting(E_ALL ^ E_NOTICE);
37 /* Get rid of session id in urls */
38 if(!in_array("ini_set", $disfunc)) {
39 //@ini_set("date.timezone","UTC");
40 @ini_set("default_mimetype","text/html");
41 @ini_set("zlib.output_compression", false);
42 @ini_set("zlib.output_compression_level", -1);
43 @ini_set("session.use_trans_sid", false);
44 @ini_set("session.use_cookies", true);
45 @ini_set("session.use_only_cookies", true);
46 @ini_set("url_rewriter.tags","");
47 @ini_set('zend.ze1_compatibility_mode', 0);
48 @ini_set("ignore_user_abort", 1); }
49 @set_time_limit(30); @ignore_user_abort(true);
50 /* Change session garbage collection settings */
51 if(!in_array("ini_set", $disfunc)) {
52 @ini_set("session.gc_probability", 1);
53 @ini_set("session.gc_divisor", 100);
54 @ini_set("session.gc_maxlifetime", 1440);
55 /* Change session hash type here */
56 @ini_set("session.hash_function", 1);
57 @ini_set("session.hash_bits_per_character", 6); }
58 if(file_exists('extrasettings.php')) {
59 require_once('extrasettings.php'); }
60 if(file_exists('extendsettings.php')) {
61 require_once('extendsettings.php'); }
62 /* Do not change anything below this line unless you know what you are doing */
63 if(!isset($Settings['clean_ob'])) { $Settings['clean_ob'] = "off"; }
64 function idb_output_handler($buffer) { return $buffer; }
65 if($Settings['clean_ob']=="on") {
66 /* Check for other output handlers/buffers are open
67 and close and get the contents in an array */
68 $numob = count(ob_list_handlers()); $iob = 0;
69 while ($iob < $numob) {
70 $old_ob_var[$iob] = ob_get_clean();
71 ++$iob; } } ob_start("idb_output_handler");
72 if(ini_get("register_globals")) {
73 if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
74 require_once($SettDir['misc'].'killglobals.php'); }
75 if(!isset($preact['idb'])) { $preact['idb'] = null; }
76 if(!isset($_GET['act'])) { $_GET['act'] = null; }
77 if(!isset($_POST['act'])) { $_POST['act'] = null; }
78 if ($_GET['act']==null||$_GET['act']=="view") { $_GET['act']="Part1"; }
79 if ($_POST['act']==null||$_POST['act']=="view") { $_POST['act']="Part1"; }
80 $_TEG = array(null); $_TEG['part'] = preg_replace("/Part(1|2|3|4)/","\\1",$_GET['act']);
81 $_GET['act'] = strtolower($_GET['act']); if(isset($_TEG['part'])) {
82 if($_TEG['part']<=4&&$_TEG['part']>=1) { $_GET['act'] = "Part".$_TEG['part']; } }
83 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
84 $preact['idb'] = "installing"; }
85 $SetupDir['setup'] = "setup/"; $ConvertDir['setup'] = $SetupDir['setup']; $SetupDir['sql'] = "setup/sql/";
86 $SetupDir['convert'] = "setup/convert/"; $ConvertDir['convert'] = $SetupDir['convert']; $ConvertDir['sql'] = $SetupDir['sql'];
87 $Settings['output_type'] = "html"; $Settings['html_type'] = "xhtml10";
88 $Settings['board_name'] = "Installing iDB";
89 if(!isset($Settings['charset'])) {
90 $Settings['charset'] = "ISO-8859-15"; }
91 if(isset($Settings['charset'])) {
92 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
93 $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
94 $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
95 $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
96 $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
97 $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
98 $Settings['charset'] = "ISO-8859-15"; } }
99 $SQLCharset = "latin1";
100 if(isset($_POST['charset'])) {
101 if($_POST['charset']=="ISO-8859-1") {
102 $SQLCharset = "latin1"; }
103 if($_POST['charset']=="ISO-8859-15") {
104 $SQLCharset = "latin1"; }
105 if($_POST['charset']=="UTF-8") {
106 $SQLCharset = "utf8"; }
107 $Settings['charset'] = $_POST['charset']; }
108 if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS']=="off"; }
109 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
110 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
111 $this_dir = null;
112 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
113 dirname($_SERVER['SCRIPT_NAME'])!=null) {
114 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
115 if($this_dir==null||$this_dir==".") {
116 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
117 dirname($_SERVER['SCRIPT_NAME'])==null) {
118 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
119 if($this_dir=="\/") { $this_dir="/"; }
120 $this_dir = str_replace("//", "/", $this_dir);
121 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
122 if(!isset($_POST['BoardURL'])) {
123 $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
124 if(isset($_POST['BoardURL'])) {
125 $Settings['idburl'] = $_POST['BoardURL']; }
126 $Settings['qstr'] = "&";
127 $Settings['qsep'] = "=";
128 require($SetupDir['setup'].'preinstall.php');
129 require_once($SettDir['misc'].'utf8.php');
130 require_once($SettDir['inc'].'filename.php');
131 require_once($SettDir['inc'].'function.php');
132 $Settings['board_name'] = "Installing ".$RName;
133 function get_theme_values($matches) {
134 global $ThemeSet;
135 $return_text = null;
136 if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
137 if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
138 return $return_text; }
139 foreach($ThemeSet AS $key => $value) {
140 $ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
141 $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
142 $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
143 $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
144 $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
145 $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]);
146 $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
147 require($SetupDir['convert'].'info.php');
148 require($SetupDir['setup'].'xhtml10.php');
149 $Error = null; $_GET['time'] = false;
152 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
153 </head>
154 <body>
155 <?php require($SettDir['inc'].'navbar.php'); ?>
156 <div class="Table1Border">
157 <?php if($ThemeSet['TableStyle']=="div") { ?>
158 <div class="TableRow1">
159 <span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="Install.php">Install <?php echo $VerInfo['iDB_Ver_Show']; ?> </a></span>
160 </div>
161 <?php } ?>
162 <table class="Table1">
163 <?php if($ThemeSet['TableStyle']=="table") { ?>
164 <tr class="TableRow1">
165 <td class="TableColumn1" colspan="2"><span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="Install.php">Install <?php echo $VerInfo['iDB_Ver_Show']; ?> </a></span>
166 </td>
167 </tr><?php } ?>
168 <tr class="TableRow2">
169 <th class="TableColumn2" style="width: 100%; text-align: left;">
170 <span style="float: left;">&nbsp;Inert your install info: </span>
171 <span style="float: right;">&nbsp;</span>
172 </th>
173 </tr>
174 <?php
175 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
176 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
177 $this_dir = null;
178 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
179 dirname($_SERVER['SCRIPT_NAME'])!=null) {
180 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
181 if($this_dir==null||$this_dir==".") {
182 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
183 dirname($_SERVER['SCRIPT_NAME'])==null) {
184 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
185 if($this_dir=="\/") { $this_dir="/"; }
186 $this_dir = str_replace("//", "/", $this_dir);
187 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
188 function sql_list_dbs() {
189 $result = sql_query("SHOW DATABASES;",$SQLStat);
190 while( $data = sql_fetch_row($result) ) {
191 $array[] = $data[0];
192 } return $array; }
193 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
194 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
195 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
196 require($SetupDir['setup'].'license.php'); } } }
197 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
198 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
199 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
200 require($SetupDir['setup'].'presetup.php'); } } }
201 if($_POST['SetupType']=="convert") {
202 require($ConvertInfo['ConvertFile']); }
203 if($_POST['SetupType']=="install") {
204 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
205 if ($_GET['act']=="Part3"&&$_POST['act']=="Part3") {
206 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
207 require($SetupDir['setup'].'setup.php'); } } } }
208 if($_POST['SetupType']=="install") {
209 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
210 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
211 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
212 require($SetupDir['setup'].'mkconfig.php'); } } } }
213 if ($Error=="Yes") { ?>
214 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
215 <br /><br />
216 </td>
217 </tr>
218 <?php } ?>
219 <tr class="TableRow4">
220 <td class="TableColumn4">&nbsp;<a href="index.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
221 </tr>
222 </table></div>
223 <div>&nbsp;</div>
224 <?php
225 require($SettDir['inc'].'endpage.php');
227 </body>
228 </html>
229 <?php
230 fix_amp(null);