Small update
[iDB.git] / setup / sql / pgsql.php
blob399878f9e70c852ed82e038106412fe262830d18
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-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
13 iDB Installer made by Game Maker 2k - http://idb.berlios.net/
15 $FileInfo: pgsql.php - Last Update: 08/02/2019 SVN 905 - Author: cooldude2k $
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/"; }
24 $query=sql_pre_query("ALTER DATABASE \"".$_POST['DatabaseName']."\" DEFAULT CHARACTER SET ".$SQLCharset." COLLATE ".$SQLCollate.";", array(null));
25 sql_query($query,$SQLStat);
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 " \"LastLogin\" numeric(15) NOT NULL default '0',\n".
172 " \"LastPostTime\" numeric(15) NOT NULL default '0',\n".
173 " \"BanTime\" numeric(15) NOT NULL default '0',\n".
174 " \"BirthDay\" numeric(5) NOT NULL default '0',\n".
175 " \"BirthMonth\" numeric(5) NOT NULL default '0',\n".
176 " \"BirthYear\" numeric(5) NOT NULL default '0',\n".
177 " \"Signature\" text NOT NULL,\n".
178 " \"Notes\" text NOT NULL,\n".
179 " \"Avatar\" varchar(150) NOT NULL default '',\n".
180 " \"AvatarSize\" varchar(10) NOT NULL default '',\n".
181 " \"Website\" varchar(150) NOT NULL default '',\n".
182 " \"Gender\" varchar(15) NOT NULL default '',\n".
183 " \"PostCount\" numeric(15) NOT NULL default '0',\n".
184 " \"Karma\" numeric(15) NOT NULL default '0',\n".
185 " \"KarmaUpdate\" numeric(15) NOT NULL default '0',\n".
186 " \"RepliesPerPage\" numeric(5) NOT NULL default '0',\n".
187 " \"TopicsPerPage\" numeric(5) NOT NULL default '0',\n".
188 " \"MessagesPerPage\" numeric(5) NOT NULL default '0',\n".
189 " \"TimeZone\" varchar(256) NOT NULL default '0',\n".
190 " \"DateFormat\" VARCHAR(15) NOT NULL default '0',\n".
191 " \"TimeFormat\" VARCHAR(15) NOT NULL default '0',\n".
192 " \"UseTheme\" varchar(32) NOT NULL default '0',\n".
193 " \"IP\" varchar(64) NOT NULL default '',\n".
194 " \"Salt\" varchar(50) NOT NULL default '',\n".
195 " UNIQUE (\"Name\"),\n".
196 " UNIQUE (\"Email\")\n".
197 ");", array(null));
198 sql_query($query,$SQLStat);
199 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."members\" (\"id\", \"Name\", \"UserPassword\", \"HashType\", \"Email\", \"GroupID\", \"LevelID\", \"Validated\", \"HiddenMember\", \"WarnLevel\", \"Interests\", \"Title\", \"Joined\", \"LastActive\", \"LastLogin\", \"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".
200 "(-1, 'Guest', '%s', 'GuestPassword', '%s', 4, -1, 'no', 'yes', 0, 'Guest Account', 'Guest', %i, %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".
201 "(1, '%s', '%s', '".$iDBHashType."', '%s', 1, 1, 'yes', 'no', 0, '%s', 'Admin', %i, %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,$YourDate,$YourWebsite,$_POST['YourOffSet'],$_POST['iDBDateFormat'],$_POST['iDBTimeFormat'],$_POST['DefaultTheme'],$GSalt,$_POST['AdminUser'],$NewPassword,$_POST['AdminEmail'],"",$YourDate,$YourDate,$YourDate,"","http://",$YourWebsite,$_POST['YourOffSet'],$_POST['iDBDateFormat'],$_POST['iDBTimeFormat'],$_POST['DefaultTheme'],$UserIP,$YourSalt));
202 sql_query($query,$SQLStat);
203 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."mempermissions\" (\n".
204 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
205 " \"PermissionID\" numeric(15) NOT NULL default '0',\n".
206 " \"CanViewBoard\" varchar(5) NOT NULL default '',\n".
207 " \"CanViewOffLine\" varchar(5) NOT NULL default '',\n".
208 " \"CanEditProfile\" varchar(5) NOT NULL default '',\n".
209 " \"CanAddEvents\" varchar(5) NOT NULL default '',\n".
210 " \"CanPM\" varchar(5) NOT NULL default '',\n".
211 " \"CanSearch\" varchar(5) NOT NULL default '',\n".
212 " \"CanExecPHP\" varchar(5) NOT NULL default '',\n".
213 " \"CanDoHTML\" varchar(5) NOT NULL default '',\n".
214 " \"CanUseBBTags\" varchar(5) NOT NULL default '',\n".
215 " \"CanModForum\" varchar(5) NOT NULL default '',\n".
216 " \"CanViewIPAddress\" varchar(5) NOT NULL default '',\n".
217 " \"CanViewUserAgent\" varchar(5) NOT NULL default '',\n".
218 " \"FloodControl\" numeric(5) NOT NULL default '0',\n".
219 " \"SearchFlood\" numeric(5) NOT NULL default '0',\n".
220 " \"HasModCP\" varchar(5) NOT NULL default '',\n".
221 " \"HasAdminCP\" varchar(5) NOT NULL default '',\n".
222 " \"ViewDBInfo\" varchar(5) NOT NULL default ''\n".
223 ");", array(null));
224 sql_query($query,$SQLStat);
225 $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".
226 "(-1, 0, 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', -1, -1, 'group', 'group', 'group'),\n".
227 "(1, 0, 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', 'group', -1, -1, 'group', 'group', 'group');", array(null));
228 //"(-1, 0, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 30, 30, 'no', 'no', 'no'),\n".
229 //"(1, 0, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 30, 30, 'yes', 'yes', 'yes');", array(null));
230 sql_query($query,$SQLStat);
231 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."messenger\" (\n".
232 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
233 " \"DiscussionID\" numeric(15) NOT NULL default '0',\n".
234 " \"SenderID\" numeric(15) NOT NULL default '0',\n".
235 " \"ReciverID\" numeric(15) NOT NULL default '0',\n".
236 " \"GuestName\" varchar(150) NOT NULL default '',\n".
237 " \"MessageTitle\" varchar(150) NOT NULL default '',\n".
238 " \"MessageText\" text NOT NULL,\n".
239 " \"Description\" text NOT NULL,\n".
240 " \"DateSend\" numeric(15) NOT NULL default '0',\n".
241 " \"Read\" numeric(5) NOT NULL default '0',\n".
242 " \"IP\" varchar(64) NOT NULL default ''\n".
243 ");", array(null));
244 sql_query($query,$SQLStat);
245 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."messenger\" (\"DiscussionID\", \"SenderID\", \"ReciverID\", \"GuestName\", \"MessageTitle\", \"MessageText\", \"Description\", \"DateSend\", \"Read\", \"IP\") VALUES\n".
246 "(0, -1, 1, '".$iDB_Author."', 'Welcome', 'Welcome to your new Internet Discussion Board! :)', 'Welcome %s', %i, 0, '".$GuestLocalIP."');", array($_POST['AdminUser'],$YourDate));
247 sql_query($query,$SQLStat);
248 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."permissions\" (\n".
249 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
250 " \"PermissionID\" numeric(15) NOT NULL default '0',\n".
251 " \"Name\" varchar(150) NOT NULL default '',\n".
252 " \"ForumID\" numeric(15) NOT NULL default '0',\n".
253 " \"CanViewForum\" varchar(5) NOT NULL default '',\n".
254 " \"CanMakePolls\" varchar(5) NOT NULL default '',\n".
255 " \"CanMakeTopics\" varchar(5) NOT NULL default '',\n".
256 " \"CanMakeReplys\" varchar(5) NOT NULL default '',\n".
257 " \"CanMakeReplysCT\" varchar(5) NOT NULL default '',\n".
258 " \"CanEditTopics\" varchar(5) NOT NULL default '',\n".
259 " \"CanEditTopicsCT\" varchar(5) NOT NULL default '',\n".
260 " \"CanEditReplys\" varchar(5) NOT NULL default '',\n".
261 " \"CanEditReplysCT\" varchar(5) NOT NULL default '',\n".
262 " \"CanDeleteTopics\" varchar(5) NOT NULL default '',\n".
263 " \"CanDeleteTopicsCT\" varchar(5) NOT NULL default '',\n".
264 " \"CanDeleteReplys\" varchar(5) NOT NULL default '',\n".
265 " \"CanDeleteReplysCT\" varchar(5) NOT NULL default '',\n".
266 " \"CanCloseTopics\" varchar(5) NOT NULL default '',\n".
267 " \"CanPinTopics\" varchar(5) NOT NULL default '',\n".
268 " \"CanExecPHP\" varchar(5) NOT NULL default '',\n".
269 " \"CanDoHTML\" varchar(5) NOT NULL default '',\n".
270 " \"CanUseBBTags\" varchar(5) NOT NULL default '',\n".
271 " \"CanModForum\" varchar(5) NOT NULL default ''\n".
272 ");", array(null));
273 sql_query($query,$SQLStat);
274 $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".
275 "(1, 'Admin', 1, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes'),\n".
276 "(2, 'Moderator', 1, 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'no', 'yes', 'yes'),\n".
277 "(3, 'Member', 1, 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'yes', 'no', 'no', 'no', 'no', 'no', 'yes', 'no'),\n".
278 "(4, 'Guest', 1, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no'),\n".
279 "(5, 'Banned', 1, 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no'),\n".
280 "(6, 'Validate', 1, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no');", array(null));
281 sql_query($query,$SQLStat);
282 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."polls\" (\n".
283 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
284 " \"UserID\" numeric(15) NOT NULL default '0',\n".
285 " \"GuestName\" varchar(150) NOT NULL default '',\n".
286 " \"PollValues\" text NOT NULL,\n".
287 " \"Description\" text NOT NULL,\n".
288 " \"UsersVoted\" text NOT NULL,\n".
289 " \"IP\" varchar(64) NOT NULL default ''\n".
290 ");", array(null));
291 sql_query($query,$SQLStat);
292 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."posts\" (\n".
293 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
294 " \"TopicID\" numeric(15) NOT NULL default '0',\n".
295 " \"ForumID\" numeric(15) NOT NULL default '0',\n".
296 " \"CategoryID\" numeric(15) NOT NULL default '0',\n".
297 " \"UserID\" numeric(15) NOT NULL default '0',\n".
298 " \"GuestName\" varchar(150) NOT NULL default '',\n".
299 " \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
300 " \"LastUpdate\" numeric(15) NOT NULL default '0',\n".
301 " \"EditUser\" numeric(15) NOT NULL default '0',\n".
302 " \"EditUserName\" varchar(150) NOT NULL default '',\n".
303 " \"Post\" text NOT NULL,\n".
304 " \"Description\" text NOT NULL,\n".
305 " \"IP\" varchar(64) NOT NULL default '',\n".
306 " \"EditIP\" varchar(64) NOT NULL default ''\n".
307 ");", array(null));
308 sql_query($query,$SQLStat);
309 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
310 "(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']));
311 sql_query($query,$SQLStat);
312 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."restrictedwords\" (\n".
313 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
314 " \"Word\" text NOT NULL,\n".
315 " \"RestrictedUserName\" varchar(5) NOT NULL default '',\n".
316 " \"RestrictedTopicName\" varchar(5) NOT NULL default '',\n".
317 " \"RestrictedEventName\" varchar(5) NOT NULL default '',\n".
318 " \"RestrictedMessageName\" varchar(5) NOT NULL default '',\n".
319 " \"CaseInsensitive\" varchar(5) NOT NULL default '',\n".
320 " \"WholeWord\" varchar(5) NOT NULL default ''\n".
321 ");", array(null));
322 sql_query($query,$SQLStat);
323 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."sessions\" (\n".
324 " \"session_id\" VARCHAR(250) PRIMARY KEY NOT NULL default '',\n".
325 " \"session_data\" text NOT NULL,\n".
326 " \"serialized_data\" text NOT NULL,\n".
327 " \"user_agent\" text NOT NULL,\n".
328 " \"ip_address\" varchar(64) NOT NULL default '',\n".
329 " \"expires\" numeric(15) NOT NULL default '0'\n".
330 ");", array(null));
331 sql_query($query,$SQLStat);
332 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."smileys\" (\n".
333 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
334 " \"FileName\" text NOT NULL,\n".
335 " \"SmileName\" text NOT NULL,\n".
336 " \"SmileText\" text NOT NULL,\n".
337 " \"Directory\" text NOT NULL,\n".
338 " \"Display\" varchar(5) NOT NULL default '',\n".
339 " \"ReplaceCI\" varchar(5) NOT NULL default ''\n".
340 ");", array(null));
341 sql_query($query,$SQLStat);
342 $query = sql_pre_query("INSERT INTO \"".$_POST['tableprefix']."smileys\" (\"FileName\", \"SmileName\", \"SmileText\", \"Directory\", \"Display\", \"ReplaceCI\") VALUES\n".
343 "('angry.png', 'Angry', ':angry:', 'smileys/', 'yes', 'yes'),\n".
344 "('closedeyes.png', 'Sleep', 'v_v', 'smileys/', 'yes', 'no'),\n".
345 "('cool.png', 'Cool', 'B)', 'smileys/', 'yes', 'no'),\n".
346 "('glare.png', 'Hmph', ':hmph:', 'smileys/', 'yes', 'yes'),\n".
347 "('happy.png', 'Happy', '^_^', 'smileys/', 'yes', 'no'),\n".
348 "('hmm.png', 'Hmm', ':unsure:', 'smileys/', 'yes', 'yes'),\n".
349 "('huh.png', 'Huh', ':huh:', 'smileys/', 'yes', 'yes'),\n".
350 "('laugh.png', 'lol', ':laugh:', 'smileys/', 'yes', 'yes'),\n".
351 "('lol.png', 'lol', ':lol:', 'smileys/', 'yes', 'yes'),\n".
352 "('mad.png', 'Mad', ':mad:', 'smileys/', 'yes', 'yes'),\n".
353 "('ninja.png', 'Ninja', ':ninja:', 'smileys/', 'yes', 'yes'),\n".
354 "('ohno.png', 'ohno', ':ohno:', 'smileys/', 'yes', 'yes'),\n".
355 "('ohmy.png', 'ohmy', ':o', 'smileys/', 'yes', 'yes'),\n".
356 "('sad.png', 'Sad', ':(', 'smileys/', 'yes', 'no'),\n".
357 "('sleep.png', 'Sleep', '-_-', 'smileys/', 'yes', 'no'),\n".
358 "('smile.png', 'Happy', ':)', 'smileys/', 'yes', 'no'),\n".
359 "('sweat.png', 'Sweat', ':sweat:', 'smileys/', 'yes', 'yes'),\n".
360 "('tongue.png', 'Tongue', ':P', 'smileys/', 'yes', 'no'),\n".
361 "('wub.png', 'Wub', ':wub:', 'smileys/', 'yes', 'yes'),\n".
362 "('x.png', 'X', ':x:', 'smileys/', 'yes', 'yes');", array(null));
363 sql_query($query,$SQLStat);
365 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."tagboard\" (\n".
366 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
367 " \"UserID\" numeric(15) NOT NULL default '0',\n".
368 " \"GuestName\" varchar(150) NOT NULL default '',\n".
369 " \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
370 " \"Post\" text NOT NULL,\n".
371 " \"IP\" varchar(64) NOT NULL default ''
372 ");", array(null));
373 sql_query($query,$SQLStat);
374 $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));
375 sql_query($query,$SQLStat);
377 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."themes\" (\n".
378 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
379 " \"Name\" varchar(32) NOT NULL default '',\n".
380 " \"ThemeName\" varchar(32) NOT NULL default '',\n".
381 " \"ThemeMaker\" varchar(150) NOT NULL default '',\n".
382 " \"ThemeVersion\" varchar(150) NOT NULL default '',\n".
383 " \"ThemeVersionType\" varchar(150) NOT NULL default '',\n".
384 " \"ThemeSubVersion\" varchar(150) NOT NULL default '',\n".
385 " \"MakerURL\" varchar(150) NOT NULL default '',\n".
386 " \"CopyRight\" varchar(150) NOT NULL default '',\n".
387 " \"WrapperString\" text NOT NULL,\n".
388 " \"CSS\" text NOT NULL,\n".
389 " \"CSSType\" varchar(150) NOT NULL default '',\n".
390 " \"FavIcon\" varchar(150) NOT NULL default '',\n".
391 " \"TableStyle\" varchar(150) NOT NULL default '',\n".
392 " \"MiniPageAltStyle\" varchar(150) NOT NULL default '',\n".
393 " \"PreLogo\" varchar(150) NOT NULL default '',\n".
394 " \"Logo\" varchar(150) NOT NULL default '',\n".
395 " \"LogoStyle\" varchar(150) NOT NULL default '',\n".
396 " \"SubLogo\" varchar(150) NOT NULL default '',\n".
397 " \"TopicIcon\" varchar(150) NOT NULL default '',\n".
398 " \"MovedTopicIcon\" varchar(150) NOT NULL default '',\n".
399 " \"HotTopic\" varchar(150) NOT NULL default '',\n".
400 " \"MovedHotTopic\" varchar(150) NOT NULL default '',\n".
401 " \"PinTopic\" varchar(150) NOT NULL default '',\n".
402 " \"AnnouncementTopic\" varchar(150) NOT NULL default '',\n".
403 " \"MovedPinTopic\" varchar(150) NOT NULL default '',\n".
404 " \"HotPinTopic\" varchar(150) NOT NULL default '',\n".
405 " \"MovedHotPinTopic\" varchar(150) NOT NULL default '',\n".
406 " \"ClosedTopic\" varchar(150) NOT NULL default '',\n".
407 " \"MovedClosedTopic\" varchar(150) NOT NULL default '',\n".
408 " \"HotClosedTopic\" varchar(150) NOT NULL default '',\n".
409 " \"MovedHotClosedTopic\" varchar(150) NOT NULL default '',\n".
410 " \"PinClosedTopic\" varchar(150) NOT NULL default '',\n".
411 " \"MovedPinClosedTopic\" varchar(150) NOT NULL default '',\n".
412 " \"HotPinClosedTopic\" varchar(150) NOT NULL default '',\n".
413 " \"MovedHotPinClosedTopic\" varchar(150) NOT NULL default '',\n".
414 " \"MessageRead\" varchar(150) NOT NULL default '',\n".
415 " \"MessageUnread\" varchar(150) NOT NULL default '',\n".
416 " \"Profile\" varchar(150) NOT NULL default '',\n".
417 " \"WWW\" varchar(150) NOT NULL default '',\n".
418 " \"PM\" varchar(150) NOT NULL default '',\n".
419 " \"TopicLayout\" varchar(150) NOT NULL default '',\n".
420 " \"AddReply\" varchar(150) NOT NULL default '',\n".
421 " \"FastReply\" varchar(150) NOT NULL default '',\n".
422 " \"NewTopic\" varchar(150) NOT NULL default '',\n".
423 " \"QuoteReply\" varchar(150) NOT NULL default '',\n".
424 " \"EditReply\" varchar(150) NOT NULL default '',\n".
425 " \"DeleteReply\" varchar(150) NOT NULL default '',\n".
426 " \"Report\" varchar(150) NOT NULL default '',\n".
427 " \"LineDivider\" varchar(150) NOT NULL default '',\n".
428 " \"ButtonDivider\" varchar(150) NOT NULL default '',\n".
429 " \"LineDividerTopic\" varchar(150) NOT NULL default '',\n".
430 " \"TitleDivider\" varchar(150) NOT NULL default '',\n".
431 " \"ForumStyle\" varchar(150) NOT NULL default '',\n".
432 " \"ForumIcon\" varchar(150) NOT NULL default '',\n".
433 " \"SubForumIcon\" varchar(150) NOT NULL default '',\n".
434 " \"RedirectIcon\" varchar(150) NOT NULL default '',\n".
435 " \"TitleIcon\" varchar(150) NOT NULL default '',\n".
436 " \"NavLinkIcon\" varchar(150) NOT NULL default '',\n".
437 " \"NavLinkDivider\" varchar(150) NOT NULL default '',\n".
438 " \"BoardStatsIcon\" varchar(150) NOT NULL default '',\n".
439 " \"MemberStatsIcon\" varchar(150) NOT NULL default '',\n".
440 " \"BirthdayStatsIcon\" varchar(150) NOT NULL default '',\n".
441 " \"EventStatsIcon\" varchar(150) NOT NULL default '',\n".
442 " \"OnlineStatsIcon\" varchar(150) NOT NULL default '',\n".
443 " \"NoAvatar\" varchar(150) NOT NULL default '',\n".
444 " \"NoAvatarSize\" varchar(150) NOT NULL default '',\n".
445 " UNIQUE (\"Name\")\n".
446 ");", array(null));
447 sql_query($query,$SQLStat);
448 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."topics\" (\n".
449 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
450 " \"PollID\" numeric(15) NOT NULL default '0',\n".
451 " \"ForumID\" numeric(15) NOT NULL default '0',\n".
452 " \"CategoryID\" numeric(15) NOT NULL default '0',\n".
453 " \"OldForumID\" numeric(15) NOT NULL default '0',\n".
454 " \"OldCategoryID\" numeric(15) NOT NULL default '0',\n".
455 " \"UserID\" numeric(15) NOT NULL default '0',\n".
456 " \"GuestName\" varchar(150) NOT NULL default '',\n".
457 " \"TimeStamp\" numeric(15) NOT NULL default '0',\n".
458 " \"LastUpdate\" numeric(15) NOT NULL default '0',\n".
459 " \"TopicName\" varchar(150) NOT NULL default '',\n".
460 " \"Description\" text NOT NULL,\n".
461 " \"NumReply\" numeric(15) NOT NULL default '0',\n".
462 " \"NumViews\" numeric(15) NOT NULL default '0',\n".
463 " \"Pinned\" numeric(5) NOT NULL default '0',\n".
464 " \"Closed\" numeric(5) NOT NULL default '0'\n".
465 ");", array(null));
466 sql_query($query,$SQLStat);
467 $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".
468 "(0, 1, 1, 1, 1, -1, '".$iDB_Author."', %i, %i, 'Welcome', 'Welcome %s', 0, 0, 1, 1);", array($YourDate,$YourDate,$_POST['AdminUser']));
469 sql_query($query,$SQLStat);
470 $query=sql_pre_query("CREATE TABLE \"".$_POST['tableprefix']."wordfilter\" (\n".
471 " \"id\" SERIAL PRIMARY KEY NOT NULL,\n".
472 " \"FilterWord\" text NOT NULL,\n".
473 " \"Replacement\" text NOT NULL,\n".
474 " \"CaseInsensitive\" varchar(5) NOT NULL default '',\n".
475 " \"WholeWord\" varchar(5) NOT NULL default ''\n".
476 ");", array(null));
477 sql_query($query,$SQLStat);
478 $TableChCk = array("categories", "catpermissions", "events", "forums", "groups", "levels", "members", "mempermissions", "messenger", "permissions", "polls", "posts", "restrictedwords", "sessions", "smileys", "themes", "topics", "wordfilter");
479 $TablePreFix = $_POST['tableprefix'];
480 function add_prefix($tarray) {
481 global $TablePreFix;
482 return $TablePreFix.$tarray; }
483 $TableChCk = array_map("add_prefix",$TableChCk);
484 $tcount = count($TableChCk); $ti = 0;
485 while ($ti < $tcount) {
486 $OptimizeTea = sql_query(sql_pre_query("VACUUM ANALYZE \"".$TableChCk[$ti]."\"", array(null)),$SQLStat);
487 ++$ti; }