OSDN Git Service

Small update to error_reporting. :P
[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: 10/26/2011 SVN 765 - 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("date.timezone","UTC"); 
41 @ini_set("default_mimetype","text/html"); 
42 @ini_set("zlib.output_compression", false);
43 @ini_set("zlib.output_compression_level", -1);
44 @ini_set("session.use_trans_sid", false);
45 @ini_set("session.use_cookies", true);
46 @ini_set("session.use_only_cookies", true);
47 @ini_set("url_rewriter.tags",""); 
48 @ini_set('zend.ze1_compatibility_mode', 0);
49 @ini_set("ignore_user_abort", 1); }
50 @set_time_limit(30); @ignore_user_abort(true);
51 /* Change session garbage collection settings */
52 if(!in_array("ini_set", $disfunc)) {
53 @ini_set("session.gc_probability", 1);
54 @ini_set("session.gc_divisor", 100);
55 @ini_set("session.gc_maxlifetime", 1440);
56 /* Change session hash type here */
57 @ini_set("session.hash_function", 1);
58 @ini_set("session.hash_bits_per_character", 6); }
59 if(file_exists('extrasettings.php')) {
60         require_once('extrasettings.php'); }
61 if(file_exists('extendsettings.php')) {
62         require_once('extendsettings.php'); }
63 /* Do not change anything below this line unless you know what you are doing */
64 if(!isset($Settings['clean_ob'])) { $Settings['clean_ob'] = "off"; }
65 function idb_output_handler($buffer) { return $buffer; }
66 if($Settings['clean_ob']=="on") {
67 /* Check for other output handlers/buffers are open
68    and close and get the contents in an array */
69 $numob = count(ob_list_handlers()); $iob = 0; 
70 while ($iob < $numob) { 
71         $old_ob_var[$iob] = ob_get_clean(); 
72         ++$iob; } } ob_start("idb_output_handler");
73 if(ini_get("register_globals")) { 
74         if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
75         require_once($SettDir['misc'].'killglobals.php'); }
76 if(!isset($preact['idb'])) { $preact['idb'] = null; }
77 if(!isset($_GET['act'])) { $_GET['act'] = null; }
78 if(!isset($_POST['act'])) { $_POST['act'] = null; }
79 if ($_GET['act']==null||$_GET['act']=="view") { $_GET['act']="Part1"; }
80 if ($_POST['act']==null||$_POST['act']=="view") { $_POST['act']="Part1"; }
81 $_TEG = array(null); $_TEG['part'] = preg_replace("/Part(1|2|3|4)/","\\1",$_GET['act']);
82 $_GET['act'] = strtolower($_GET['act']); if(isset($_TEG['part'])) {
83 if($_TEG['part']<=4&&$_TEG['part']>=1) { $_GET['act'] = "Part".$_TEG['part']; } }
84 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
85         $preact['idb'] = "installing";  }
86 $SetupDir['setup'] = "setup/"; $ConvertDir['setup'] = $SetupDir['setup']; $SetupDir['sql'] = "setup/sql/"; 
87 $SetupDir['convert'] = "setup/convert/"; $ConvertDir['convert'] = $SetupDir['convert']; $ConvertDir['sql'] = $SetupDir['sql'];
88 $Settings['output_type'] = "html"; $Settings['html_type'] = "xhtml10";
89 $Settings['board_name'] = "Installing iDB"; 
90 if(!isset($Settings['charset'])) {
91         $Settings['charset'] = "ISO-8859-15"; }
92 if(isset($Settings['charset'])) {
93 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
94         $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
95         $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
96         $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
97         $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
98         $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
99         $Settings['charset'] = "ISO-8859-15"; } }
100 $SQLCharset = "latin1";
101 if(isset($_POST['charset'])) { 
102 if($_POST['charset']=="ISO-8859-1") {
103         $SQLCharset = "latin1"; }
104 if($_POST['charset']=="ISO-8859-15") {
105         $SQLCharset = "latin1"; }
106 if($_POST['charset']=="UTF-8") {
107         $SQLCharset = "utf8"; }
108         $Settings['charset'] = $_POST['charset']; }
109 if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS']=="off"; }
110 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
111 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
112 $this_dir = null;
113 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
114         dirname($_SERVER['SCRIPT_NAME'])!=null) {
115 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
116 if($this_dir==null||$this_dir==".") {
117 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
118         dirname($_SERVER['SCRIPT_NAME'])==null) {
119 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
120 if($this_dir=="\/") { $this_dir="/"; }
121 $this_dir = str_replace("//", "/", $this_dir);
122 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
123 if(!isset($_POST['BoardURL'])) { 
124    $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
125 if(isset($_POST['BoardURL'])) { 
126    $Settings['idburl'] = $_POST['BoardURL']; }
127 $Settings['qstr'] = "&";
128 $Settings['qsep'] = "=";
129 require($SetupDir['setup'].'preinstall.php');
130 require_once($SettDir['misc'].'utf8.php');
131 require_once($SettDir['inc'].'filename.php');
132 require_once($SettDir['inc'].'function.php');
133 if($_GET['act']=="README"||$_GET['act']=="ReadME") { $_GET['act']="readme"; }
134 if($_GET['act']=="readme"||$_GET['act']=="ReadMe") {
135 header("Content-Type: text/plain; charset=".$Settings['charset']);
136 require("README"); fix_amp(null); die(); }
137 $Settings['board_name'] = "Installing ".$RName; 
138 function get_theme_values($matches) {
139         global $ThemeSet;
140         $return_text = null;
141         if(isset($ThemeSet[$matches[1]])) { $return_text = $ThemeSet[$matches[1]]; }
142         if(!isset($ThemeSet[$matches[1]])) { $return_text = null; }
143         return $return_text; }
144 foreach($ThemeSet AS $key => $value) {
145         $ThemeSet[$key] = preg_replace("/%%/s", "{percent}p", $ThemeSet[$key]);
146         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}T/s", "get_theme_values", $ThemeSet[$key]);
147         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}e/s", "get_env_values", $ThemeSet[$key]);
148         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}i/s", "get_server_values", $ThemeSet[$key]);
149         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}s/s", "get_setting_values", $ThemeSet[$key]);
150         $ThemeSet[$key] = preg_replace_callback("/%\{([^\}]*)\}t/s", "get_time", $ThemeSet[$key]); 
151         $ThemeSet[$key] = preg_replace("/\{percent\}p/s", "%", $ThemeSet[$key]); }
152 require($SetupDir['convert'].'info.php');
153 require($SetupDir['setup'].'xhtml10.php');
154 $Error = null; $_GET['time'] = false;
155 ?>
156
157 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
158 </head>
159 <body>
160 <?php require($SettDir['inc'].'navbar.php'); ?>
161 <div class="Table1Border">
162 <?php if($ThemeSet['TableStyle']=="div") { ?>
163 <div class="TableRow1">
164 <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>
165 </div>
166 <?php } ?>
167 <table class="Table1">
168 <?php if($ThemeSet['TableStyle']=="table") { ?>
169 <tr class="TableRow1">
170 <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>
171 </td>
172 </tr><?php } ?>
173 <tr class="TableRow2">
174 <th class="TableColumn2" style="width: 100%; text-align: left;">
175 <span style="float: left;">&nbsp;Inert your install info: </span>
176 <span style="float: right;">&nbsp;</span>
177 </th>
178 </tr>
179 <?php
180 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
181 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
182 $this_dir = null;
183 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
184         dirname($_SERVER['SCRIPT_NAME'])!=null) {
185 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
186 if($this_dir==null||$this_dir==".") {
187 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
188         dirname($_SERVER['SCRIPT_NAME'])==null) {
189 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
190 if($this_dir=="\/") { $this_dir="/"; }
191 $this_dir = str_replace("//", "/", $this_dir);
192 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
193 function sql_list_dbs() {
194    $result = sql_query("SHOW DATABASES;",$SQLStat);
195    while( $data = sql_fetch_row($result) ) {
196        $array[] = $data[0];
197    } return $array; }
198 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
199 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
200 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
201    require($SetupDir['setup'].'license.php'); } } }
202 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
203 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
204 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
205    require($SetupDir['setup'].'presetup.php'); } } }
206 if($_POST['SetupType']=="convert") {
207         require($ConvertInfo['ConvertFile']); }
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'].'setup.php'); } } } }
213 if($_POST['SetupType']=="install") {
214 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
215 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
216 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
217    require($SetupDir['setup'].'mkconfig.php'); } } } }
218 if ($Error=="Yes") { ?>
219 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
220 <br /><br />
221 </td>
222 </tr>
223 <?php } ?>
224 <tr class="TableRow4">
225 <td class="TableColumn4">&nbsp;<a href="index.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
226 </tr>
227 </table></div>
228 <div>&nbsp;</div>
229 <?php 
230 require($SettDir['inc'].'endpage.php'); 
231 ?>
232 </body>
233 </html>
234 <?php
235 fix_amp(null);
236 ?>