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