punbb/install.php
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
equal deleted inserted replaced
1:8f6143115bf5 2:a8a21e1c7afa
   350 		default:
   350 		default:
   351 			error('\''.$db_type.'\' is not a valid database type.');
   351 			error('\''.$db_type.'\' is not a valid database type.');
   352 	}
   352 	}
   353 
   353 
   354 	// Create the database object (and connect/select db)
   354 	// Create the database object (and connect/select db)
   355 	$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
   355 	$pun_db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
   356 
   356 
   357 
   357 
   358 	// Do some DB type specific checks
   358 	// Do some DB type specific checks
   359 	switch ($db_type)
   359 	switch ($db_type)
   360 	{
   360 	{
   374 			break;
   374 			break;
   375 	}
   375 	}
   376 
   376 
   377 
   377 
   378 	// Make sure PunBB isn't already installed
   378 	// Make sure PunBB isn't already installed
   379 	$result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1');
   379 	$result = $pun_db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1');
   380 	if ($db->num_rows($result))
   380 	if ($pun_db->num_rows($result))
   381 		error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.');
   381 		error('A table called "'.$db_prefix.'users" is already present in the database "'.$db_name.'". This could mean that PunBB is already installed or that another piece of software is installed and is occupying one or more of the table names PunBB requires. If you want to install multiple copies of PunBB in the same database, you must choose a different table prefix.');
   382 
   382 
   383 
   383 
   384 	// Create all tables
   384 	// Create all tables
   385 	switch ($db_type)
   385 	switch ($db_type)
   396 					PRIMARY KEY (id)
   396 					PRIMARY KEY (id)
   397 					) TYPE=MyISAM;";
   397 					) TYPE=MyISAM;";
   398 			break;
   398 			break;
   399 
   399 
   400 		case 'pgsql':
   400 		case 'pgsql':
   401 			$db->start_transaction();
   401 			$pun_db->start_transaction();
   402 
   402 
   403 			$sql = 'CREATE TABLE '.$db_prefix."bans (
   403 			$sql = 'CREATE TABLE '.$db_prefix."bans (
   404 					id SERIAL,
   404 					id SERIAL,
   405 					username VARCHAR(200),
   405 					username VARCHAR(200),
   406 					ip VARCHAR(255),
   406 					ip VARCHAR(255),
   410 					PRIMARY KEY (id)
   410 					PRIMARY KEY (id)
   411 					)";
   411 					)";
   412 			break;
   412 			break;
   413 
   413 
   414 		case 'sqlite':
   414 		case 'sqlite':
   415 			$db->start_transaction();
   415 			$pun_db->start_transaction();
   416 
   416 
   417 			$sql = 'CREATE TABLE '.$db_prefix."bans (
   417 			$sql = 'CREATE TABLE '.$db_prefix."bans (
   418 					id INTEGER NOT NULL,
   418 					id INTEGER NOT NULL,
   419 					username VARCHAR(200),
   419 					username VARCHAR(200),
   420 					ip  VARCHAR(255),
   420 					ip  VARCHAR(255),
   425 					)";
   425 					)";
   426 			break;
   426 			break;
   427 
   427 
   428 	}
   428 	}
   429 
   429 
   430 	$db->query($sql) or error('Unable to create table '.$db_prefix.'bans. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   430 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'bans. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   431 
   431 
   432 
   432 
   433 	switch ($db_type)
   433 	switch ($db_type)
   434 	{
   434 	{
   435 		case 'mysql':
   435 		case 'mysql':
   459 					PRIMARY KEY (id)
   459 					PRIMARY KEY (id)
   460 					)";
   460 					)";
   461 			break;
   461 			break;
   462 	}
   462 	}
   463 
   463 
   464 	$db->query($sql) or error('Unable to create table '.$db_prefix.'categories. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   464 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'categories. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   465 
   465 
   466 
   466 
   467 
   467 
   468 	switch ($db_type)
   468 	switch ($db_type)
   469 	{
   469 	{
   494 					PRIMARY KEY (id)
   494 					PRIMARY KEY (id)
   495 					)";
   495 					)";
   496 			break;
   496 			break;
   497 	}
   497 	}
   498 
   498 
   499 	$db->query($sql) or error('Unable to create table '.$db_prefix.'censoring. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   499 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'censoring. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   500 
   500 
   501 
   501 
   502 
   502 
   503 	switch ($db_type)
   503 	switch ($db_type)
   504 	{
   504 	{
   526 					PRIMARY KEY (conf_name)
   526 					PRIMARY KEY (conf_name)
   527 					)";
   527 					)";
   528 			break;
   528 			break;
   529 	}
   529 	}
   530 
   530 
   531 	$db->query($sql) or error('Unable to create table '.$db_prefix.'config. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   531 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'config. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   532 
   532 
   533 
   533 
   534 
   534 
   535 	switch ($db_type)
   535 	switch ($db_type)
   536 	{
   536 	{
   567 					PRIMARY KEY (group_id, forum_id)
   567 					PRIMARY KEY (group_id, forum_id)
   568 					)";
   568 					)";
   569 			break;
   569 			break;
   570 	}
   570 	}
   571 
   571 
   572 	$db->query($sql) or error('Unable to create table '.$db_prefix.'forum_perms. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   572 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'forum_perms. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   573 
   573 
   574 
   574 
   575 
   575 
   576 	switch ($db_type)
   576 	switch ($db_type)
   577 	{
   577 	{
   632 					PRIMARY KEY (id)
   632 					PRIMARY KEY (id)
   633 					)";
   633 					)";
   634 			break;
   634 			break;
   635 	}
   635 	}
   636 
   636 
   637 	$db->query($sql) or error('Unable to create table '.$db_prefix.'forums. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   637 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'forums. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   638 
   638 
   639 
   639 
   640 
   640 
   641 	switch ($db_type)
   641 	switch ($db_type)
   642 	{
   642 	{
   706 					PRIMARY KEY (g_id)
   706 					PRIMARY KEY (g_id)
   707 					)";
   707 					)";
   708 			break;
   708 			break;
   709 	}
   709 	}
   710 
   710 
   711 	$db->query($sql) or error('Unable to create table '.$db_prefix.'groups. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   711 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'groups. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   712 
   712 
   713 
   713 
   714 
   714 
   715 	switch ($db_type)
   715 	switch ($db_type)
   716 	{
   716 	{
   741 					idle INTEGER NOT NULL DEFAULT 0
   741 					idle INTEGER NOT NULL DEFAULT 0
   742 					)";
   742 					)";
   743 			break;
   743 			break;
   744 	}
   744 	}
   745 
   745 
   746 	$db->query($sql) or error('Unable to create table '.$db_prefix.'online. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   746 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'online. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   747 
   747 
   748 
   748 
   749 
   749 
   750 	switch ($db_type)
   750 	switch ($db_type)
   751 	{
   751 	{
   800 					PRIMARY KEY (id)
   800 					PRIMARY KEY (id)
   801 					)";
   801 					)";
   802 			break;
   802 			break;
   803 	}
   803 	}
   804 
   804 
   805 	$db->query($sql) or error('Unable to create table '.$db_prefix.'posts. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   805 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'posts. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   806 
   806 
   807 
   807 
   808 
   808 
   809 	switch ($db_type)
   809 	switch ($db_type)
   810 	{
   810 	{
   835 					PRIMARY KEY (id)
   835 					PRIMARY KEY (id)
   836 					)";
   836 					)";
   837 			break;
   837 			break;
   838 	}
   838 	}
   839 
   839 
   840 	$db->query($sql) or error('Unable to create table '.$db_prefix.'titles. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   840 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'titles. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   841 
   841 
   842 
   842 
   843 
   843 
   844 	switch ($db_type)
   844 	switch ($db_type)
   845 	{
   845 	{
   888 					PRIMARY KEY (id)
   888 					PRIMARY KEY (id)
   889 					)";
   889 					)";
   890 			break;
   890 			break;
   891 	}
   891 	}
   892 
   892 
   893 	$db->query($sql) or error('Unable to create table '.$db_prefix.'reports. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   893 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'reports. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   894 
   894 
   895 
   895 
   896 
   896 
   897 	switch ($db_type)
   897 	switch ($db_type)
   898 	{
   898 	{
   923 					PRIMARY KEY (id)
   923 					PRIMARY KEY (id)
   924 					)";
   924 					)";
   925 			break;
   925 			break;
   926 	}
   926 	}
   927 
   927 
   928 	$db->query($sql) or error('Unable to create table '.$db_prefix.'search_cache. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   928 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_cache. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   929 
   929 
   930 
   930 
   931 
   931 
   932 	switch ($db_type)
   932 	switch ($db_type)
   933 	{
   933 	{
   955 					subject_match INTEGER NOT NULL DEFAULT 0
   955 					subject_match INTEGER NOT NULL DEFAULT 0
   956 					)";
   956 					)";
   957 			break;
   957 			break;
   958 	}
   958 	}
   959 
   959 
   960 	$db->query($sql) or error('Unable to create table '.$db_prefix.'search_matches. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   960 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_matches. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   961 
   961 
   962 
   962 
   963 
   963 
   964 	switch ($db_type)
   964 	switch ($db_type)
   965 	{
   965 	{
   989 					UNIQUE (word)
   989 					UNIQUE (word)
   990 					)";
   990 					)";
   991 			break;
   991 			break;
   992 	}
   992 	}
   993 
   993 
   994 	$db->query($sql) or error('Unable to create table '.$db_prefix.'search_words. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
   994 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'search_words. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
   995 
   995 
   996 
   996 
   997 
   997 
   998 	switch ($db_type)
   998 	switch ($db_type)
   999 	{
   999 	{
  1021 					PRIMARY KEY (user_id, topic_id)
  1021 					PRIMARY KEY (user_id, topic_id)
  1022 					)";
  1022 					)";
  1023 			break;
  1023 			break;
  1024 	}
  1024 	}
  1025 
  1025 
  1026 	$db->query($sql) or error('Unable to create table '.$db_prefix.'subscriptions. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
  1026 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'subscriptions. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
  1027 
  1027 
  1028 
  1028 
  1029 
  1029 
  1030 	switch ($db_type)
  1030 	switch ($db_type)
  1031 	{
  1031 	{
  1086 					PRIMARY KEY (id)
  1086 					PRIMARY KEY (id)
  1087 					)";
  1087 					)";
  1088 			break;
  1088 			break;
  1089 	}
  1089 	}
  1090 
  1090 
  1091 	$db->query($sql) or error('Unable to create table '.$db_prefix.'topics. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
  1091 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'topics. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
  1092 
  1092 
  1093 
  1093 
  1094 
  1094 
  1095 	switch ($db_type)
  1095 	switch ($db_type)
  1096 	{
  1096 	{
  1223 					PRIMARY KEY (id)
  1223 					PRIMARY KEY (id)
  1224 					)";
  1224 					)";
  1225 			break;
  1225 			break;
  1226 	}
  1226 	}
  1227 
  1227 
  1228 	$db->query($sql) or error('Unable to create table '.$db_prefix.'users. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
  1228 	$pun_db->query($sql) or error('Unable to create table '.$db_prefix.'users. Please check your settings and try again.',  __FILE__, __LINE__, $pun_db->error());
  1229 
  1229 
  1230 
  1230 
  1231 	// Add some indexes
  1231 	// Add some indexes
  1232 	switch ($db_type)
  1232 	switch ($db_type)
  1233 	{
  1233 	{
  1264 			break;
  1264 			break;
  1265 	}
  1265 	}
  1266 
  1266 
  1267 	@reset($queries);
  1267 	@reset($queries);
  1268 	while (list(, $sql) = @each($queries))
  1268 	while (list(, $sql) = @each($queries))
  1269 		$db->query($sql) or error('Unable to create indexes. Please check your configuration and try again.',  __FILE__, __LINE__, $db->error());
  1269 		$pun_db->query($sql) or error('Unable to create indexes. Please check your configuration and try again.',  __FILE__, __LINE__, $pun_db->error());
  1270 
  1270 
  1271 
  1271 
  1272 
  1272 
  1273 	$now = time();
  1273 	$now = time();
  1274 
  1274 
  1275 	// Insert the four preset groups
  1275 	// Insert the four preset groups
  1276 	$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());
  1276 	$pun_db->query('INSERT INTO '.$pun_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__, $pun_db->error());
  1277 	$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());
  1277 	$pun_db->query('INSERT INTO '.$pun_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__, $pun_db->error());
  1278 	$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());
  1278 	$pun_db->query('INSERT INTO '.$pun_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__, $pun_db->error());
  1279 	$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());
  1279 	$pun_db->query('INSERT INTO '.$pun_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__, $pun_db->error());
  1280 
  1280 
  1281 	// Insert guest and first admin user
  1281 	// Insert guest and first admin user
  1282 	$db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'Guest', 'Guest', 'Guest')")
  1282 	$pun_db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'Guest', 'Guest', 'Guest')")
  1283 		or error('Unable to add guest user. Please check your configuration and try again.');
  1283 		or error('Unable to add guest user. Please check your configuration and try again.');
  1284 
  1284 
  1285 	$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.')')
  1285 	$pun_db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, '".$pun_db->escape($username)."', '".pun_hash($password1)."', '$email', 1, ".$now.", ".$now.", '127.0.0.1', ".$now.')')
  1286 		or error('Unable to add administrator user. Please check your configuration and try again.');
  1286 		or error('Unable to add administrator user. Please check your configuration and try again.');
  1287 
  1287 
  1288 	// Insert config data
  1288 	// Insert config data
  1289 	$config = array(
  1289 	$config = array(
  1290 		'o_cur_version'				=> "'$punbb_version'",
  1290 		'o_cur_version'				=> "'$punbb_version'",
  1359 		'p_force_guest_email'		=> "'1'"
  1359 		'p_force_guest_email'		=> "'1'"
  1360 	);
  1360 	);
  1361 
  1361 
  1362 	while (list($conf_name, $conf_value) = @each($config))
  1362 	while (list($conf_name, $conf_value) = @each($config))
  1363 	{
  1363 	{
  1364 		$db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
  1364 		$pun_db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
  1365 			or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again.');
  1365 			or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again.');
  1366 	}
  1366 	}
  1367 
  1367 
  1368 	// Insert some other default data
  1368 	// Insert some other default data
  1369 	$db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Test category', 1)")
  1369 	$pun_db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Test category', 1)")
  1370 		or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again.');
  1370 		or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again.');
  1371 
  1371 
  1372 	$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)")
  1372 	$pun_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, '".$pun_db->escape($username)."', 1, 1)")
  1373 		or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again.');
  1373 		or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again.');
  1374 
  1374 
  1375 	$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)")
  1375 	$pun_db->query('INSERT INTO '.$db_prefix."topics (poster, subject, posted, last_post, last_post_id, last_poster, forum_id) VALUES('".$pun_db->escape($username)."', 'Test post', ".$now.", ".$now.", 1, '".$pun_db->escape($username)."', 1)")
  1376 		or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again.');
  1376 		or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again.');
  1377 
  1377 
  1378 	$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)')
  1378 	$pun_db->query('INSERT INTO '.$db_prefix."posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES('".$pun_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)')
  1379 		or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again.');
  1379 		or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again.');
  1380 
  1380 
  1381 	$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('New member', 0)")
  1381 	$pun_db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('New member', 0)")
  1382 		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
  1382 		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
  1383 
  1383 
  1384 	$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Member', 10)")
  1384 	$pun_db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Member', 10)")
  1385 		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
  1385 		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again.');
  1386 
  1386 
  1387 
  1387 
  1388 	if ($db_type == 'pgsql' || $db_type == 'sqlite')
  1388 	if ($db_type == 'pgsql' || $db_type == 'sqlite')
  1389 		$db->end_transaction();
  1389 		$pun_db->end_transaction();
  1390 
  1390 
  1391 
  1391 
  1392 
  1392 
  1393 	$alerts = '';
  1393 	$alerts = '';
  1394 	// Check if the cache directory is writable
  1394 	// Check if the cache directory is writable