Newer
Older
Graham Cole
committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
user_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, topic_id)
) TYPE=MyISAM;";
break;
case 'pgsql':
$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
user_id INT NOT NULL DEFAULT 0,
topic_id INT NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, topic_id)
)";
break;
case 'sqlite':
$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
user_id INTEGER NOT NULL DEFAULT 0,
topic_id INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, topic_id)
)";
break;
}
$db->query($sql) or error('Unable to create table '.$db_prefix.'subscriptions. Please check your settings and try again.', __FILE__, __LINE__, $db->error());
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'CREATE TABLE '.$db_prefix."topics (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
poster VARCHAR(200) NOT NULL DEFAULT '',
subject VARCHAR(255) NOT NULL DEFAULT '',
posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
last_post INT(10) UNSIGNED NOT NULL DEFAULT 0,
last_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
last_poster VARCHAR(200),
num_views MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
num_replies MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
closed TINYINT(1) NOT NULL DEFAULT 0,
sticky TINYINT(1) NOT NULL DEFAULT 0,
moved_to INT(10) UNSIGNED,
forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) TYPE=MyISAM;";
break;
case 'pgsql':
$sql = 'CREATE TABLE '.$db_prefix."topics (
id SERIAL,
poster VARCHAR(200) NOT NULL DEFAULT '',
subject VARCHAR(255) NOT NULL DEFAULT '',
posted INT NOT NULL DEFAULT 0,
last_post INT NOT NULL DEFAULT 0,
last_post_id INT NOT NULL DEFAULT 0,
last_poster VARCHAR(200),
num_views INT NOT NULL DEFAULT 0,
num_replies INT NOT NULL DEFAULT 0,
closed SMALLINT NOT NULL DEFAULT 0,
sticky SMALLINT NOT NULL DEFAULT 0,
moved_to INT,
forum_id INT NOT NULL DEFAULT 0,
PRIMARY KEY (id)
)";
break;
case 'sqlite':
$sql = 'CREATE TABLE '.$db_prefix."topics (
id INTEGER NOT NULL,
poster VARCHAR(200) NOT NULL DEFAULT '',
subject VARCHAR(255) NOT NULL DEFAULT '',
posted INTEGER NOT NULL DEFAULT 0,
last_post INTEGER NOT NULL DEFAULT 0,
last_post_id INTEGER NOT NULL DEFAULT 0,
last_poster VARCHAR(200),
num_views INTEGER NOT NULL DEFAULT 0,
num_replies INTEGER NOT NULL DEFAULT 0,
closed INTEGER NOT NULL DEFAULT 0,
sticky INTEGER NOT NULL DEFAULT 0,
moved_to INTEGER,
forum_id INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (id)
)";
break;
}
$db->query($sql) or error('Unable to create table '.$db_prefix.'topics. Please check your settings and try again.', __FILE__, __LINE__, $db->error());
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'CREATE TABLE '.$db_prefix."users (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
group_id INT(10) UNSIGNED NOT NULL DEFAULT 4,
username VARCHAR(200) NOT NULL DEFAULT '',
password VARCHAR(40) NOT NULL DEFAULT '',
email VARCHAR(50) NOT NULL DEFAULT '',
title VARCHAR(50),
realname VARCHAR(40),
url VARCHAR(100),
jabber VARCHAR(75),
icq VARCHAR(12),
msn VARCHAR(50),
aim VARCHAR(30),
yahoo VARCHAR(30),
location VARCHAR(30),
use_avatar TINYINT(1) NOT NULL DEFAULT 0,
signature TEXT,
disp_topics TINYINT(3) UNSIGNED,
disp_posts TINYINT(3) UNSIGNED,
email_setting TINYINT(1) NOT NULL DEFAULT 1,
save_pass TINYINT(1) NOT NULL DEFAULT 1,
notify_with_post TINYINT(1) NOT NULL DEFAULT 0,
show_smilies TINYINT(1) NOT NULL DEFAULT 1,
show_img TINYINT(1) NOT NULL DEFAULT 1,
show_img_sig TINYINT(1) NOT NULL DEFAULT 1,
show_avatars TINYINT(1) NOT NULL DEFAULT 1,
show_sig TINYINT(1) NOT NULL DEFAULT 1,
timezone FLOAT NOT NULL DEFAULT 0,
language VARCHAR(25) NOT NULL DEFAULT 'English',
style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
num_posts INT(10) UNSIGNED NOT NULL DEFAULT 0,
last_post INT(10) UNSIGNED,
registered INT(10) UNSIGNED NOT NULL DEFAULT 0,
registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
last_visit INT(10) UNSIGNED NOT NULL DEFAULT 0,
admin_note VARCHAR(30),
activate_string VARCHAR(50),
activate_key VARCHAR(8),
PRIMARY KEY (id)
) TYPE=MyISAM;";
break;
case 'pgsql':
$sql = 'CREATE TABLE '.$db_prefix."users (
id SERIAL,
group_id INT NOT NULL DEFAULT 4,
username VARCHAR(200) NOT NULL DEFAULT '',
password VARCHAR(40) NOT NULL DEFAULT '',
email VARCHAR(50) NOT NULL DEFAULT '',
title VARCHAR(50),
realname VARCHAR(40),
url VARCHAR(100),
jabber VARCHAR(75),
icq VARCHAR(12),
msn VARCHAR(50),
aim VARCHAR(30),
yahoo VARCHAR(30),
location VARCHAR(30),
use_avatar SMALLINT NOT NULL DEFAULT 0,
signature TEXT,
disp_topics SMALLINT,
disp_posts SMALLINT,
email_setting SMALLINT NOT NULL DEFAULT 1,
save_pass SMALLINT NOT NULL DEFAULT 1,
notify_with_post SMALLINT NOT NULL DEFAULT 0,
show_smilies SMALLINT NOT NULL DEFAULT 1,
show_img SMALLINT NOT NULL DEFAULT 1,
show_img_sig SMALLINT NOT NULL DEFAULT 1,
show_avatars SMALLINT NOT NULL DEFAULT 1,
show_sig SMALLINT NOT NULL DEFAULT 1,
timezone REAL NOT NULL DEFAULT 0,
language VARCHAR(25) NOT NULL DEFAULT 'English',
style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
num_posts INT NOT NULL DEFAULT 0,
last_post INT,
registered INT NOT NULL DEFAULT 0,
registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
last_visit INT NOT NULL DEFAULT 0,
admin_note VARCHAR(30),
activate_string VARCHAR(50),
activate_key VARCHAR(8),
PRIMARY KEY (id)
)";
break;
case 'sqlite':
$sql = 'CREATE TABLE '.$db_prefix."users (
id INTEGER NOT NULL,
group_id INTEGER NOT NULL DEFAULT 4,
username VARCHAR(200) NOT NULL DEFAULT '',
password VARCHAR(40) NOT NULL DEFAULT '',
email VARCHAR(50) NOT NULL DEFAULT '',
title VARCHAR(50),
realname VARCHAR(40),
url VARCHAR(100),
jabber VARCHAR(75),
icq VARCHAR(12),
msn VARCHAR(50),
aim VARCHAR(30),
yahoo VARCHAR(30),
location VARCHAR(30),
use_avatar INTEGER NOT NULL DEFAULT 0,
signature TEXT,
disp_topics INTEGER,
disp_posts INTEGER,
email_setting INTEGER NOT NULL DEFAULT 1,
save_pass INTEGER NOT NULL DEFAULT 1,
notify_with_post INTEGER NOT NULL DEFAULT 0,
show_smilies INTEGER NOT NULL DEFAULT 1,
show_img INTEGER NOT NULL DEFAULT 1,
show_img_sig INTEGER NOT NULL DEFAULT 1,
show_avatars INTEGER NOT NULL DEFAULT 1,
show_sig INTEGER NOT NULL DEFAULT 1,
timezone FLOAT NOT NULL DEFAULT 0,
language VARCHAR(25) NOT NULL DEFAULT 'English',
style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
num_posts INTEGER NOT NULL DEFAULT 0,
last_post INTEGER,
registered INTEGER NOT NULL DEFAULT 0,
registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
last_visit INTEGER NOT NULL DEFAULT 0,
admin_note VARCHAR(30),
activate_string VARCHAR(50),
activate_key VARCHAR(8),
PRIMARY KEY (id)
)";
break;
}
$db->query($sql) or error('Unable to create table '.$db_prefix.'users. Please check your settings and try again.', __FILE__, __LINE__, $db->error());
// Add some indexes
switch ($db_type)
{
case 'mysql':
case 'mysqli':
// We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege
$queries[] = 'ALTER TABLE '.$db_prefix.'online ADD UNIQUE INDEX '.$db_prefix.'online_user_id_ident_idx(user_id,ident)';
$queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'reports ADD INDEX '.$db_prefix.'reports_zapped_idx(zapped)';
$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_word_id_idx(word_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_post_id_idx(post_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_forum_id_idx(forum_id)';
$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_moved_to_idx(moved_to)';
$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_registered_idx(registered)';
$queries[] = 'ALTER TABLE '.$db_prefix.'search_cache ADD INDEX '.$db_prefix.'search_cache_ident_idx(ident(8))';
$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_username_idx(username(8))';
break;
default:
$queries[] = 'CREATE INDEX '.$db_prefix.'online_user_id_idx ON '.$db_prefix.'online(user_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'posts_topic_id_idx ON '.$db_prefix.'posts(topic_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'posts_multi_idx ON '.$db_prefix.'posts(poster_id, topic_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'reports_zapped_idx ON '.$db_prefix.'reports(zapped)';
$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_word_id_idx ON '.$db_prefix.'search_matches(word_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_post_id_idx ON '.$db_prefix.'search_matches(post_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'topics_forum_id_idx ON '.$db_prefix.'topics(forum_id)';
$queries[] = 'CREATE INDEX '.$db_prefix.'topics_moved_to_idx ON '.$db_prefix.'topics(moved_to)';
$queries[] = 'CREATE INDEX '.$db_prefix.'users_registered_idx ON '.$db_prefix.'users(registered)';
$queries[] = 'CREATE INDEX '.$db_prefix.'users_username_idx ON '.$db_prefix.'users(username)';
$queries[] = 'CREATE INDEX '.$db_prefix.'search_cache_ident_idx ON '.$db_prefix.'search_cache(ident)';
$queries[] = 'CREATE INDEX '.$db_prefix.'search_words_id_idx ON '.$db_prefix.'search_words(id)';
break;
}
@reset($queries);
while (list(, $sql) = @each($queries))
$db->query($sql) or error('Unable to create indexes. Please check your configuration and try again.', __FILE__, __LINE__, $db->error());
$now = time();
// Insert the four preset groups
$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Administrators', 'Administrator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error());
$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Moderators', 'Moderator', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error());
$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Guest', NULL, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0)") or error('Unable to add group', __FILE__, __LINE__, $db->error());
$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Members', NULL, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 300, 60, 30)") or error('Unable to add group', __FILE__, __LINE__, $db->error());
// Insert guest and first admin user
$db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'Guest', 'Guest', 'Guest')")
or error('Unable to add guest user. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, '".$db->escape($username)."', '".pun_hash($password1)."', '$email', 1, ".$now.", ".$now.", '127.0.0.1', ".$now.')')
or error('Unable to add administrator user. Please check your configuration and try again.');
// Insert config data
$config = array(
'o_cur_version' => "'$punbb_version'",
'o_board_title' => "'My PunBB forum'",
'o_board_desc' => "'Unfortunately no one can be told what PunBB is - you have to see it for yourself.'",
'o_server_timezone' => "'0'",
'o_time_format' => "'H:i:s'",
'o_date_format' => "'Y-m-d'",
'o_timeout_visit' => "'600'",
'o_timeout_online' => "'300'",
'o_redirect_delay' => "'1'",
'o_show_version' => "'0'",
'o_show_user_info' => "'1'",
'o_show_post_count' => "'1'",
'o_smilies' => "'1'",
'o_smilies_sig' => "'1'",
'o_make_links' => "'1'",
'o_default_lang' => "'English'",
'o_default_style' => "'Oxygen'",
'o_default_user_group' => "'4'",
'o_topic_review' => "'15'",
'o_disp_topics_default' => "'30'",
'o_disp_posts_default' => "'25'",
'o_indent_num_spaces' => "'4'",
'o_quickpost' => "'1'",
'o_users_online' => "'1'",
'o_censoring' => "'0'",
'o_ranks' => "'1'",
'o_show_dot' => "'0'",
'o_quickjump' => "'1'",
'o_gzip' => "'0'",
'o_additional_navlinks' => "''",
'o_report_method' => "'0'",
'o_regs_report' => "'0'",
'o_mailing_list' => "'$email'",
'o_avatars' => "'1'",
'o_avatars_dir' => "'img/avatars'",
'o_avatars_width' => "'60'",
'o_avatars_height' => "'60'",
'o_avatars_size' => "'10240'",
'o_search_all_forums' => "'1'",
'o_base_url' => "'$base_url'",
'o_admin_email' => "'$email'",
'o_webmaster_email' => "'$email'",
'o_subscriptions' => "'1'",
'o_smtp_host' => "NULL",
'o_smtp_user' => "NULL",
'o_smtp_pass' => "NULL",
'o_regs_allow' => "'1'",
'o_regs_verify' => "'0'",
'o_announcement' => "'0'",
'o_announcement_message' => "'Enter your announcement here.'",
'o_rules' => "'0'",
'o_rules_message' => "'Enter your rules here.'",
'o_maintenance' => "'0'",
'o_maintenance_message' => "'The forums are temporarily down for maintenance. Please try again in a few minutes.<br />\\n<br />\\n/Administrator'",
'p_mod_edit_users' => "'1'",
'p_mod_rename_users' => "'0'",
'p_mod_change_passwords' => "'0'",
'p_mod_ban_users' => "'0'",
'p_message_bbcode' => "'1'",
'p_message_img_tag' => "'1'",
'p_message_all_caps' => "'1'",
'p_subject_all_caps' => "'1'",
'p_sig_all_caps' => "'1'",
'p_sig_bbcode' => "'1'",
'p_sig_img_tag' => "'0'",
'p_sig_length' => "'400'",
'p_sig_lines' => "'4'",
'p_allow_banned_email' => "'1'",
'p_allow_dupe_email' => "'0'",
'p_force_guest_email' => "'1'"
);
while (list($conf_name, $conf_value) = @each($config))
{
$db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again.');
}
// Insert some other default data
$db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Test category', 1)")
or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('Test forum', 'This is just a test forum', 1, 1, ".$now.", 1, '".$db->escape($username)."', 1, 1)")
or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."topics (poster, subject, posted, last_post, last_post_id, last_poster, forum_id) VALUES('".$db->escape($username)."', 'Test post', ".$now.", ".$now.", 1, '".$db->escape($username)."', 1)")
or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES('".$db->escape($username)."', 2, '127.0.0.1', 'If you are looking at this (which I guess you are), the install of PunBB appears to have worked! Now log in and head over to the administration control panel to configure your forum.', ".$now.', 1)')
or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('New member', 0)")
or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Member', 10)")
or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
if ($db_type == 'pgsql' || $db_type == 'sqlite')
$db->end_transaction();
$alerts = '';
// Check if the cache directory is writable
if (!@is_writable('./cache/'))
$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The cache directory is currently not writable!</strong></span> In order for PunBB to function properly, the directory named <em>cache</em> must be writable by PHP. Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
// Check if default avatar directory is writable
if (!@is_writable('./img/avatars/'))
$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>The avatar directory is currently not writable!</strong></span> If you want users to be able to upload their own avatar images you must see to it that the directory named <em>img/avatars</em> is writable by PHP. You can later choose to save avatar images in a different directory (see Admin/Options). Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.</p>';
/// Display config.php and give further instructions
$config = '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.$db_name."';\n".'$db_username = \''.$db_username."';\n".'$db_password = \''.$db_password."';\n".'$db_prefix = \''.$db_prefix."';\n".'$p_connect = false;'."\n\n".'$cookie_name = '."'punbb_cookie';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n".'$cookie_seed = \''.substr(sha1(uniqid(rand(), true)), 0, 16)."';\n\ndefine('PUN', 1);";
Graham Cole
committed
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PunBB Installation</title>
<link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
</head>
<body>
<div id="puninstall" style="margin: auto 10% auto 10%">
<div class="pun">
<div class="blockform">
<h2>Final instructions</h2>
<div class="box">
<div class="fakeform">
<div class="inform">
<div class="forminfo">
<p>To finalize the installation all you need to do is to <strong>copy and paste the text in the text box below into a file called config.php and then upload this file to the root directory of your PunBB installation</strong>. Make sure there are no linebreaks or spaces before <?php. You can later edit config.php if you reconfigure your setup (e.g. change the database password or ).</p>
<?php if ($alerts != ''): ?> <?php echo $alerts."\n" ?>
<?php endif; ?> </div>
<fieldset>
<legend>Copy contents to config.php</legend>
<div class="infldset">
<textarea cols="80" rows="20"><?php echo htmlspecialchars($config) ?></textarea>
</div>
</fieldset>
</div>
<div class="inform">
<div class="forminfo">
<p>Once you have created config.php with the contents above, PunBB is installed!</p>
<p><a href="index.php">Go to forum index</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}