OSDN Git Service

Yet another small bugfix.
[idb/iDB.git.git] / setup / sql / pgsql.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-2017 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2017 Game Maker 2k - http://gamemaker2k.org/
13     iDB Installer made by Game Maker 2k - http://idb.berlios.net/
14
15     $FileInfo: pgsql.php - Last Update: 01/26/2017 SVN 810 - Author: cooldude2k $
16 */
17 $File3Name = basename($_SERVER['SCRIPT_NAME']);
18 if ($File3Name=="pgsql.php"||$File3Name=="/pgsql.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 $query=sql_pre_query("ALTER DATABASE \"".$_POST['DatabaseName']."\" DEFAULT CHARACTER SET ".$SQLCharset." COLLATE ".$SQLCollate.";", array(null));
25 sql_query($query,$SQLStat);
26 */
27 $parsestr = parse_url($YourWebsite);
28 if (!filter_var($parsestr['host'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) || $parsestr['host'] == "localhost") {
29         $GuestLocalIP = gethostbyname($parsestr['host']); } else { $GuestLocalIP = $parsestr['host']; }
30 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."categories\" (\n".
31 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
32 "  \"OrderID\" numeric(15) NOT NULL default '0',\n".
33 "  \"Name\" varchar(150) NOT NULL default '',\n".
34 "  \"ShowCategory\" varchar(5) NOT NULL default '',\n".
35 "  \"CategoryType\" varchar(15) NOT NULL default '',\n".
36 "  \"SubShowForums\" varchar(5) NOT NULL default '',\n".
37 "  \"InSubCategory\" numeric(15) NOT NULL default '0',\n".
38 "  \"PostCountView\" numeric(15) NOT NULL default '0',\n".
39 "  \"KarmaCountView\" numeric(15) NOT NULL default '0',\n".
40 "  \"Description\" text NOT NULL\n".
41 ");", array(null));
42 sql_query($query,$SQLStat);
43 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."categories\" (\"OrderID\", \"Name\", \"ShowCategory\", \"CategoryType\", \"SubShowForums\", \"InSubCategory\", \"PostCountView\", \"KarmaCountView\", \"Description\")\n". 
44 "VALUES (1, 'A Test Category', 'yes', 'category', 'yes', 0, 0, 0, 'A test category that may be removed at any time.');", array(null));
45 sql_query($query,$SQLStat);
46 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."catpermissions\" (\n".
47 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
48 "  \"PermissionID\" numeric(15) NOT NULL default '0',\n".
49 "  \"Name\" varchar(150) NOT NULL default '',\n".
50 "  \"CategoryID\" numeric(15) NOT NULL default '0',\n".
51 "  \"CanViewCategory\" varchar(5) NOT NULL default ''\n".
52 ");", array(null));
53 sql_query($query,$SQLStat);
54 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES\n".
55 "(1, 'Admin', 1, 'yes'),\n".
56 "(2, 'Moderator', 1, 'yes'),\n".
57 "(3, 'Member', 1, 'yes'),\n".
58 "(4, 'Guest', 1, 'yes'),\n".
59 "(5, 'Banned', 1, 'no'),\n".
60 "(6, 'Validate', 1, 'yes');", array(null)); 
61 sql_query($query,$SQLStat);
62 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."events\" (\n".
63 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
64 "  \"UserID\" numeric(15) NOT NULL default '0',\n".
65 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
66 "  \"EventName\" varchar(150) NOT NULL default '',\n".
67 "  \"EventText\" text NOT NULL,\n".
68 "  \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
69 "  \"TimeStampEnd\" numeric(15) NOT NULL default '0',\n".
70 "  \"EventMonth\" numeric(5) NOT NULL default '0',\n".
71 "  \"EventMonthEnd\" numeric(5) NOT NULL default '0',\n".
72 "  \"EventDay\" numeric(5) NOT NULL default '0',\n".
73 "  \"EventDayEnd\" numeric(5) NOT NULL default '0',\n".
74 "  \"EventYear\" numeric(5) NOT NULL default '0',\n".
75 "  \"EventYearEnd\" numeric(5) NOT NULL default '0',\n".
76 "  \"IP\" varchar(64) NOT NULL default ''\n".
77 ");", array(null));
78 sql_query($query,$SQLStat);
79 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."events\" (\"UserID\", \"GuestName\", \"EventName\", \"EventText\", \"TimeStamp\", \"TimeStampEnd\", \"EventMonth\", \"EventMonthEnd\", \"EventDay\", \"EventDayEnd\", \"EventYear\", \"EventYearEnd\", \"IP\") VALUES\n".
80 "(-1, '".$iDB_Author."', 'iDB Install', 'This is the start date of your board. ^_^', %i, %i, %i, %i, %i, %i, %i, %i, '".$GuestLocalIP."');", array($YourDate,$YourDateEnd,$EventMonth,$EventMonthEnd,$EventDay,$EventDayEnd,$EventYear,$EventYearEnd));
81 sql_query($query,$SQLStat);
82 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."forums\" (\n".
83 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
84 "  \"CategoryID\" numeric(15) NOT NULL default '0',\n".
85 "  \"OrderID\" numeric(15) NOT NULL default '0',\n".
86 "  \"Name\" varchar(150) NOT NULL default '',\n".
87 "  \"ShowForum\" varchar(5) NOT NULL default '',\n".
88 "  \"ForumType\" varchar(15) NOT NULL default '',\n".
89 "  \"InSubForum\" numeric(15) NOT NULL default '0',\n".
90 "  \"RedirectURL\" text NOT NULL,\n".
91 "  \"Redirects\" numeric(15) NOT NULL default '0',\n".
92 "  \"NumViews\" numeric(15) NOT NULL default '0',\n".
93 "  \"Description\" text NOT NULL,\n".
94 "  \"PostCountAdd\" varchar(15) NOT NULL default '',\n".
95 "  \"PostCountView\" numeric(15) NOT NULL default '0',\n".
96 "  \"KarmaCountView\" numeric(15) NOT NULL default '0',\n".
97 "  \"CanHaveTopics\" varchar(5) NOT NULL default '',\n".
98 "  \"HotTopicPosts\" numeric(15) NOT NULL default '0',\n".
99 "  \"NumPosts\" numeric(15) NOT NULL default '0',\n".
100 "  \"NumTopics\" numeric(15) NOT NULL default '0'\n".
101 ");", array(null));
102 sql_query($query,$SQLStat);
103 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."forums\" (\"CategoryID\", \"OrderID\", \"Name\", \"ShowForum\", \"ForumType\", \"InSubForum\", \"RedirectURL\", \"Redirects\", \"NumViews\", \"Description\", \"PostCountAdd\", \"PostCountView\", \"KarmaCountView\", \"CanHaveTopics\", \"HotTopicPosts\", \"NumPosts\", \"NumTopics\") VALUES\n".
104 "(1, 1, 'A Test Forum', 'yes', 'forum', 0, 'http://', 0, 0, 'A test forum that may be removed at any time.', 'off', 0, 0, 'yes', 15, 1, 1);", array(null));
105 sql_query($query,$SQLStat);
106 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."groups\" (\n".
107 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
108 "  \"Name\" varchar(150) NOT NULL default '',\n".
109 "  \"PermissionID\" numeric(15) NOT NULL default '0',\n".
110 "  \"NamePrefix\" varchar(150) NOT NULL default '',\n".
111 "  \"NameSuffix\" varchar(150) NOT NULL default '',\n".
112 "  \"CanViewBoard\" varchar(5) NOT NULL default '',\n".
113 "  \"CanViewOffLine\" varchar(5) NOT NULL default '',\n".
114 "  \"CanEditProfile\" varchar(5) NOT NULL default '',\n".
115 "  \"CanAddEvents\" varchar(5) NOT NULL default '',\n".
116 "  \"CanPM\" varchar(5) NOT NULL default '',\n".
117 "  \"CanSearch\" varchar(5) NOT NULL default '',\n".
118 "  \"CanExecPHP\" varchar(5) NOT NULL default '',\n".
119 "  \"CanDoHTML\" varchar(5) NOT NULL default '',\n".
120 "  \"CanUseBBTags\" varchar(5) NOT NULL default '',\n".
121 "  \"CanModForum\" varchar(5) NOT NULL default '',\n".
122 "  \"CanViewIPAddress\" varchar(5) NOT NULL default '',\n".
123 "  \"CanViewUserAgent\" varchar(5) NOT NULL default '',\n".
124 "  \"FloodControl\" numeric(5) NOT NULL default '0',\n".
125 "  \"SearchFlood\" numeric(5) NOT NULL default '0',\n".
126 "  \"PromoteTo\" numeric(15) NOT NULL default '0',\n".
127 "  \"PromotePosts\" numeric(15) NOT NULL default '0',\n".
128 "  \"PromoteKarma\" numeric(15) NOT NULL default '0',\n".
129 "  \"HasModCP\" varchar(5) NOT NULL default '',\n".
130 "  \"HasAdminCP\" varchar(5) NOT NULL default '',\n".
131 "  \"ViewDBInfo\" varchar(5) NOT NULL default '',\n".
132 "  UNIQUE (\"Name\")\n".
133 ");", array(null));
134 sql_query($query,$SQLStat);
135 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."groups\" (\"Name\", \"PermissionID\", \"NamePrefix\", \"NameSuffix\", \"CanViewBoard\", \"CanViewOffLine\", \"CanEditProfile\", \"CanAddEvents\", \"CanPM\", \"CanSearch\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanViewIPAddress\", \"CanViewUserAgent\", \"FloodControl\", \"SearchFlood\", \"PromoteTo\", \"PromotePosts\", \"PromoteKarma\", \"HasModCP\", \"HasAdminCP\", \"ViewDBInfo\") VALUES\n".
136 "('Admin', 1, '', '', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'yes', 30, 30, 0, 0, 0, 'yes', 'yes', 'yes'),\n".
137 "('Moderator', 2, '', '', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'yes', 30, 30, 0, 0, 0, 'yes', 'no', 'no'),\n".
138 "('Member', 3, '', '', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'no', 'no', 'yes', 'no', 'no', 'no', 30, 30, 0, 0, 0, 'no', 'no', 'no'),\n".
139 "('Guest', 4, '', '', 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'yes', 'no', 'no', 'no', 30, 30, 0, 0, 0, 'no', 'no', 'no'),\n".
140 "('Banned', 5, '', '', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 30, 30, 0, 0, 0, 'no', 'no', 'no'),\n".
141 "('Validate', 6, '', '', 'yes', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'no', 30, 30, 0, 0, 0, 'no', 'no', 'no');", array(null)); 
142 sql_query($query,$SQLStat);
143 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."levels\" (\n".
144 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
145 "  \"Name\" varchar(150) NOT NULL default '',\n".
146 "  \"PromoteTo\" numeric(15) NOT NULL default '0',\n".
147 "  \"PromotePosts\" numeric(15) NOT NULL default '0',\n".
148 "  \"PromoteKarma\" numeric(15) NOT NULL default '0',\n".
149 "  UNIQUE (\"Name\")\n".
150 ");", array(null));
151 sql_query($query,$SQLStat);
152 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."levels\" (\"id\", \"Name\", \"PromoteTo\", \"PromotePosts\", \"PromoteKarma\") VALUES\n".
153 "(-1, 'Guest', 0, 0, 0),\n".
154 "(1, 'Member', 0, 0, 0);", array(null));
155 sql_query($query,$SQLStat);
156 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."members\" (\n".
157 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
158 "  \"Name\" varchar(150) NOT NULL default '',\n".
159 "  \"UserPassword\" varchar(256) NOT NULL default '',\n".
160 "  \"HashType\" varchar(50) NOT NULL default '',\n".
161 "  \"Email\" varchar(256) NOT NULL default '',\n".
162 "  \"GroupID\" numeric(15) NOT NULL default '0',\n".
163 "  \"LevelID\" numeric(15) NOT NULL default '0',\n".
164 "  \"Validated\" varchar(20) NOT NULL default '',\n".
165 "  \"HiddenMember\" varchar(20) NOT NULL default '',\n".
166 "  \"WarnLevel\" numeric(15) NOT NULL default '0',\n".
167 "  \"Interests\" text NOT NULL default '',\n".
168 "  \"Title\" varchar(150) NOT NULL default '',\n".
169 "  \"Joined\" numeric(15) NOT NULL default '0',\n".
170 "  \"LastActive\" numeric(15) NOT NULL default '0',\n".
171 "  \"LastPostTime\" numeric(15) NOT NULL default '0',\n".
172 "  \"BanTime\" numeric(15) NOT NULL default '0',\n".
173 "  \"BirthDay\" numeric(5) NOT NULL default '0',\n".
174 "  \"BirthMonth\" numeric(5) NOT NULL default '0',\n".
175 "  \"BirthYear\" numeric(5) NOT NULL default '0',\n".
176 "  \"Signature\" text NOT NULL,\n".
177 "  \"Notes\" text NOT NULL,\n".
178 "  \"Avatar\" varchar(150) NOT NULL default '',\n".
179 "  \"AvatarSize\" varchar(10) NOT NULL default '',\n".
180 "  \"Website\" varchar(150) NOT NULL default '',\n".
181 "  \"Gender\" varchar(15) NOT NULL default '',\n".
182 "  \"PostCount\" numeric(15) NOT NULL default '0',\n".
183 "  \"Karma\" numeric(15) NOT NULL default '0',\n".
184 "  \"KarmaUpdate\" numeric(15) NOT NULL default '0',\n".
185 "  \"RepliesPerPage\" numeric(5) NOT NULL default '0',\n".
186 "  \"TopicsPerPage\" numeric(5) NOT NULL default '0',\n".
187 "  \"MessagesPerPage\" numeric(5) NOT NULL default '0',\n".
188 "  \"TimeZone\" varchar(256) NOT NULL default '0',\n".
189 "  \"DateFormat\" VARCHAR(15) NOT NULL default '0',\n".
190 "  \"TimeFormat\" VARCHAR(15) NOT NULL default '0',\n".
191 "  \"UseTheme\" varchar(32) NOT NULL default '0',\n".
192 "  \"IP\" varchar(64) NOT NULL default '',\n".
193 "  \"Salt\" varchar(50) NOT NULL default '',\n".
194 "  UNIQUE (\"Name\"),\n".
195 "  UNIQUE (\"Email\")\n".
196 ");", array(null));
197 sql_query($query,$SQLStat);
198 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."members\" (\"id\", \"Name\", \"UserPassword\", \"HashType\", \"Email\", \"GroupID\", \"LevelID\", \"Validated\", \"HiddenMember\", \"WarnLevel\", \"Interests\", \"Title\", \"Joined\", \"LastActive\", \"LastPostTime\", \"BanTime\", \"BirthDay\", \"BirthMonth\", \"BirthYear\", \"Signature\", \"Notes\", \"Avatar\", \"AvatarSize\", \"Website\", \"Gender\", \"PostCount\", \"Karma\", \"KarmaUpdate\", \"RepliesPerPage\", \"TopicsPerPage\", \"MessagesPerPage\", \"TimeZone\", \"DateFormat\", \"TimeFormat\", \"UseTheme\", \"IP\", \"Salt\") VALUES\n".
199 "(-1, 'Guest', '%s', 'GuestPassword', '%s', 4, -1, 'no', 'yes', 0, 'Guest Account', 'Guest', %i, %i, '0', '0', '0', '0', '0', '', 'Your Notes', 'http://', '100x100', '%s', 'UnKnow', 1, 0, 0, 10, 10, 10, '%s', '%s', '%s', '%s', '".$GuestLocalIP."', '%s'),\n".
200 "(1, '%s', '%s', '".$iDBHashType."', '%s', 1, 1, 'yes', 'no', 0, '%s', 'Admin', %i, %i, '0', '0', '0', '0', '0', '%s', 'Your Notes', '%s', '100x100', '%s', 'UnKnow', 0, 0, 0, 10, 10, 10, '%s', '%s', '%s', '%s', '%s', '%s');", array($GuestPassword,$GEmail,$YourDate,$YourDate,$YourWebsite,$_POST['YourOffSet'],$_POST['iDBDateFormat'],$_POST['iDBTimeFormat'],$_POST['DefaultTheme'],$GSalt,$_POST['AdminUser'],$NewPassword,$_POST['AdminEmail'],"",$YourDate,$YourDate,"","http://",$YourWebsite,$_POST['YourOffSet'],$_POST['iDBDateFormat'],$_POST['iDBTimeFormat'],$_POST['DefaultTheme'],$UserIP,$YourSalt));
201 sql_query($query,$SQLStat);
202 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."mempermissions\" (\n".
203 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
204 "  \"PermissionID\" numeric(15) NOT NULL default '0',\n".
205 "  \"CanViewBoard\" varchar(5) NOT NULL default '',\n".
206 "  \"CanViewOffLine\" varchar(5) NOT NULL default '',\n".
207 "  \"CanEditProfile\" varchar(5) NOT NULL default '',\n".
208 "  \"CanAddEvents\" varchar(5) NOT NULL default '',\n".
209 "  \"CanPM\" varchar(5) NOT NULL default '',\n".
210 "  \"CanSearch\" varchar(5) NOT NULL default '',\n".
211 "  \"CanExecPHP\" varchar(5) NOT NULL default '',\n".
212 "  \"CanDoHTML\" varchar(5) NOT NULL default '',\n".
213 "  \"CanUseBBTags\" varchar(5) NOT NULL default '',\n".
214 "  \"CanModForum\" varchar(5) NOT NULL default '',\n".
215 "  \"CanViewIPAddress\" varchar(5) NOT NULL default '',\n".
216 "  \"CanViewUserAgent\" varchar(5) NOT NULL default '',\n".
217 "  \"FloodControl\" numeric(5) NOT NULL default '0',\n".
218 "  \"SearchFlood\" numeric(5) NOT NULL default '0',\n".
219 "  \"HasModCP\" varchar(5) NOT NULL default '',\n".
220 "  \"HasAdminCP\" varchar(5) NOT NULL default '',\n".
221 "  \"ViewDBInfo\" varchar(5) NOT NULL default ''\n".
222 ");", array(null));
223 sql_query($query,$SQLStat);
224 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."mempermissions\" (\"id\", \"PermissionID\", \"CanViewBoard\", \"CanViewOffLine\", \"CanEditProfile\", \"CanAddEvents\", \"CanPM\", \"CanSearch\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanViewIPAddress\", \"CanViewUserAgent\", \"FloodControl\", \"SearchFlood\", \"HasModCP\", \"HasAdminCP\", \"ViewDBInfo\") VALUES\n".
225 "(-1, 0, 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', -1, -1, 'group', 'group', 'group'),\n".
226 "(1, 0, 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', -1, -1, 'group', 'group', 'group');", array(null));
227 //"(-1, 0, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 30, 30, 'no', 'no', 'no'),\n".
228 //"(1, 0, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 30, 30, 'yes', 'yes', 'yes');", array(null));
229 sql_query($query,$SQLStat);
230 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."messenger\" (\n".
231 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
232 "  \"DiscussionID\" numeric(15) NOT NULL default '0',\n".
233 "  \"SenderID\" numeric(15) NOT NULL default '0',\n".
234 "  \"ReciverID\" numeric(15) NOT NULL default '0',\n".
235 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
236 "  \"MessageTitle\" varchar(150) NOT NULL default '',\n".
237 "  \"MessageText\" text NOT NULL,\n".
238 "  \"Description\" text NOT NULL,\n".
239 "  \"DateSend\" numeric(15) NOT NULL default '0',\n".
240 "  \"Read\" numeric(5) NOT NULL default '0',\n".
241 "  \"IP\" varchar(64) NOT NULL default ''\n".
242 ");", array(null));
243 sql_query($query,$SQLStat);
244 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."messenger\" (\"DiscussionID\", \"SenderID\", \"ReciverID\", \"GuestName\", \"MessageTitle\", \"MessageText\", \"Description\", \"DateSend\", \"Read\", \"IP\") VALUES\n".
245 "(0, -1, 1, '".$iDB_Author."', 'Welcome', 'Welcome to your new Internet Discussion Board! :)', 'Welcome %s', %i, 0, '".$GuestLocalIP."');", array($_POST['AdminUser'],$YourDate));
246 sql_query($query,$SQLStat);
247 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."permissions\" (\n".
248 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
249 "  \"PermissionID\" numeric(15) NOT NULL default '0',\n".
250 "  \"Name\" varchar(150) NOT NULL default '',\n".
251 "  \"ForumID\" numeric(15) NOT NULL default '0',\n".
252 "  \"CanViewForum\" varchar(5) NOT NULL default '',\n".
253 "  \"CanMakePolls\" varchar(5) NOT NULL default '',\n".
254 "  \"CanMakeTopics\" varchar(5) NOT NULL default '',\n".
255 "  \"CanMakeReplys\" varchar(5) NOT NULL default '',\n".
256 "  \"CanMakeReplysCT\" varchar(5) NOT NULL default '',\n".
257 "  \"CanEditTopics\" varchar(5) NOT NULL default '',\n".
258 "  \"CanEditTopicsCT\" varchar(5) NOT NULL default '',\n".
259 "  \"CanEditReplys\" varchar(5) NOT NULL default '',\n".
260 "  \"CanEditReplysCT\" varchar(5) NOT NULL default '',\n".
261 "  \"CanDeleteTopics\" varchar(5) NOT NULL default '',\n".
262 "  \"CanDeleteTopicsCT\" varchar(5) NOT NULL default '',\n".
263 "  \"CanDeleteReplys\" varchar(5) NOT NULL default '',\n".
264 "  \"CanDeleteReplysCT\" varchar(5) NOT NULL default '',\n".
265 "  \"CanCloseTopics\" varchar(5) NOT NULL default '',\n".
266 "  \"CanPinTopics\" varchar(5) NOT NULL default '',\n".
267 "  \"CanExecPHP\" varchar(5) NOT NULL default '',\n".
268 "  \"CanDoHTML\" varchar(5) NOT NULL default '',\n".
269 "  \"CanUseBBTags\" varchar(5) NOT NULL default '',\n".
270 "  \"CanModForum\" varchar(5) NOT NULL default ''\n".
271 ");", array(null));
272 sql_query($query,$SQLStat);
273 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES\n".
274 "(1, 'Admin', 1, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes'),\n".
275 "(2, 'Moderator', 1, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'no', 'yes', 'yes'),\n".
276 "(3, 'Member', 1, 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'no', 'no', 'no', 'no', 'yes', 'no'),\n".
277 "(4, 'Guest', 1, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no'),\n".
278 "(5, 'Banned', 1, 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no'),\n".
279 "(6, 'Validate', 1, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no');", array(null)); 
280 sql_query($query,$SQLStat);
281 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."polls\" (\n".
282 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
283 "  \"UserID\" numeric(15) NOT NULL default '0',\n".
284 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
285 "  \"PollValues\" text NOT NULL,\n".
286 "  \"Description\" text NOT NULL,\n".
287 "  \"UsersVoted\" text NOT NULL,\n".
288 "  \"IP\" varchar(64) NOT NULL default ''\n".
289 ");", array(null));
290 sql_query($query,$SQLStat);
291 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."posts\" (\n".
292 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
293 "  \"TopicID\" numeric(15) NOT NULL default '0',\n".
294 "  \"ForumID\" numeric(15) NOT NULL default '0',\n".
295 "  \"CategoryID\" numeric(15) NOT NULL default '0',\n".
296 "  \"UserID\" numeric(15) NOT NULL default '0',\n".
297 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
298 "  \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
299 "  \"LastUpdate\" numeric(15) NOT NULL default '0',\n".
300 "  \"EditUser\" numeric(15) NOT NULL default '0',\n".
301 "  \"EditUserName\" varchar(150) NOT NULL default '',\n".
302 "  \"Post\" text NOT NULL,\n".
303 "  \"Description\" text NOT NULL,\n".
304 "  \"IP\" varchar(64) NOT NULL default '',\n".
305 "  \"EditIP\" varchar(64) NOT NULL default ''\n".
306 ");", array(null));
307 sql_query($query,$SQLStat);
308 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
309 "(1, 1, 1, -1, '".$iDB_Author."', %i, %i, 1, '".$_POST['AdminUser']."', 'Welcome to your new Internet Discussion Board! :) ', 'Welcome %s', '".$GuestLocalIP."', '127.0.0.1');", array($YourDate,$YourEditDate,$_POST['AdminUser'])); 
310 sql_query($query,$SQLStat);
311 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."restrictedwords\" (\n".
312 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
313 "  \"Word\" text NOT NULL,\n".
314 "  \"RestrictedUserName\" varchar(5) NOT NULL default '',\n".
315 "  \"RestrictedTopicName\" varchar(5) NOT NULL default '',\n".
316 "  \"RestrictedEventName\" varchar(5) NOT NULL default '',\n".
317 "  \"RestrictedMessageName\" varchar(5) NOT NULL default '',\n".
318 "  \"CaseInsensitive\" varchar(5) NOT NULL default '',\n".
319 "  \"WholeWord\" varchar(5) NOT NULL default ''\n".
320 ");", array(null));
321 sql_query($query,$SQLStat);
322 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."sessions\" (\n".
323 "  \"session_id\" VARCHAR(250) PRIMARY KEY NOT NULL default '',\n".
324 "  \"session_data\" text NOT NULL,\n".
325 "  \"serialized_data\" text NOT NULL,\n".
326 "  \"user_agent\" text NOT NULL,\n".
327 "  \"ip_address\" varchar(64) NOT NULL default '',\n".
328 "  \"expires\" numeric(15) NOT NULL default '0'\n".
329 ");", array(null));
330 sql_query($query,$SQLStat);
331 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."smileys\" (\n".
332 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
333 "  \"FileName\" text NOT NULL,\n".
334 "  \"SmileName\" text NOT NULL,\n".
335 "  \"SmileText\" text NOT NULL,\n".
336 "  \"Directory\" text NOT NULL,\n".
337 "  \"Display\" varchar(5) NOT NULL default '',\n".
338 "  \"ReplaceCI\" varchar(5) NOT NULL default ''\n".
339 ");", array(null));
340 sql_query($query,$SQLStat);
341 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."smileys\" (\"FileName\", \"SmileName\", \"SmileText\", \"Directory\", \"Display\", \"ReplaceCI\") VALUES\n".
342 "('angry.png', 'Angry', ':angry:', 'smileys/', 'yes', 'yes'),\n".
343 "('closedeyes.png', 'Sleep', 'v_v', 'smileys/', 'yes', 'no'),\n".
344 "('cool.png', 'Cool', 'B)', 'smileys/', 'yes', 'no'),\n".
345 "('glare.png', 'Hmph', ':hmph:', 'smileys/', 'yes', 'yes'),\n".
346 "('happy.png', 'Happy', '^_^', 'smileys/', 'yes', 'no'),\n".
347 "('hmm.png', 'Hmm', ':unsure:', 'smileys/', 'yes', 'yes'),\n".
348 "('huh.png', 'Huh', ':huh:', 'smileys/', 'yes', 'yes'),\n".
349 "('laugh.png', 'lol', ':laugh:', 'smileys/', 'yes', 'yes'),\n".
350 "('lol.png', 'lol', ':lol:', 'smileys/', 'yes', 'yes'),\n".
351 "('mad.png', 'Mad', ':mad:', 'smileys/', 'yes', 'yes'),\n".
352 "('ninja.png', 'Ninja', ':ninja:', 'smileys/', 'yes', 'yes'),\n".
353 "('ohno.png', 'ohno', ':ohno:', 'smileys/', 'yes', 'yes'),\n".
354 "('ohmy.png', 'ohmy', ':o', 'smileys/', 'yes', 'yes'),\n".
355 "('sad.png', 'Sad', ':(', 'smileys/', 'yes', 'no'),\n".
356 "('sleep.png', 'Sleep', '-_-', 'smileys/', 'yes', 'no'),\n".
357 "('smile.png', 'Happy', ':)', 'smileys/', 'yes', 'no'),\n".
358 "('sweat.png', 'Sweat', ':sweat:', 'smileys/', 'yes', 'yes'),\n".
359 "('tongue.png', 'Tongue', ':P', 'smileys/', 'yes', 'no'),\n".
360 "('wub.png', 'Wub', ':wub:', 'smileys/', 'yes', 'yes'),\n".
361 "('x.png', 'X', ':x:', 'smileys/', 'yes', 'yes');", array(null));
362 sql_query($query,$SQLStat);
363 /*
364 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."tagboard\" (\n".
365 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
366 "  \"UserID\" numeric(15) NOT NULL default '0',\n".
367 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
368 "  \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
369 "  \"Post\" text NOT NULL,\n".
370 "  \"IP\" varchar(64) NOT NULL default ''
371 ");", array(null));
372 sql_query($query,$SQLStat);
373 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."tagboard\" VALUES (1,-1,'".$iDB_Author."',".$YourDate.",'Welcome to Your New Tag Board. ^_^','127.0.0.1'), array(null)); 
374 sql_query($query,$SQLStat);
375 */
376 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."themes\" (\n".
377 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
378 "  \"Name\" varchar(32) NOT NULL default '',\n".
379 "  \"ThemeName\" varchar(32) NOT NULL default '',\n".
380 "  \"ThemeMaker\" varchar(150) NOT NULL default '',\n".
381 "  \"ThemeVersion\" varchar(150) NOT NULL default '',\n".
382 "  \"ThemeVersionType\" varchar(150) NOT NULL default '',\n".
383 "  \"ThemeSubVersion\" varchar(150) NOT NULL default '',\n".
384 "  \"MakerURL\" varchar(150) NOT NULL default '',\n".
385 "  \"CopyRight\" varchar(150) NOT NULL default '',\n".
386 "  \"WrapperString\" text NOT NULL,\n".
387 "  \"CSS\" text NOT NULL,\n".
388 "  \"CSSType\" varchar(150) NOT NULL default '',\n".
389 "  \"FavIcon\" varchar(150) NOT NULL default '',\n".
390 "  \"TableStyle\" varchar(150) NOT NULL default '',\n".
391 "  \"MiniPageAltStyle\" varchar(150) NOT NULL default '',\n".
392 "  \"PreLogo\" varchar(150) NOT NULL default '',\n".
393 "  \"Logo\" varchar(150) NOT NULL default '',\n".
394 "  \"LogoStyle\" varchar(150) NOT NULL default '',\n".
395 "  \"SubLogo\" varchar(150) NOT NULL default '',\n".
396 "  \"TopicIcon\" varchar(150) NOT NULL default '',\n".
397 "  \"MovedTopicIcon\" varchar(150) NOT NULL default '',\n".
398 "  \"HotTopic\" varchar(150) NOT NULL default '',\n".
399 "  \"MovedHotTopic\" varchar(150) NOT NULL default '',\n".
400 "  \"PinTopic\" varchar(150) NOT NULL default '',\n".
401 "  \"AnnouncementTopic\" varchar(150) NOT NULL default '',\n".
402 "  \"MovedPinTopic\" varchar(150) NOT NULL default '',\n".
403 "  \"HotPinTopic\" varchar(150) NOT NULL default '',\n".
404 "  \"MovedHotPinTopic\" varchar(150) NOT NULL default '',\n".
405 "  \"ClosedTopic\" varchar(150) NOT NULL default '',\n".
406 "  \"MovedClosedTopic\" varchar(150) NOT NULL default '',\n".
407 "  \"HotClosedTopic\" varchar(150) NOT NULL default '',\n".
408 "  \"MovedHotClosedTopic\" varchar(150) NOT NULL default '',\n".
409 "  \"PinClosedTopic\" varchar(150) NOT NULL default '',\n".
410 "  \"MovedPinClosedTopic\" varchar(150) NOT NULL default '',\n".
411 "  \"HotPinClosedTopic\" varchar(150) NOT NULL default '',\n".
412 "  \"MovedHotPinClosedTopic\" varchar(150) NOT NULL default '',\n".
413 "  \"MessageRead\" varchar(150) NOT NULL default '',\n".
414 "  \"MessageUnread\" varchar(150) NOT NULL default '',\n".
415 "  \"Profile\" varchar(150) NOT NULL default '',\n".
416 "  \"WWW\" varchar(150) NOT NULL default '',\n".
417 "  \"PM\" varchar(150) NOT NULL default '',\n".
418 "  \"TopicLayout\" varchar(150) NOT NULL default '',\n".
419 "  \"AddReply\" varchar(150) NOT NULL default '',\n".
420 "  \"FastReply\" varchar(150) NOT NULL default '',\n".
421 "  \"NewTopic\" varchar(150) NOT NULL default '',\n".
422 "  \"QuoteReply\" varchar(150) NOT NULL default '',\n".
423 "  \"EditReply\" varchar(150) NOT NULL default '',\n".
424 "  \"DeleteReply\" varchar(150) NOT NULL default '',\n".
425 "  \"Report\" varchar(150) NOT NULL default '',\n".
426 "  \"LineDivider\" varchar(150) NOT NULL default '',\n".
427 "  \"ButtonDivider\" varchar(150) NOT NULL default '',\n".
428 "  \"LineDividerTopic\" varchar(150) NOT NULL default '',\n".
429 "  \"TitleDivider\" varchar(150) NOT NULL default '',\n".
430 "  \"ForumStyle\" varchar(150) NOT NULL default '',\n".
431 "  \"ForumIcon\" varchar(150) NOT NULL default '',\n".
432 "  \"SubForumIcon\" varchar(150) NOT NULL default '',\n".
433 "  \"RedirectIcon\" varchar(150) NOT NULL default '',\n".
434 "  \"TitleIcon\" varchar(150) NOT NULL default '',\n".
435 "  \"NavLinkIcon\" varchar(150) NOT NULL default '',\n".
436 "  \"NavLinkDivider\" varchar(150) NOT NULL default '',\n".
437 "  \"StatsIcon\" varchar(150) NOT NULL default '',\n".
438 "  \"NoAvatar\" varchar(150) NOT NULL default '',\n".
439 "  \"NoAvatarSize\" varchar(150) NOT NULL default '',\n".
440 "  UNIQUE (\"Name\")\n".
441 ");", array(null));
442 sql_query($query,$SQLStat);
443 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."topics\" (\n".
444 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
445 "  \"PollID\" numeric(15) NOT NULL default '0',\n".
446 "  \"ForumID\" numeric(15) NOT NULL default '0',\n".
447 "  \"CategoryID\" numeric(15) NOT NULL default '0',\n".
448 "  \"OldForumID\" numeric(15) NOT NULL default '0',\n".
449 "  \"OldCategoryID\" numeric(15) NOT NULL default '0',\n".
450 "  \"UserID\" numeric(15) NOT NULL default '0',\n".
451 "  \"GuestName\" varchar(150) NOT NULL default '',\n".
452 "  \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
453 "  \"LastUpdate\" numeric(15) NOT NULL default '0',\n".
454 "  \"TopicName\" varchar(150) NOT NULL default '',\n".
455 "  \"Description\" text NOT NULL,\n".
456 "  \"NumReply\" numeric(15) NOT NULL default '0',\n".
457 "  \"NumViews\" numeric(15) NOT NULL default '0',\n".
458 "  \"Pinned\" numeric(5) NOT NULL default '0',\n".
459 "  \"Closed\" numeric(5) NOT NULL default '0'\n".
460 ");", array(null));
461 sql_query($query,$SQLStat);
462 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."topics\" (\"PollID\", \"ForumID\", \"CategoryID\", \"OldForumID\", \"OldCategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"TopicName\", \"Description\", \"NumReply\", \"NumViews\", \"Pinned\", \"Closed\") VALUES\n".
463 "(0, 1, 1, 1, 1, -1, '".$iDB_Author."', %i, %i, 'Welcome', 'Welcome %s', 0, 0, 1, 1);", array($YourDate,$YourDate,$_POST['AdminUser']));
464 sql_query($query,$SQLStat);
465 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."wordfilter\" (\n".
466 "  \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
467 "  \"FilterWord\" text NOT NULL,\n".
468 "  \"Replacement\" text NOT NULL,\n".
469 "  \"CaseInsensitive\" varchar(5) NOT NULL default '',\n".
470 "  \"WholeWord\" varchar(5) NOT NULL default ''\n".
471 ");", array(null));
472 sql_query($query,$SQLStat);
473 $TableChCk = array("categories", "catpermissions", "events", "forums", "groups", "levels", "members", "mempermissions", "messenger", "permissions", "polls", "posts", "restrictedwords", "sessions", "smileys", "themes", "topics", "wordfilter");
474 $TablePreFix = $_POST['tableprefix'];
475 function add_prefix($tarray) {
476 global $TablePreFix;
477 return $TablePreFix.$tarray; }
478 $TableChCk = array_map("add_prefix",$TableChCk);
479 $tcount = count($TableChCk); $ti = 0;
480 while ($ti < $tcount) {
481 $OptimizeTea = sql_query(sql_pre_query("VACUUM ANALYZE \"".$TableChCk[$ti]."\"", array(null)),$SQLStat);
482 ++$ti; }
483 ?>