OSDN Git Service

459f4e01d21c7f74ffea59538104c24244d7414a
[idb/iDB.git.git] / setup / setup.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2004-2009 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
13     iDB Installer made by Game Maker 2k - http://idb.berlios.net/
14
15     $FileInfo: setup.php - Last Update: 7/17/2009 SVN 273 - Author: cooldude2k $
16 */
17 $File3Name = basename($_SERVER['SCRIPT_NAME']);
18 if ($File3Name=="setup.php"||$File3Name=="/setup.php") {
19         require('index.php');
20         exit(); }
21 if(!isset($SetupDir['setup'])) { $SetupDir['setup'] = "setup/"; }
22 if(!isset($SetupDir['convert'])) { $SetupDir['convert'] = "setup/convert/"; }
23 ?>
24 <tr class="TableRow3">
25 <td class="TableColumn3">
26 <?php
27 $checkfile="settings.php";
28 if (!is_writable($checkfile)) {
29    echo "<br />Settings is not writable.";
30    @chmod("settings.php",0755); $Error="Yes";
31    @chmod("settingsbak.php",0755);
32 } else { /* settings.php is writable install iDB. ^_^ */ }
33 $StatSQL = @mysql_connect($_POST['DatabaseHost'],$_POST['DatabaseUserName'],$_POST['DatabasePassword']);
34 if(!$StatSQL) { $Error="Yes";
35 echo "<span class=\"TableMessage\">";
36 echo "<br />".mysql_errno().": ".mysql_error()."\n</span>\n"; }
37 if ($Error!="Yes") {
38 $pretext = "<?php\n/*\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the Revised BSD License.\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-2007 Cool Dude 2k - http://intdb.sourceforge.net/\n    Copyright 2004-2007 Game Maker 2k - http://idb.berlios.de/support/category.php?act=view&id=2\n    Emoticons made by Jcink http://tfbb.jcink.com/\n*/\n";
39 $BoardSettings=$pretext."\$Settings = array();\n\$Settings['sqlhost'] = '".$_POST['DatabaseHost']."';\n\$Settings['sqluser'] = '".$_POST['DatabaseUserName']."';\n\$Settings['sqlpass'] = '".$_POST['DatabasePassword']."';\n?>";
40 $fp = fopen("./settings.php","w+");
41 fwrite($fp, $BoardSettings);
42 fclose($fp);
43 //      @cp("settings.php","settingsbak.php");
44 $fp = fopen("./settingsbak.php","w+");
45 fwrite($fp, $BoardSettings);
46 fclose($fp);
47 ?>
48 <form style="display: inline;" method="post" id="install" action="install.php?act=Part4">
49 <table style="text-align: left;">
50 <tr style="text-align: left;">
51         <td style="width: 50%;"><label class="TextBoxLabel" for="NewBoardName">Insert Board Name:</label></td>
52         <td style="width: 50%;"><input type="text" name="NewBoardName" class="TextBox" id="NewBoardName" size="20" /></td>
53 </tr><tr>
54         <td style="width: 50%;"><label class="TextBoxLabel" for="DatabaseName">Insert Database Name:</label></td>
55         <td style="width: 50%;"><input type="text" name="DatabaseName" class="TextBox" id="DatabaseName" size="20" />
56         <?php /*<select id="dblist" name="dblist" class="TextBox" onchange="document.install.DatabaseName.value=this.value">
57         <option value=" ">none on list</option>
58         <?php $dblist = sql_list_dbs();
59         $num = count($dblist); $i = 0;
60         while ($i < $num) {
61                 echo "<option value=\"".$dblist[$i]."\">";
62                 echo $dblist[$i]."</option>\n";
63                 ++$i;
64         } ?></select><?php */ ?></td>
65 </tr><tr>
66         <td style="width: 50%;"><label class="TextBoxLabel" for="tableprefix">Insert Table Prefix:<br /></label></td>
67         <td style="width: 50%;"><input type="text" name="tableprefix" class="TextBox" id="tableprefix" value="idb_" size="20" /></td>
68 </tr><tr>
69         <td style="width: 50%;"><label class="TextBoxLabel" for="AdminUser">Insert Admin User Name:</label></td>
70         <td style="width: 50%;"><input type="text" name="AdminUser" class="TextBox" id="AdminUser" size="20" /></td>
71 </tr><tr>
72         <td style="width: 50%;"><label class="TextBoxLabel" for="AdminPassword">Insert Admin Password:</label></td>
73         <td style="width: 50%;"><input type="password" name="AdminPasswords" class="TextBox" id="AdminPassword" size="20" maxlength="30" /></td>
74 </tr><tr>
75         <td style="width: 50%;"><label class="TextBoxLabel" for="ReaPassword">ReInsert Admin Password:</label></td>
76         <td style="width: 50%;"><input type="password" class="TextBox" name="ReaPassword" size="20" id="ReaPassword" maxlength="30" /></td>
77 </tr><tr>
78         <td style="width: 50%;"><label class="TextBoxLabel" for="BoardURL">Insert The Board URL:</label></td>
79         <td style="width: 50%;"><input type="text" class="TextBox" name="BoardURL" size="20" id="BoardURL" value="<?php echo $prehost.$_SERVER['HTTP_HOST'].$this_dir; ?>" /></td>
80 </tr><tr>
81         <td style="width: 50%;"><label class="TextBoxLabel" for="WebURL">Insert The WebSite URL:</label></td>
82         <td style="width: 50%;"><input type="text" class="TextBox" name="WebURL" size="20" id="WebURL" value="<?php echo $prehost.$_SERVER['HTTP_HOST']."/"; ?>" /></td>
83 </tr><tr>
84         <td style="width: 50%;"><label class="TextBoxLabel" title="Can save some bandwidth." for="UseGzip">Do you want to HTTP Content Compression:</label></td>
85         <td style="width: 50%;"><select size="1" class="TextBox" name="GZip" id="UseGzip">
86         <option value="off">No</option>
87         <option value="on">Yes</option>
88         <option value="gzip">Only GZip</option>
89         <option value="deflate">Only Deflate</option>
90         </select></td>
91 </tr><tr>
92         <td style="width: 50%;"><label class="TextBoxLabel" for="HTMLType">HTML Type to use:</label></td>
93         <td style="width: 50%;"><select size="1" class="TextBox" name="HTMLType" id="HTMLType">
94         <option value="xhtml10">XHTML 1.0</option>
95         <option value="xhtml11">XHTML 1.1</option>
96         </select></td>
97 </tr><tr>
98         <td style="width: 50%;"><label class="TextBoxLabel" for="HTMLLevel">HTML level only for XHTML 1.0:</label></td>
99         <td style="width: 50%;"><select size="1" class="TextBox" name="HTMLLevel" id="HTMLLevel">
100         <option value="Transitional">Transitional</option>
101         <option value="Strict">Strict</option>
102         </select></td>
103 </tr><tr>
104         <td style="width: 50%;"><label class="TextBoxLabel" for="OutPutType">Output file as:</label></td>
105         <td style="width: 50%;"><select size="1" class="TextBox" name="OutPutType" id="OutPutType">
106         <option value="html">HTML</option>
107         <option value="xhtml">XHTML</option>
108         </select></td>
109 </tr><tr>
110         <td style="width: 50%;"><label class="TextBoxLabel" title="Store userinfo as a cookie so you dont need to login again." for="storecookie">Store as cookie?</label></td>
111         <td style="width: 50%;"><select id="storecookie" name="storecookie" class="TextBox">
112 <option value="true">Yes</option>
113 <option value="false">No</option>
114 </select></td>
115 </tr><tr>
116         <td style="width: 50%;"><label class="TextBoxLabel" for="YourOffSet">Your TimeZone:</label></td>
117         <td style="width: 50%;"><select id="YourOffSet" name="YourOffSet" class="TextBox"><?php
118 if(date("I")!=1) { $myofftime = SeverOffSet(); $mydstime = "off"; }
119 if(date("I")==1) { $myofftime = SeverOffSet()-1; $mydstime = "on"; }
120 $plusi = 1; $minusi = 12;
121 $plusnum = 15; $minusnum = 0;
122 while ($minusi > $minusnum) {
123 if($myofftime==-$minusi) {
124 echo "<option selected=\"selected\" value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n"; }
125 if($myofftime!=-$minusi) {
126 echo "<option value=\"-".$minusi."\">GMT - ".$minusi.":00 hours</option>\n"; }
127 --$minusi; }
128 if($myofftime==0) { ?>
129 <option selected="selected" value="0">GMT +/- 0:00 hours</option>
130 <?php } if($myofftime!=0) { ?>
131 <option value="0">GMT +/- 0:00 hours</option>
132 <?php }
133 while ($plusi < $plusnum) {
134 if($myofftime==$plusi) {
135 echo "<option selected=\"selected\" value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n"; }
136 if($myofftime!=$plusi) {
137 echo "<option value=\"".$plusi."\">GMT + ".$plusi.":00 hours</option>\n"; }
138 ++$plusi; }
139 ?></select></td>
140 </tr><tr>
141         <td style="width: 50%;"><label class="TextBoxLabel" for="MinOffSet">Minute OffSet:</label></td>
142         <td style="width: 50%;"><select id="MinOffSet" name="MinOffSet" class="TextBox"><?php
143 $mini = 0; $minnum = 60;
144 while ($mini < $minnum) {
145 if(strlen($mini)==2) { $showmin = $mini; }
146 if(strlen($mini)==1) { $showmin = "0".$mini; }
147 if($mini==0) {
148 echo "\n<option selected=\"selected\" value=\"".$showmin."\">0:".$showmin." minutes</option>\n"; }
149 if($mini!=0) {
150 echo "<option value=\"".$showmin."\">0:".$showmin." minutes</option>\n"; }
151 ++$mini; }
152 ?></select></td>
153 </tr><tr>
154         <td style="width: 50%;"><label class="TextBoxLabel" for="DST">Is <span title="Daylight Savings Time">DST</span> / <span title="Summer Time">ST</span> on or off:</label></td>
155         <td style="width: 50%;"><select id="DST" name="DST" class="TextBox"><?php echo "\n" ?>
156 <?php if($mydstime=="off"||$mydstime!="on") { ?>
157 <option selected="selected" value="off">off</option><?php echo "\n" ?><option value="on">on</option>
158 <?php } if($mydstime=="on") { ?>
159 <option selected="selected" value="on">on</option><?php echo "\n" ?><option value="off">off</option>
160 <?php } echo "\n" ?></select></td>
161 </tr><tr>
162         <td style="width: 50%;"><label class="TextBoxLabel" for="TestReferer">Test Referering URL with host name:</label></td>
163         <td style="width: 50%;"><select id="TestReferer" name="TestReferer" class="TextBox">
164 <option selected="selected" value="off">off</option>
165 <option value="on">on</option>
166 </select></td>
167 </tr><tr>
168         <td style="width: 50%;"><label class="TextBoxLabel" title="Might not work" for="unlink">Delete Installer When Done? (Might not work)</label></td>
169         <td style="width: 50%;"><select id="unlink" name="unlink" class="TextBox">
170 <option value="true">Yes</option>
171 <option value="false">No</option>
172 </select></td>
173 </tr></table>
174 <table style="text-align: left;">
175 <tr style="text-align: left;">
176 <td style="width: 100%;">
177 <input type="hidden" name="charset" value="<?php echo $_POST['charset']; ?>" style="display: none;" />
178 <input type="hidden" name="SetupType" value="install" style="display: none;" />
179 <input type="hidden" name="act" value="Part4" style="display: none;" />
180 <input type="submit" class="Button" value="Install Board" name="Install_Board" />
181 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
182 </td></tr></table>
183 </form>
184 </td>
185 </tr>
186 <?php } ?>