OSDN Git Service

Another big update to iDB.
[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-2015 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2015 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: 08/18/2015 SVN 797 - 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'] = "xhtml10";
99 $Settings['board_name'] = "Installing iDB"; 
100 if(!isset($Settings['charset'])) {
101         $Settings['charset'] = "ISO-8859-15"; }
102 if(isset($Settings['charset'])) {
103 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
104         $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
105         $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
106         $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
107         $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
108         $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
109         $Settings['charset'] = "ISO-8859-15"; } }
110 $SQLCharset = "latin1";
111 if(isset($_POST['charset'])) { 
112 if($_POST['charset']=="ISO-8859-1") {
113         $SQLCharset = "latin1"; }
114 if($_POST['charset']=="ISO-8859-15") {
115         $SQLCharset = "latin1"; }
116 if($_POST['charset']=="UTF-8") {
117         $SQLCharset = "utf8"; }
118         $Settings['charset'] = $_POST['charset']; }
119 if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS']=="off"; }
120 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
121 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
122 $this_dir = null;
123 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
124         dirname($_SERVER['SCRIPT_NAME'])!=null) {
125 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
126 if($this_dir==null||$this_dir==".") {
127 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
128         dirname($_SERVER['SCRIPT_NAME'])==null) {
129 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
130 if($this_dir=="\/") { $this_dir="/"; }
131 $this_dir = str_replace("//", "/", $this_dir);
132 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
133 if(!isset($_POST['BoardURL'])) { 
134    $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
135 if(isset($_POST['BoardURL'])) { 
136    $Settings['idburl'] = $_POST['BoardURL']; }
137 $Settings['qstr'] = "&";
138 $Settings['qsep'] = "=";
139 require($SetupDir['setup'].'preinstall.php');
140 require_once($SettDir['misc'].'utf8.php');
141 require_once($SettDir['inc'].'filename.php');
142 require_once($SettDir['inc'].'function.php');
143 if($_GET['act']=="README"||$_GET['act']=="ReadME") { $_GET['act']="readme"; }
144 if($_GET['act']=="readme"||$_GET['act']=="ReadMe") {
145 header("Content-Type: text/plain; charset=".$Settings['charset']);
146 require("README"); fix_amp(null); die(); }
147 $Settings['board_name'] = "Installing ".$RName; 
148 function get_theme_values($matches) {
149         global $ThemeSet;
150         $return_text = null;
151         if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
152         if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
153         return $return_text; }
154 foreach($ThemeSet AS $key => $value) {
155         $ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
156         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
157         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
158         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
159         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
160         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]); 
161         $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
162 require($SetupDir['convert'].'info.php');
163 require($SetupDir['setup'].'xhtml10.php');
164 $Error = null; $_GET['time'] = false;
165 ?>
166
167 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
168 </head>
169 <body>
170 <?php require($SettDir['inc'].'navbar.php'); ?>
171 <div class="Table1Border">
172 <?php if($ThemeSet['TableStyle']=="div") { ?>
173 <div class="TableRow1">
174 <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>
175 </div>
176 <?php } ?>
177 <table class="Table1">
178 <?php if($ThemeSet['TableStyle']=="table") { ?>
179 <tr class="TableRow1">
180 <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>
181 </td>
182 </tr><?php } ?>
183 <tr class="TableRow2">
184 <th class="TableColumn2" style="width: 100%; text-align: left;">
185 <span style="float: left;">&nbsp;Inert your install info: </span>
186 <span style="float: right;">&nbsp;</span>
187 </th>
188 </tr>
189 <?php
190 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
191 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
192 $this_dir = null;
193 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
194         dirname($_SERVER['SCRIPT_NAME'])!=null) {
195 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
196 if($this_dir==null||$this_dir==".") {
197 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
198         dirname($_SERVER['SCRIPT_NAME'])==null) {
199 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
200 if($this_dir=="\/") { $this_dir="/"; }
201 $this_dir = str_replace("//", "/", $this_dir);
202 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
203 function sql_list_dbs() {
204    $result = sql_query("SHOW DATABASES;",$SQLStat);
205    while( $data = sql_fetch_row($result) ) {
206        $array[] = $data[0];
207    } return $array; }
208 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
209 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
210 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
211    require($SetupDir['setup'].'license.php'); } } }
212 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
213 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
214 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
215    require($SetupDir['setup'].'presetup.php'); } } }
216 if($_POST['SetupType']=="convert") {
217         require($ConvertInfo['ConvertFile']); }
218 if($_POST['SetupType']=="install") {
219 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
220 if ($_GET['act']=="Part3"&&$_POST['act']=="Part3") {
221 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
222    require($SetupDir['setup'].'setup.php'); } } } }
223 if($_POST['SetupType']=="install") {
224 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
225 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
226 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
227    require($SetupDir['setup'].'mkconfig.php'); } } } }
228 if ($Error=="Yes") { ?>
229 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
230 <br /><br />
231 </td>
232 </tr>
233 <?php } ?>
234 <tr class="TableRow4">
235 <td class="TableColumn4">&nbsp;<a href="install.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
236 </tr>
237 </table></div>
238 <div>&nbsp;</div>
239 <?php 
240 require($SettDir['inc'].'endpage.php'); 
241 ?>
242 </body>
243 </html>
244 <?php
245 fix_amp(null);
246 ?>