Small update
[iDB.git] / setup / mkconfig.php
blobd8a9326633c47b5c8dccb3ec1887076624ec9ef8
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-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
13 iDB Installer made by Game Maker 2k - http://idb.berlios.net/
15 $FileInfo: mkconfig.php - Last Update: 08/02/2019 SVN 905 - Author: cooldude2k $
17 $File3Name = basename($_SERVER['SCRIPT_NAME']);
18 if ($File3Name=="mkconfig.php"||$File3Name=="/mkconfig.php") {
19 require('index.php');
20 exit(); }
21 require_once('settings.php');
22 if(!isset($SetupDir['setup'])) { $SetupDir['setup'] = "setup/"; }
23 if(!isset($SetupDir['sql'])) { $SetupDir['sql'] = "setup/sql/"; }
24 if(!isset($SetupDir['convert'])) { $SetupDir['convert'] = "setup/convert/"; }
25 $_POST['DatabaseHost'] = $Settings['sqlhost'];
26 $_POST['DatabaseUserName'] = $Settings['sqluser'];
27 $_POST['DatabasePassword'] = $Settings['sqlpass'];
28 $Settings['charset'] = $_POST['charset'];
29 $Settings['sqltype'] = $_POST['DatabaseType'];
30 if(!isset($_POST['DefaultTheme'])) { $_POST['DefaultTheme'] = "iDB"; }
31 if(isset($_POST['DefaultTheme'])) {
32 $_POST['DefaultTheme'] = chack_themes($_POST['DefaultTheme']); }
33 $Settings['vercheck'] = 2;
34 if(!isset($_POST['SQLThemes'])) { $_POST['SQLThemes'] = "off"; }
35 if($_POST['SQLThemes']!="on"&&$_POST['SQLThemes']!="off") {
36 $_POST['SQLThemes'] = "off"; }
37 $disfunc = @ini_get("disable_functions");
38 $disfunc = @trim($disfunc);
39 $disfunc = @preg_replace("/([\\s+|\\t+|\\n+|\\r+|\\0+|\\x0B+])/i", "", $disfunc);
40 if($disfunc!="ini_set") { $disfunc = explode(",",$disfunc); }
41 if($disfunc=="ini_set") { $disfunc = array("ini_set"); }
42 $servtz = new DateTimeZone($_POST['YourOffSet']);
43 $servcurtime->setTimezone($servtz);
44 $usertz = new DateTimeZone($_POST['YourOffSet']);
45 $usercurtime->setTimezone($usertz);
47 <tr class="TableRow3" style="text-align: center;">
48 <td class="TableColumn3" colspan="2">
49 <?php
50 $dayconv = array('second' => 1, 'minute' => 60, 'hour' => 3600, 'day' => 86400, 'week' => 604800, 'month' => 2630880, 'year' => 31570560, 'decade' => 315705600);
51 $_POST['tableprefix'] = strtolower($_POST['tableprefix']);
52 $_POST['tableprefix'] = preg_replace("/[^A-Za-z0-9_$]/", "", $_POST['tableprefix']);
53 if($_POST['tableprefix']==null||$_POST['tableprefix']=="_") { $_POST['tableprefix']="idb_"; }
54 if(!isset($_POST['sessprefix'])) { $_POST['sessprefix'] = null; }
55 if($_POST['sessprefix']==null||$_POST['sessprefix']=="_") { $_POST['sessprefix']="idb_"; }
56 $checkfile="settings.php";
57 @chmod("settings.php",0766);
58 @chmod("settingsbak.php",0766);
59 if (!is_writable($checkfile)) {
60 echo "<br />Settings is not writable.";
61 @chmod("settings.php",0766); $Error="Yes";
62 @chmod("settingsbak.php",0766);
63 } else { /* settings.php is writable install iDB. ^_^ */ }
64 if (session_id()) { session_destroy(); }
65 session_name($_POST['tableprefix']."sess");
66 if(preg_match("/\/$/", $_POST['BoardURL'])<1) {
67 $_POST['BoardURL'] = $_POST['BoardURL']."/"; }
68 function unparse_url($parsed_url) {
69 $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
70 $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
71 $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
72 $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
73 $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
74 $pass = ($user || $pass) ? "$pass@" : '';
75 $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
76 $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
77 $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
78 return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
80 $OrgBoardURL = $_POST['BoardURL'];
81 $PreBestURL = parse_url($_POST['BoardURL']);
82 $PreServURL = parse_url((isset($_SERVER['HTTPS']) ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1));
83 if($PreBestURL['host']=="localhost.url"&&str_replace("/", "", $PreBestURL['path'])=="localpath") {
84 $PreBestURL['host'] = $PreServURL['host'];
85 $PreBestURL['path'] = $PreServURL['path'];
86 $_POST['BoardURL'] = unparse_url($PreBestURL); }
87 if($PreBestURL['host']=="localhost.url"&&str_replace("/", "", $PreBestURL['path'])!="localpath") {
88 $PreBestURL['host'] = $PreServURL['host'];
89 $_POST['BoardURL'] = unparse_url($PreBestURL); }
90 if($PreBestURL['host']!="localhost.url"&&str_replace("/", "", $PreBestURL['path'])=="localpath") {
91 $PreBestURL['path'] = $PreServURL['path'];
92 $_POST['BoardURL'] = unparse_url($PreBestURL); }
93 $OrgWebSiteURL = $_POST['WebURL'];
94 $PreWestURL = parse_url($_POST['WebURL']);
95 if($PreWestURL['host']=="localhost.url"&&str_replace("/", "", $PreWestURL['path'])=="localpath") {
96 $PreWestURL['host'] = $PreServURL['host'];
97 $PreWestURL['path'] = $PreServURL['path'];
98 $_POST['WebURL'] = unparse_url($PreWestURL); }
99 if($PreWestURL['host']=="localhost.url"&&str_replace("/", "", $PreWestURL['path'])!="localpath") {
100 $PreWestURL['host'] = $PreServURL['host'];
101 $_POST['WebURL'] = unparse_url($PreWestURL); }
102 if($PreWestURL['host']!="localhost.url"&&str_replace("/", "", $PreWestURL['path'])=="localpath") {
103 $PreWestURL['path'] = $PreServURL['path'];
104 $_POST['WebURL'] = unparse_url($PreWestURL); }
105 $URLsTest = parse_url($_POST['BoardURL']);
106 $this_dir = $URLsTest['path'];
107 $Settings['enable_https'] = "off";
108 if($URLsTest['scheme']=="https") {
109 $Settings['enable_https'] = "on"; }
110 session_set_cookie_params(0, $this_dir, $URLsTest['host']);
111 session_cache_limiter("private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
112 header("Cache-Control: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
113 header("Pragma: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
114 header("Date: ".$utccurtime->format("D, d M Y H:i:s")." GMT");
115 header("Last-Modified: ".$utccurtime->format("D, d M Y H:i:s")." GMT");
116 header("Expires: ".$utccurtime->format("D, d M Y H:i:s")." GMT");
117 if (version_compare(phpversion(), '7.0', '<')) { session_start(); } else {
118 session_start([
119 'use_trans_sid' => false,
120 'use_cookies' => true,
121 'use_only_cookies' => true,
122 'gc_probability' => 1,
123 'gc_divisor' => 100,
124 'gc_maxlifetime' => 1440,
125 'hash_function' => 1,
126 'hash_bits_per_character' => 6,
127 'name' => $_POST['tableprefix']."sess",
128 ]); }
129 //@register_shutdown_function("session_write_close");
130 if (pre_strlen($_POST['AdminPasswords'])<"3") { $Error="Yes";
131 echo "<br />Your password is too small."; }
132 if (pre_strlen($_POST['AdminUser'])<"3") { $Error="Yes";
133 echo "<br />Your user name is too small."; }
134 if (pre_strlen($_POST['AdminUser'])<"3") { $Error="Yes";
135 echo "<br />Your user name is too small."; }
136 if (pre_strlen($_POST['AdminEmail'])<"3") { $Error="Yes";
137 echo "<br />Your email name is too small."; }
138 if (!filter_var($_POST['AdminEmail'], FILTER_VALIDATE_EMAIL)) { $Error="Yes";
139 echo "<br />Your email is not a valid email address."; }
140 if (!filter_var($_POST['BoardURL'], FILTER_VALIDATE_URL)) { $Error="Yes";
141 echo "<br />Your board url is not a valid web url."; }
142 if (!filter_var($OrgBoardURL, FILTER_VALIDATE_URL)) { $Error="Yes";
143 echo "<br />Your board url is not a valid web url."; }
144 if (!filter_var($_POST['WebURL'], FILTER_VALIDATE_URL)&&$_POST['WebURL']!="localhost") { $Error="Yes";
145 echo "<br />Your website url is not a valid web url."; }
146 if (!filter_var($OrgWebSiteURL, FILTER_VALIDATE_URL)&&$OrgWebSiteURL!="localhost") { $Error="Yes";
147 echo "<br />Your website url is not a valid web url."; }
148 if (pre_strlen($_POST['AdminPasswords'])>"60") { $Error="Yes";
149 echo "<br />Your password is too big."; }
150 if (pre_strlen($_POST['AdminUser'])>"30") { $Error="Yes";
151 echo "<br />Your user name is too big."; }
152 if ($_POST['AdminPasswords']!=$_POST['ReaPassword']) { $Error="Yes";
153 echo "<br />Your passwords did not match."; }
154 if($_POST['HTMLType']=="html5") { $_POST['OutPutType'] = "html"; }
155 if($_POST['HTMLType']=="xhtml5") { $_POST['OutPutType'] = "xhtml"; }
156 $_POST['BoardURL'] = htmlentities($_POST['BoardURL'], ENT_QUOTES, $Settings['charset']);
157 $_POST['BoardURL'] = remove_spaces($_POST['BoardURL']);
158 $_POST['BoardURL'] = addslashes($_POST['BoardURL']);
159 $OrgBoardURL = htmlentities($OrgBoardURL, ENT_QUOTES, $Settings['charset']);
160 $OrgBoardURL = remove_spaces($OrgBoardURL);
161 $OrgBoardURL = addslashes($OrgBoardURL);
162 $YourDate = $utccurtime->getTimestamp();
163 $YourEditDate = $YourDate + $dayconv['minute'];
164 $GSalt = salt_hmac(); $YourSalt = salt_hmac();
165 /* Fix The User Info for iDB */
166 $_POST['NewBoardName'] = stripcslashes(htmlspecialchars($_POST['NewBoardName'], ENT_QUOTES, $Settings['charset']));
167 //$_POST['NewBoardName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NewBoardName']);
168 $_POST['NewBoardName'] = remove_spaces($_POST['NewBoardName']);
169 //$_POST['AdminPassword'] = stripcslashes(htmlspecialchars($_POST['AdminPassword'], ENT_QUOTES, $Settings['charset']));
170 //$_POST['AdminPassword'] = preg_replace("/\&amp;#(.*?);/is", "&#$1;", $_POST['AdminPassword']);
171 $_POST['AdminUser'] = stripcslashes(htmlspecialchars($_POST['AdminUser'], ENT_QUOTES, $Settings['charset']));
172 //$_POST['AdminUser'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['AdminUser']);
173 $_POST['AdminUser'] = remove_spaces($_POST['AdminUser']);
174 $_POST['AdminEmail'] = remove_spaces($_POST['AdminEmail']);
175 if(!function_exists('hash')&&!function_exists('hash_algos')) {
176 if($_POST['usehashtype']!="md5"&&
177 $_POST['usehashtype']!="sha1") {
178 $_POST['usehashtype'] = "sha1"; } }
179 if(function_exists('hash')&&function_exists('hash_algos')) {
180 if(!in_array($_POST['usehashtype'],hash_algos())) {
181 $_POST['usehashtype'] = "sha1"; }
182 if($_POST['usehashtype']!="md2"&&
183 $_POST['usehashtype']!="md4"&&
184 $_POST['usehashtype']!="md5"&&
185 $_POST['usehashtype']!="sha1"&&
186 $_POST['usehashtype']!="sha224"&&
187 $_POST['usehashtype']!="sha256"&&
188 $_POST['usehashtype']!="sha384"&&
189 $_POST['usehashtype']!="sha512"&&
190 $_POST['usehashtype']!="sha3-224"&&
191 $_POST['usehashtype']!="sha3-256"&&
192 $_POST['usehashtype']!="sha3-384"&&
193 $_POST['usehashtype']!="sha3-512"&&
194 $_POST['usehashtype']!="ripemd128"&&
195 $_POST['usehashtype']!="ripemd160"&&
196 $_POST['usehashtype']!="ripemd256"&&
197 $_POST['usehashtype']!="ripemd320"&&
198 $_POST['usehashtype']!="bcrypt") {
199 $_POST['usehashtype'] = "sha1"; } }
200 if($_POST['usehashtype']=="md2") { $iDBHashType = "iDBH2"; }
201 if($_POST['usehashtype']=="md4") { $iDBHashType = "iDBH4"; }
202 if($_POST['usehashtype']=="md5") { $iDBHashType = "iDBH5"; }
203 if($_POST['usehashtype']=="sha1") { $iDBHashType = "iDBH"; }
204 if($_POST['usehashtype']=="sha224") { $iDBHashType = "iDBH224"; }
205 if($_POST['usehashtype']=="sha256") { $iDBHashType = "iDBH256"; }
206 if($_POST['usehashtype']=="sha384") { $iDBHashType = "iDBH384"; }
207 if($_POST['usehashtype']=="sha512") { $iDBHashType = "iDBH512"; }
208 if($_POST['usehashtype']=="sha3-224") { $iDBHashType = "iDBH3224"; }
209 if($_POST['usehashtype']=="sha3-256") { $iDBHashType = "iDBH3256"; }
210 if($_POST['usehashtype']=="sha3-384") { $iDBHashType = "iDBH3384"; }
211 if($_POST['usehashtype']=="sha3-512") { $iDBHashType = "iDBH3512"; }
212 if($_POST['usehashtype']=="ripemd128") { $iDBHashType = "iDBHRMD128"; }
213 if($_POST['usehashtype']=="ripemd160") { $iDBHashType = "iDBHRMD160"; }
214 if($_POST['usehashtype']=="ripemd256") { $iDBHashType = "iDBHRMD256"; }
215 if($_POST['usehashtype']=="ripemd320") { $iDBHashType = "iDBHRMD320"; }
216 if($_POST['usehashtype']=="bcrypt") { $iDBHashType = "iDBCRYPT"; }
217 if ($_POST['AdminUser']=="Guest") { $Error="Yes";
218 echo "<br />You can not use Guest as your name."; }
219 /* We are done now with fixing the info. ^_^ */
220 $SQLStat = sql_connect_db($_POST['DatabaseHost'],$_POST['DatabaseUserName'],$_POST['DatabasePassword'],$_POST['DatabaseName']);
221 if(isset($_POST['sqlcollate'])) { $Settings['sql_collate'] = $_POST['sqlcollate']; }
222 if(isset($Settings['sql_collate'])&&!isset($Settings['sql_charset'])) {
223 if($Settings['sql_collate']=="ascii_bin"||
224 $Settings['sql_collate']=="ascii_generel_ci") {
225 $Settings['sql_charset'] = "ascii"; }
226 if($Settings['sql_collate']=="latin1_bin"||
227 $Settings['sql_collate']=="latin1_general_ci"||
228 $Settings['sql_collate']=="latin1_general_cs") {
229 $Settings['sql_charset'] = "latin1"; }
230 if($Settings['sql_collate']=="utf8_bin"||
231 $Settings['sql_collate']=="utf8_general_ci"||
232 $Settings['sql_collate']=="utf8_unicode_ci"||
233 $Settings['sql_collate']=="utf8mb4_bin"||
234 $Settings['sql_collate']=="utf8mb4_general_ci"||
235 $Settings['sql_collate']=="utf8mb4_unicode_ci") {
236 $Settings['sql_charset'] = "utf8"; } }
237 if(isset($Settings['sql_collate'])&&isset($Settings['sql_charset'])) {
238 if($Settings['sql_charset']=="ascii") {
239 if($Settings['sql_collate']!="ascii_bin"&&
240 $Settings['sql_collate']!="ascii_generel_ci") {
241 $Settings['sql_collate'] = "ascii_generel_ci"; } }
242 if($Settings['sql_charset']=="latin1") {
243 if($Settings['sql_collate']!="latin1_bin"&&
244 $Settings['sql_collate']!="latin1_general_ci"&&
245 $Settings['sql_collate']!="latin1_general_cs") {
246 $Settings['sql_collate'] = "latin1_general_ci"; } }
247 if($Settings['sql_charset']=="utf8" || $Settings['sql_charset']=="utf8mb4") {
248 if($Settings['sql_collate']!="utf8_bin"&&
249 $Settings['sql_collate']!="utf8_general_ci"&&
250 $Settings['sql_collate']!="utf8_unicode_ci"&&
251 $Settings['sql_collate']!="utf8mb4_bin"&&
252 $Settings['sql_collate']!="utf8mb4_general_ci"&&
253 $Settings['sql_collate']!="utf8mb4_unicode_ci") {
254 $Settings['sql_collate'] = "utf8mb4_unicode_ci"; } }
255 if($Settings['sql_collate']=="utf8_bin"||
256 $Settings['sql_collate']=="utf8_general_ci"||
257 $Settings['sql_collate']=="utf8_unicode_ci") {
258 $Settings['sql_charset'] = "utf8"; }
259 if($Settings['sql_collate']=="utf8mb4_bin"||
260 $Settings['sql_collate']=="utf8mb4_general_ci"||
261 $Settings['sql_collate']=="utf8mb4_unicode_ci") {
262 $Settings['sql_charset'] = "utf8mb4"; }
263 $SQLCollate = $Settings['sql_collate'];
264 $SQLCharset = $Settings['sql_charset']; }
265 if(!isset($Settings['sql_collate'])||!isset($Settings['sql_charset'])) {
266 $SQLCollate = "latin1_general_ci";
267 $SQLCharset = "latin1";
268 if($Settings['charset']=="ISO-8859-1") {
269 $SQLCollate = "latin1_general_ci";
270 $SQLCharset = "latin1"; }
271 if($Settings['charset']=="ISO-8859-15") {
272 $SQLCollate = "latin1_general_ci";
273 $SQLCharset = "latin1"; }
274 if($Settings['charset']=="UTF-8") {
275 $SQLCollate = "utf8mb4_unicode_ci";
276 $SQLCharset = "utf8mb4"; }
277 $Settings['sql_collate'] = $SQLCollate;
278 $Settings['sql_charset'] = $SQLCharset; }
279 sql_set_charset($SQLCharset,$SQLStat);
280 if($SQLStat===false) { $Error="Yes";
281 echo "<br />".sql_errorno($SQLStat)."\n"; }
282 if ($Error!="Yes") {
283 $ServerUUID = rand_uuid("rand");
284 $MyDay = $usercurtime->format("d");
285 $MyMonth = $usercurtime->format("m");
286 $MyYear = $usercurtime->format("Y");
287 $MyYear10 = $MyYear+10;
288 $YourDateEnd = $YourDate;
289 $EventMonth = $utccurtime->format("m");
290 $EventMonthEnd = $utccurtime->format("m");
291 $EventDay = $utccurtime->format("d");
292 $EventDayEnd = $utccurtime->format("d");
293 $EventYear = $utccurtime->format("Y");
294 $EventYearEnd = $utccurtime->format("Y");
295 $KarmaBoostDay = $EventMonth.$EventDay;
296 $Settings['idb_time_format'] = "g:i A";
297 if(!isset($_POST['iDBTimeFormat'])) {
298 $_POST['iDBTimeFormat'] = "g:i A"; }
299 if(isset($_POST['iDBTimeFormat'])) {
300 $_POST['iDBTimeFormat'] = convert_strftime($_POST['iDBTimeFormat']); }
301 $Settings['idb_date_format'] = "F j Y";
302 if(!isset($_POST['iDBDateFormat'])) {
303 $_POST['iDBDateFormat'] = "F j Y"; }
304 if(isset($_POST['iDBDateFormat'])) {
305 $_POST['iDBDateFormat'] = convert_strftime($_POST['iDBDateFormat']); }
306 if(!isset($_POST['iDBHTTPLogger'])) {
307 $_POST['iDBHTTPLogger'] = "off"; }
308 if(isset($_POST['iDBHTTPLogger'])&&$_POST['iDBHTTPLogger']!="on"&&$_POST['iDBHTTPLogger']!="off") {
309 $_POST['iDBHTTPLogger'] = "off"; }
310 if(!isset($_POST['iDBLoggerFormat'])) {
311 $_POST['iDBLoggerFormat'] = "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""; }
312 $Settings['idb_time_format'] = $_POST['iDBTimeFormat'];
313 $Settings['idb_date_format'] = $_POST['iDBDateFormat'];
314 $NewPassword = b64e_hmac($_POST['AdminPasswords'],$YourDate,$YourSalt,$_POST['usehashtype']);
315 //$Name = stripcslashes(htmlspecialchars($AdminUser, ENT_QUOTES, $Settings['charset']));
316 //$YourWebsite = "http://".$_SERVER['HTTP_HOST'].$this_dir."index.php?act=view";
317 $_POST['WebURL'] = htmlentities($_POST['WebURL'], ENT_QUOTES, $Settings['charset']);
318 $_POST['WebURL'] = remove_spaces($_POST['WebURL']);
319 $YourWebsite = $_POST['WebURL'];
320 $OrgWebSiteURL = htmlentities($OrgWebSiteURL, ENT_QUOTES, $Settings['charset']);
321 $OrgWebSiteURL = remove_spaces($OrgWebSiteURL);
322 $UserIP = $_SERVER['REMOTE_ADDR'];
323 $PostCount = 2;
324 $Email = "admin@".$_SERVER['HTTP_HOST'];
325 $GEmail = "guest@".$_SERVER['HTTP_HOST'];
326 $grand = rand(6,16); $i = 0; $gpass = "";
327 while ($i < $grand) {
328 $csrand = rand(1,3);
329 if($csrand!=1&&$csrand!=2&&$csrand!=3) { $csrand=1; }
330 if($csrand==1) { $gpass .= chr(rand(48,57)); }
331 if($csrand==2) { $gpass .= chr(rand(65,90)); }
332 if($csrand==3) { $gpass .= chr(rand(97,122)); }
333 ++$i; } $GuestPassword = b64e_hmac($gpass,$YourDate,$GSalt,$_POST['usehashtype']);
334 $url_this_dir = "http://".$_SERVER['HTTP_HOST'].$this_dir."index.php?act=view";
335 $YourIP = $_SERVER['REMOTE_ADDR'];
336 if($Settings['sqltype']!="cubrid") {
337 @unlink($SettDir['sqldumper'].'cubrid.php');
338 @unlink($SettDir['sql'].'cubrid.php'); }
339 if($Settings['sqltype']!="mysql"&&
340 $Settings['sqltype']!="mysqli") {
341 @unlink($SettDir['sqldumper'].'mysql.php'); }
342 if($Settings['sqltype']!="mysql") {
343 @unlink($SettDir['sql'].'mysql.php'); }
344 if($Settings['sqltype']!="mysqli") {
345 @unlink($SettDir['sql'].'mysqli.php'); }
346 if($Settings['sqltype']!="pgsql") {
347 @unlink($SettDir['sqldumper'].'pgsql.php');
348 @unlink($SettDir['sql'].'pgsql.php'); }
349 if($Settings['sqltype']!="sqlite") {
350 if($Settings['sqltype']!="sqlite3") {
351 @unlink($SettDir['sqldumper'].'sqlite.php'); }
352 @unlink($SettDir['sql'].'sqlite.php'); }
353 if($Settings['sqltype']!="sqlite3") {
354 @unlink($SettDir['sql'].'sqlite3.php'); }
355 if($Settings['sqltype']=="mysql"||
356 $Settings['sqltype']=="mysqli") {
357 require($SetupDir['sql'].'mysql.php'); }
358 if($Settings['sqltype']=="pgsql") {
359 require($SetupDir['sql'].'pgsql.php'); }
360 if($Settings['sqltype']=="sqlite"||$Settings['sqltype']=="sqlite3") {
361 require($SetupDir['sql'].'sqlite.php'); }
362 if($Settings['sqltype']=="cubrid") {
363 require($SetupDir['sql'].'cubrid.php'); }
364 if($_POST['SQLThemes']=="on") {
365 $OldThemeSet = $ThemeSet;
366 $Settings['board_name'] = $_POST['NewBoardName'];
367 $skindir = dirname(realpath("sql.php"))."/".$SettDir['themes'];
368 if ($handle = opendir($skindir)) { $dirnum = null;
369 while (false !== ($file = readdir($handle))) {
370 if ($dirnum==null) { $dirnum = 0; }
371 if (file_exists($skindir.$file."/info.php")) {
372 if ($file != "." && $file != "..") {
373 require($skindir.$file."/info.php");
374 $themelist[$dirnum] = $file;
375 ++$dirnum; } } }
376 closedir($handle); asort($themelist);
377 $themenum=count($themelist); $themei=0;
378 while ($themei < $themenum) {
379 require($skindir.$themelist[$themei]."/settings.php");
380 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."themes\" (\"Name\", \"ThemeName\", \"ThemeMaker\", \"ThemeVersion\", \"ThemeVersionType\", \"ThemeSubVersion\", \"MakerURL\", \"CopyRight\", \"WrapperString\", \"CSS\", \"CSSType\", \"FavIcon\", \"TableStyle\", \"MiniPageAltStyle\", \"PreLogo\", \"Logo\", \"LogoStyle\", \"SubLogo\", \"TopicIcon\", \"MovedTopicIcon\", \"HotTopic\", \"MovedHotTopic\", \"PinTopic\", \"AnnouncementTopic\", \"MovedPinTopic\", \"HotPinTopic\", \"MovedHotPinTopic\", \"ClosedTopic\", \"MovedClosedTopic\", \"HotClosedTopic\", \"MovedHotClosedTopic\", \"PinClosedTopic\", \"MovedPinClosedTopic\", \"HotPinClosedTopic\", \"MovedHotPinClosedTopic\", \"MessageRead\", \"MessageUnread\", \"Profile\", \"WWW\", \"PM\", \"TopicLayout\", \"AddReply\", \"FastReply\", \"NewTopic\", \"QuoteReply\", \"EditReply\", \"DeleteReply\", \"Report\", \"LineDivider\", \"ButtonDivider\", \"LineDividerTopic\", \"TitleDivider\", \"ForumStyle\", \"ForumIcon\", \"SubForumIcon\", \"RedirectIcon\", \"TitleIcon\", \"NavLinkIcon\", \"NavLinkDivider\", \"BoardStatsIcon\", \"MemberStatsIcon\", \"BirthdayStatsIcon\", \"EventStatsIcon\", \"OnlineStatsIcon\", \"NoAvatar\", \"NoAvatarSize\") VALUES\n".
381 "('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');", array($themelist[$themei], $ThemeSet['ThemeName'], $ThemeSet['ThemeMaker'], $ThemeSet['ThemeVersion'], $ThemeSet['ThemeVersionType'], $ThemeSet['ThemeSubVersion'], $ThemeSet['MakerURL'], $ThemeSet['CopyRight'], $ThemeSet['WrapperString'], $ThemeSet['CSS'], $ThemeSet['CSSType'], $ThemeSet['FavIcon'], $ThemeSet['TableStyle'], $ThemeSet['MiniPageAltStyle'], $ThemeSet['PreLogo'], $ThemeSet['Logo'], $ThemeSet['LogoStyle'], $ThemeSet['SubLogo'], $ThemeSet['TopicIcon'], $ThemeSet['MovedTopicIcon'], $ThemeSet['HotTopic'], $ThemeSet['MovedHotTopic'], $ThemeSet['PinTopic'], $ThemeSet['AnnouncementTopic'], $ThemeSet['MovedPinTopic'], $ThemeSet['HotPinTopic'], $ThemeSet['MovedHotPinTopic'], $ThemeSet['ClosedTopic'], $ThemeSet['MovedClosedTopic'], $ThemeSet['HotClosedTopic'], $ThemeSet['MovedHotClosedTopic'], $ThemeSet['PinClosedTopic'], $ThemeSet['MovedPinClosedTopic'], $ThemeSet['HotPinClosedTopic'], $ThemeSet['MovedHotPinClosedTopic'], $ThemeSet['MessageRead'], $ThemeSet['MessageUnread'], $ThemeSet['Profile'], $ThemeSet['WWW'], $ThemeSet['PM'], $ThemeSet['TopicLayout'], $ThemeSet['AddReply'], $ThemeSet['FastReply'], $ThemeSet['NewTopic'], $ThemeSet['QuoteReply'], $ThemeSet['EditReply'], $ThemeSet['DeleteReply'], $ThemeSet['Report'], $ThemeSet['LineDivider'], $ThemeSet['ButtonDivider'], $ThemeSet['LineDividerTopic'], $ThemeSet['TitleDivider'], $ThemeSet['ForumStyle'], $ThemeSet['ForumIcon'], $ThemeSet['SubForumIcon'], $ThemeSet['RedirectIcon'], $ThemeSet['TitleIcon'], $ThemeSet['NavLinkIcon'], $ThemeSet['NavLinkDivider'], $ThemeSet['BoardStatsIcon'], $ThemeSet['MemberStatsIcon'], $ThemeSet['BirthdayStatsIcon'], $ThemeSet['EventStatsIcon'], $ThemeSet['OnlineStatsIcon'], $ThemeSet['NoAvatar'], $ThemeSet['NoAvatarSize']));
382 sql_query($query,$SQLStat);
383 ++$themei; } }
384 sql_disconnect_db($SQLStat);
385 $ThemeSet = $OldThemeSet; }
386 $CHMOD = $_SERVER['PHP_SELF'];
387 $iDBRDate = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
388 $iDBRSVN = $VER2[2]." ".$SubVerN;
389 $LastUpdateS = "Last Update: ".$iDBRDate." ".$iDBRSVN;
390 $pretext = "<?php\n/*\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n Revised BSD License for more details.\n\n Copyright 2004-".$SVNDay[2]." iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1\n Copyright 2004-".$SVNDay[2]." Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2\n iDB Installer made by Game Maker 2k - http://idb.berlios.net/\n\n \$FileInfo: settings.php & settingsbak.php - ".$LastUpdateS." - Author: cooldude2k \$\n*/\n";
391 $pretext2 = array("/* Board Setting Section Begins */\n\$Settings = array();","/* Board Setting Section Ends \n Board Info Section Begins */\n\$SettInfo = array();","/* Board Setting Section Ends \n Board Dir Section Begins */\n\$SettDir = array();","/* Board Dir Section Ends */");
392 $settcheck = "\$File3Name = basename(\$_SERVER['SCRIPT_NAME']);\nif (\$File3Name==\"settings.php\"||\$File3Name==\"/settings.php\"||\n \$File3Name==\"settingsbak.php\"||\$File3Name==\"/settingsbak.php\") {\n header('Location: index.php');\n exit(); }\n";
393 $BoardSettings=$pretext2[0]."\n".
394 "\$Settings['sqlhost'] = '".$_POST['DatabaseHost']."';\n".
395 "\$Settings['sqldb'] = '".$_POST['DatabaseName']."';\n".
396 "\$Settings['sqltable'] = '".$_POST['tableprefix']."';\n".
397 "\$Settings['sqluser'] = '".$_POST['DatabaseUserName']."';\n".
398 "\$Settings['sqlpass'] = '".$_POST['DatabasePassword']."';\n".
399 "\$Settings['sqltype'] = '".$_POST['DatabaseType']."';\n".
400 "\$Settings['board_name'] = '".$_POST['NewBoardName']."';\n".
401 "\$Settings['idbdir'] = '".$idbdir."';\n".
402 "\$Settings['idburl'] = '".$OrgBoardURL."';\n".
403 "\$Settings['enable_https'] = '".$Settings['enable_https']."';\n".
404 "\$Settings['weburl'] = '".$OrgWebSiteURL."';\n".
405 "\$Settings['SQLThemes'] = '".$_POST['SQLThemes']."';\n".
406 "\$Settings['use_gzip'] = '".$_POST['GZip']."';\n".
407 "\$Settings['html_type'] = '".$_POST['HTMLType']."';\n".
408 "\$Settings['output_type'] = '".$_POST['OutPutType']."';\n".
409 "\$Settings['GuestGroup'] = 'Guest';\n".
410 "\$Settings['MemberGroup'] = 'Member';\n".
411 "\$Settings['ValidateGroup'] = 'Validate';\n".
412 "\$Settings['AdminValidate'] = 'off';\n".
413 "\$Settings['TestReferer'] = '".$_POST['TestReferer']."';\n".
414 "\$Settings['DefaultTheme'] = '".$_POST['DefaultTheme']."';\n".
415 "\$Settings['DefaultTimeZone'] = '".$_POST['YourOffSet']."';\n".
416 "\$Settings['start_date'] = ".$YourDate.";\n".
417 "\$Settings['idb_time_format'] = '".$Settings['idb_time_format']."';\n".
418 "\$Settings['idb_date_format'] = '".$Settings['idb_date_format']."';\n".
419 "\$Settings['use_hashtype'] = '".$_POST['usehashtype']."';\n".
420 "\$Settings['charset'] = '".$Settings['charset']."';\n".
421 "\$Settings['sql_collate'] = '".$Settings['sql_collate']."';\n".
422 "\$Settings['sql_charset'] = '".$Settings['sql_charset']."';\n".
423 "\$Settings['add_power_by'] = 'off';\n".
424 "\$Settings['send_pagesize'] = 'off';\n".
425 "\$Settings['max_posts'] = '10';\n".
426 "\$Settings['max_topics'] = '10';\n".
427 "\$Settings['max_memlist'] = '10';\n".
428 "\$Settings['max_pmlist'] = '10';\n".
429 "\$Settings['hot_topic_num'] = '15';\n".
430 "\$Settings['qstr'] = '&';\n".
431 "\$Settings['qsep'] = '=';\n".
432 "\$Settings['file_ext'] = '.php';\n".
433 "\$Settings['rss_ext'] = '.php';\n".
434 "\$Settings['js_ext'] = '.js';\n".
435 "\$Settings['showverinfo'] = 'on';\n".
436 "\$Settings['vercheck'] = 1;\n".
437 "\$Settings['enable_rss'] = 'on';\n".
438 "\$Settings['enable_search'] = 'on';\n".
439 "\$Settings['sessionid_in_urls'] = 'off';\n".
440 "\$Settings['fixpathinfo'] = 'off';\n".
441 "\$Settings['fixbasedir'] = 'off';\n".
442 "\$Settings['fixcookiedir'] = 'off';\n".
443 "\$Settings['fixredirectdir'] = 'off';\n".
444 "\$Settings['enable_pathinfo'] = 'off';\n".
445 "\$Settings['rssurl'] = 'off';\n".
446 "\$Settings['board_offline'] = 'off';\n".
447 "\$Settings['VerCheckURL'] = '';\n".
448 "\$Settings['IPCheckURL'] = '';\n".
449 "\$Settings['log_http_request'] = '".$_POST['iDBHTTPLogger']."';\n".
450 "\$Settings['log_config_format'] = '".$_POST['iDBLoggerFormat']."';\n".
451 "\$Settings['BoardUUID'] = '".base64_encode($ServerUUID)."';\n".
452 "\$Settings['KarmaBoostDays'] = '".$KarmaBoostDay."';\n".
453 "\$Settings['KBoostPercent'] = '6|10';\n".$pretext2[1]."\n".
454 "\$SettInfo['board_name'] = '".$_POST['NewBoardName']."';\n".
455 "\$SettInfo['Author'] = '".$_POST['AdminUser']."';\n".
456 "\$SettInfo['Keywords'] = '".$_POST['NewBoardName'].",".$_POST['AdminUser']."';\n".
457 "\$SettInfo['Description'] = '".$_POST['NewBoardName'].",".$_POST['AdminUser']."';\n".$pretext2[2]."\n".
458 "\$SettDir['maindir'] = '".$idbdir."';\n".
459 "\$SettDir['inc'] = 'inc/';\n".
460 "\$SettDir['logs'] = 'logs/';\n".
461 "\$SettDir['archive'] = 'archive/';\n".
462 "\$SettDir['misc'] = 'inc/misc/';\n".
463 "\$SettDir['sql'] = 'inc/misc/sql/';\n".
464 "\$SettDir['admin'] = 'inc/admin/';\n".
465 "\$SettDir['sqldumper'] = 'inc/admin/sqldumper/';\n".
466 "\$SettDir['mod'] = 'inc/mod/';\n".
467 "\$SettDir['mplayer'] = 'inc/mplayer/';\n".
468 "\$SettDir['themes'] = 'themes/';\n".$pretext2[3]."\n?>";
469 $BoardSettingsBak = $pretext.$settcheck.$BoardSettings;
470 $BoardSettings = $pretext.$settcheck.$BoardSettings;
471 $fp = fopen("settings.php","w+");
472 fwrite($fp, $BoardSettings);
473 fclose($fp);
474 // cp("settings.php","settingsbak.php");
475 $fp = fopen("settingsbak.php","w+");
476 fwrite($fp, $BoardSettingsBak);
477 fclose($fp);
478 if($_POST['storecookie']=="true") {
479 if($URLsTest['host']!="localhost.url") {
480 setcookie("MemberName", $_POST['AdminUser'], time() + (7 * 86400), $this_dir, $URLsTest['host']);
481 setcookie("UserID", 1, time() + (7 * 86400), $this_dir, $URLsTest['host']);
482 setcookie("SessPass", $NewPassword, time() + (7 * 86400), $this_dir, $URLsTest['host']); }
483 if($URLsTest['host']=="localhost.url") {
484 setcookie("MemberName", $_POST['AdminUser'], time() + (7 * 86400), $this_dir, false);
485 setcookie("UserID", 1, time() + (7 * 86400), $this_dir, false);
486 setcookie("SessPass", $NewPassword, time() + (7 * 86400), $this_dir, false); } }
487 $chdel = true;
488 if($Error!="Yes") {
489 if($_POST['unlink']=="true") {
490 if($ConvertInfo['ConvertFile']!=null) {
491 if(!@unlink($ConvertInfo['ConvertFile'])) { $chdel = false; } }
492 if(!@unlink($SetupDir['convert'].'index.php')) { $chdel = false; }
493 if(!@unlink($SetupDir['convert'].'info.php')) { $chdel = false; }
494 if(!@rmdir($SetupDir['convert'])) { $chdel = false; }
495 if(!@unlink($SetupDir['sql'].'cubrid.php')) { $chdel = false; }
496 if(!@unlink($SetupDir['sql'].'index.php')) { $chdel = false; }
497 if(!@unlink($SetupDir['sql'].'mysql.php')) { $chdel = false; }
498 if(!@unlink($SetupDir['sql'].'pgsql.php')) { $chdel = false; }
499 if(!@unlink($SetupDir['sql'].'sqlite.php')) { $chdel = false; }
500 if(!@rmdir($SetupDir['sql'])) { $chdel = false; }
501 if(!@unlink($SetupDir['setup'].'index.php')) { $chdel = false; }
502 if(!@unlink($SetupDir['setup'].'license.php')) { $chdel = false; }
503 if(!@unlink($SetupDir['setup'].'mkconfig.php')) { $chdel = false; }
504 if(!@unlink($SetupDir['setup'].'preinstall.php')) { $chdel = false; }
505 if(!@unlink($SetupDir['setup'].'presetup.php')) { $chdel = false; }
506 if(!@unlink($SetupDir['setup'].'setup.php')) { $chdel = false; }
507 if(!@unlink($SetupDir['setup'].'html5.php')) { $chdel = false; }
508 if(!@rmdir('setup')) { $chdel = false; }
509 if(!@unlink('install.php')) { $chdel = false; } } }
510 ?><span class="TableMessage">
511 <br />Install Finish <a href="index.php?act=view">Click here</a> to goto board. ^_^</span>
512 <?php if($chdel===false) { ?><span class="TableMessage">
513 <br />Error: Cound not delete installer. Read readme.txt for more info.</span>
514 <?php } ?><br /><br />
515 </td>
516 </tr>
517 <?php } ?>