OSDN Git Service

Small random bug fixes.
[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-2010 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2010 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: 05/11/2010 SVN 488 - 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 if($disfunc!="ini_set") { $disfunc = explode(",",$disfunc); }
23 if($disfunc=="ini_set") { $disfunc = array("ini_set"); }
24 if(!in_array("ini_set", $disfunc)) {
25 // Uncomment next two lines to show errors
26 /*@ini_set("display_errors", true);
27 @ini_set("display_startup_errors", true); */ }
28 @error_reporting(E_ALL ^ E_NOTICE);
29 /* Get rid of session id in urls */
30 if(!in_array("ini_set", $disfunc)) {
31 @ini_set("session.use_trans_sid", false);
32 @ini_set("session.use_cookies", true);
33 @ini_set("session.use_only_cookies", true);
34 @ini_set("url_rewriter.tags",""); }
35 @set_time_limit(30); @ignore_user_abort(true);
36 /* Change session garbage collection settings */
37 if(!in_array("ini_set", $disfunc)) {
38 @ini_set("session.gc_probability", 1);
39 @ini_set("session.gc_divisor", 100);
40 @ini_set("session.gc_maxlifetime", 1440);
41 /* Change session hash type here */
42 @ini_set('session.hash_function', 1);
43 @ini_set('session.hash_bits_per_character', 6); }
44 /* Do not change anything below this line unless you know what you are doing */
45 $Settings['clean_ob'] = "off";
46 if($Settings['clean_ob']=="on") {
47 /* Check for other output handlers/buffers are open
48    and close and get the contents in an array */
49 $numob = count(ob_list_handlers()); $iob = 0; 
50 while ($iob < $numob) { 
51         $old_ob_var[$iob] = ob_get_clean(); 
52         ++$iob; } } ob_start();
53 if(ini_get("register_globals")) { 
54         if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
55         require_once($SettDir['misc'].'killglobals.php'); }
56 if(!isset($preact['idb'])) { $preact['idb'] = null; }
57 if(!isset($_GET['act'])) { $_GET['act'] = null; }
58 if(!isset($_POST['act'])) { $_POST['act'] = null; }
59 if ($_GET['act']==null||$_GET['act']=="view") { $_GET['act']="Part1"; }
60 if ($_POST['act']==null||$_POST['act']=="view") { $_POST['act']="Part1"; }
61 $_TEG = array(null); $_TEG['part'] = preg_replace("/Part(1|2|3|4)/","\\1",$_GET['act']);
62 $_GET['act'] = strtolower($_GET['act']); if(isset($_TEG['part'])) {
63 if($_TEG['part']<=4&&$_TEG['part']>=1) { $_GET['act'] = "Part".$_TEG['part']; } }
64 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
65         $preact['idb'] = "installing";  }
66 $SetupDir['setup'] = "setup/"; $ConvertDir['setup'] = $SetupDir['setup']; $SetupDir['sql'] = "setup/sql/"; 
67 $SetupDir['convert'] = "setup/convert/"; $ConvertDir['convert'] = $SetupDir['convert']; $ConvertDir['sql'] = $SetupDir['sql'];
68 $Settings['output_type'] = "html"; $Settings['html_type'] = "xhtml10";
69 $Settings['board_name'] = "Installing iDB"; 
70 if(!isset($Settings['charset'])) {
71         $Settings['charset'] = "ISO-8859-15"; }
72 if(isset($Settings['charset'])) {
73 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
74         $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
75         $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
76         $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
77         $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
78         $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
79         $Settings['charset'] = "ISO-8859-15"; } }
80 $SQLCharset = "latin1";
81 if(isset($_POST['charset'])) { 
82 if($_POST['charset']=="ISO-8859-1") {
83         $SQLCharset = "latin1"; }
84 if($_POST['charset']=="ISO-8859-15") {
85         $SQLCharset = "latin1"; }
86 if($_POST['charset']=="UTF-8") {
87         $SQLCharset = "utf8"; }
88         $Settings['charset'] = $_POST['charset']; }
89 if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS']=="off"; }
90 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
91 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
92 $this_dir = null;
93 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
94         dirname($_SERVER['SCRIPT_NAME'])!=null) {
95 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
96 if($this_dir==null||$this_dir==".") {
97 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
98         dirname($_SERVER['SCRIPT_NAME'])==null) {
99 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
100 if($this_dir=="\/") { $this_dir="/"; }
101 $this_dir = str_replace("//", "/", $this_dir);
102 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
103 if(!isset($_POST['BoardURL'])) { 
104    $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
105 if(isset($_POST['BoardURL'])) { 
106    $Settings['idburl'] = $_POST['BoardURL']; }
107 $Settings['qstr'] = "&";
108 $Settings['qsep'] = "=";
109 require($SetupDir['setup'].'preinstall.php');
110 require_once($SettDir['misc'].'utf8.php');
111 require_once($SettDir['inc'].'filename.php');
112 require_once($SettDir['inc'].'function.php');
113 require($SetupDir['convert'].'info.php');
114 require($SettDir['inc'].'xhtml10.php');
115 $Error = null; $_GET['time'] = false;
116 ?>
117
118 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']; ?> </title>
119 </head>
120 <body>
121 <?php require($SettDir['inc'].'navbar.php'); ?>
122 <div class="Table1Border">
123 <?php if($ThemeSet['TableStyle']=="div") { ?>
124 <div class="TableRow1">
125 <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>
126 </div>
127 <?php } ?>
128 <table class="Table1">
129 <?php if($ThemeSet['TableStyle']=="table") { ?>
130 <tr class="TableRow1">
131 <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>
132 </td>
133 </tr><?php } ?>
134 <tr class="TableRow2">
135 <th class="TableColumn2" style="width: 100%; text-align: left;">
136 <span style="float: left;">&nbsp;Inert your install info: </span>
137 <span style="float: right;">&nbsp;</span>
138 </th>
139 </tr>
140 <?php
141 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
142 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
143 $this_dir = null;
144 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
145         dirname($_SERVER['SCRIPT_NAME'])!=null) {
146 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
147 if($this_dir==null||$this_dir==".") {
148 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
149         dirname($_SERVER['SCRIPT_NAME'])==null) {
150 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
151 if($this_dir=="\/") { $this_dir="/"; }
152 $this_dir = str_replace("//", "/", $this_dir);
153 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
154 function sql_list_dbs() {
155    $result = sql_query("SHOW DATABASES;",$SQLStat);
156    while( $data = sql_fetch_row($result) ) {
157        $array[] = $data[0];
158    } return $array; }
159 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
160 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
161 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
162    require($SetupDir['setup'].'license.php'); } } }
163 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
164 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
165 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
166    require($SetupDir['setup'].'presetup.php'); } } }
167 if($_POST['SetupType']=="convert") {
168         require($ConvertInfo['ConvertFile']); }
169 if($_POST['SetupType']=="install") {
170 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
171 if ($_GET['act']=="Part3"&&$_POST['act']=="Part3") {
172 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
173    require($SetupDir['setup'].'setup.php'); } } } }
174 if($_POST['SetupType']=="install") {
175 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
176 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
177 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
178    require($SetupDir['setup'].'mkconfig.php'); } } } }
179 if ($Error=="Yes") { ?>
180 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
181 <br /><br />
182 </td>
183 </tr>
184 <?php } ?>
185 <tr class="TableRow4">
186 <td class="TableColumn4">&nbsp;<a href="index.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
187 </tr>
188 </table></div>
189 <div>&nbsp;</div>
190 <?php require($SettDir['inc'].'endpage.php'); ?>
191 </body>
192 </html>
193 <?php fix_amp(null); ?>