Small bug fix. :o
[iDB.git] / setup / mkconfig.php
blob2cd7d67264e027e08eff8c96b11b06900d5bb562
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.net/
15 $FileInfo: mkconfig.php - Last Update: 07/22/2011 SVN 727 - 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 if(!in_array("ini_set", $disfunc)) {
43 @ini_set("date.timezone","UTC"); }
44 if(function_exists("date_default_timezone_set")) {
45 @date_default_timezone_set("UTC"); }
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($_POST['sessprefix']==null||$_POST['sessprefix']=="_") { $_POST['sessprefix']="idb_"; }
55 $checkfile="settings.php";
56 @chmod("settings.php",0766);
57 @chmod("settingsbak.php",0766);
58 if (!is_writable($checkfile)) {
59 echo "<br />Settings is not writable.";
60 @chmod("settings.php",0766); $Error="Yes";
61 @chmod("settingsbak.php",0766);
62 } else { /* settings.php is writable install iDB. ^_^ */ }
63 if (session_id()) { session_destroy(); }
64 session_name($_POST['tableprefix']."sess");
65 if(preg_match("/\/$/", $_POST['BoardURL'])<1) {
66 $_POST['BoardURL'] = $_POST['BoardURL']."/"; }
67 $URLsTest = parse_url($_POST['BoardURL']);
68 $this_dir = $URLsTest['path'];
69 $Settings['enable_https'] = "off";
70 if($URLsTest['scheme']=="https") {
71 $Settings['enable_https'] = "on"; }
72 session_set_cookie_params(0, $this_dir, $URLsTest['host']);
73 session_cache_limiter("private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
74 header("Cache-Control: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
75 header("Pragma: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
76 header("Date: ".gmdate("D, d M Y H:i:s")." GMT");
77 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
78 header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
79 session_start();
80 //@register_shutdown_function("session_write_close");
81 if (pre_strlen($_POST['AdminPasswords'])<"3") { $Error="Yes";
82 echo "<br />Your password is too small."; }
83 if (pre_strlen($_POST['AdminUser'])<"3") { $Error="Yes";
84 echo "<br />Your user name is too small."; }
85 if (pre_strlen($_POST['AdminUser'])<"3") { $Error="Yes";
86 echo "<br />Your user name is too small."; }
87 if (pre_strlen($_POST['AdminEmail'])<"3") { $Error="Yes";
88 echo "<br />Your email name is too small."; }
89 if (pre_strlen($_POST['AdminPasswords'])>"60") { $Error="Yes";
90 echo "<br />Your password is too big."; }
91 if (pre_strlen($_POST['AdminUser'])>"30") { $Error="Yes";
92 echo "<br />Your user name is too big."; }
93 if ($_POST['AdminPasswords']!=$_POST['ReaPassword']) { $Error="Yes";
94 echo "<br />Your passwords did not match."; }
95 if($_POST['HTMLType']=="xhtml11") { $_POST['HTMLLevel'] = "Strict"; }
96 if($_POST['HTMLType']=="html5") { $_POST['OutPutType'] = "html"; }
97 if($_POST['HTMLType']=="xhtml5") { $_POST['OutPutType'] = "xhtml"; }
98 $_POST['BoardURL'] = htmlentities($_POST['BoardURL'], ENT_QUOTES, $Settings['charset']);
99 $_POST['BoardURL'] = remove_spaces($_POST['BoardURL']);
100 $_POST['BoardURL'] = addslashes($_POST['BoardURL']);
101 $YourDate = GMTimeStamp();
102 $YourEditDate = $YourDate + $dayconv['minute'];
103 $GSalt = salt_hmac(); $YourSalt = salt_hmac();
104 /* Fix The User Info for iDB */
105 $_POST['NewBoardName'] = stripcslashes(htmlspecialchars($_POST['NewBoardName'], ENT_QUOTES, $Settings['charset']));
106 //$_POST['NewBoardName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NewBoardName']);
107 $_POST['NewBoardName'] = remove_spaces($_POST['NewBoardName']);
108 //$_POST['AdminPassword'] = stripcslashes(htmlspecialchars($_POST['AdminPassword'], ENT_QUOTES, $Settings['charset']));
109 //$_POST['AdminPassword'] = preg_replace("/\&amp;#(.*?);/is", "&#$1;", $_POST['AdminPassword']);
110 $_POST['AdminUser'] = stripcslashes(htmlspecialchars($_POST['AdminUser'], ENT_QUOTES, $Settings['charset']));
111 //$_POST['AdminUser'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['AdminUser']);
112 $_POST['AdminUser'] = remove_spaces($_POST['AdminUser']);
113 $_POST['AdminEmail'] = remove_spaces($_POST['AdminEmail']);
114 if(!function_exists('hash')&&!function_exists('hash_algos')) {
115 if($_POST['usehashtype']!="md5"&&
116 $_POST['usehashtype']!="sha1") {
117 $_POST['usehashtype'] = "sha1"; } }
118 if(function_exists('hash')&&function_exists('hash_algos')) {
119 if(!in_array($_POST['usehashtype'],hash_algos())) {
120 $_POST['usehashtype'] = "sha1"; }
121 if($_POST['usehashtype']!="md2"&&
122 $_POST['usehashtype']!="md4"&&
123 $_POST['usehashtype']!="md5"&&
124 $_POST['usehashtype']!="sha1"&&
125 $_POST['usehashtype']!="sha224"&&
126 $_POST['usehashtype']!="sha256"&&
127 $_POST['usehashtype']!="sha384"&&
128 $_POST['usehashtype']!="sha512"&&
129 $_POST['usehashtype']!="ripemd128"&&
130 $_POST['usehashtype']!="ripemd160"&&
131 $_POST['usehashtype']!="ripemd256"&&
132 $_POST['usehashtype']!="ripemd320"&&
133 $_POST['usehashtype']!="salsa10"&&
134 $_POST['usehashtype']!="salsa20"&&
135 $_POST['usehashtype']!="snefru"&&
136 $_POST['usehashtype']!="snefru256"&&
137 $_POST['usehashtype']!="gost") {
138 $_POST['usehashtype'] = "sha1"; } }
139 if($_POST['usehashtype']=="md2") { $iDBHashType = "iDBH2"; }
140 if($_POST['usehashtype']=="md4") { $iDBHashType = "iDBH4"; }
141 if($_POST['usehashtype']=="md5") { $iDBHashType = "iDBH5"; }
142 if($_POST['usehashtype']=="sha1") { $iDBHashType = "iDBH"; }
143 if($_POST['usehashtype']=="sha224") { $iDBHashType = "iDBH224"; }
144 if($_POST['usehashtype']=="sha256") { $iDBHashType = "iDBH256"; }
145 if($_POST['usehashtype']=="sha384") { $iDBHashType = "iDBH384"; }
146 if($_POST['usehashtype']=="sha512") { $iDBHashType = "iDBH512"; }
147 if($_POST['usehashtype']=="ripemd128") { $iDBHashType = "iDBHRMD128"; }
148 if($_POST['usehashtype']=="ripemd160") { $iDBHashType = "iDBHRMD160"; }
149 if($_POST['usehashtype']=="ripemd256") { $iDBHashType = "iDBHRMD256"; }
150 if($_POST['usehashtype']=="ripemd320") { $iDBHashType = "iDBHRMD320"; }
151 if($_POST['usehashtype']=="salsa10") { $iDBHashType = "iDBHSALSA10"; }
152 if($_POST['usehashtype']=="salsa20") { $iDBHashType = "iDBHSALSA20"; }
153 if($_POST['usehashtype']=="snefru") { $iDBHashType = "iDBHSFRU"; }
154 if($_POST['usehashtype']=="snefru256") { $iDBHashType = "iDBHSFRU256"; }
155 if($_POST['usehashtype']=="gost") { $iDBHashType = "iDBHGOST"; }
156 if ($_POST['AdminUser']=="Guest") { $Error="Yes";
157 echo "<br />You can not use Guest as your name."; }
158 /* We are done now with fixing the info. ^_^ */
159 $SQLStat = sql_connect_db($_POST['DatabaseHost'],$_POST['DatabaseUserName'],$_POST['DatabasePassword'],$_POST['DatabaseName']);
160 if(isset($_POST['sqlcollate'])) { $Settings['sql_collate'] = $_POST['sqlcollate']; }
161 if(isset($Settings['sql_collate'])&&!isset($Settings['sql_charset'])) {
162 if($Settings['sql_collate']=="ascii_bin"||
163 $Settings['sql_collate']=="ascii_generel_ci") {
164 $Settings['sql_charset'] = "ascii"; }
165 if($Settings['sql_collate']=="latin1_bin"||
166 $Settings['sql_collate']=="latin1_general_ci"||
167 $Settings['sql_collate']=="latin1_general_cs") {
168 $Settings['sql_charset'] = "latin1"; }
169 if($Settings['sql_collate']=="utf8_bin"||
170 $Settings['sql_collate']=="utf8_general_ci"||
171 $Settings['sql_collate']=="utf8_unicode_ci") {
172 $Settings['sql_charset'] = "utf8"; } }
173 if(isset($Settings['sql_collate'])&&isset($Settings['sql_charset'])) {
174 if($Settings['sql_charset']=="ascii") {
175 if($Settings['sql_collate']!="ascii_bin"&&
176 $Settings['sql_collate']!="ascii_generel_ci") {
177 $Settings['sql_collate'] = "ascii_generel_ci"; } }
178 if($Settings['sql_charset']=="latin1") {
179 if($Settings['sql_collate']!="latin1_bin"&&
180 $Settings['sql_collate']!="latin1_general_ci"&&
181 $Settings['sql_collate']!="latin1_general_cs") {
182 $Settings['sql_collate'] = "latin1_general_ci"; } }
183 if($Settings['sql_charset']=="utf8") {
184 if($Settings['sql_collate']!="utf8_bin"&&
185 $Settings['sql_collate']!="utf8_general_ci"&&
186 $Settings['sql_collate']!="utf8_unicode_ci") {
187 $Settings['sql_collate'] = "utf8_unicode_ci"; } }
188 $SQLCollate = $Settings['sql_collate'];
189 $SQLCharset = $Settings['sql_charset']; }
190 if(!isset($Settings['sql_collate'])||!isset($Settings['sql_charset'])) {
191 $SQLCollate = "latin1_general_ci";
192 $SQLCharset = "latin1";
193 if($Settings['charset']=="ISO-8859-1") {
194 $SQLCollate = "latin1_general_ci";
195 $SQLCharset = "latin1"; }
196 if($Settings['charset']=="ISO-8859-15") {
197 $SQLCollate = "latin1_general_ci";
198 $SQLCharset = "latin1"; }
199 if($Settings['charset']=="UTF-8") {
200 $SQLCollate = "utf8_unicode_ci";
201 $SQLCharset = "utf8"; }
202 $Settings['sql_collate'] = $SQLCollate;
203 $Settings['sql_charset'] = $SQLCharset; }
204 sql_set_charset($SQLCharset,$SQLStat);
205 if($SQLStat===false) { $Error="Yes";
206 echo "<br />".sql_errorno($SQLStat)."\n"; }
207 if ($Error!="Yes") {
208 $ServerUUID = rand_uuid("rand");
209 if(!is_numeric($_POST['YourOffSet'])) { $_POST['YourOffSet'] = "0"; }
210 if(!is_numeric($_POST['MinOffSet'])) { $_POST['MinOffSet'] = "00"; }
211 if($_POST['MinOffSet']<0) { $_POST['MinOffSet'] = "00"; }
212 $YourOffSet = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
213 $AdminDST = $_POST['DST'];
214 $MyDay = GMTimeGet("d",$YourOffSet,0,$AdminDST);
215 $MyMonth = GMTimeGet("m",$YourOffSet,0,$AdminDST);
216 $MyYear = GMTimeGet("Y",$YourOffSet,0,$AdminDST);
217 $MyYear10 = $MyYear+10;
218 $YourDateEnd = $YourDate;
219 $EventMonth = GMTimeChange("m",$YourDate,0,0,"off");
220 $EventMonthEnd = GMTimeChange("m",$YourDateEnd,0,0,"off");
221 $EventDay = GMTimeChange("d",$YourDate,0,0,"off");
222 $EventDayEnd = GMTimeChange("d",$YourDateEnd,0,0,"off");
223 $EventYear = GMTimeChange("Y",$YourDate,0,0,"off");
224 $EventYearEnd = GMTimeChange("Y",$YourDateEnd,0,0,"off");
225 $KarmaBoostDay = $EventMonth.$EventDay;
226 $Settings['idb_time_format'] = "g:i A";
227 $NewPassword = b64e_hmac($_POST['AdminPasswords'],$YourDate,$YourSalt,$_POST['usehashtype']);
228 //$Name = stripcslashes(htmlspecialchars($AdminUser, ENT_QUOTES, $Settings['charset']));
229 //$YourWebsite = "http://".$_SERVER['HTTP_HOST'].$this_dir."index.php?act=view";
230 $_POST['WebURL'] = htmlentities($_POST['WebURL'], ENT_QUOTES, $Settings['charset']);
231 $_POST['WebURL'] = remove_spaces($_POST['WebURL']);
232 $YourWebsite = $_POST['WebURL'];
233 $UserIP = $_SERVER['REMOTE_ADDR'];
234 $PostCount = 2;
235 $Email = "admin@".$_SERVER['HTTP_HOST'];
236 $AdminTime = $_POST['YourOffSet'].":".$_POST['MinOffSet'];
237 $GEmail = "guest@".$_SERVER['HTTP_HOST'];
238 $grand = rand(6,16); $i = 0; $gpass = "";
239 while ($i < $grand) {
240 $csrand = rand(1,3);
241 if($csrand!=1&&$csrand!=2&&$csrand!=3) { $csrand=1; }
242 if($csrand==1) { $gpass .= chr(rand(48,57)); }
243 if($csrand==2) { $gpass .= chr(rand(65,90)); }
244 if($csrand==3) { $gpass .= chr(rand(97,122)); }
245 ++$i; } $GuestPassword = b64e_hmac($gpass,$YourDate,$GSalt,$_POST['usehashtype']);
246 $url_this_dir = "http://".$_SERVER['HTTP_HOST'].$this_dir."index.php?act=view";
247 $YourIP = $_SERVER['REMOTE_ADDR'];
248 if($Settings['sqltype']=="mysql"||
249 $Settings['sqltype']=="mysqli") {
250 require($SetupDir['sql'].'mysql.php'); }
251 if($Settings['sqltype']=="pgsql") {
252 require($SetupDir['sql'].'pgsql.php'); }
253 if($Settings['sqltype']=="sqlite") {
254 require($SetupDir['sql'].'sqlite.php'); }
255 if($Settings['sqltype']=="cubrid") {
256 require($SetupDir['sql'].'cubrid.php'); }
257 if($_POST['SQLThemes']=="on") {
258 $OldThemeSet = $ThemeSet;
259 $Settings['board_name'] = $_POST['NewBoardName'];
260 $skindir = dirname(realpath("sql.php"))."/".$SettDir['themes'];
261 if ($handle = opendir($skindir)) { $dirnum = null;
262 while (false !== ($file = readdir($handle))) {
263 if ($dirnum==null) { $dirnum = 0; }
264 if (file_exists($skindir.$file."/info.php")) {
265 if ($file != "." && $file != "..") {
266 include($skindir.$file."/info.php");
267 $themelist[$dirnum] = $file;
268 ++$dirnum; } } }
269 closedir($handle); asort($themelist);
270 $themenum=count($themelist); $themei=0;
271 while ($themei < $themenum) {
272 include($skindir.$themelist[$themei]."/settings.php");
273 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."themes\" (\"Name\", \"ThemeName\", \"ThemeMaker\", \"ThemeVersion\", \"ThemeVersionType\", \"ThemeSubVersion\", \"MakerURL\", \"CopyRight\", \"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\", \"StatsIcon\", \"NoAvatar\", \"NoAvatarSize\") VALUES\n".
274 "('%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['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['StatsIcon'], $ThemeSet['NoAvatar'], $ThemeSet['NoAvatarSize']));
275 sql_query($query,$SQLStat);
276 ++$themei; } }
277 sql_disconnect_db($SQLStat);
278 $ThemeSet = $OldThemeSet; }
279 $CHMOD = $_SERVER['PHP_SELF'];
280 $iDBRDate = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
281 $iDBRSVN = $VER2[2]." ".$SubVerN;
282 $LastUpdateS = "Last Update: ".$iDBRDate." ".$iDBRSVN;
283 $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 - http://idb.berlios.de/\n Copyright 2004-".$SVNDay[2]." Game Maker 2k - http://gamemaker2k.org/\n iDB Installer made by Game Maker 2k - http://idb.berlios.net/\n\n \$FileInfo: settings.php & settingsbak.php - ".$LastUpdateS." - Author: cooldude2k \$\n*/\n";
284 $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 */");
285 $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";
286 $BoardSettings=$pretext2[0]."\n".
287 "\$Settings['sqlhost'] = '".$_POST['DatabaseHost']."';\n".
288 "\$Settings['sqldb'] = '".$_POST['DatabaseName']."';\n".
289 "\$Settings['sqltable'] = '".$_POST['tableprefix']."';\n".
290 "\$Settings['sqluser'] = '".$_POST['DatabaseUserName']."';\n".
291 "\$Settings['sqlpass'] = '".$_POST['DatabasePassword']."';\n".
292 "\$Settings['sqltype'] = '".$_POST['DatabaseType']."';\n".
293 "\$Settings['board_name'] = '".$_POST['NewBoardName']."';\n".
294 "\$Settings['idbdir'] = '".$idbdir."';\n".
295 "\$Settings['idburl'] = '".$_POST['BoardURL']."';\n".
296 "\$Settings['enable_https'] = '".$Settings['enable_https']."';\n".
297 "\$Settings['weburl'] = '".$_POST['WebURL']."';\n".
298 "\$Settings['SQLThemes'] = '".$_POST['SQLThemes']."';\n".
299 "\$Settings['use_gzip'] = '".$_POST['GZip']."';\n".
300 "\$Settings['html_type'] = '".$_POST['HTMLType']."';\n".
301 "\$Settings['html_level'] = '".$_POST['HTMLLevel']."';\n".
302 "\$Settings['output_type'] = '".$_POST['OutPutType']."';\n".
303 "\$Settings['GuestGroup'] = 'Guest';\n".
304 "\$Settings['MemberGroup'] = 'Member';\n".
305 "\$Settings['ValidateGroup'] = 'Validate';\n".
306 "\$Settings['AdminValidate'] = 'off';\n".
307 "\$Settings['TestReferer'] = '".$_POST['TestReferer']."';\n".
308 "\$Settings['DefaultTheme'] = '".$_POST['DefaultTheme']."';\n".
309 "\$Settings['DefaultTimeZone'] = '".$AdminTime."';\n".
310 "\$Settings['DefaultDST'] = '".$AdminDST."';\n".
311 "\$Settings['start_date'] = ".$YourDate.";\n".
312 "\$Settings['idb_time_format'] = '".$Settings['idb_time_format']."';\n".
313 "\$Settings['use_hashtype'] = '".$_POST['usehashtype']."';\n".
314 "\$Settings['charset'] = '".$Settings['charset']."';\n".
315 "\$Settings['sql_collate'] = '".$Settings['sql_collate']."';\n".
316 "\$Settings['sql_charset'] = '".$Settings['sql_charset']."';\n".
317 "\$Settings['add_power_by'] = 'off';\n".
318 "\$Settings['send_pagesize'] = 'off';\n".
319 "\$Settings['max_posts'] = '10';\n".
320 "\$Settings['max_topics'] = '10';\n".
321 "\$Settings['max_memlist'] = '10';\n".
322 "\$Settings['max_pmlist'] = '10';\n".
323 "\$Settings['hot_topic_num'] = '15';\n".
324 "\$Settings['qstr'] = '&';\n".
325 "\$Settings['qsep'] = '=';\n".
326 "\$Settings['file_ext'] = '.php';\n".
327 "\$Settings['rss_ext'] = '.php';\n".
328 "\$Settings['js_ext'] = '.js';\n".
329 "\$Settings['showverinfo'] = 'on';\n".
330 "\$Settings['vercheck'] = 1;\n".
331 "\$Settings['enable_rss'] = 'on';\n".
332 "\$Settings['enable_search'] = 'on';\n".
333 "\$Settings['sessionid_in_urls'] = 'off';\n".
334 "\$Settings['fixpathinfo'] = 'off';\n".
335 "\$Settings['fixbasedir'] = 'off';\n".
336 "\$Settings['fixcookiedir'] = 'off';\n".
337 "\$Settings['fixredirectdir'] = 'off';\n".
338 "\$Settings['enable_pathinfo'] = 'off';\n".
339 "\$Settings['rssurl'] = 'off';\n".
340 "\$Settings['board_offline'] = 'off';\n".
341 "\$Settings['VerCheckURL'] = '';\n".
342 "\$Settings['IPCheckURL'] = '';\n".
343 "\$Settings['log_http_request'] = 'off';\n".
344 "\$Settings['log_config_format'] = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"';\n".
345 "\$Settings['BoardUUID'] = '".$ServerUUID."';\n".
346 "\$Settings['KarmaBoostDays'] = '".$KarmaBoostDay."';\n".
347 "\$Settings['KBoostPercent'] = '6|10';\n".$pretext2[1]."\n".
348 "\$SettInfo['board_name'] = '".$_POST['NewBoardName']."';\n".
349 "\$SettInfo['Author'] = '".$_POST['AdminUser']."';\n".
350 "\$SettInfo['Keywords'] = '".$_POST['NewBoardName'].",".$_POST['AdminUser']."';\n".
351 "\$SettInfo['Description'] = '".$_POST['NewBoardName'].",".$_POST['AdminUser']."';\n".$pretext2[2]."\n".
352 "\$SettDir['maindir'] = '".$idbdir."';\n".
353 "\$SettDir['inc'] = 'inc/';\n".
354 "\$SettDir['logs'] = 'logs/';\n".
355 "\$SettDir['archive'] = 'archive/';\n".
356 "\$SettDir['misc'] = 'inc/misc/';\n".
357 "\$SettDir['sql'] = 'inc/misc/sql/';\n".
358 "\$SettDir['admin'] = 'inc/admin/';\n".
359 "\$SettDir['sqldumper'] = 'inc/admin/sqldumper/';\n".
360 "\$SettDir['mod'] = 'inc/mod/';\n".
361 "\$SettDir['themes'] = 'themes/';\n".$pretext2[3]."\n?>";
362 $BoardSettingsBak = $pretext.$settcheck.$BoardSettings;
363 $BoardSettings = $pretext.$settcheck.$BoardSettings;
364 $fp = fopen("settings.php","w+");
365 fwrite($fp, $BoardSettings);
366 fclose($fp);
367 // cp("settings.php","settingsbak.php");
368 $fp = fopen("settingsbak.php","w+");
369 fwrite($fp, $BoardSettingsBak);
370 fclose($fp);
371 if($_POST['storecookie']=="true") {
372 if($URLsTest['host']!="localhost") {
373 setcookie("MemberName", $_POST['AdminUser'], time() + (7 * 86400), $this_dir, $URLsTest['host']);
374 setcookie("UserID", 1, time() + (7 * 86400), $this_dir, $URLsTest['host']);
375 setcookie("SessPass", $NewPassword, time() + (7 * 86400), $this_dir, $URLsTest['host']); }
376 if($URLsTest['host']=="localhost") {
377 setcookie("MemberName", $_POST['AdminUser'], time() + (7 * 86400), $this_dir, false);
378 setcookie("UserID", 1, time() + (7 * 86400), $this_dir, false);
379 setcookie("SessPass", $NewPassword, time() + (7 * 86400), $this_dir, false); } }
380 $chdel = true;
381 if($Error!="Yes") {
382 if($_POST['unlink']=="true") {
383 $chdel1 = @unlink($SetupDir['setup'].'presetup.php'); $chdel2 = @unlink($SetupDir['setup'].'setup.php');
384 $chdel3 = @unlink($SetupDir['setup'].'mkconfig.php'); $chdel4 = @unlink($SetupDir['sql'].'mysql.php');
385 $chdel5 = @unlink($SetupDir['setup'].'index.php'); $chdel6 = @unlink($SetupDir['setup'].'license.php');
386 $chdel7 = @unlink($SetupDir['setup'].'preinstall.php'); $chdel8 = @unlink($SetupDir['convert'].'index.php');
387 if($ConvertInfo['ConvertFile']!=null) { $chdel0 = @unlink($ConvertInfo['ConvertFile']); }
388 $chdel9 = @unlink($SetupDir['convert'].'info.php');
389 $chdel14 = @unlink($SetupDir['sql'].'pgsql.php'); $chdel15 = @unlink($SetupDir['sql'].'sqlite.php');
390 $chdel19 = @unlink($SetupDir['sql'].'index.php'); $chdel20 = @unlink($SetupDir['sql'].'cubrid.php');
391 $chdel10 = @rmdir($SetupDir['convert']); $chdel16 = @rmdir($SetupDir['sql']); $chdel11 = @rmdir('setup');
392 $chdel12 = @unlink('install.php'); } }
393 if($chdel1===false||$chdel2===false||$chdel3===false||$chdel4===false) { $chdel = false; }
394 if($chdel5===false||$chdel6===false||$chdel7===false||$chdel8===false) { $chdel = false; }
395 if($chdel9===false||$chdel10===false||$chdel11===false||$chdel12===false) { $chdel = false; }
396 if($chdel4===false||$chdel15===false||$chdel16===false||$chdel19===false) { $chdel = false; }
397 if($ConvertInfo['ConvertFile']!=null) { if($chdel0===false) { $chdel = false; } }
398 ?><span class="TableMessage">
399 <br />Install Finish <a href="index.php?act=view">Click here</a> to goto board. ^_^</span>
400 <?php if($chdel===false) { ?><span class="TableMessage">
401 <br />Error: Cound not delete installer. Read readme.txt for more info.</span>
402 <?php } ?><br /><br />
403 </td>
404 </tr>
405 <?php } ?>