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