OSDN Git Service

Small bug fix and moved sql drivers to sql dir.
[idb/iDB.git.git] / install.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.de/support/category.php?act=view&id=2
14
15     $FileInfo: install.php - Last Update: 12/07/2009 SVN 380 - Author: cooldude2k $
16 *//*
17 if(ini_get("register_globals")) {
18 require_once('inc/misc/killglobals.php'); }
19 */
20 //ini_set("display_errors", true); 
21 //ini_set("display_startup_errors", true);
22 error_reporting(E_ALL ^ E_NOTICE);
23 /* Get rid of session id in urls */
24 //ini_set("session.use_trans_sid", false);
25 //ini_set("session.use_cookies", true);
26 //ini_set("session.use_only_cookies", true);
27 //ini_set("url_rewriter.tags","");
28 set_time_limit(30); ignore_user_abort(true);
29 /* Change session garbage collection settings */
30 //ini_set("session.gc_probability", 1);
31 //ini_set("session.gc_divisor", 100);
32 //ini_set("session.gc_maxlifetime", 1440);
33 ob_start();
34 if(ini_get("register_globals")) { 
35         if(!isset($SettDir['misc'])) { $SettDir['misc'] = "inc/misc/"; }
36         require_once($SettDir['misc'].'killglobals.php'); }
37 if(!isset($preact['idb'])) { $preact['idb'] = null; }
38 if(!isset($_GET['act'])) { $_GET['act'] = null; }
39 if(!isset($_POST['act'])) { $_POST['act'] = null; }
40 if ($_GET['act']==null||$_GET['act']=="view") { $_GET['act']="Part1"; }
41 if ($_POST['act']==null||$_POST['act']=="view") { $_POST['act']="Part1"; }
42 $_TEG = array(null); $_TEG['part'] = preg_replace("/Part(1|2|3|4)/","\\1",$_GET['act']);
43 $_GET['act'] = strtolower($_GET['act']); if(isset($_TEG['part'])) {
44 if($_TEG['part']<=4&&$_TEG['part']>=1) { $_GET['act'] = "Part".$_TEG['part']; } }
45 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
46         $preact['idb'] = "installing";  }
47 $SetupDir['setup'] = "setup/"; $ConvertDir['setup'] = $SetupDir['setup']; $SetupDir['sql'] = "setup/sql/"; 
48 $SetupDir['convert'] = "setup/convert/"; $ConvertDir['convert'] = $SetupDir['convert']; $ConvertDir['sql'] = $SetupDir['sql'];
49 $Settings['output_type'] = "html"; $Settings['html_type'] = "xhtml10";
50 $Settings['board_name'] = "Installing iDB"; 
51 if(!isset($Settings['charset'])) {
52         $Settings['charset'] = "ISO-8859-15"; }
53 if(isset($Settings['charset'])) {
54 if($Settings['charset']!="ISO-8859-15"&&$Settings['charset']!="ISO-8859-1"&&
55         $Settings['charset']!="UTF-8"&&$Settings['charset']!="CP866"&&
56         $Settings['charset']!="Windows-1251"&&$Settings['charset']!="Windows-1252"&&
57         $Settings['charset']!="KOI8-R"&&$Settings['charset']!="BIG5"&&
58         $Settings['charset']!="GB2312"&&$Settings['charset']!="BIG5-HKSCS"&&
59         $Settings['charset']!="Shift_JIS"&&$Settings['charset']!="EUC-JP") {
60         $Settings['charset'] = "ISO-8859-15"; } }
61 $SQLCharset = "latin1";
62 if(isset($_POST['charset'])) { 
63 if($_POST['charset']=="ISO-8859-1") {
64         $SQLCharset = "latin1"; }
65 if($_POST['charset']=="ISO-8859-15") {
66         $SQLCharset = "latin1"; }
67 if($_POST['charset']=="UTF-8") {
68         $SQLCharset = "utf8"; }
69         $Settings['charset'] = $_POST['charset']; }
70 if(!isset($_SERVER['HTTPS'])) { $_SERVER['HTTPS']=="off"; }
71 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
72 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
73 $this_dir = null;
74 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
75         dirname($_SERVER['SCRIPT_NAME'])!=null) {
76 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
77 if($this_dir==null||$this_dir==".") {
78 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
79         dirname($_SERVER['SCRIPT_NAME'])==null) {
80 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
81 if($this_dir=="\/") { $this_dir="/"; }
82 $this_dir = str_replace("//", "/", $this_dir);
83 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
84 if(!isset($_POST['BoardURL'])) { 
85    $Settings['idburl'] = $prehost.$_SERVER["HTTP_HOST"].$this_dir; }
86 if(isset($_POST['BoardURL'])) { 
87    $Settings['idburl'] = $_POST['BoardURL']; }
88 $Settings['qstr'] = "&";
89 $Settings['qsep'] = "=";
90 require($SetupDir['setup'].'preinstall.php');
91 require_once($SettDir['misc'].'utf8.php');
92 require_once($SettDir['inc'].'filename.php');
93 require_once($SettDir['inc'].'function.php');
94 require($SetupDir['convert'].'info.php');
95 require($SettDir['inc'].'xhtml10.php');
96 $Error = null; $_GET['time'] = false;
97 ?>
98
99 <title> <?php echo "Installing ".$VerInfo['iDB_Ver_Show']." on ".$OSType2; ?> </title>
100 </head>
101 <body>
102 <?php require($SettDir['inc'].'navbar.php'); ?>
103 <div class="Table1Border">
104 <?php if($ThemeSet['TableStyle']=="div") { ?>
105 <div class="TableRow1">
106 <span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="Install.php">Install <?php echo $VerInfo['iDB_Ver_Show']." on ".$OSType2; ?> </a></span>
107 </div>
108 <?php } ?>
109 <table class="Table1">
110 <?php if($ThemeSet['TableStyle']=="table") { ?>
111 <tr class="TableRow1">
112 <td class="TableColumn1" colspan="2"><span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="Install.php">Install <?php echo $VerInfo['iDB_Ver_Show']." on ".$OSType2; ?> </a></span>
113 </td>
114 </tr><?php } ?>
115 <tr class="TableRow2">
116 <th class="TableColumn2" style="width: 100%; text-align: left;">
117 <span style="float: left;">&nbsp;Inert your install info: </span>
118 <span style="float: right;">&nbsp;</span>
119 </th>
120 </tr>
121 <?php
122 if($_SERVER['HTTPS']=="on") { $prehost = "https://"; }
123 if($_SERVER['HTTPS']!="on") { $prehost = "http://"; }
124 $this_dir = null;
125 if(dirname($_SERVER['SCRIPT_NAME'])!="."||
126         dirname($_SERVER['SCRIPT_NAME'])!=null) {
127 $this_dir = dirname($_SERVER['SCRIPT_NAME'])."/"; }
128 if($this_dir==null||$this_dir==".") {
129 if(dirname($_SERVER['SCRIPT_NAME'])=="."||
130         dirname($_SERVER['SCRIPT_NAME'])==null) {
131 $this_dir = dirname($_SERVER['PHP_SELF'])."/"; } }
132 if($this_dir=="\/") { $this_dir="/"; }
133 $this_dir = str_replace("//", "/", $this_dir);
134 $idbdir = addslashes(str_replace("\\","/",dirname(__FILE__)."/"));
135 function sql_list_dbs() {
136    $result = sql_query("SHOW DATABASES;",$SQLStat);
137    while( $data = sql_fetch_row($result) ) {
138        $array[] = $data[0];
139    } return $array; }
140 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
141 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
142 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
143    require($SetupDir['setup'].'license.php'); } } }
144 if ($_GET['act']=="Part2"&&$_POST['act']=="Part2") {
145 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
146 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
147    require($SetupDir['setup'].'presetup.php'); } } }
148 if($_POST['SetupType']=="convert") {
149         require($ConvertInfo['ConvertFile']); }
150 if($_POST['SetupType']=="install") {
151 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
152 if ($_GET['act']=="Part3"&&$_POST['act']=="Part3") {
153 if ($_GET['act']!="Part4"&&$_POST['act']!="Part4") {
154    require($SetupDir['setup'].'setup.php'); } } } }
155 if($_POST['SetupType']=="install") {
156 if ($_GET['act']!="Part2"&&$_POST['act']!="Part2") {
157 if ($_GET['act']!="Part3"&&$_POST['act']!="Part3") {
158 if ($_GET['act']=="Part4"&&$_POST['act']=="Part4") {
159    require($SetupDir['setup'].'mkconfig.php'); } } } }
160 if ($Error=="Yes") { ?>
161 <br />Install Failed with errors. <a href="install.php?act=view">Click here</a> to restart install. &lt;_&lt;
162 <br /><br />
163 </td>
164 </tr>
165 <?php } ?>
166 <tr class="TableRow4">
167 <td class="TableColumn4">&nbsp;<a href="index.php?act=ReadMe">Readme.txt</a>&nbsp;</td>
168 </tr>
169 </table></div>
170 <div>&nbsp;</div>
171 <?php require($SettDir['inc'].'endpage.php'); ?>
172 </body>
173 </html>
174 <?php fix_amp(null); ?>