OSDN Git Service

Yet another small bugfix.
[idb/iDB.git.git] / install.php
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.
5
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.
10
11     Copyright 2004-2017 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2017 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
14
15     $FileInfo: install.php - Last Update: 01/26/2017 SVN 810 - 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 if(!defined("E_DEPRECATED")) { define("E_DEPRECATED", 0); }
37 @error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
38 /* Get rid of session id in urls */
39 if(!in_array("ini_set", $disfunc)) {
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 $deftz = new DateTimeZone(date_default_timezone_get());
63 $defcurtime = new DateTime();
64 $defcurtime->setTimezone($deftz);
65 $utctz = new DateTimeZone("UTC");
66 $utccurtime = new DateTime();
67 $utccurtime->setTimestamp($defcurtime->getTimestamp());
68 $utccurtime->setTimezone($utctz);
69 $servcurtime = new DateTime();
70 $servcurtime->setTimestamp($defcurtime->getTimestamp());
71 $usercurtime = new DateTime();
72 $usercurtime->setTimestamp($defcurtime->getTimestamp());
73 /* Do not change anything below this line unless you know what you are doing */
74 if(!isset($Settings['clean_ob'])) { $Settings['clean_ob'] = "off"; }
75 function idb_output_handler($buffer) { return $buffer; }
76 if($Settings['clean_ob']=="on") {
77 /* Check for other output handlers/buffers are open
78    and close and get the contents in an array */
79 $numob = count(ob_list_handlers()); $iob = 0; 
80 while ($iob < $numob) { 
81         $old_ob_var[$iob] = ob_get_clean(); 
82         ++$iob; } } ob_start("idb_output_handler");
83 if(ini_get("register_globals")) { 
84         if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
85         require_once($SettDir['misc'].'killglobals.php'); }
86 if(!isset($preact['idb'])) { $preact['idb'] = null; }
87 if(!isset($_GET['act'])) { $_GET['act'] = null; }
88 if(!isset($_POST['act'])) { $_POST['act'] = null; }
89 if ($_GET['act']==null||$_GET['act']=="view") { $_GET['act']="Part1"; }
90 if ($_POST['act']==null||$_POST['act']=="view") { $_POST['act']="Part1"; }
91 $_TEG = array(null); $_TEG['part'] = preg_replace("/Part(1|2|3|4)/","\\1",$_GET['act']);
92 $_GET['act'] = strtolower($_GET['act']); if(isset($_TEG['part'])) {
93 if($_TEG['part']<=4&&$_TEG['part']>=1) { $_GET['act'] = "Part".$_TEG['part']; } }
94 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
95         $preact['idb'] = "installing";  }
96 $SetupDir['setup'] = "setup/"; $ConvertDir['setup'] = $SetupDir['setup']; $SetupDir['sql'] = "setup/sql/"; 
97 $SetupDir['convert'] = "setup/convert/"; $ConvertDir['convert'] = $SetupDir['convert']; $ConvertDir['sql'] = $SetupDir['sql'];
98 $Settings['output_type'] = "html"; $Settings['html_type'] = "html5";
99 $Settings['board_name'] = "Installing iDB"; 
100 if(!isset($Settings['charset'])) {
101         $Settings['charset'] = "ISO-8859-15"; 
102         header("Content-Type: text/html; charset=ISO-8859-15"); }
103 if(isset($Settings['charset'])) {
104 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
105         $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
106         $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
107         $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
108         $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
109         $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
110         $Settings['charset'] = "ISO-8859-15"; 
111         header("Content-Type: text/html; charset=ISO-8859-15"); } }
112 $SQLCharset = "latin1";
113 if(isset($_POST['charset'])) { 
114 if($_POST['charset']=="ISO-8859-1") {
115         $SQLCharset = "latin1"; }
116 if($_POST['charset']=="ISO-8859-15") {
117         $SQLCharset = "latin1"; }
118 if($_POST['charset']=="UTF-8") {
119         $SQLCharset = "utf8"; }
120         $Settings['charset'] = $_POST['charset']; }
121 $ServHTTPS = "off";
122 if(isset($_SERVER['HTTPS'])) { $ServHTTPS=="off"; }
123 if($ServHTTPS=="on") { $prehost = "https://"; }
124 if($ServHTTPS!="on") { $prehost = "http://"; }
125 $this_dir = null;
126 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
127         dirname($_SERVER['SCRIPT_NAME'])!=null) {
128 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
129 if($this_dir==null||$this_dir==".") {
130 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
131         dirname($_SERVER['SCRIPT_NAME'])==null) {
132 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
133 if($this_dir=="\/") { $this_dir="/"; }
134 $this_dir = str_replace("//", "/", $this_dir);
135 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
136 if(!isset($_POST['BoardURL'])) { 
137    $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
138 if(isset($_POST['BoardURL'])) { 
139    $Settings['idburl'] = $_POST['BoardURL']; }
140 $Settings['qstr'] = "&";
141 $Settings['qsep'] = "=";
142 require($SetupDir['setup'].'preinstall.php');
143 require_once($SettDir['misc'].'utf8.php');
144 require_once($SettDir['inc'].'filename.php');
145 require_once($SettDir['inc'].'function.php');
146 if($_GET['act']=="README"||$_GET['act']=="ReadME") { $_GET['act']="readme"; }
147 if($_GET['act']=="readme"||$_GET['act']=="ReadMe") {
148 header("Content-Type: text/plain; charset=".$Settings['charset']);
149 require("README"); fix_amp(null); die(); }
150 $Settings['board_name'] = "Installing ".$RName; 
151 function get_theme_values($matches) {
152         global $ThemeSet;
153         $return_text = null;
154         if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
155         if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
156         return $return_text; }
157 foreach($ThemeSet AS $key => $value) {
158         $ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
159         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
160         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
161         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
162         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
163         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]); 
164         $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
165 require($SetupDir['convert'].'info.php');
166 require($SetupDir['setup'].'html5.php');
167 $Error = null; $_GET['time'] = false;
168 ?>
169
170 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
171 </head>
172 <body>
173 <?php require($SettDir['inc'].'navbar.php'); ?>
174 <div class="Table1Border">
175 <?php if($ThemeSet['TableStyle']=="div") { ?>
176 <div class="TableRow1">
177 <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>
178 </div>
179 <?php } ?>
180 <table class="Table1">
181 <?php if($ThemeSet['TableStyle']=="table") { ?>
182 <tr class="TableRow1">
183 <td class="TableColumn1"><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>
184 </td>
185 </tr><?php } ?>
186 <tr class="TableRow2">
187 <th class="TableColumn2" style="width: 100%; text-align: left;">
188 <span style="float: left;">&nbsp;Inert your install info: </span>
189 <span style="float: right;">&nbsp;</span>
190 </th>
191 </tr>
192 <?php
193 if($ServHTTPS=="on") { $prehost = "https://"; }
194 if($ServHTTPS!="on") { $prehost = "http://"; }
195 $this_dir = null;
196 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
197         dirname($_SERVER['SCRIPT_NAME'])!=null) {
198 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
199 if($this_dir==null||$this_dir==".") {
200 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
201         dirname($_SERVER['SCRIPT_NAME'])==null) {
202 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
203 if($this_dir=="\/") { $this_dir="/"; }
204 $this_dir = str_replace("//", "/", $this_dir);
205 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
206 function sql_list_dbs() {
207    $result = sql_query("SHOW DATABASES;",$SQLStat);
208    while( $data = sql_fetch_row($result) ) {
209        $array[] = $data[0];
210    } return $array; }
211 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
212 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
213 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
214    require($SetupDir['setup'].'license.php'); } } }
215 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
216 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
217 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
218    require($SetupDir['setup'].'presetup.php'); } } }
219 if($_POST['SetupType']=="convert") {
220         require($ConvertInfo['ConvertFile']); }
221 if($_POST['SetupType']=="install") {
222 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
223 if ($_GET['act']=="Part3"&&$_POST['act']=="Part3") {
224 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
225    require($SetupDir['setup'].'setup.php'); } } } }
226 if($_POST['SetupType']=="install") {
227 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
228 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
229 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
230    require($SetupDir['setup'].'mkconfig.php'); } } } }
231 if ($Error=="Yes") { ?>
232 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
233 <br /><br />
234 </td>
235 </tr>
236 <?php } ?>
237 <tr class="TableRow4">
238 <td class="TableColumn4">&nbsp;<a href="install.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
239 </tr>
240 </table></div>
241 <div>&nbsp;</div>
242 <?php 
243 require($SettDir['inc'].'endpage.php'); 
244 ?>
245 </body>
246 </html>
247 <?php
248 fix_amp(null);
249 ?>