OSDN Git Service

Small update.
[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-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
14
15     $FileInfo: install.php - Last Update: 08/16/2011 SVN 753 - 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 if($_GET['act']=="README"||$_GET['act']=="ReadME") { $_GET['act']="readme"; }
133 if($_GET['act']=="readme"||$_GET['act']=="ReadMe") {
134 header("Content-Type: text/plain; charset=".$Settings['charset']);
135 require("README"); fix_amp(null); die(); }
136 $Settings['board_name'] = "Installing ".$RName; 
137 function get_theme_values($matches) {
138         global $ThemeSet;
139         $return_text = null;
140         if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
141         if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
142         return $return_text; }
143 foreach($ThemeSet AS $key => $value) {
144         $ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
145         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
146         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
147         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
148         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
149         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]); 
150         $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
151 require($SetupDir['convert'].'info.php');
152 require($SetupDir['setup'].'xhtml10.php');
153 $Error = null; $_GET['time'] = false;
154 ?>
155
156 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
157 </head>
158 <body>
159 <?php require($SettDir['inc'].'navbar.php'); ?>
160 <div class="Table1Border">
161 <?php if($ThemeSet['TableStyle']=="div") { ?>
162 <div class="TableRow1">
163 <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>
164 </div>
165 <?php } ?>
166 <table class="Table1">
167 <?php if($ThemeSet['TableStyle']=="table") { ?>
168 <tr class="TableRow1">
169 <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>
170 </td>
171 </tr><?php } ?>
172 <tr class="TableRow2">
173 <th class="TableColumn2" style="width: 100%; text-align: left;">
174 <span style="float: left;">&nbsp;Inert your install info: </span>
175 <span style="float: right;">&nbsp;</span>
176 </th>
177 </tr>
178 <?php
179 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
180 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
181 $this_dir = null;
182 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
183         dirname($_SERVER['SCRIPT_NAME'])!=null) {
184 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
185 if($this_dir==null||$this_dir==".") {
186 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
187         dirname($_SERVER['SCRIPT_NAME'])==null) {
188 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
189 if($this_dir=="\/") { $this_dir="/"; }
190 $this_dir = str_replace("//", "/", $this_dir);
191 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
192 function sql_list_dbs() {
193    $result = sql_query("SHOW DATABASES;",$SQLStat);
194    while( $data = sql_fetch_row($result) ) {
195        $array[] = $data[0];
196    } return $array; }
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'].'license.php'); } } }
201 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
202 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
203 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
204    require($SetupDir['setup'].'presetup.php'); } } }
205 if($_POST['SetupType']=="convert") {
206         require($ConvertInfo['ConvertFile']); }
207 if($_POST['SetupType']=="install") {
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'].'setup.php'); } } } }
212 if($_POST['SetupType']=="install") {
213 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
214 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
215 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
216    require($SetupDir['setup'].'mkconfig.php'); } } } }
217 if ($Error=="Yes") { ?>
218 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
219 <br /><br />
220 </td>
221 </tr>
222 <?php } ?>
223 <tr class="TableRow4">
224 <td class="TableColumn4">&nbsp;<a href="index.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
225 </tr>
226 </table></div>
227 <div>&nbsp;</div>
228 <?php 
229 require($SettDir['inc'].'endpage.php'); 
230 ?>
231 </body>
232 </html>
233 <?php
234 fix_amp(null);
235 ?>