OSDN Git Service

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