diff --git a/phpBB/install/install.php b/phpBB/install/install.php new file mode 100644 index 0000000000..cb33ca7c73 --- /dev/null +++ b/phpBB/install/install.php @@ -0,0 +1,882 @@ + array( + 'LABEL' => 'MySQL 3.x', + 'SCHEMA' => 'mysql', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_remarks' + ), + 'mysql4' => array( + 'LABEL' => 'MySQL 4.x', + 'SCHEMA' => 'mysql', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_remarks' + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 7.x', + 'SCHEMA' => 'postgres', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ), + 'mssql' => array( + 'LABEL' => 'MS SQL Server 7/2000', + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ), + 'msaccess' => array( + 'LABEL' => 'MS Access [ ODBC ]', + 'SCHEMA' => '', + 'DELIM' => '', + 'DELIM_BASIC' => ';', + 'COMMENTS' => '' + ), + 'mssql-odbc' => array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ) +); + +// +// Uncomment the following line to completely disable the ftp option... +// +// define('NO_FTP', true); + +/*************************************************************************** +* +* End Install Customization Section +* +***************************************************************************/ + +// +// Try opening config file +// +if ( @file_exists('../config.'.$phpEx) ) +{ + include('../config.'.$phpEx); +} + +// +// Obtain various vars +// +$confirm = ( isset($_POST['confirm']) ) ? true : false; +$cancel = ( isset($_POST['cancel']) ) ? true : false; + +if ( isset($_POST['install_step']) || isset($_GET['install_step']) ) +{ + $install_step = ( isset($_POST['install_step']) ) ? $_POST['install_step'] : $_GET['install_step']; +} +else +{ + $install_step = ''; +} + +$upgrade = ( !empty($_POST['upgrade']) ) ? $_POST['upgrade']: ''; +$upgrade_now = ( !empty($_POST['upgrade_now']) ) ? $_POST['upgrade_now']:''; + +$dbms = isset($_POST['dbms']) ? $_POST['dbms'] : ''; +$language = ( !empty($_POST['language']) ) ? $_POST['language'] : $default_language; + +$dbhost = ( !empty($_POST['dbhost']) ) ? $_POST['dbhost'] : ''; +$dbuser = ( !empty($_POST['dbuser']) ) ? $_POST['dbuser'] : ''; +$dbpasswd = ( !empty($_POST['dbpasswd']) ) ? $_POST['dbpasswd'] : ''; +$dbname = ( !empty($_POST['dbname']) ) ? $_POST['dbname'] : ''; + +$table_prefix = ( !empty($_POST['prefix']) ) ? $_POST['prefix'] : ''; + +$admin_name = ( !empty($_POST['admin_name']) ) ? $_POST['admin_name'] : ''; +$admin_pass1 = ( !empty($_POST['admin_pass1']) ) ? $_POST['admin_pass1'] : ''; +$admin_pass2 = ( !empty($_POST['admin_pass2']) ) ? $_POST['admin_pass2'] : ''; + +$ftp_path = ( !empty($_POST['ftp_path']) ) ? $_POST['ftp_path'] : ''; +$ftp_user = ( !empty($_POST['ftp_user']) ) ? $_POST['ftp_user'] : ''; +$ftp_pass = ( !empty($_POST['ftp_pass']) ) ? $_POST['ftp_pass'] : ''; + +$server_name = ( !empty($_POST['server_name']) ) ? $_POST['server_name'] : ''; +$server_port = ( !empty($_POST['server_port']) ) ? $_POST['server_port'] : ''; +$board_email = ( !empty($_POST['board_email']) ) ? $_POST['board_email'] : ''; +$script_path = ( !empty($_POST['script_path']) ) ? $_POST['script_path'] : ''; + +// +// Do we install/upgrade/update or quit back to index? +// +if ( !defined('PHPBB_INSTALLED') ) +{ + include($phpbb_root_path . 'includes/session.'.$phpEx); + include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); + + // Import language file, setup template ... + include($phpbb_root_path . 'language/' . $language . '/lang_main.'.$phpEx); + include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx); + + if ( $upgrade == 1 ) + { + require('upgrade.'.$phpEx); + $install_step = 1; + } +} +else +{ + header("Location: ../index.$phpEx"); + exit; +} + +// +// What shall we do? +// +if ( !empty($_POST['send_file']) && $_POST['send_file'] == 1 && !defined("PHPBB_INSTALLED") && empty($_POST['upgrade_now']) ) +{ + // + // We need to stripslashes no matter what the setting of magic_quotes_gpc is + // because we add slahes at the top if its off, and they are added automaticlly + // if it is on. + // + $_POST['config_data'] = stripslashes($_POST['config_data']); + + header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); + header("Content-disposition: attachment; filename=config.$phpEx"); + echo $_POST['config_data']; + exit; + +} +else if ( !empty($_POST['send_file']) && $_POST['send_file'] == 2 && !defined("PHPBB_INSTALLED") ) +{ + // + // Ok we couldn't write the config file so let's try ftping it. + // + + $_POST['config_data'] = stripslashes($_POST['config_data']); + + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + + if ( $upgrade == 1 ) + { + $s_hidden_fields .= ''; + } + + $template->assign_block_vars("switch_ftp_file", array()); + $template->assign_block_vars("switch_common_install", array()); + + $template->assign_vars(array( + "L_INSTRUCTION_TEXT" => $lang['ftp_instructs'], + "L_FTP_INFO" => $lang['ftp_info'], + "L_FTP_PATH" => $lang['ftp_path'], + "L_FTP_PASS" => $lang['ftp_password'], + "L_FTP_USER" => $lang['ftp_username'], + "L_SUBMIT" => $lang['Transfer_config'], + + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_FORM_ACTION" => "install.$phpEx") + ); + + $template->pparse("body"); + + exit; + +} +else if( !empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED") ) +{ + // + // Here we'll actually send the file... + // + $_POST['config_data'] = stripslashes($_POST['config_data']); + + $conn_id = @ftp_connect('localhost'); + $login_result = @ftp_login($conn_id, "$ftp_user", "$ftp_pass"); + + if ( !$conn_id || !$login_result ) + { + // + // Error couldn't get connected... Go back to option to send file... + // + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + + page_header($lang['NoFTP_config'], "install.$phpEx"); + + if ( $upgrade == 1 ) + { + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + + $template->assign_block_vars("switch_upgrade_install", array()); + $template->assign_vars(array( + "L_UPGRADE_INST" => $lang['continue_upgrade'], + "L_UPGRADE_SUBMIT" => $lang['upgrade_submit']) + ); + } + + page_footer($lang['Download_config'], $s_hidden_fields); + + exit; + } + else + { + // + // Write out a temp file... + // + $tmpfname = @tempnam('/tmp', 'cfg'); + + @unlink($tmpfname); // unlink for safety on php4.0.3+ + + $fp = @fopen($tmpfname, 'w'); + + @fwrite($fp, $_POST['config_data']); + + @fclose($fp); + + // + // Now ftp it across. + // + @ftp_chdir($conn_id, $ftp_dir); + + $res = ftp_put($conn_id, '../config.'.$phpEx, $tmpfname, FTP_ASCII); + + @ftp_quit($conn_id); + + unlink($tmpfname); + + if( $upgrade == 1 ) + { + require('upgrade.'.$phpEx); + exit; + } + + // + // Ok we are basically done with the install process let's go on and let the user + // configure their board now. We are going to do this by calling the admin_board.php + // from the normal board admin section. + // + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + + page_header($lang['Inst_Step_2'], "../login.$phpEx"); + page_footer($lang['Finish_Install'], $s_hidden_fields); + + exit(); + } + +} +else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin_pass1) || $dbhost == '' ) && !defined("PHPBB_INSTALLED") ) +{ + // + // Ok we haven't installed before so lets work our way through the various + // steps of the install process. This could turn out to be quite a lengty + // process. + // + // Step 0 gather the pertinant info for database setup... + // Namely dbms, dbhost, dbname, dbuser, and dbpasswd. + // + + // + // Guess at some basic info used for install.. + // + if ( !empty($_SERVER['SERVER_NAME']) || !empty($_ENV['SERVER_NAME']) ) + { + $server_name = ( !empty($_SERVER['SERVER_NAME']) ) ? $_SERVER['SERVER_NAME'] : $_ENV['SERVER_NAME']; + } + else if ( !empty($_SERVER['HTTP_HOST']) || !empty($_ENV['HTTP_HOST']) ) + { + $server_name = ( !empty($_SERVER['HTTP_HOST']) ) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST']; + } + else + { + $server_name = ''; + } + + if ( !empty($_SERVER['SERVER_PORT']) || !empty($_ENV['SERVER_PORT']) ) + { + $server_port = ( !empty($_SERVER['SERVER_PORT']) ) ? $_SERVER['SERVER_PORT'] : $_ENV['SERVER_PORT']; + } + else + { + $server_port = '80'; + } + + $script_path = preg_replace('/install\/install\.'.$phpEx.'/i', '', $_SERVER['PHP_SELF']); + + // + // + // + $instruction_text = $lang['Inst_Step_0']; +/* + if ( (($_POST['admin_pass1'] != $_POST['admin_pass2']) && $install_step != '0') || ( empty($_POST['admin_pass1']) && !empty($dbhost)) ) + { + $instruction_text = $lang['Password_mismatch'] . '
' . $instruction_text; + } +*/ + $lang_options = language_select($language, 'language', '../language'); + + foreach( $available_dbms as $dbms_name => $details ) + { + $selected = ( $dbms_name == $dbms ) ? ' selected="selected' : ''; + $dbms_options .= ''; + } + + $upgrade_option = ''; + $upgrade_option .= ''; + $upgrade_option .= ''; + + $s_hidden_fields = ''; + + page_header($instruction_text, "install.$phpEx"); + +?> + + + + + : + + + + : + + + + : + + + + + + + : + + + + : + + + + : + + + + : + + + + : + + + + + + + : + + + + : + + + + : + + + + : + + + + : + + + + : + + + + : + + +assign_block_vars("switch_error_install", array()); + + $template->assign_vars(array( + "L_ERROR_TITLE" => $lang['Installer_Error'], + "L_ERROR" => $lang['Install_No_Ext']) + ); + $template->pparse('body'); */ + + die("Error during installation: no $check_exts extension"); + } + + include($phpbb_root_path . 'db/' . $dbms . '.' . $phpEx); + + $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); + } + + $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; + $dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; + + $remove_remarks = $available_dbms[$dbms]['COMMENTS'];; + $delimiter = $available_dbms[$dbms]['DELIM']; + $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; + + if ( $install_step == 1 || $reinstall ) + { + if ( $upgrade != 1 ) + { + if ( $dbms != 'msaccess' ) + { + // + // Ok we have the db info go ahead and read in the relevant schema + // and work on building the table.. probably ought to provide some + // kind of feedback to the user as we are working here in order + // to let them know we are actually doing something. + // + $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)); + $sql_query = preg_replace('/phpbb_/is', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter); + + $sql_count = count($sql_query); + + for($i = 0; $i < $sql_count; $i++) + { + $db->sql_query($sql_query[$i]); + } + + // + // Ok tables have been built, let's fill in the basic information + // + $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter_basic); + + $sql_count = count($sql_query); + + for($i = 0; $i < $sql_count; $i++) + { + $db->sql_query($sql_query[$i]); + } + } + + // + // Ok at this point they have entered their admin password, let's go + // ahead and create the admin account with some basic default information + // that they can customize later, and write out the config file. After + // this we are going to pass them over to the admin_forum.php script + // to set up their forum defaults. + // + $admin_pass_md5 = ( $confirm && $userdata['user_level'] == ADMIN ) ? $admin_pass1 : md5($admin_pass1); + $error = ''; + + // + // Update the default admin user with their information. + // + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('board_startdate', " . time() . ")"; + $db->sql_query($sql); + + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('default_lang', '" . str_replace("\'", "''", $language) . "')"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $server_name . "' + WHERE config_name = 'server_name'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $server_port . "' + WHERE config_name = 'server_port'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $script_path . "' + WHERE config_name = 'script_path'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $board_email . "' + WHERE config_name = 'board_email'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $server_name . "' + WHERE config_name = 'cookie_domain'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $admin_name . "' + WHERE config_name = 'newest_username'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "users + SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "', user_lang = '" . str_replace("\'", "''", $language) . "', user_email='" . str_replace("\'", "''", $board_email) . "' + WHERE username = 'Admin'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "moderator_cache + SET username = '" . $admin_name . "' + WHERE username = 'Admin'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "forums + SET forum_last_poster_name = '" . $admin_name . "' + WHERE forum_last_poster_name = 'Admin'"; + $db->sql_query($sql); + + $sql = "UPDATE " . $table_prefix . "users + SET user_regdate = " . time(); + $db->sql_query($sql); + +/* if ( $error != '' ) + { + $template->assign_block_vars("switch_error_install", array()); + + $template->assign_vars(array( + "L_ERROR_TITLE" => $lang['Installer_Error'], + "L_ERROR" => $lang['Install_db_error'] . '

' . $error) + ); + + $template->pparse('body'); + + exit; + }*/ + } + + if ( !$reinstall && !$upgrade_now ) + { +// $template->assign_block_vars("switch_common_install", array()); + + // + // Write out the config file. + // + $config_data = ''; // Done this to prevent highlighting editors getting confused! + + @umask(0111); + $no_open = FALSE; + + if ( !($fp = @fopen('../config.'.$phpEx, 'w')) ) + { + // + // Unable to open the file writeable do something here as an attempt + // to get around that... + // + $s_hidden_fields = ''; + + if ( extension_loaded('ftp') && !defined('NO_FTP') ) + { + $template->assign_block_vars('switch_ftp_option', array()); + + $lang['Unwriteable_config'] .= '

' . $lang['ftp_option'] . '

'; + + $template->assign_vars(array( + "L_CHOOSE_FTP" => $lang['ftp_choose'], + "L_ATTEMPT_FTP" => $lang['Attempt_ftp'], + "L_SEND_FILE" => $lang['Send_file']) + ); + } + else + { + $s_hidden_fields .= ''; + } + + if ( $upgrade == 1 ) + { + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + + $template->assign_block_vars("switch_upgrade_install", array()); + $template->assign_vars(array( + "L_UPGRADE_INST" => $lang['continue_upgrade'], + "L_UPGRADE_SUBMIT" => $lang['upgrade_submit']) + ); + } + + $template->assign_vars(array( + "L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'], + "L_SUBMIT" => $lang['Download_config'], + + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_FORM_ACTION" => "install.$phpEx") + ); + + $template->pparse('body'); + + exit; + } + + $result = @fputs($fp, $config_data, strlen($config_data)); + + @fclose($fp); + $upgrade_now = $lang['upgrade_submit']; + } + else + { +// $template->assign_block_vars("switch_common_install", array()); + } + + // + // First off let's check and see if we are supposed to be doing an upgrade. + // + if ( $upgrade == 1 && $upgrade_now == $lang['upgrade_submit'] ) + { + define('INSTALLING', true); + require('upgrade.'.$phpEx); + exit; + } + // + // Ok we are basically done with the install process let's go on + // and let the user configure their board now. + // + // We are going to do this by calling the admin_board.php from the + // normal board admin section. + // + if ( !$reinstall ) + { + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + } + else + { + $s_hidden_fields = ''; + } + + page_header($lang['Inst_Step_2'], "../login.$phpEx"); + page_footer($lang['Finish_Install'], $s_hidden_fields); + + exit; + } +} + +// addslashes to vars if magic_quotes_gpc is off this is a security precaution +// to prevent someone trying to break out of a SQL statement. +function slash_input_data(&$data) +{ + if ( is_array($data) ) + { + foreach ( $data as $k => $v ) + { + $data[$k] = ( is_array($v) ) ? slash_input_data($v) : addslashes($v); + } + } + return $data; +} + +// Output page -> header +function page_header($l_instructions, $s_action) +{ + global $phpEx, $lang; + +?> + + + + + +<?php echo $lang['Welcome_install']; ?> + + + + + + + + +
phpBB Logo      
+ + + +


+ +

+ +
+ +
+ footer +function page_footer($l_submit, $s_hidden_fields) +{ + global $lang; + +?> + + + +
+ +
Powered by phpBB © 2002 phpBB Group
+ +
+ + + + \ No newline at end of file diff --git a/phpBB/install/schemas/index.htm b/phpBB/install/schemas/index.htm new file mode 100644 index 0000000000..ee1f723a7d --- /dev/null +++ b/phpBB/install/schemas/index.htm @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpBB/install/schemas/ms_access_primer.zip b/phpBB/install/schemas/ms_access_primer.zip new file mode 100644 index 0000000000..d22c6f5bde Binary files /dev/null and b/phpBB/install/schemas/ms_access_primer.zip differ diff --git a/phpBB/install/schemas/mssql_basic.sql b/phpBB/install/schemas/mssql_basic.sql new file mode 100644 index 0000000000..efc3032ca1 --- /dev/null +++ b/phpBB/install/schemas/mssql_basic.sql @@ -0,0 +1,244 @@ +/* + + Basic DB data for phpBB2 devel (MSSQL) + + $Id$ + +*/ + +BEGIN TRANSACTION; + +/* + -- Config +*/ +INSERT INTO phpbb_config (config_name, config_value) VALUES ('config_id','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc','A _little_ text to describe your forum'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name','phpbb2mysql'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path','/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length','3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html_tags','b,i,u,pre'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_theme_create','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_inbox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sentbox_privmsgs','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_savebox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.1.0 [20020421]'); + +/* + -- Categories +*/ +SET IDENTITY_INSERT phpbb_categories ON; + +INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 1); + +SET IDENTITY_INSERT phpbb_categories OFF; + + +/* + -- Forums +*/ +INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', '', '', 1, 1, 3, 1, 1, 1, 3); + +/* + -- Users + Default Admin --> username: admin + password: admin (change this or remove it once everything is working!) +*/ +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', '', '', '', '', 0, 0); +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1); + + +/* + -- Ranks +*/ +SET IDENTITY_INSERT phpbb_ranks ON; + +INSERT INTO phpbb_ranks (rank_id, rank_title, rank_min, rank_special, rank_image) VALUES (1, 'Site Admin', -1, 1, ''); + +SET IDENTITY_INSERT phpbb_ranks OFF; + + +/* + -- Groups +*/ +INSERT INTO phpbb_groups (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES (1, 1, 'Anonymous', 'Personal User', '', 1); +INSERT INTO phpbb_groups (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES (2, 1, 'Admin', 'Personal User', '', 1); + + +/* + -- User -> Group +*/ +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (1, -1, ''); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (2, 2, ''); + + +/* + -- Demo Topic +*/ +SET IDENTITY_INSERT phpbb_topics ON; + +INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, forum_id, topic_status, topic_type, topic_vote, topic_first_post_id, topic_last_post_id, topic_moved_id) VALUES (1, 'Welcome to phpBB 2', 2, '972086460', 0, 0, 1, 0, 0, 0, 1, 1, ''); + +SET IDENTITY_INSERT phpbb_topics OFF; + + +/* + -- Demo Post +*/ +SET IDENTITY_INSERT phpbb_posts ON; + +INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, post_username, poster_ip) VALUES (1, 1, 1, 2, 972086460, NULL, '7F000001'); +INSERT INTO phpbb_posts_text (post_id, post_subject, post_text) VALUES (1, NULL, 'This is an example post in your phpBB 2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!'); + +SET IDENTITY_INSERT phpbb_posts OFF; + + +/* + -- Themes +*/ +SET IDENTITY_INSERT phpbb_themes ON; + +INSERT INTO phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, ''Courier New'', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', ''); + +SET IDENTITY_INSERT phpbb_themes OFF; + +INSERT INTO phpbb_themes_name (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name) VALUES (1, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', ''); + + +/* + -- Smilies +*/ +SET IDENTITY_INSERT phpbb_smilies ON; + +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 1, ':D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 2, ':-D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 3, ':grin:', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 4, ':)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 5, ':-)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 6, ':smile:', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 7, ':(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 8, ':-(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 9, ':sad:', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 10, ':o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 11, ':-o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 12, ':eek:', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 13, '8O', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 14, '8-O', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 15, ':shock:', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 16, ':?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 17, ':-?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 18, ':???:', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 19, '8)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 20, '8-)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 21, ':cool:', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 22, ':lol:', 'icon_lol.gif', 'Laughing'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 23, ':x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 24, ':-x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 25, ':mad:', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 26, ':P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 27, ':-P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 28, ':razz:', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 29, ':oops:', 'icon_redface.gif', 'Embarassed'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 30, ':cry:', 'icon_cry.gif', 'Crying or Very sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 31, ':evil:', 'icon_evil.gif', 'Evil or Very Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 32, ':twisted:', 'icon_twisted.gif', 'Twisted Evil'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 33, ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 34, ':wink:', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 35, ';)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 36, ';-)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 37, ':!:', 'icon_exclaim.gif', 'Exclamation'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 38, ':?:', 'icon_question.gif', 'Question'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 39, ':idea:', 'icon_idea.gif', 'Idea'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 40, ':arrow:', 'icon_arrow.gif', 'Arrow'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 41, ':|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 42, ':-|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 43, ':neutral:', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 44, ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green'); + +SET IDENTITY_INSERT phpbb_smilies OFF; + + +/* + -- Search Words +*/ +SET IDENTITY_INSERT phpbb_search_wordlist ON; + +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 1, 'example', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 2, 'post', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 3, 'phpbb', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 4, 'installation', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 5, 'delete', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 6, 'topic', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 7, 'forum', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 8, 'since', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 9, 'everything', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 10, 'seems', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 11, 'working', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 12, 'welcome', 0 ); + +SET IDENTITY_INSERT phpbb_search_wordlist OFF; + + +/* + -- Search Word Matches +*/ +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 1, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 2, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 4, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 5, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 6, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 7, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 8, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 9, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 10, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 11, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 12, 1, 1 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 1 ); + +COMMIT; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql new file mode 100644 index 0000000000..f25a0bf857 --- /dev/null +++ b/phpBB/install/schemas/mssql_schema.sql @@ -0,0 +1,678 @@ +/* + + mssql_schema.sql for phpBB2 (c) 2001, phpBB Group + + $Id$ + +*/ + +BEGIN TRANSACTION +GO + +CREATE TABLE [phpbb_auth_access] ( + [group_id] [int] NULL , + [forum_id] [int] NULL , + [auth_view] [smallint] NOT NULL , + [auth_read] [smallint] NOT NULL , + [auth_post] [smallint] NOT NULL , + [auth_reply] [smallint] NOT NULL , + [auth_edit] [smallint] NOT NULL , + [auth_delete] [smallint] NOT NULL , + [auth_sticky] [smallint] NOT NULL , + [auth_announce] [smallint] NOT NULL , + [auth_vote] [smallint] NOT NULL , + [auth_pollcreate] [smallint] NOT NULL , + [auth_attachments] [smallint] NOT NULL , + [auth_mod] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_banlist] ( + [ban_id] [int] IDENTITY (1, 1) NOT NULL , + [ban_userid] [int] NULL , + [ban_ip] [char] (40) NULL , + [ban_email] [varchar] (50) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_categories] ( + [cat_id] [int] IDENTITY (1, 1) NOT NULL , + [cat_title] [varchar] (50) NOT NULL , + [cat_order] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_config] ( + [config_name] [varchar] (255) NULL , + [config_value] [varchar] (255) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_disallow] ( + [disallow_id] [int] IDENTITY (1, 1) NOT NULL , + [disallow_username] [varchar] (100) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_forum_prune] ( + [prune_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] NOT NULL , + [prune_days] [int] NOT NULL , + [prune_freq] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_forums] ( + [forum_id] [int] NOT NULL , + [cat_id] [int] NOT NULL , + [forum_name] [varchar] (100) NOT NULL , + [forum_desc] [varchar] (255) NULL , + [forum_status] [smallint] NOT NULL , + [forum_order] [int] NOT NULL , + [forum_posts] [int] NOT NULL , + [forum_topics] [smallint] NOT NULL , + [forum_last_post_id] [int] NOT NULL , + [prune_next] [int] NULL , + [prune_enable] [smallint] NOT NULL , + [auth_view] [smallint] NOT NULL , + [auth_read] [smallint] NOT NULL , + [auth_post] [smallint] NOT NULL , + [auth_reply] [smallint] NOT NULL , + [auth_edit] [smallint] NOT NULL , + [auth_delete] [smallint] NOT NULL , + [auth_sticky] [smallint] NOT NULL , + [auth_announce] [smallint] NOT NULL , + [auth_vote] [smallint] NOT NULL , + [auth_pollcreate] [smallint] NOT NULL , + [auth_attachments] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_forums_watch] ( + [forum_id] [int] NOT NULL , + [user_id] [int] NOT NULL , + [notify_status] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_groups] ( + [group_id] [int] NOT NULL , + [group_type] [smallint] NULL , + [group_name] [varchar] (50) NOT NULL , + [group_description] [varchar] (255) NOT NULL , + [group_moderator] [int] NULL , + [group_single_user] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_posts] ( + [post_id] [int] IDENTITY (1, 1) NOT NULL , + [topic_id] [int] NOT NULL , + [forum_id] [int] NOT NULL , + [poster_id] [int] NOT NULL , + [post_time] [int] NOT NULL , + [poster_ip] [char] (40) NULL , + [post_username] [char] (25) NULL , + [enable_bbcode] [smallint] NULL , + [enable_html] [smallint] NULL , + [enable_smilies] [smallint] NULL , + [enable_sig] [smallint] NULL , + [post_edit_time] [int] NULL , + [post_edit_count] [smallint] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_posts_text] ( + [post_id] [int] NOT NULL , + [bbcode_uid] [char] (10) NULL , + [post_subject] [char] (60) NULL , + [post_text] [text] NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE TABLE [phpbb_privmsgs] ( + [privmsgs_id] [int] IDENTITY (1, 1) NOT NULL , + [privmsgs_type] [smallint] NOT NULL , + [privmsgs_subject] [varchar] (100) NOT NULL , + [privmsgs_from_userid] [int] NOT NULL , + [privmsgs_to_userid] [int] NOT NULL , + [privmsgs_date] [int] NOT NULL , + [privmsgs_ip] [char] (40) NOT NULL , + [privmsgs_enable_bbcode] [smallint] NULL , + [privmsgs_enable_html] [smallint] NULL , + [privmsgs_enable_smilies] [smallint] NULL , + [privmsgs_attach_sig] [smallint] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_privmsgs_text] ( + [privmsgs_text_id] [int] NOT NULL , + [privmsgs_bbcode_uid] [char] (10) NULL , + [privmsgs_text] [text] NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE TABLE [phpbb_ranks] ( + [rank_id] [int] IDENTITY (1, 1) NOT NULL , + [rank_title] [varchar] (50) NOT NULL , + [rank_min] [int] NULL , + [rank_special] [smallint] NULL , + [rank_image] [varchar] (50) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_search_results] ( + [search_id] [int] NOT NULL , + [session_id] [char] (32) NOT NULL , + [search_array] [text] NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE TABLE [phpbb_search_wordlist] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word_text] [varchar] (50) NOT NULL , + [word_common] [tinyint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_search_wordmatch] ( + [post_id] [int] NOT NULL , + [word_id] [int] NOT NULL , + [title_match] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_sessions] ( + [session_id] [char] (32) NOT NULL , + [session_user_id] [int] NOT NULL , + [session_start] [int] NULL , + [session_time] [int] NULL , + [session_ip] [char] (40) NOT NULL , + [session_page] [int] NULL , + [session_logged_in] [smallint] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_smilies] ( + [smilies_id] [int] IDENTITY (1, 1) NOT NULL , + [code] [varchar] (10) NOT NULL , + [smile_url] [varchar] (50) NOT NULL , + [emoticon] [varchar] (50) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_themes] ( + [themes_id] [int] IDENTITY (1, 1) NOT NULL , + [template_name] [varchar] (30) NOT NULL , + [style_name] [varchar] (50) NOT NULL , + [head_stylesheet] [varchar] (50) NULL , + [body_background] [varchar] (50) NULL , + [body_bgcolor] [char] (6) NULL , + [body_text] [char] (6) NULL , + [body_link] [char] (6) NULL , + [body_vlink] [char] (6) NULL , + [body_alink] [char] (6) NULL , + [body_hlink] [char] (6) NULL , + [tr_color1] [char] (6) NULL , + [tr_color2] [char] (6) NULL , + [tr_color3] [char] (6) NULL , + [tr_class1] [varchar] (25) NULL , + [tr_class2] [varchar] (25) NULL , + [tr_class3] [varchar] (25) NULL , + [th_color1] [char] (6) NULL , + [th_color2] [char] (6) NULL , + [th_color3] [char] (6) NULL , + [th_class1] [varchar] (25) NULL , + [th_class2] [varchar] (25) NULL , + [th_class3] [varchar] (25) NULL , + [td_color1] [char] (6) NULL , + [td_color2] [char] (6) NULL , + [td_color3] [char] (6) NULL , + [td_class1] [varchar] (25) NULL , + [td_class2] [varchar] (25) NULL , + [td_class3] [varchar] (25) NULL , + [fontface1] [varchar] (50) NULL , + [fontface2] [varchar] (50) NULL , + [fontface3] [varchar] (50) NULL , + [fontsize1] [smallint] NULL , + [fontsize2] [smallint] NULL , + [fontsize3] [smallint] NULL , + [fontcolor1] [char] (6) NULL , + [fontcolor2] [char] (6) NULL , + [fontcolor3] [char] (6) NULL , + [span_class1] [varchar] (25) NULL , + [span_class2] [varchar] (25) NULL , + [span_class3] [varchar] (25) NULL , + [img_size_poll] [smallint] NULL , + [img_size_privmsg] [smallint] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_themes_name] ( + [themes_id] [int] NOT NULL , + [tr_color1_name] [varchar] (50) NULL , + [tr_color2_name] [varchar] (50) NULL , + [tr_color3_name] [varchar] (50) NULL , + [tr_class1_name] [varchar] (50) NULL , + [tr_class2_name] [varchar] (50) NULL , + [tr_class3_name] [varchar] (50) NULL , + [th_color1_name] [varchar] (50) NULL , + [th_color2_name] [varchar] (50) NULL , + [th_color3_name] [varchar] (50) NULL , + [th_class1_name] [varchar] (50) NULL , + [th_class2_name] [varchar] (50) NULL , + [th_class3_name] [varchar] (50) NULL , + [td_color1_name] [varchar] (50) NULL , + [td_color2_name] [varchar] (50) NULL , + [td_color3_name] [varchar] (50) NULL , + [td_class1_name] [varchar] (50) NULL , + [td_class2_name] [varchar] (50) NULL , + [td_class3_name] [varchar] (50) NULL , + [fontface1_name] [varchar] (50) NULL , + [fontface2_name] [varchar] (50) NULL , + [fontface3_name] [varchar] (50) NULL , + [fontsize1_name] [varchar] (50) NULL , + [fontsize2_name] [varchar] (50) NULL , + [fontsize3_name] [varchar] (50) NULL , + [fontcolor1_name] [varchar] (50) NULL , + [fontcolor2_name] [varchar] (50) NULL , + [fontcolor3_name] [varchar] (50) NULL , + [span_class1_name] [varchar] (50) NULL , + [span_class2_name] [varchar] (50) NULL , + [span_class3_name] [varchar] (50) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_topics] ( + [topic_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] NOT NULL , + [topic_title] [varchar] (60) NOT NULL , + [topic_poster] [int] NOT NULL , + [topic_time] [int] NOT NULL , + [topic_views] [int] NOT NULL , + [topic_replies] [int] NOT NULL , + [topic_status] [smallint] NOT NULL , + [topic_type] [smallint] NOT NULL , + [topic_vote] [smallint] NOT NULL , + [topic_first_post_id] [int] NULL , + [topic_last_post_id] [int] NULL , + [topic_moved_id] [int] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_topics_watch] ( + [topic_id] [int] NOT NULL , + [user_id] [int] NOT NULL , + [notify_status] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_user_group] ( + [group_id] [int] NOT NULL , + [user_id] [int] NOT NULL , + [user_pending] [smallint] NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_users] ( + [user_id] [int] NOT NULL , + [user_active] [smallint] NULL , + [username] [varchar] (25) NOT NULL , + [user_password] [varchar] (32) NOT NULL , + [user_session_time] [int] NOT NULL , + [user_session_page] [smallint] NOT NULL , + [user_lastvisit] [int] NOT NULL , + [user_regdate] [int] NOT NULL , + [user_level] [smallint] NOT NULL , + [user_posts] [int] NOT NULL , + [user_timezone] [decimal] (4,2) NOT NULL , + [user_style] [int] NULL , + [user_lang] [varchar] (255) NULL , + [user_dateformat] [varchar] (14) NOT NULL , + [user_new_privmsg] [smallint] NOT NULL , + [user_unread_privmsg] [smallint] NOT NULL , + [user_last_privmsg] [int] NOT NULL , + [user_emailtime] [int] NOT NULL , + [user_viewemail] [smallint] NULL , + [user_attachsig] [smallint] NULL , + [user_allowhtml] [smallint] NULL , + [user_allowbbcode] [smallint] NULL , + [user_allowsmile] [smallint] NULL , + [user_allowavatar] [smallint] NULL , + [user_allow_pm] [smallint] NOT NULL , + [user_allow_viewonline] [smallint] NOT NULL , + [user_notify_pm] [smallint] NOT NULL , + [user_popup_pm] [smallint] NULL , + [user_rank] [int] NULL , + [user_avatar_type] [smallint] NULL , + [user_avatar] [varchar] (100) NULL , + [user_email] [varchar] (255) NULL , + [user_icq] [varchar] (15) NULL , + [user_website] [varchar] (100) NULL , + [user_occ] [varchar] (100) NULL , + [user_from] [varchar] (100) NULL , + [user_sig] [text] NULL , + [user_sig_bbcode_uid] [char] (10) NULL , + [user_aim] [varchar] (255) NULL , + [user_yim] [varchar] (255) NULL , + [user_msnm] [varchar] (255) NULL , + [user_interests] [varchar] (255) NULL , + [user_actkey] [varchar] (32) NULL , + [user_newpasswd] [varchar] (32) NULL , + [user_notify] [smallint] NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +CREATE TABLE [phpbb_vote_desc] ( + [vote_id] [int] IDENTITY (1, 1) NOT NULL , + [topic_id] [int] NOT NULL , + [vote_text] [varchar] (255) NOT NULL , + [vote_start] [int] NOT NULL , + [vote_length] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_vote_results] ( + [vote_id] [int] NOT NULL , + [vote_option_id] [int] NOT NULL , + [vote_option_text] [varchar] (255) NOT NULL , + [vote_result] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_vote_voters] ( + [vote_id] [int] NOT NULL , + [vote_user_id] [int] NOT NULL , + [vote_user_ip] [char] (40) NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_words] ( + [word_id] [int] IDENTITY (1, 1) NOT NULL , + [word] [varchar] (255) NOT NULL , + [replacement] [varchar] (255) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_banlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_banlist] PRIMARY KEY CLUSTERED + ( + [ban_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_categories] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_categories] PRIMARY KEY CLUSTERED + ( + [cat_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_disallow] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_disallow] PRIMARY KEY CLUSTERED + ( + [disallow_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forum_prune] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forum_prune] PRIMARY KEY CLUSTERED + ( + [prune_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_forums] PRIMARY KEY CLUSTERED + ( + [forum_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_groups] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_groups] PRIMARY KEY CLUSTERED + ( + [group_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_posts] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_posts] PRIMARY KEY CLUSTERED + ( + [post_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs] PRIMARY KEY CLUSTERED + ( + [privmsgs_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_privmsgs_text] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_privmsgs_text] PRIMARY KEY CLUSTERED + ( + [privmsgs_text_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_ranks] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_ranks] PRIMARY KEY CLUSTERED + ( + [rank_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_results] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_results] PRIMARY KEY CLUSTERED + ( + [search_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_search_wordlist] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_smilies] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_smilies] PRIMARY KEY CLUSTERED + ( + [smilies_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_themes] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_themes] PRIMARY KEY CLUSTERED + ( + [themes_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_themes_name] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_themes_name] PRIMARY KEY CLUSTERED + ( + [themes_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_topics] PRIMARY KEY CLUSTERED + ( + [topic_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED + ( + [user_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_vote_desc] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_vote_desc] PRIMARY KEY CLUSTERED + ( + [vote_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_words] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_words] PRIMARY KEY CLUSTERED + ( + [word_id] + ) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_auth_access] WITH NOCHECK ADD + CONSTRAINT [DF_phpbb_auth_access_auth_view] DEFAULT (0) FOR [auth_view], + CONSTRAINT [DF_phpbb_auth_access_auth_read] DEFAULT (0) FOR [auth_read], + CONSTRAINT [DF_phpbb_auth_access_auth_post] DEFAULT (0) FOR [auth_post], + CONSTRAINT [DF_phpbb_auth_access_auth_reply] DEFAULT (0) FOR [auth_reply], + CONSTRAINT [DF_phpbb_auth_access_auth_edit] DEFAULT (0) FOR [auth_edit], + CONSTRAINT [DF_phpbb_auth_access_auth_delete] DEFAULT (0) FOR [auth_delete], + CONSTRAINT [DF_phpbb_auth_access_auth_sticky] DEFAULT (0) FOR [auth_sticky], + CONSTRAINT [DF_phpbb_auth_access_auth_announce] DEFAULT (0) FOR [auth_announce], + CONSTRAINT [DF_phpbb_auth_access_auth_vote] DEFAULT (0) FOR [auth_vote], + CONSTRAINT [DF_phpbb_auth_access_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate], + CONSTRAINT [DF_phpbb_auth_access_auth_attachments] DEFAULT (0) FOR [auth_attachments], + CONSTRAINT [DF_phpbb_auth_access_auth_mod] DEFAULT (0) FOR [auth_mod] +GO + +ALTER TABLE [phpbb_forums] WITH NOCHECK ADD + CONSTRAINT [DF_phpbb_forums_forum_posts] DEFAULT (0) FOR [forum_posts], + CONSTRAINT [DF_phpbb_forums_forum_topics] DEFAULT (0) FOR [forum_topics], + CONSTRAINT [DF_phpbb_forums_forum_last_post_id] DEFAULT (0) FOR [forum_last_post_id], + CONSTRAINT [DF_phpbb_forums_prune_enable] DEFAULT (0) FOR [prune_enable], + CONSTRAINT [DF_phpbb_forums_auth_view] DEFAULT (0) FOR [auth_view], + CONSTRAINT [DF_phpbb_forums_auth_read] DEFAULT (0) FOR [auth_read], + CONSTRAINT [DF_phpbb_forums_auth_post] DEFAULT (0) FOR [auth_post], + CONSTRAINT [DF_phpbb_forums_auth_reply] DEFAULT (0) FOR [auth_reply], + CONSTRAINT [DF_phpbb_forums_auth_edit] DEFAULT (0) FOR [auth_edit], + CONSTRAINT [DF_phpbb_forums_auth_delete] DEFAULT (0) FOR [auth_delete], + CONSTRAINT [DF_phpbb_forums_auth_sticky] DEFAULT (0) FOR [auth_sticky], + CONSTRAINT [DF_phpbb_forums_auth_announce] DEFAULT (0) FOR [auth_announce], + CONSTRAINT [DF_phpbb_forums_auth_vote] DEFAULT (0) FOR [auth_vote], + CONSTRAINT [DF_phpbb_forums_auth_pollcreate] DEFAULT (0) FOR [auth_pollcreate], + CONSTRAINT [DF_phpbb_forums_auth_attachments] DEFAULT (0) FOR [auth_attachments] +GO + +ALTER TABLE [phpbb_search_wordlist] WITH NOCHECK ADD + CONSTRAINT [DF_phpbb_search_wordlist_word_common] DEFAULT (0) FOR [word_common] +GO + +ALTER TABLE [phpbb_topics] WITH NOCHECK ADD + CONSTRAINT [DF_phpbb_topics_topic_views] DEFAULT (0) FOR [topic_views], + CONSTRAINT [DF_phpbb_topics_topic_replies] DEFAULT (0) FOR [topic_replies], + CONSTRAINT [DF_phpbb_topics_topic_status] DEFAULT (0) FOR [topic_status], + CONSTRAINT [DF_phpbb_topics_topic_type] DEFAULT (0) FOR [topic_type], + CONSTRAINT [DF_phpbb_topics_topic_vote] DEFAULT (0) FOR [topic_vote], + CONSTRAINT [DF_phpbb_topics_topic_moved_id] DEFAULT (0) FOR topic_moved_id +GO + +ALTER TABLE [phpbb_users] WITH NOCHECK ADD + CONSTRAINT [DF_phpbb_users_user_level] DEFAULT (0) FOR [user_level], + CONSTRAINT [DF_phpbb_users_user_posts] DEFAULT (0) FOR [user_posts], + CONSTRAINT [DF_phpbb_users_user_session_time] DEFAULT (0) FOR [user_session_time], + CONSTRAINT [DF_phpbb_users_user_session_page] DEFAULT (0) FOR [user_session_page], + CONSTRAINT [DF_phpbb_users_user_lastvisit] DEFAULT (0) FOR [user_lastvisit], + CONSTRAINT [DF_phpbb_users_user_new_privmsg] DEFAULT (0) FOR [user_new_privmsg], + CONSTRAINT [DF_phpbb_users_user_unread_privmsg] DEFAULT (0) FOR [user_unread_privmsg], + CONSTRAINT [DF_phpbb_users_user_last_privmsg] DEFAULT (0) FOR [user_last_privmsg], + CONSTRAINT [DF_phpbb_users_user_emailtime] DEFAULT (0) FOR [user_emailtime], + CONSTRAINT [DF_phpbb_users_user_viewemail] DEFAULT (1) FOR [user_viewemail], + CONSTRAINT [DF_phpbb_users_user_attachsig] DEFAULT (1) FOR [user_attachsig], + CONSTRAINT [DF_phpbb_users_user_allowhtml] DEFAULT (0) FOR [user_allowhtml], + CONSTRAINT [DF_phpbb_users_user_allowbbcode] DEFAULT (1) FOR [user_allowbbcode], + CONSTRAINT [DF_phpbb_users_user_allowsmile] DEFAULT (1) FOR [user_allowsmile], + CONSTRAINT [DF_phpbb_users_user_allowavatar] DEFAULT (1) FOR [user_allowavatar], + CONSTRAINT [DF_phpbb_users_user_allow_pm] DEFAULT (1) FOR [user_allow_pm], + CONSTRAINT [DF_phpbb_users_user_allow_viewonline] DEFAULT (1) FOR [user_allow_viewonline], + CONSTRAINT [DF_phpbb_users_user_notify_pm] DEFAULT (1) FOR [user_notify_pm], + CONSTRAINT [DF_phpbb_users_user_popup_pm] DEFAULT (1) FOR [user_popup_pm], + CONSTRAINT [DF_phpbb_users_user_avatar_type] DEFAULT (0) FOR [user_avatar_type] +GO + + CREATE INDEX [IX_phpbb_auth_access] ON [phpbb_auth_access]([group_id], [forum_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_banlist] ON [phpbb_banlist]([ban_userid], [ban_ip]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_categories] ON [phpbb_categories]([cat_order]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_forum_prune] ON [phpbb_forum_prune]([forum_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_forums] ON [phpbb_forums]([cat_id], [forum_order], [forum_last_post_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_forums_watch] ON [phpbb_forums_watch]([forum_id], [user_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_groups] ON [phpbb_groups]([group_single_user]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_posts] ON [phpbb_posts]([topic_id], [forum_id], [poster_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_posts_text] ON [phpbb_posts_text]([post_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_privmsgs] ON [phpbb_privmsgs]([privmsgs_from_userid], [privmsgs_to_userid]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_ranks] ON [phpbb_ranks]([rank_min], [rank_special]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_search_results] ON [phpbb_search_results]([session_id]) ON [PRIMARY] +GO + + CREATE UNIQUE INDEX [IX_phpbb_search_wordlist] ON [phpbb_search_wordlist]([word_text]) WITH IGNORE_DUP_KEY ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_search_wordlist_1] ON [phpbb_search_wordlist]([word_common]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_search_wordmatch] ON [phpbb_search_wordmatch]([post_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_search_wordmatch_1] ON [phpbb_search_wordmatch]([word_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_sessions] ON [phpbb_sessions]([session_id], [session_user_id], [session_ip], [session_logged_in]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_topics] ON [phpbb_topics]([forum_id], [topic_type], [topic_first_post_id], [topic_last_post_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_topics_watch] ON [phpbb_topics_watch]([topic_id], [user_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_users] ON [phpbb_users]([user_session_time]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_user_group] ON [phpbb_user_group]([group_id], [user_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_vote_desc] ON [phpbb_vote_desc]([topic_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_vote_results] ON [phpbb_vote_results]([vote_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_vote_results_1] ON [phpbb_vote_results]([vote_option_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_vote_voters] ON [phpbb_vote_voters]([vote_id]) ON [PRIMARY] +GO + + CREATE INDEX [IX_phpbb_vote_voters_1] ON [phpbb_vote_voters]([vote_user_id]) ON [PRIMARY] +GO + +COMMIT +GO diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql new file mode 100644 index 0000000000..2e471522f1 --- /dev/null +++ b/phpBB/install/schemas/mysql_basic.sql @@ -0,0 +1,309 @@ +# +# Basic DB data for phpBB2 devel +# +# $Id$ +# + +# -- Config +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc','A _little_ text to describe your forum'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name','phpbb22'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path','/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length','3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html_tags','b,i,u,pre'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','30'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars/upload'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('icons_path','images/icons'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '2.0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '2.1.1 [20021119]'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_chars','3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','90'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','90'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_method','db'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('lastread', '432000'); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_id', '2', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_username', '', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_users', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_posts', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_topics', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('session_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_last_gc', '0', 1); + +# -- auth options +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_list', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_read', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_post', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_reply', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_quote', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_edit', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_delete', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_poll', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_vote', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_announce', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_sticky', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_attach', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_download', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_html', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_bbcode', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_smilies', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_img', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_flash', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_sigs', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_search', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_email', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_rate', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_print', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_ignoreflood', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_ignorequeue', 1); + +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_edit', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_delete', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_move', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_lock', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_split', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_merge', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_approve', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_unrate', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_auth', 1, 1); + +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_server', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_defaults', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_board', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_cookies', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_clearlogs', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_words', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_icons', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_bbcode', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_attach', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_events', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_email', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_styles', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_user', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_useradd', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_userdel', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_ranks', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_ban', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_names', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_group', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_groupadd', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_groupdel', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_forum', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_forumadd', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_forumdel', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_prune', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_auth', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_authmods', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_authadmins', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_backup', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_restore', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_search', 1); + +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_email', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_pm', 1); +INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_avatar', 1); + + +# -- phpbb_styles +INSERT INTO phpbb_styles (style_id, template_id, theme_id, imageset_id, style_name) VALUES (1, 1, 1, 1, 'subSilver'); + +# -- phpbb_styles_imageset +INSERT INTO phpbb_styles_imageset (imageset_id, imageset_name, imageset_path, post_new, post_locked, post_pm, reply_new, reply_pm, reply_locked, icon_quote, icon_edit, icon_search, icon_profile, icon_pm, icon_email, icon_www, icon_icq, icon_aim, icon_yim, icon_msnm, icon_no_email, icon_no_www, icon_no_icq, icon_no_aim, icon_no_yim, icon_no_msnm, icon_delete, icon_ip, goto_post, goto_post_new, goto_post_latest, goto_post_newest, forum, forum_new, forum_locked, sub_forum, sub_forum_new, folder, folder_new, folder_hot, folder_hot_new, folder_locked, folder_locked_new, folder_sticky, folder_sticky_new, folder_announce, folder_announce_new, topic_watch, topic_unwatch, poll_left, poll_center, poll_right, rating) VALUES (1, 'subSilver © phpBB Group', 'subSilver', '"imagesets/subSilver/{LANG}/post.gif" width="82" height="25" border="0"', '"imagesets/subSilver/{LANG}/reply-locked.gif" width="82" height="25" border="0"', '"imagesets/subSilver/{LANG}/post.gif" width="82" height="25" border="0"', '"imagesets/subSilver/{LANG}/reply.gif" width="88" height="25" border="0"', '"imagesets/subSilver/{LANG}/reply.gif" width="88" height="25" border="0"', '"imagesets/subSilver/{LANG}/reply-locked.gif" width="82" height="25" border="0"', '"imagesets/subSilver/{LANG}/icon_quote.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_edit.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_search.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_profile.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_pm.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_email.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_www.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_icq_add.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_aim.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_yim.gif" width="59" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_msnm.gif" width="59" height="18" border="0"', '', '', '', '', '', '', '"imagesets/subSilver/icon_delete.gif" width="16" height="18" border="0"', '"imagesets/subSilver/{LANG}/icon_ip.gif" width="16" height="18" border="0"', '"imagesets/subSilver/icon_minipost.gif" width="12" height="9" border="0"', '"imagesets/subSilver/icon_minipost_new.gif" width="12" height="9" border="0"', '"imagesets/subSilver/icon_latest_reply.gif" width="18" height="9" border="0"', '"imagesets/subSilver/icon_newest_reply.gif" width="18" height="9" border="0"', '"imagesets/subSilver/folder_big.gif" width="46" height="25" border="0"', '"imagesets/subSilver/folder_new_big.gif" width="46" height="25" border="0"', '"imagesets/subSilver/folder_locked_big.gif" width="46" height="25" border="0"', '"imagesets/subSilver/subfolder_big.gif" width="46" height="25" border="0"', '"imagesets/subSilver/subfolder_new_big.gif" width="46" height="25" border="0"', '"imagesets/subSilver/folder.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_new.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_hot.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_new_hot.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_lock.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_lock_new.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_sticky.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_sticky_new.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_announce.gif" width="19" height="18" border="0"', '"imagesets/subSilver/folder_announce_new.gif" width="19" height="18" border="0"', '', '', '"imagesets/subSilver/voting_lcap.gif" width="4" height="12" border="0"', '"imagesets/subSilver/voting_rcap.gif" height="12" border="0"', '"imagesets/subSilver/voting_bar.gif" width="4" height="12" border="0"', '"imagesets/subSilver/ratings/{RATE}.gif" width="45" height="17" border="0"'); + +# -- phpbb_styles_template +INSERT INTO phpbb_styles_template (template_id, template_name, template_path, poll_length, pm_box_length, compile_crc) VALUES (1, 'subSilver © phpBB Group', 'subSilver', 205, 175, ''); + +# -- phpbb_styles_theme +INSERT INTO phpbb_styles_theme (theme_id, css_data, css_external) VALUES (1, 'th { background-image: url(templates/subSilver/images/cellpic3.gif) }\r\ntd.cat { background-image: url(templates/subSilver/images/cellpic1.gif) }\r\ntd.rowpic { background-image: url(templates/subSilver/images/cellpic2.jpg); background-repeat: repeat-y }\r\ntd.icqback { background-image: url(templates/subSilver/images/icon_icq_add.gif); background-repeat: no-repeat }\r\ntd.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom { background-image: url(templates/subSilver/images/cellpic1.gif) }\r\nth.thTop { background-image: url(templates/subSilver/images/cellpic3.gif) }', 'subSilver/subSilver.css'); + + +# -- Forums +INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, left_id, right_id, parent_id, forum_postable, forum_posts, forum_topics, forum_last_post_id, forum_last_poster_id, forum_last_poster_name) VALUES (1, 'My first Category', '', 1, 4, 0, 0, 1, 1, 1, 2, 'Admin'); + +INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, left_id, right_id, parent_id, forum_postable, forum_posts, forum_topics, forum_last_post_id, forum_last_poster_id, forum_last_poster_name) VALUES (2, 'Test Forum 1', 'This is just a test forum.', 2, 3, 1, 1, 1, 1, 1, 2, 'Admin'); + + +# -- Users +INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 0, 'Anonymous', 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', '', '', '', '', 0, 0); + +# -- username: admin password: admin (change this or remove it once everything is working!) +INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active, user_founder) VALUES ( 2, 'Admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'en', 0, 'd M Y h:i a', '', '', 0, 1, 1); + + +# -- Ranks +INSERT INTO phpbb_ranks (rank_id, rank_title, rank_min, rank_special, rank_image) VALUES ( 1, 'Site Admin', -1, 1, NULL); + + +# -- Groups +INSERT INTO phpbb_groups (group_id, group_name, group_type) VALUES (1, 'GUESTS', 3); +INSERT INTO phpbb_groups (group_id, group_name, group_type) VALUES (2, 'INACTIVE', 3); +INSERT INTO phpbb_groups (group_id, group_name, group_type) VALUES (3, 'REGISTERED', 3); +INSERT INTO phpbb_groups (group_id, group_name, group_type) VALUES (4, 'SUPER_MODERATORS', 3); +INSERT INTO phpbb_groups (group_id, group_name, group_type) VALUES (5, 'ADMINISTRATORS', 3); + + +# -- User -> Group +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (1, 0, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (3, 2, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (5, 2, 0); + + +# -- User auth +INSERT INTO phpbb_auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) SELECT 2, 1, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value LIKE 'm_%'; +INSERT INTO phpbb_auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) SELECT 2, 2, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value LIKE 'm_%'; + + +# -- Group auth +# -- give very limited rights to GUEST and INACTIVE groups +# -- give basic, typically non-contencious rights to REGISTERED users +# -- give all admin rights to ADMIN group +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 1, 1, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_bbcode', 'f_search', 'f_print'); +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 1, 2, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_bbcode', 'f_search', 'f_print'); + +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 2, 1, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_bbcode', 'f_search', 'f_print'); +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 2, 2, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_bbcode', 'f_search', 'f_print'); + +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 3, 1, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_', 'f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_edit', 'f_delete', 'f_vote', 'f_download', 'f_bbcode', 'f_smilies', 'f_sigs', 'f_search', 'f_email', 'f_print'); +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 3, 1, auth_option_id, 2 FROM phpbb_auth_options WHERE auth_value IN ('f_img', 'f_flash', 'f_poll', 'f_announce', 'f_sticky', 'f_attach', 'f_html', 'f_rate'); + +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 3, 2, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value IN ('f_', 'f_list', 'f_read', 'f_post', 'f_reply', 'f_quote', 'f_edit', 'f_delete', 'f_vote', 'f_download', 'f_bbcode', 'f_smilies', 'f_img', 'f_flash', 'f_sigs', 'f_search', 'f_email', 'f_print'); +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 3, 2, auth_option_id, 2 FROM phpbb_auth_options WHERE auth_value IN ('f_img', 'f_flash', 'f_poll', 'f_announce', 'f_sticky', 'f_attach', 'f_html', 'f_rate'); + +INSERT INTO phpbb_auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) SELECT 5, 0, auth_option_id, 1 FROM phpbb_auth_options WHERE auth_value LIKE 'a_%'; + + +# -- Moderator cache +INSERT INTO phpbb_moderator_cache (user_id, forum_id, username) VALUES (2, 2, 'admin'); + + +# -- Demo Topic +INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, forum_id, topic_status, topic_type, topic_first_post_id, topic_last_post_id, topic_last_poster_id, topic_last_post_time) VALUES (1, 'Welcome to phpBB 2', 2, '972086460', 0, 0, 2, 0, 0, 1, 1, 2, 972086460); + + +# -- Demo Post +INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, post_username, poster_ip) VALUES (1, 1, 2, 2, 972086460, NULL, '127.0.0.1'); +INSERT INTO phpbb_posts_text (post_id, post_subject, post_text) VALUES (1, NULL, 'This is an example post in your phpBB 2.2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!'); + + +# -- Topic icons +INSERT INTO phpbb_icons (icons_id, icons_url, icons_width, icons_height) VALUES (1, '', 0, 0); + + +# -- Smilies +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':D', 'icon_biggrin.gif', 'Very Happy', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':)', 'icon_smile.gif', 'Smile', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':(', 'icon_sad.gif', 'Sad', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':o', 'icon_surprised.gif', 'Surprised', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':eek:', 'icon_surprised.gif', 'Surprised', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( '8O', 'icon_eek.gif', 'Shocked', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':?', 'icon_confused.gif', 'Confused', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( '8)', 'icon_cool.gif', 'Cool', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':lol:', 'icon_lol.gif', 'Laughing', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':x', 'icon_mad.gif', 'Mad', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':P', 'icon_razz.gif', 'Razz', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':oops:', 'icon_redface.gif', 'Embarassed', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':cry:', 'icon_cry.gif', 'Crying or Very sad', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':evil:', 'icon_evil.gif', 'Evil or Very Mad', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':twisted:', 'icon_twisted.gif', 'Twisted Evil', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ';)', 'icon_wink.gif', 'Wink', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':!:', 'icon_exclaim.gif', 'Exclamation', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':?:', 'icon_question.gif', 'Question', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':idea:', 'icon_idea.gif', 'Idea', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':arrow:', 'icon_arrow.gif', 'Arrow', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':|', 'icon_neutral.gif', 'Neutral', 15, 15); +INSERT INTO phpbb_smilies (code, smile_url, emoticon, smile_width, smile_height) VALUES ( ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green', 15, 15); + + +# -- wordlist +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 1, 'example', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 2, 'post', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 3, 'phpbb', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 4, 'installation', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 5, 'delete', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 6, 'topic', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 7, 'forum', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 8, 'since', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 9, 'everything', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 10, 'seems', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 11, 'working', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 12, 'welcome', 0 ); + + +# -- wordmatch +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 1, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 2, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 4, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 5, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 6, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 7, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 8, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 9, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 10, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 11, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 12, 1, 1 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 1 ); diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql new file mode 100644 index 0000000000..26b756b2db --- /dev/null +++ b/phpBB/install/schemas/mysql_schema.sql @@ -0,0 +1,713 @@ +# +# phpbb - MySQL schema +# +# $Id$ +# + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_attach_desc' +# +CREATE TABLE phpbb_attach_desc ( + attach_id mediumint(8) UNSIGNED NOT NULL auto_increment, + attach_filename varchar(255) NOT NULL, + download_count mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + filename varchar(255) NOT NULL, + comment varchar(60), + mimetype varchar(60), + filesize int(20) NOT NULL, + filetime int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (attach_id) +); + +# -------------------------------------------------------- +# +# Table structure for table `phpbb_auth_groups` +# +CREATE TABLE phpbb_auth_groups ( + group_id mediumint(8) unsigned NOT NULL default '0', + forum_id mediumint(8) unsigned NOT NULL default '0', + auth_option_id smallint(5) unsigned NOT NULL default '0', + auth_allow_deny tinyint(4) NOT NULL default '1', + KEY group_id (group_id), + KEY auth_option_id (auth_option_id) +); + + +# +# Table structure for table `phpbb_auth_options` +# +CREATE TABLE phpbb_auth_options ( + auth_option_id tinyint(4) NOT NULL auto_increment, + auth_value char(20) NOT NULL, + is_global tinyint(1) DEFAULT '0' NOT NULL, + is_local tinyint(1) DEFAULT '0' NOT NULL, + founder_only tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (auth_option_id), + KEY auth_value (auth_value) +); + + +# -------------------------------------------------------- +# +# Table structure for table `phpbb_auth_users` +# +CREATE TABLE phpbb_auth_users ( + user_id mediumint(8) UNSIGNED NOT NULL default '0', + forum_id mediumint(8) unsigned NOT NULL default '0', + auth_option_id smallint(5) unsigned NOT NULL default '0', + auth_allow_deny tinyint(4) NOT NULL default '1', + KEY user_id (user_id), + KEY auth_option_id (auth_option_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_banlist' +# +CREATE TABLE phpbb_banlist ( + ban_id mediumint(8) UNSIGNED NOT NULL auto_increment, + ban_userid mediumint(8) UNSIGNED NOT NULL, + ban_ip varchar(40) NOT NULL, + ban_email varchar(50), + ban_start int(11), + ban_end int(11), + ban_reason varchar(255), + PRIMARY KEY (ban_id), + KEY ban_ip_user_id (ban_ip, ban_userid), + KEY ban_email (ban_email) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_config' +# +CREATE TABLE phpbb_config ( + config_name varchar(255) NOT NULL, + config_value varchar(255) NOT NULL, + is_dynamic tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (config_name), + KEY is_dynamic (is_dynamic) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_disallow' <- combine with banlist +# +CREATE TABLE phpbb_disallow ( + disallow_id mediumint(8) UNSIGNED NOT NULL auto_increment, + disallow_username varchar(30), + PRIMARY KEY (disallow_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_forums' +# +CREATE TABLE phpbb_forums ( + forum_id smallint(5) UNSIGNED NOT NULL auto_increment, + parent_id smallint(5) UNSIGNED NOT NULL, + left_id smallint(5) UNSIGNED NOT NULL, + right_id smallint(5) UNSIGNED NOT NULL, + forum_parents text, + forum_name varchar(150) NOT NULL, + forum_desc text, + forum_style tinyint(4) UNSIGNED, + forum_image varchar(50), + forum_status tinyint(4) DEFAULT '0' NOT NULL, + forum_postable tinyint(4) DEFAULT '0' NOT NULL, + forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_last_poster_id mediumint(8) DEFAULT '0' NOT NULL, + forum_last_post_time int(11) DEFAULT '0' NOT NULL, + forum_last_poster_name varchar(30), + display_on_index tinyint(1) DEFAULT '1' NOT NULL, + enable_post_count tinyint(1) DEFAULT '1' NOT NULL, + enable_moderate tinyint(1) DEFAULT '0' NOT NULL, + enable_icons tinyint(1) DEFAULT '1' NOT NULL, + enable_prune tinyint(1) DEFAULT '0' NOT NULL, + prune_next int(11) UNSIGNED, + prune_days tinyint(4) UNSIGNED NOT NULL, + prune_freq tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (forum_id), + KEY left_id (left_id), + KEY forum_last_post_id (forum_last_post_id) +); + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_forums_watch' +# +CREATE TABLE phpbb_forums_watch ( + forum_id smallint(5) UNSIGNED NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL default '0', + KEY forum_id (forum_id), + KEY user_id (user_id), + KEY notify_status (notify_status) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_groups' +# +CREATE TABLE phpbb_groups ( + group_id mediumint(8) NOT NULL auto_increment, + group_type tinyint(4) DEFAULT '1' NOT NULL, + group_name varchar(40) NOT NULL, + group_avatar varchar(100), + group_avatar_type tinyint(4), + group_colour varchar(6) DEFAULT '' NOT NULL, + group_description varchar(255) NOT NULL, + PRIMARY KEY (group_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_groups_moderator' +# +CREATE TABLE phpbb_groups_moderator ( + group_id mediumint(8) NOT NULL, + user_id mediumint(8) NOT NULL +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_icons' +# +CREATE TABLE phpbb_icons ( + icons_id tinyint(4) UNSIGNED NOT NULL auto_increment, + icons_url varchar(50), + icons_width tinyint(4) UNSIGNED NOT NULL, + icons_height tinyint(4) UNSIGNED NOT NULL, + PRIMARY KEY (icons_id) +); + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_lastread' +# +CREATE TABLE phpbb_lastread ( + user_id mediumint(9) NOT NULL default '0', + lastread_type tinyint(4) NOT NULL default '0', + forum_id smallint(6) NOT NULL default '0', + topic_id mediumint(9) NOT NULL default '0', + lastread_time int(4) NOT NULL default '0', + PRIMARY KEY (user_id,topic_id) +); + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_log_moderator' +# +CREATE TABLE phpbb_log_moderator ( + log_id mediumint(5) UNSIGNED NOT NULL DEFAULT '0' auto_increment, + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + log_ip varchar(40) NOT NULL, + log_time int(11) NOT NULL, + log_operation text, + log_data text, + PRIMARY KEY (log_id), + KEY forum_id (forum_id), + KEY user_id (user_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_log_admin' +# +CREATE TABLE phpbb_log_admin ( + log_id mediumint(5) UNSIGNED NOT NULL DEFAULT '0' auto_increment, + user_id mediumint(8) NOT NULL DEFAULT '0', + log_ip varchar(40) NOT NULL, + log_time int(11) NOT NULL, + log_operation text, + log_data text, + PRIMARY KEY (log_id), + KEY user_id (user_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_moderator_cache' +# +CREATE TABLE phpbb_moderator_cache ( + forum_id mediumint(8) unsigned NOT NULL, + user_id mediumint(8) unsigned default NULL, + username char(30) default NULL, + group_id mediumint(8) unsigned default NULL, + groupname char(30) default NULL, + display_on_index tinyint(4) NOT NULL default '1', + KEY display_on_index (display_on_index), + KEY forum_id (forum_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_vote_results' +# +CREATE TABLE phpbb_poll_results ( + poll_option_id tinyint(4) unsigned NOT NULL DEFAULT '0', + topic_id mediumint(8) UNSIGNED NOT NULL, + poll_option_text varchar(255) NOT NULL, + poll_option_total mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + KEY poll_option_id (poll_option_id), + KEY topic_id (topic_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_vote_voters' +# +CREATE TABLE phpbb_poll_voters ( + topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + poll_option_id tinyint(4) UNSIGNED NOT NULL DEFAULT '0', + vote_user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + vote_user_ip varchar(40) NOT NULL, + KEY topic_id (topic_id), + KEY vote_user_id (vote_user_id), + KEY vote_user_ip (vote_user_ip) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_posts' +# +CREATE TABLE phpbb_posts ( + post_id mediumint(8) UNSIGNED NOT NULL auto_increment, + topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + attach_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poster_ip varchar(40) NOT NULL, + post_time int(11) DEFAULT '0' NOT NULL, + post_approved tinyint(1) DEFAULT '1' NOT NULL, + post_username varchar(30), + enable_bbcode tinyint(1) DEFAULT '1' NOT NULL, + enable_html tinyint(1) DEFAULT '0' NOT NULL, + enable_smilies tinyint(1) DEFAULT '1' NOT NULL, + enable_magic_url tinyint(1) DEFAULT '1' NOT NULL, + enable_sig tinyint(1) DEFAULT '1' NOT NULL, + post_edit_time int(11), + post_edit_count smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (post_id), + KEY forum_id (forum_id), + KEY topic_id (topic_id), + KEY poster_id (poster_id), + KEY post_time (post_time) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_posts_text' +# +CREATE TABLE phpbb_posts_text ( + post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_uid varchar(10) NOT NULL, + bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + post_checksum varchar(32) NOT NULL, + post_subject varchar(60), + post_text text, + PRIMARY KEY (post_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_privmsgs' +# +CREATE TABLE phpbb_privmsgs ( + privmsgs_id mediumint(8) UNSIGNED NOT NULL auto_increment, + attach_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + privmsgs_type tinyint(4) DEFAULT '0' NOT NULL, + privmsgs_subject varchar(60) DEFAULT '0' NOT NULL, + privmsgs_from_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + privmsgs_to_userid mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + privmsgs_date int(11) DEFAULT '0' NOT NULL, + privmsgs_ip varchar(40) NOT NULL, + privmsgs_enable_bbcode tinyint(1) DEFAULT '1' NOT NULL, + privmsgs_enable_html tinyint(1) DEFAULT '0' NOT NULL, + privmsgs_enable_smilies tinyint(1) DEFAULT '1' NOT NULL, + privmsgs_attach_sig tinyint(1) DEFAULT '1' NOT NULL, + PRIMARY KEY (privmsgs_id), + KEY privmsgs_from_userid (privmsgs_from_userid), + KEY privmsgs_to_userid (privmsgs_to_userid) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_privmsgs_text' +# +CREATE TABLE phpbb_privmsgs_text ( + privmsgs_text_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + privmsgs_bbcode_uid varchar(10) DEFAULT '0' NOT NULL, + privmsgs_text text, + PRIMARY KEY (privmsgs_text_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_ranks' +# +CREATE TABLE phpbb_ranks ( + rank_id smallint(5) UNSIGNED NOT NULL auto_increment, + rank_title varchar(50) NOT NULL, + rank_min mediumint(8) DEFAULT '0' NOT NULL, + rank_special tinyint(1) DEFAULT '0', + rank_image varchar(100), + rank_colour varchar(6), + PRIMARY KEY (rank_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table `phpbb_search_results` +# +CREATE TABLE phpbb_search_results ( + search_id int(11) UNSIGNED NOT NULL default '0', + session_id varchar(32) NOT NULL default '', + search_array text NOT NULL, + PRIMARY KEY (search_id), + KEY session_id (session_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table `phpbb_search_wordlist` +# +CREATE TABLE phpbb_search_wordlist ( + word_text varchar(50) binary NOT NULL default '', + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word_common tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (word_text), + KEY word_id (word_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table `phpbb_search_wordmatch` +# +CREATE TABLE phpbb_search_wordmatch ( + post_id mediumint(8) UNSIGNED NOT NULL default '0', + word_id mediumint(8) UNSIGNED NOT NULL default '0', + title_match tinyint(1) NOT NULL default '0', + KEY word_id (word_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_sessions' +# +CREATE TABLE phpbb_sessions ( + session_id varchar(32) DEFAULT '' NOT NULL, + session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + session_last_visit int(11) DEFAULT '0' NOT NULL, + session_start int(11) DEFAULT '0' NOT NULL, + session_time int(11) DEFAULT '0' NOT NULL, + session_ip varchar(40) DEFAULT '0' NOT NULL, + session_browser varchar(100) DEFAULT '' NULL, + session_page varchar(100) DEFAULT '0' NOT NULL, + PRIMARY KEY (session_id), + KEY session_time (session_time) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_smilies' +# +CREATE TABLE phpbb_smilies ( + smilies_id tinyint(4) UNSIGNED NOT NULL auto_increment, + code char(10), + smile_url char(50), + smile_width tinyint(4) UNSIGNED NOT NULL, + smile_height tinyint(4) UNSIGNED NOT NULL, + smile_order tinyint(4) UNSIGNED NOT NULL, + emoticon char(50), + display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + PRIMARY KEY (smilies_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_styles' +# +CREATE TABLE phpbb_styles ( + style_id tinyint(4) UNSIGNED NOT NULL auto_increment, + template_id char(50) NOT NULL, + theme_id tinyint(4) UNSIGNED NOT NULL, + imageset_id tinyint(4) UNSIGNED NOT NULL, + style_name char(30) NOT NULL, + PRIMARY KEY (style_id), + KEY (template_id), + KEY (theme_id), + KEY (imageset_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_styles_template' +# +CREATE TABLE phpbb_styles_template ( + template_id tinyint(4) UNSIGNED NOT NULL auto_increment, + template_name varchar(30) NOT NULL, + template_path varchar(50) NOT NULL, + poll_length smallint(5) UNSIGNED NOT NULL, + pm_box_length smallint(5) UNSIGNED NOT NULL, + compile_crc text, + PRIMARY KEY (template_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_styles_theme' +# +CREATE TABLE phpbb_styles_theme ( + theme_id tinyint(4) UNSIGNED NOT NULL auto_increment, + theme_name varchar(60), + css_external varchar(100), + css_data text, + PRIMARY KEY (theme_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_styles_imageset' +# +CREATE TABLE phpbb_styles_imageset ( + imageset_id tinyint(4) UNSIGNED NOT NULL auto_increment, + imageset_name varchar(100), + imageset_path varchar(30), + post_new varchar(200), + post_locked varchar(200), + post_pm varchar(200), + reply_new varchar(200), + reply_pm varchar(200), + reply_locked varchar(200), + icon_profile varchar(200), + icon_pm varchar(200), + icon_delete varchar(200), + icon_ip varchar(200), + icon_quote varchar(200), + icon_search varchar(200), + icon_edit varchar(200), + icon_email varchar(200), + icon_www varchar(200), + icon_icq varchar(200), + icon_aim varchar(200), + icon_yim varchar(200), + icon_msnm varchar(200), + icon_no_email varchar(200) DEFAULT '', + icon_no_www varchar(200) DEFAULT '', + icon_no_icq varchar(200) DEFAULT '', + icon_no_aim varchar(200) DEFAULT '', + icon_no_yim varchar(200) DEFAULT '', + icon_no_msnm varchar(200) DEFAULT '', + goto_post varchar(200), + goto_post_new varchar(200), + goto_post_latest varchar(200), + goto_post_newest varchar(200), + forum varchar(200), + forum_new varchar(200), + forum_locked varchar(200), + sub_forum varchar(200), + sub_forum_new varchar(200), + folder varchar(200), + folder_new varchar(200), + folder_hot varchar(200), + folder_hot_new varchar(200), + folder_locked varchar(200), + folder_locked_new varchar(200), + folder_sticky varchar(200), + folder_sticky_new varchar(200), + folder_announce varchar(200), + folder_announce_new varchar(200), + topic_watch varchar(200), + topic_unwatch varchar(200), + poll_left varchar(200), + poll_center varchar(200), + poll_right varchar(200), + rating varchar(200), + PRIMARY KEY (imageset_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_topics' +# +CREATE TABLE phpbb_topics ( + topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, + forum_id smallint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + topic_title varchar(60) NOT NULL, + topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_time int(11) DEFAULT '0' NOT NULL, + topic_icon tinyint(4) UNSIGNED DEFAULT '1' NOT NULL, + topic_rating tinyint(4) DEFAULT '0' NOT NULL, + topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, + topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_first_poster_name varchar(30), + topic_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_last_poster_name varchar(30), + topic_last_post_time int(11) DEFAULT '0' NOT NULL, + topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + poll_title varchar(255) NOT NULL, + poll_start int(11) NOT NULL DEFAULT '0', + poll_length int(11) NOT NULL DEFAULT '0', + poll_last_vote int(11), + PRIMARY KEY (topic_id), + KEY forum_id (forum_id), + KEY topic_moved_id (topic_moved_id), + KEY topic_last_post_time (topic_last_post_time), + KEY topic_type (topic_type) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_topics_rating' +# +CREATE TABLE phpbb_topics_rating ( + topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_id tinyint(4) UNSIGNED UNSIGNED NOT NULL DEFAULT '0', + rating tinyint(4) NOT NULL, + KEY topic_id (topic_id), + KEY user_id (user_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_topics_watch' +# +CREATE TABLE phpbb_topics_watch ( + topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL default '0', + KEY topic_id (topic_id), + KEY user_id (user_id), + KEY notify_status (notify_status) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_user_group' +# +CREATE TABLE phpbb_user_group ( + group_id mediumint(8) DEFAULT '0' NOT NULL, + user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_pending tinyint(1), + KEY group_id (group_id), + KEY user_id (user_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_users' +# +CREATE TABLE phpbb_users ( + user_id mediumint(8) UNSIGNED NOT NULL auto_increment, + user_active tinyint(1) DEFAULT '1', + user_founder tinyint(1) DEFAULT '0' NOT NULL, + user_permissions text NULL, + user_ip varchar(40), + user_regdate int(11) DEFAULT '0' NOT NULL, + username varchar(30) NOT NULL, + user_password varchar(32) NOT NULL, + user_email varchar(60), + user_session_time int(11) DEFAULT '0' NOT NULL, + user_session_page smallint(5) DEFAULT '0' NOT NULL, + user_lastvisit int(11) DEFAULT '0' NOT NULL, + user_startpage varchar(100) DEFAULT '', + user_colour varchar(6) DEFAULT '' NOT NULL, + user_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + user_lang varchar(50), + user_timezone decimal(4,2) DEFAULT '0' NOT NULL, + user_dst tinyint(1) DEFAULT '0' NOT NULL, + user_dateformat varchar(15) DEFAULT 'd M Y H:i' NOT NULL, + user_style tinyint(4), + user_rank int(11) DEFAULT '0', + user_new_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + user_unread_privmsg smallint(5) UNSIGNED DEFAULT '0' NOT NULL, + user_last_privmsg int(11) DEFAULT '0' NOT NULL, + user_emailtime int(11), + user_sortby_type varchar(1) DEFAULT 'l' NOT NULL, + user_sortby_dir varchar(1) DEFAULT 'd' NOT NULL, + user_show_days tinyint(1) DEFAULT '0' NOT NULL, + user_viewemail tinyint(1) DEFAULT '1' NOT NULL, + user_viewsigs tinyint(1) DEFAULT '1' NOT NULL, + user_viewavatars tinyint(1) DEFAULT '1' NOT NULL, + user_viewimg tinyint(1) DEFAULT '1' NOT NULL, + user_attachsig tinyint(1), + user_allowhtml tinyint(1) DEFAULT '1', + user_allowbbcode tinyint(1) DEFAULT '1', + user_allowsmile tinyint(1) DEFAULT '1', + user_allowavatar tinyint(1) DEFAULT '1' NOT NULL, + user_allow_pm tinyint(1) DEFAULT '1' NOT NULL, + user_allow_email tinyint(1) DEFAULT '1' NOT NULL, + user_allow_viewonline tinyint(1) DEFAULT '1' NOT NULL, + user_notify tinyint(1) DEFAULT '1' NOT NULL, + user_notify_pm tinyint(1) DEFAULT '1' NOT NULL, + user_popup_pm tinyint(1) DEFAULT '0' NOT NULL, + user_avatar char(100), + user_avatar_type tinyint(4) DEFAULT '0' NOT NULL, + user_avatar_width tinyint(4) UNSIGNED, + user_avatar_height tinyint(4) UNSIGNED, + user_sig text, + user_sig_bbcode_uid varchar(10), + user_from varchar(100), + user_icq varchar(15), + user_aim varchar(255), + user_yim varchar(255), + user_msnm varchar(255), + user_website varchar(100), + user_occ varchar(100), + user_interests varchar(255), + user_actkey varchar(32), + user_newpasswd varchar(32), + PRIMARY KEY (user_id) +); + + +# -------------------------------------------------------- +# +# Table structure for table 'phpbb_words' +# +CREATE TABLE phpbb_words ( + word_id mediumint(8) UNSIGNED NOT NULL auto_increment, + word char(100) NOT NULL, + replacement char(100) NOT NULL, + PRIMARY KEY (word_id) +); diff --git a/phpBB/install/schemas/postgres_basic.sql b/phpBB/install/schemas/postgres_basic.sql new file mode 100644 index 0000000000..6f820ebb08 --- /dev/null +++ b/phpBB/install/schemas/postgres_basic.sql @@ -0,0 +1,184 @@ +/* +* Basic DB data for phpBB2 devel +* +* $Id$ +*/ + +-- Config +INSERT INTO phpbb_config (config_name, config_value) VALUES ('config_id','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc','A _little_ text to describe your forum'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name','phpbb2mysql'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path','/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length','3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html_tags','b,i,u,pre'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_theme_create','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_inbox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sentbox_privmsgs','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_savebox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.1.0 [20020421]'); + +-- Categories +INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 10); + + +-- Forums +INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 10, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3); + +-- Users +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 0, 1, 0, 1, 1, NULL, '', '', '', '', '', '', 0, 0); + +-- username: admin password: admin (change this or remove it once everything is working!) +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1); + + +-- Ranks +INSERT INTO phpbb_ranks (rank_id, rank_title, rank_min, rank_special, rank_image) VALUES ( 1, 'Site Admin', -1, 1, NULL); + + +-- Groups +INSERT INTO phpbb_groups (group_id, group_name, group_description, group_single_user) VALUES (1, 'Anonymous', 'Personal User', 1); +INSERT INTO phpbb_groups (group_id, group_name, group_description, group_single_user) VALUES (2, 'Admin', 'Personal User', 1); + + +-- User -> Group +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (1, -1, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (2, 2, 0); + + +-- Demo Topic +INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, forum_id, topic_status, topic_type, topic_vote, topic_first_post_id, topic_last_post_id) VALUES (1, 'Welcome to phpBB 2', 2, '972086460', 0, 0, 1, 0, 0, 0, 1, 1); + + +-- Demo Post +INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, post_username, poster_ip) VALUES (1, 1, 1, 2, 972086460, NULL, '7F000001'); +INSERT INTO phpbb_posts_text (post_id, post_subject, post_text) VALUES (1, NULL, 'This is an example post in your phpBB 2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!'); + + +-- Themes +INSERT INTO phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', NULL, 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', NULL, NULL, NULL, '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', NULL, 'row1', 'row2', NULL, 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, ''Courier New'', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', NULL, NULL, NULL); + +INSERT INTO phpbb_themes_name (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name) VALUES (1, 'The lightest row colour', 'The medium row color', 'The darkest row colour', NULL, NULL, NULL, 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', NULL, 'Background for topic posts', '2nd background for topic posts', NULL, 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', NULL, NULL, NULL); + + +-- Smilies +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':grin:', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':smile:', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':sad:', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':eek:', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8O', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8-O', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':shock:', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':???:', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( '8-)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':cool:', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':lol:', 'icon_lol.gif', 'Laughing'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':mad:', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':razz:', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':oops:', 'icon_redface.gif', 'Embarassed'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':cry:', 'icon_cry.gif', 'Crying or Very sad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':evil:', 'icon_evil.gif', 'Evil or Very Mad'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':twisted:', 'icon_twisted.gif', 'Twisted Evil'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':wink:', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ';)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ';-)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':!:', 'icon_exclaim.gif', 'Exclamation'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':?:', 'icon_question.gif', 'Question'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':idea:', 'icon_idea.gif', 'Idea'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':arrow:', 'icon_arrow.gif', 'Arrow'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':-|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':neutral:', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (code, smile_url, emoticon) VALUES ( ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green'); + + +-- wordlist +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 1, 'example', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 2, 'post', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 3, 'phpbb', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 4, 'installation', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 5, 'delete', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 6, 'topic', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 7, 'forum', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 8, 'since', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 9, 'everything', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 10, 'seems', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 11, 'working', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 12, 'welcome', 0 ); + + +-- wordmatch +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 1, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 2, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 4, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 5, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 6, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 7, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 8, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 9, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 10, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 11, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 12, 1, 1 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 1 ); diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql new file mode 100644 index 0000000000..ae236c9d94 --- /dev/null +++ b/phpBB/install/schemas/postgres_schema.sql @@ -0,0 +1,549 @@ +/* + phpBB2 PostgreSQL DB schema - phpBB group 2001 + + + $Id$ +*/ + +CREATE SEQUENCE phpbb_banlist_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_categories_id_seq start 2 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_disallow_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_posts_id_seq start 2 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_privmsgs_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_ranks_id_seq start 2 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_search_wordlist_id_seq start 13 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_smilies_id_seq start 42 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_themes_id_seq start 7 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_topics_id_seq start 2 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_users_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_words_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_groups_id_seq start 3 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_forum_prune_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; +CREATE SEQUENCE phpbb_vote_desc_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1; + +/* -------------------------------------------------------- + Table structure for table phpbb_auth_access +-------------------------------------------------------- */ +CREATE TABLE phpbb_auth_access ( + group_id int DEFAULT '0' NOT NULL, + forum_id int2 DEFAULT '0' NOT NULL, + auth_view int2 DEFAULT '0' NOT NULL, + auth_read int2 DEFAULT '0' NOT NULL, + auth_post int2 DEFAULT '0' NOT NULL, + auth_reply int2 DEFAULT '0' NOT NULL, + auth_edit int2 DEFAULT '0' NOT NULL, + auth_delete int2 DEFAULT '0' NOT NULL, + auth_announce int2 DEFAULT '0' NOT NULL, + auth_sticky int2 DEFAULT '0' NOT NULL, + auth_pollcreate int2 DEFAULT '0' NOT NULL, + auth_attachments int2 DEFAULT '0' NOT NULL, + auth_vote int2 DEFAULT '0' NOT NULL, + auth_mod int2 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_auth_access_pkey PRIMARY KEY (group_id, forum_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_groups +-------------------------------------------------------- */ +CREATE TABLE phpbb_groups ( + group_id int DEFAULT nextval('phpbb_groups_id_seq'::text) NOT NULL, + group_name varchar(40) NOT NULL, + group_type int2 DEFAULT '1' NOT NULL, + group_description varchar(255) NOT NULL, + group_moderator int4 DEFAULT '0' NOT NULL, + group_single_user int2 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_groups_pkey PRIMARY KEY (group_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_banlist +-------------------------------------------------------- */ +CREATE TABLE phpbb_banlist ( + ban_id int4 DEFAULT nextval('phpbb_banlist_id_seq'::text) NOT NULL, + ban_userid int4, + ban_ip char(40), + ban_email varchar(255), + CONSTRAINT phpbb_banlist_pkey PRIMARY KEY (ban_id) +); +CREATE INDEX ban_userid_phpbb_banlist_index ON phpbb_banlist (ban_userid); + + +/* -------------------------------------------------------- + Table structure for table phpbb_categories +-------------------------------------------------------- */ +CREATE TABLE phpbb_categories ( + cat_id int4 DEFAULT nextval('phpbb_categories_id_seq'::text) NOT NULL, + cat_title varchar(100), + cat_order int4, + CONSTRAINT phpbb_categories_pkey PRIMARY KEY (cat_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_config +-------------------------------------------------------- */ +CREATE TABLE phpbb_config ( + config_name varchar(255) NOT NULL, + config_value varchar(255) NOT NULL, + CONSTRAINT phpbb_config_pkey PRIMARY KEY (config_name) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_disallow +-------------------------------------------------------- */ +CREATE TABLE phpbb_disallow ( + disallow_id int4 DEFAULT nextval('phpbb_disallow_id_seq'::text) NOT NULL, + disallow_username varchar(25), + CONSTRAINT phpbb_disallow_pkey PRIMARY KEY (disallow_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_forums +-------------------------------------------------------- */ +CREATE TABLE phpbb_forums ( + forum_id int4 DEFAULT '0' NOT NULL, + cat_id int4, + forum_name varchar(150), + forum_desc text, + forum_status int2 DEFAULT '0' NOT NULL, + forum_order int4 DEFAULT '1' NOT NULL, + forum_posts int4 DEFAULT '0' NOT NULL, + forum_topics int4 DEFAULT '0' NOT NULL, + forum_last_post_id int4 DEFAULT '0' NOT NULL, + prune_enable int2 DEFAULT '0' NOT NULL, + prune_next int, + auth_view int2 DEFAULT '0' NOT NULL, + auth_read int2 DEFAULT '0' NOT NULL, + auth_post int2 DEFAULT '0' NOT NULL, + auth_reply int2 DEFAULT '0' NOT NULL, + auth_edit int2 DEFAULT '0' NOT NULL, + auth_delete int2 DEFAULT '0' NOT NULL, + auth_announce int2 DEFAULT '0' NOT NULL, + auth_sticky int2 DEFAULT '0' NOT NULL, + auth_pollcreate int2 DEFAULT '0' NOT NULL, + auth_vote int2 DEFAULT '0' NOT NULL, + auth_attachments int2 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_forums_pkey PRIMARY KEY (forum_id) +); +CREATE INDEX cat_id_phpbb_forums_index ON phpbb_forums (cat_id); +CREATE INDEX forum_id_phpbb_forums_index ON phpbb_forums (forum_id); +CREATE INDEX forums_order_phpbb_forums_index ON phpbb_forums (forum_order); +CREATE INDEX forum_last_post_id_phpbb_forums_index ON phpbb_forums (forum_last_post_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_forums_watch +-------------------------------------------------------- */ +CREATE TABLE phpbb_forums_watch ( + forum_id int4, + user_id int4, + notify_status int2 NOT NULL default '0' +); +CREATE INDEX forum_id_phpbb_forums_watch_index ON phpbb_forums_watch (forum_id); +CREATE INDEX user_id_phpbb_forums_watch_index ON phpbb_forums_watch (user_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_forum_prune +-------------------------------------------------------- */ +CREATE TABLE phpbb_forum_prune ( + prune_id int4 DEFAULT nextval('phpbb_forum_prune_id_seq'::text) NOT NULL, + forum_id int4 NOT NULL, + prune_days int4 NOT NULL, + prune_freq int4 NOT NULL, + CONSTRAINT phpbb_forum_prune_pkey PRIMARY KEY (prune_id) +); +CREATE INDEX prune_id_phpbb_forum_prune_index ON phpbb_forum_prune (prune_id); +CREATE INDEX forum_id_phpbb_forum_prune_index ON phpbb_forum_prune (forum_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_posts +-------------------------------------------------------- */ +CREATE TABLE phpbb_posts ( + post_id int4 DEFAULT nextval('phpbb_posts_id_seq'::text) NOT NULL, + topic_id int4 DEFAULT '0' NOT NULL, + forum_id int4 DEFAULT '0' NOT NULL, + poster_id int4 DEFAULT '0' NOT NULL, + post_time int4 DEFAULT '0' NOT NULL, + post_username varchar(25), + poster_ip char(40) DEFAULT '' NOT NULL, + enable_bbcode int2 DEFAULT '1' NOT NULL, + enable_html int2 DEFAULT '0' NOT NULL, + enable_smilies int2 DEFAULT '1' NOT NULL, + enable_sig int2 DEFAULT '1' NOT NULL, + post_edit_time int4, + post_edit_count int2 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_posts_pkey PRIMARY KEY (post_id) +); +CREATE INDEX forum_id_phpbb_posts_index ON phpbb_posts (forum_id); +CREATE INDEX post_time_phpbb_posts_index ON phpbb_posts (post_time); +CREATE INDEX poster_id_phpbb_posts_index ON phpbb_posts (poster_id); +CREATE INDEX topic_id_phpbb_posts_index ON phpbb_posts (topic_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_posts_text +-------------------------------------------------------- */ +CREATE TABLE phpbb_posts_text ( + post_id int4 DEFAULT '0' NOT NULL, + bbcode_uid varchar(10) DEFAULT '' NOT NULL, + post_subject varchar(60), + post_text text, + CONSTRAINT phpbb_posts_text_pkey PRIMARY KEY (post_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_privmsgs +-------------------------------------------------------- */ +CREATE TABLE phpbb_privmsgs ( + privmsgs_id int4 DEFAULT nextval('phpbb_privmsgs_id_seq'::text) NOT NULL, + privmsgs_type int2 DEFAULT '0' NOT NULL, + privmsgs_subject varchar(255) DEFAULT '0' NOT NULL, + privmsgs_from_userid int4 DEFAULT '0' NOT NULL, + privmsgs_to_userid int4 DEFAULT '0' NOT NULL, + privmsgs_date int4 DEFAULT '0' NOT NULL, + privmsgs_ip char(40) NOT NULL, + privmsgs_enable_bbcode int2 DEFAULT '1' NOT NULL, + privmsgs_enable_html int2 DEFAULT '0' NOT NULL, + privmsgs_enable_smilies int2 DEFAULT '1' NOT NULL, + privmsgs_attach_sig int2 DEFAULT '1' NOT NULL, + CONSTRAINT phpbb_privmsgs_pkey PRIMARY KEY (privmsgs_id) +); +CREATE INDEX privmsgs_from_userid_index ON phpbb_privmsgs (privmsgs_from_userid); +CREATE INDEX privmsgs_to_userid_index ON phpbb_privmsgs (privmsgs_to_userid); + + +/* -------------------------------------------------------- + Table structure for table phpbb_privmsgs_text +-------------------------------------------------------- */ +CREATE TABLE phpbb_privmsgs_text ( + privmsgs_text_id int4 DEFAULT '0' NOT NULL, + privmsgs_bbcode_uid char(10) DEFAULT '0' NOT NULL, + privmsgs_text text, + CONSTRAINT phpbb_privmsgs_text_pkey PRIMARY KEY (privmsgs_text_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_ranks +-------------------------------------------------------- */ +CREATE TABLE phpbb_ranks ( + rank_id int4 DEFAULT nextval('phpbb_ranks_id_seq'::text) NOT NULL, + rank_title varchar(50) DEFAULT '' NOT NULL, + rank_min int4 DEFAULT '0' NOT NULL, + rank_special int2 DEFAULT '0', + rank_image varchar(255), + CONSTRAINT phpbb_ranks_pkey PRIMARY KEY (rank_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_search_results +-------------------------------------------------------- */ +CREATE TABLE phpbb_search_results ( + search_id int4 NOT NULL default '0', + session_id char(32) NOT NULL default '', + search_array text NOT NULL, + CONSTRAINT phpbb_search_results_pkey PRIMARY KEY (search_id) +); +CREATE INDEX session_id_phpbb_search_results ON phpbb_search_results (session_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_search_wordlist +-------------------------------------------------------- */ +CREATE TABLE phpbb_search_wordlist ( + word_id int4 DEFAULT nextval('phpbb_search_wordlist_id_seq'::text) NOT NULL, + word_text varchar(50) NOT NULL DEFAULT '', + word_common int2 NOT NULL DEFAULT '0', + CONSTRAINT phpbb_search_wordlist_pkey PRIMARY KEY (word_text) +); +CREATE INDEX word_id_phpbb_search_wordlist ON phpbb_search_wordlist (word_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_search_wordmatch +-------------------------------------------------------- */ +CREATE TABLE phpbb_search_wordmatch ( + post_id int4 NOT NULL default '0', + word_id int4 NOT NULL default '0', + title_match int2 NOT NULL default '0' +); +CREATE INDEX word_id_phpbb_search_wordmatch ON phpbb_search_wordmatch (word_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_sessions +-------------------------------------------------------- */ +CREATE TABLE phpbb_sessions ( + session_id char(32) DEFAULT '0' NOT NULL, + session_user_id int4 DEFAULT '0' NOT NULL, + session_start int4 DEFAULT '0' NOT NULL, + session_time int4 DEFAULT '0' NOT NULL, + session_ip char(40) DEFAULT '0' NOT NULL, + session_page int4 DEFAULT '0' NOT NULL, + session_logged_in int2 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_session_pkey PRIMARY KEY (session_id) +); +CREATE INDEX session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX session_id_ip_user_id ON phpbb_sessions (session_id, session_ip, session_user_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_smilies +-------------------------------------------------------- */ +CREATE TABLE phpbb_smilies ( + smilies_id int4 DEFAULT nextval('phpbb_smilies_id_seq'::text) NOT NULL, + code varchar(50), + smile_url varchar(100), + emoticon varchar(75), + CONSTRAINT phpbb_smilies_pkey PRIMARY KEY (smilies_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_themes +-------------------------------------------------------- */ +CREATE TABLE phpbb_themes ( + themes_id int4 DEFAULT nextval('phpbb_themes_id_seq'::text) NOT NULL, + style_name varchar(30), + template_name varchar(30) NOT NULL DEFAULT '', + head_stylesheet varchar(100), + body_background varchar(100), + body_bgcolor char(6), + body_text char(6), + body_link char(6), + body_vlink char(6), + body_alink char(6), + body_hlink char(6), + tr_color1 char(6), + tr_color2 char(6), + tr_color3 char(6), + tr_class1 varchar(25), + tr_class2 varchar(25), + tr_class3 varchar(25), + th_color1 char(6), + th_color2 char(6), + th_color3 char(6), + th_class1 varchar(25), + th_class2 varchar(25), + th_class3 varchar(25), + td_color1 char(6), + td_color2 char(6), + td_color3 char(6), + td_class1 varchar(25), + td_class2 varchar(25), + td_class3 varchar(25), + fontface1 varchar(50), + fontface2 varchar(50), + fontface3 varchar(50), + fontsize1 int2, + fontsize2 int2, + fontsize3 int2, + fontcolor1 char(6), + fontcolor2 char(6), + fontcolor3 char(6), + span_class1 varchar(25), + span_class2 varchar(25), + span_class3 varchar(25), + img_size_poll int2, + img_size_privmsg int2, + CONSTRAINT phpbb_themes_pkey PRIMARY KEY (themes_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_themes_name +-------------------------------------------------------- */ +CREATE TABLE phpbb_themes_name ( + themes_id int4 DEFAULT '0' NOT NULL, + tr_color1_name char(50), + tr_color2_name char(50), + tr_color3_name char(50), + tr_class1_name varchar(50), + tr_class2_name varchar(50), + tr_class3_name varchar(50), + th_color1_name char(50), + th_color2_name char(50), + th_color3_name char(50), + th_class1_name varchar(50), + th_class2_name varchar(50), + th_class3_name varchar(50), + td_color1_name char(50), + td_color2_name char(50), + td_color3_name char(50), + td_class1_name varchar(50), + td_class2_name varchar(50), + td_class3_name varchar(50), + fontface1_name varchar(50), + fontface2_name varchar(50), + fontface3_name varchar(50), + fontsize1_name varchar(50), + fontsize2_name varchar(50), + fontsize3_name varchar(50), + fontcolor1_name char(50), + fontcolor2_name char(50), + fontcolor3_name char(50), + span_class1_name varchar(50), + span_class2_name varchar(50), + span_class3_name varchar(50), + CONSTRAINT phpbb_themes_name_pkey PRIMARY KEY (themes_id) +); + + +/* -------------------------------------------------------- + Table structure for table phpbb_topics +-------------------------------------------------------- */ +CREATE TABLE phpbb_topics ( + topic_id int4 DEFAULT nextval('phpbb_topics_id_seq'::text) NOT NULL, + forum_id int4 DEFAULT '0' NOT NULL, + topic_title varchar(60) DEFAULT '' NOT NULL, + topic_poster int4 DEFAULT '0' NOT NULL, + topic_time int4 DEFAULT '0' NOT NULL, + topic_views int4 DEFAULT '0' NOT NULL, + topic_replies int4 DEFAULT '0' NOT NULL, + topic_status int2 DEFAULT '0' NOT NULL, + topic_vote int2 DEFAULT '0' NOT NULL, + topic_type int2 DEFAULT '0' NOT NULL, + topic_first_post_id int4 DEFAULT '0' NOT NULL, + topic_last_post_id int4 DEFAULT '0' NOT NULL, + topic_moved_id int4 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_topics_pkey PRIMARY KEY (topic_id) +); +CREATE INDEX forum_id_phpbb_topics_index ON phpbb_topics (forum_id); +CREATE INDEX topic_moved_id_phpbb_topics_index ON phpbb_topics (topic_moved_id); +CREATE INDEX topic_first_post_id_phpbb_topics_index ON phpbb_topics (topic_first_post_id); +CREATE INDEX topic_last_post_id_phpbb_topics_index ON phpbb_topics (topic_last_post_id); +CREATE INDEX topic_status_phpbb_topics_index ON phpbb_topics (topic_status); +CREATE INDEX topic_type_phpbb_topics_index ON phpbb_topics (topic_type); + + +/* -------------------------------------------------------- + Table structure for table phpbb_topics_watch +-------------------------------------------------------- */ +CREATE TABLE phpbb_topics_watch ( + topic_id int4, + user_id int4, + notify_status int2 NOT NULL default '0' +); +CREATE INDEX topic_id_phpbb_topics_watch_index ON phpbb_topics_watch (topic_id); +CREATE INDEX user_id_phpbb_topics_watch_index ON phpbb_topics_watch (user_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_user_group +-------------------------------------------------------- */ +CREATE TABLE phpbb_user_group ( + group_id int DEFAULT '0' NOT NULL, + user_id int DEFAULT '0' NOT NULL, + user_pending int2 +); +CREATE INDEX group_id_phpbb_user_group_index ON phpbb_user_group (group_id); +CREATE INDEX user_id_phpbb_user_group_index ON phpbb_user_group (user_id); + + +/* -------------------------------------------------------- + Table structure for table phpbb_users +-------------------------------------------------------- */ +CREATE TABLE phpbb_users ( + user_id int4 DEFAULT nextval('phpbb_users_id_seq'::text) NOT NULL, + user_active int2, + username varchar(25) DEFAULT '' NOT NULL, + user_regdate int4 DEFAULT '0' NOT NULL, + user_password varchar(32) DEFAULT '' NOT NULL, + user_session_time int4 DEFAULT '0' NOT NULL, + user_session_page int2 DEFAULT '0' NOT NULL, + user_lastvisit int4 DEFAULT '0' NOT NULL, + user_email varchar(255), + user_icq varchar(15), + user_website varchar(100), + user_occ varchar(100), + user_from varchar(100), + user_interests varchar(255), + user_sig text, + user_sig_bbcode_uid char(10), + user_style int4, + user_aim varchar(255), + user_yim varchar(255), + user_msnm varchar(255), + user_posts int4 DEFAULT '0' NOT NULL, + user_new_privmsg int2 DEFAULT '0' NOT NULL, + user_unread_privmsg int2 DEFAULT '0' NOT NULL, + user_last_privmsg int4 DEFAULT '0' NOT NULL, + user_emailtime int4, + user_viewemail int2, + user_attachsig int2, + user_allowhtml int2 DEFAULT '1', + user_allowbbcode int2 DEFAULT '1', + user_allowsmile int2 DEFAULT '1', + user_allow_pm int2 DEFAULT '1' NOT NULL, + user_allowavatar int2 DEFAULT '1' NOT NULL, + user_allow_viewonline int2 DEFAULT '1' NOT NULL, + user_rank int4 DEFAULT '0', + user_avatar varchar(100), + user_avatar_type int2 DEFAULT '0' NOT NULL, + user_level int4 DEFAULT '1', + user_lang varchar(255), + user_timezone decimal(4) DEFAULT '0' NOT NULL, + user_dateformat varchar(14) DEFAULT 'd M Y H:m' NOT NULL, + user_notify_pm int2 DEFAULT '1' NOT NULL, + user_popup_pm int2 DEFAULT '0' NOT NULL, + user_notify int2, + user_actkey varchar(32), + user_newpasswd varchar(32), + CONSTRAINT phpbb_users_pkey PRIMARY KEY (user_id) +); + +CREATE INDEX user_session_time_phpbb_users_index ON phpbb_users (user_session_time); + +/* -------------------------------------------------------- + Table structure for table phpbb_vote_desc +-------------------------------------------------------- */ +CREATE TABLE phpbb_vote_desc ( + vote_id int4 DEFAULT nextval('phpbb_vote_desc_id_seq'::text) NOT NULL , + topic_id int4 NOT NULL DEFAULT '0', + vote_text text NOT NULL, + vote_start int4 DEFAULT '0' NOT NULL, + vote_length int4 DEFAULT '0' NOT NULL, + CONSTRAINT phpbb_vote_dsc_pkey PRIMARY KEY (vote_id) +); +CREATE INDEX topic_id_phpbb_vote_desc_index ON phpbb_vote_desc (topic_id); + +/* -------------------------------------------------------- + Table structure for table phpbb_vote_results +-------------------------------------------------------- */ +CREATE TABLE phpbb_vote_results ( + vote_id int4 NOT NULL DEFAULT '0', + vote_option_id int4 NOT NULL DEFAULT '0', + vote_option_text varchar(255) NOT NULL, + vote_result int4 NOT NULL DEFAULT '0' +); +CREATE INDEX option_id_phpbb_vote_results_index ON phpbb_vote_results (vote_option_id); + +/* -------------------------------------------------------- + Table structure for table phpbb_vote_voters +-------------------------------------------------------- */ +CREATE TABLE phpbb_vote_voters ( + vote_id int4 NOT NULL DEFAULT '0', + vote_user_id int4 NOT NULL DEFAULT '0', + vote_user_ip char(40) NOT NULL +); +CREATE INDEX vote_id_phpbb_vote_voters_index ON phpbb_vote_voters (vote_id); +CREATE INDEX vote_user_id_phpbb_vote_voters_index ON phpbb_vote_voters (vote_user_id); +CREATE INDEX vote_user_ip_phpbb_vote_voters_index ON phpbb_vote_voters (vote_user_ip); + +/* -------------------------------------------------------- + Table structure for table phpbb_words +-------------------------------------------------------- */ +CREATE TABLE phpbb_words ( + word_id int4 DEFAULT nextval('phpbb_words_id_seq'::text) NOT NULL, + word varchar(100) DEFAULT '' NOT NULL, + replacement varchar(100) DEFAULT '' NOT NULL, + CONSTRAINT phpbb_words_pkey PRIMARY KEY (word_id) +); diff --git a/phpBB/install/upgrade.php b/phpBB/install/upgrade.php new file mode 100644 index 0000000000..7cad1a220a --- /dev/null +++ b/phpBB/install/upgrade.php @@ -0,0 +1,1941 @@ + 1, + 'Feb' => 2, + 'Mar' => 3, + 'Apr' => 4, + 'May' => 5, + 'Jun' => 6, + 'Jul' => 7, + 'Aug' => 8, + 'Sep' => 9, + 'Sept' => 9, + 'Oct' => 10, + 'Nov' => 11, + 'Dec' => 12 +); + +// --------------- +// Begin functions +// +function common_header() +{ +?> + + + + + + + + + + + + + +
+ + + + +
Forum HomeUpgrading to phpBB 2.0
+ +
+ + + +
+ + + +sql_query($sql)) ) + { + print "
\n"; + print "$errormsg
"; + + $sql_error = $db->sql_error(); + print $sql_error['code'] .": ". $sql_error['message']. "
\n"; + + print "
$sql
"; + print "
\n"; + + return FALSE; + } + else + { + return $result; + } +} + +function smiley_replace($text = '') +{ + global $db; + + static $search, $replace; + + // Did we get the smiley info in a previous call? + if ( !is_array($search) ) + { + $sql = "SELECT code, smile_url + FROM smiles"; + $result = query($sql, "Unable to get list of smilies from the DB"); + + $smilies = $db->sql_fetchrowset($result); + @usort($smilies, 'smiley_sort'); + + $search = array(); + $replace = array(); + for($i = 0; $i < count($smilies); $i++) + { + $search[] = '//i'; + $replace[] = $smilies[$i]['code']; + } + } + + return ( $text != '' ) ? preg_replace($search, $replace, $text) : ''; + +} + +function get_schema() +{ + global $table_prefix; + + $schemafile = file('db/schemas/mysql_schema.sql'); + $tabledata = 0; + + for($i=0; $i < count($schemafile); $i++) + { + $line = $schemafile[$i]; + + if ( preg_match('/^CREATE TABLE (\w+)/i', $line, $matches) ) + { + // Start of a new table definition, set some variables and go to the next line. + $tabledata = 1; + // Replace the 'phpbb_' prefix by the user defined prefix. + $table = str_replace('phpbb_', $table_prefix, $matches[1]); + $table_def[$table] = "CREATE TABLE $table (\n"; + continue; + } + + if ( preg_match('/^\);/', $line) ) + { + // End of the table definition + // After this we will skip everything until the next 'CREATE' line + $tabledata = 0; + $table_def[$table] .= ')'; // We don't need the closing semicolon + } + + if ( $tabledata == 1 ) + { + // We are inside a table definition, parse this line. + // Add the current line to the complete table definition: + $table_def[$table] .= $line; + if ( preg_match('/^\s*(\w+)\s+(\w+)\(([\d,]+)\)(.*)$/', $line, $matches) ) + { + // This is a column definition + $field = $matches[1]; + $type = $matches[2]; + $size = $matches[3]; + + preg_match('/DEFAULT (NULL|\'.*?\')[,\s](.*)$/i', $matches[4], $match); + $default = $match[1]; + + $notnull = ( preg_match('/NOT NULL/i', $matches[4]) ) ? 1 : 0; + $auto_increment = ( preg_match('/auto_increment/i', $matches[4]) ) ? 1 : 0; + + $field_def[$table][$field] = array( + 'type' => $type, + 'size' => $size, + 'default' => $default, + 'notnull' => $notnull, + 'auto_increment' => $auto_increment + ); + } + + if ( preg_match('/\s*PRIMARY\s+KEY\s*\((.*)\).*/', $line, $matches) ) + { + // Primary key + $key_def[$table]['PRIMARY'] = $matches[1]; + } + else if ( preg_match('/\s*KEY\s+(\w+)\s*\((.*)\)/', $line, $matches) ) + { + // Normal key + $key_def[$table][$matches[1]] = $matches[2]; + } + else if ( preg_match('/^\s*(\w+)\s*(.*?),?\s*$/', $line, $matches) ) + { + // Column definition + $create_def[$table][$matches[1]] = $matches[2]; + } + else + { + // It's a bird! It's a plane! It's something we didn't expect ;( + } + } + } + + $schema['field_def'] = $field_def; + $schema['table_def'] = $table_def; + $schema['create_def'] = $create_def; + $schema['key_def'] = $key_def; + + return $schema; +} + +function get_inserts() +{ + global $table_prefix; + + $insertfile = file('db/schemas/mysql_basic.sql'); + + for($i = 0; $i < count($insertfile); $i++) + { + if ( preg_match('/(INSERT INTO (\w+)\s.*);/i', str_replace('phpbb_', $table_prefix, $insertfile[$i]), $matches) ) + { + $returnvalue[$matches[2]][] = $matches[1]; + } + } + + return $returnvalue; +} + +function lock_tables($state, $tables= '') +{ + if ( $state == 1 ) + { + if ( is_array($tables) ) + { + $tables = join(' WRITE, ', $tables); + } + + query("LOCK TABLES $tables WRITE", "Couldn't do: $sql"); + } + else + { + query("UNLOCK TABLES", "Couldn't unlock all tables"); + } +} + +function output_table_content($content) +{ + echo $content . "\n"; + + return; +} + +// +// Nathan's bbcode2 conversion routines +// +function bbdecode($message) +{ + // Undo [code] + $code_start_html = '
Code:
';
+	$code_end_html = '

'; + $message = str_replace($code_start_html, '[code]', $message); + $message = str_replace($code_end_html, '[/code]', $message); + + // Undo [quote] + $quote_start_html = '
Quote:
'; + $quote_end_html = '

'; + $message = str_replace($quote_start_html, '[quote]', $message); + $message = str_replace($quote_end_html, '[/quote]', $message); + + // Undo [b] and [i] + $message = preg_replace("#(.*?)#s", "[b]\\1[/b]", $message); + $message = preg_replace("#(.*?)#s", "[i]\\1[/i]", $message); + + // Undo [url] (long form) + $message = preg_replace("#(.*?)#s", "[url=\\1\\2]\\3[/url]", $message); + + // Undo [url] (short form) + $message = preg_replace("#(.*?)#s", "[url]\\3[/url]", $message); + + // Undo [email] + $message = preg_replace("#(.*?)#s", "[email]\\1[/email]", $message); + + // Undo [img] + $message = preg_replace("##s", "[img]\\1[/img]", $message); + + // Undo lists (unordered/ordered) + + //
  • tags: + $message = str_replace('
  • ', '[*]', $message); + + // [list] tags: + $message = str_replace('
      ', '[list]', $message); + + // [list=x] tags: + $message = preg_replace('#
        #si', "[list=\\1]", $message); + + // [/list] tags: + $message = str_replace('
    ', '[/list]', $message); + $message = str_replace('', '[/list]', $message); + + return $message; +} + +// +// Alternative for in_array() which is only available in PHP4 +// +function inarray($needle, $haystack) +{ + for( $i = 0 ; $i < sizeof($haystack) ; $i++ ) + { + if ( $haystack[$i] == $needle ) + { + return true; + } + } + + return false; +} + +function end_step($next) +{ + global $debug; + + print "
    Next step: $next

    \n"; +} +// +// End functions +// ------------- + + +// +// Start at the beginning if the user hasn't specified a specific starting point. +// +$next = ( isset($HTTP_GET_VARS['next']) ) ? $HTTP_GET_VARS['next'] : 'start'; + +// If debug is set we'll do all steps in one go. +$debug = 1; + +// Parse the MySQL schema file into some arrays. +$schema = get_schema(); + +$table_def = $schema['table_def']; +$field_def = $schema['field_def']; +$key_def = $schema['key_def']; +$create_def = $schema['create_def']; + +// +// Get mysql_basic data +// +$inserts = get_inserts(); + +// +// Get smiley data +// +smiley_replace(); + +common_header(); + +if ( !empty($next) ) +{ + switch($next) + { + case 'start': + end_step('initial_drops'); + + case 'initial_drops': + print " * Dropping sessions and themes tables :: "; + flush(); + + query("DROP TABLE sessions", "Couldn't drop table 'sessions'"); + query("DROP TABLE themes", "Couldn't drop table 'themes'"); + + print "OK
    \n"; + + end_step('mod_old_tables'); + + case 'mod_old_tables': + $modtables = array( + "banlist" => "banlist", + "catagories" => "categories", + "config" => "old_config", + "forums" => "forums", + "disallow" => "disallow", + "posts" => "posts", + "posts_text" => "posts_text", + "priv_msgs" => "privmsgs", + "ranks" => "ranks", + "smiles" => "smilies", + "topics" => "topics", + "users" => "users", + "words" => "words" + ); + + while( list($old, $new) = each($modtables) ) + { + $result = query("SHOW INDEX FROM $old", "Couldn't get list of indices for table $old"); + + while( $row = $db->sql_fetchrow($result) ) + { + $index = $row['Key_name']; + if ( $index != 'PRIMARY' ) + { + query("ALTER TABLE $old DROP INDEX $index", "Couldn't DROP INDEX $old.$index"); + } + } + + // Rename table + $new = $table_prefix . $new; + + print " * Renaming '$old' to '$new' :: "; + flush(); + query("ALTER TABLE $old RENAME $new", "Failed to rename $old to $new"); + print "OK
    \n"; + + } + end_step('create_tables'); + + case 'create_tables': + // Create array with tables in 'old' database + $result = query('SHOW TABLES', "Couldn't get list of current tables"); + + while( $table = $db->sql_fetchrow($result) ) + { + $currenttables[] = $table[0]; + } + + // Check what tables we need to CREATE + while( list($table, $definition) = each($table_def) ) + { + if ( !inarray($table, $currenttables) ) + { + print " * Creating $table :: "; + + query($definition, "Couldn't create table $table"); + + print "OK
    \n"; + } + } + + end_step('create_config'); + + case 'create_config': + print " * Inserting new values into new layout config table :: "; + + @reset($inserts); + while( list($table, $inserts_table) = each($inserts) ) + { + if ( $table == CONFIG_TABLE ) + { + $per_pct = ceil( count($inserts_table) / 40 ); + $inc = 0; + + while( list($nr, $insert) = each($inserts_table) ) + { + query($insert, "Couldn't insert value into config table"); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + } + } + + print " OK
    \n"; + + end_step('convert_config'); + + case 'convert_config': + print " * Converting configuration table :: "; + + $sql = "SELECT * + FROM $table_prefix" . "old_config"; + $result = query($sql, "Couldn't get info from old config table"); + + $oldconfig = $db->sql_fetchrow($result); + + // + // We don't need several original config types and two others + // have changed name ... so take account of this. + // + $ignore_configs = array("selected", "admin_passwd", "override_themes", "allow_sig"); + $rename_configs = array( + "email_from" => "board_email", + "email_sig" => "board_email_sig" + ); + + while( list($name, $value) = each($oldconfig) ) + { + if ( is_int($name) ) + { + continue; + } + + if ( !inarray($name, $ignore_configs) ) + { + $name = ( !empty($rename_configs[$name]) ) ? $rename_configs[$name] : $name; + + $sql = "REPLACE INTO " . CONFIG_TABLE . " (config_name, config_value) + VALUES ('$name', '" . stripslashes($value) . "')"; + query($sql, "Couldn't update config table with values from old config table"); + } + } + + $sql = "UPDATE " . CONFIG_TABLE . " + SET config_value = 'dutch' + WHERE config_name = 'default_lang' && config_value = 'nederlands'"; + query($sql, "Couldn't rename 'nederlands' to 'dutch' in config table"); + + print "OK
    \n"; + end_step('convert_ips'); + + case 'convert_ips': + $names = array( + POSTS_TABLE => array( + 'id' => 'post_id', + 'field' => 'poster_ip' + ), + PRIVMSGS_TABLE => array( + 'id' => 'msg_id', + 'field' => 'poster_ip' + ), + BANLIST_TABLE => array( + 'id' => 'ban_id', + 'field' => 'ban_ip' + ) + ); + + lock_tables(1, array(POSTS_TABLE, PRIVMSGS_TABLE, BANLIST_TABLE)); + + $batchsize = 2000; + while( list($table, $data_array) = each($names) ) + { + $sql = "SELECT MAX(" . $data_array['id'] . ") AS max_id + FROM $table"; + $result = query($sql, "Couldn't obtain ip data from $table (" . $fields . ")"); + + $row = $db->sql_fetchrow($result); + + $maxid = $row['max_id']; + + for($i = 0; $i <= $maxid; $i += $batchsize) + { + $batchstart = $i; + $batchend = $i + $batchsize; + + $field_id = $data_array['id']; + $field = $data_array['field']; + + print " * Converting IP format '" . $field . "' / '$table' ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT $field_id, $field + FROM $table + WHERE $field_id + BETWEEN $batchstart + AND $batchend"; + $result = query($sql, "Couldn't obtain ip data from $table (" . $fields . ")"); + + $per_pct = ceil( $db->sql_numrows($result) / 40 ); + $inc = 0; + + while( $row = $db->sql_fetchrow($result) ) + { + $sql = "UPDATE $table + SET $field = '" . encode_ip($row[$field]) . "' + WHERE $field_id = " . $row[$field_id]; + query($sql, "Couldn't convert IP format of $field in $table with $field_id of " . $rowset[$field_id]); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + + print " OK
    \n"; + } + } + + lock_tables(0); + end_step('convert_dates'); + + case 'convert_dates': + $names = array( + POSTS_TABLE => array('post_time'), + TOPICS_TABLE => array('topic_time'), + PRIVMSGS_TABLE => array('msg_time') + ); + + lock_tables(1, array(POSTS_TABLE, TOPICS_TABLE, PRIVMSGS_TABLE)); + + while( list($table, $fields) = each($names) ) + { + print " * Converting date format of $fields[$i] in $table :: "; + flush(); + + for($i = 0; $i < count($fields); $i++) + { + $sql = "UPDATE $table + SET " . $fields[$i] . " = UNIX_TIMESTAMP(" . $fields[$i] . ")"; + query($sql, "Couldn't convert date format of $table(" . $fields[$i] . ")"); + } + + print "OK
    \n"; + } + + lock_tables(0); + end_step('fix_addslashes'); + + case 'fix_addslashes': + $slashfields[TOPICS_TABLE] = array('topic_title'); + $slashfields[FORUMS_TABLE] = array('forum_desc', 'forum_name'); + $slashfields[CATEGORIES_TABLE] = array('cat_title'); + $slashfields[WORDS_TABLE] = array('word', 'replacement'); + $slashfields[RANKS_TABLE] = array('rank_title'); + $slashfields[DISALLOW_TABLE] = array('disallow_username'); + + //convert smilies? + $slashes = array( + "\\'" => "'", + "\\\"" => "\"", + "\\\\" => "\\"); + $slashes = array( + "\\'" => "'", + "\\\"" => "\"", + "\\\\" => "\\"); + + lock_tables(1, array(TOPICS_TABLE, FORUMS_TABLE, CATEGORIES_TABLE, WORDS_TABLE, RANKS_TABLE, DISALLOW_TABLE, SMILIES_TABLE)); + + while( list($table, $fields) = each($slashfields) ) + { + print " * Removing slashes from $table table :: "; + flush(); + + while( list($nr, $field) = each($fields) ) + { + @reset($slashes); + while( list($search, $replace) = each($slashes) ) + { + $sql = "UPDATE $table + SET $field = REPLACE($field, '" . addslashes($search) . "', '" . addslashes($replace) . "')"; + query($sql, "Couldn't remove extraneous slashes from the old data."); + } + } + + print "OK
    \n"; + } + + lock_tables(0); + end_step('remove_topics'); + + case 'remove_topics': + print " * Removing posts with no corresponding topics :: "; + flush(); + + $sql = "SELECT p.post_id + FROM " . POSTS_TABLE . " p + LEFT JOIN " . TOPICS_TABLE . " t ON p.topic_id = t.topic_id + WHERE t.topic_id IS NULL"; + $result = query($sql, "Couldn't obtain list of deleted topics"); + + $post_total = $db->sql_numrows($result); + + if ( $post_total ) + { + $post_id_ary = array(); + while( $row = $db->sql_fetchrow($result) ) + { + $post_id_ary[] = $row['post_id']; + } + + $sql = "DELETE FROM " . POSTS_TABLE . " + WHERE post_id IN (" . implode(", ", $post_id_ary) . ")"; + query($sql, "Couldn't update posts to remove deleted user poster_id values"); + + $sql = "DELETE FROM " . POSTS_TEXT_TABLE . " + WHERE post_id IN (" . implode(", ", $post_id_ary) . ")"; + query($sql, "Couldn't update posts to remove deleted user poster_id values"); + } + + echo "OK ( Removed $post_total posts )
    \n"; + end_step('convert_users'); + + case 'convert_users': + // + // Completely remove old soft-deleted users + // + $sql = "DELETE FROM " . USERS_TABLE . " + WHERE user_level = -1"; + query($sql, "Couldn't delete old soft-deleted users"); + + $sql = "SELECT COUNT(*) AS total, MAX(user_id) AS maxid + FROM " . USERS_TABLE; + $result = query($sql, "Couldn't get max post_id."); + + $maxid = $db->sql_fetchrow($result); + + $totalposts = $maxid['total']; + $maxid = $maxid['maxid']; + + $sql = "ALTER TABLE " . USERS_TABLE . " + ADD user_sig_bbcode_uid CHAR(10), + MODIFY user_sig text"; + query($sql, "Couldn't add user_sig_bbcode_uid field to users table"); + + $super_mods = array(); + $first_admin = -2; + + $batchsize = 1000; + for($i = -1; $i <= $maxid; $i += $batchsize) + { + $batchstart = $i; + $batchend = $i + $batchsize; + + print " * Converting Users ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT * + FROM " . USERS_TABLE . " + WHERE user_id + BETWEEN $batchstart + AND $batchend"; + $result = query($sql, "Couldn't get ". USERS_TABLE .".user_id $batchstart to $batchend"); + + // Array with user fields that we want to check for invalid data (to few characters) + $checklength = array( + 'user_occ', + 'user_website', + 'user_email', + 'user_from', + 'user_intrest', + 'user_aim', + 'user_yim', + 'user_msnm'); + + lock_tables(1, array(USERS_TABLE, GROUPS_TABLE, USER_GROUP_TABLE, POSTS_TABLE)); + + $per_pct = ceil( $db->sql_numrows($result) / 40 ); + $inc = 0; + + while( $row = $db->sql_fetchrow($result) ) + { + $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user) + VALUES ('" . addslashes($row['username']) . "', 'Personal User', 1)"; + query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".GROUPS_TABLE); + + $group_id = $db->sql_nextid(); + + if ( $group_id != 0 ) + { + $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) + VALUES ($group_id, " . $row['user_id'] . ", 0)"; + query($sql, "Wasn't able to insert user ".$row['user_id']." into table ".USER_GROUP_TABLE); + } + else + { + print "Couldn't get insert ID for " . GROUPS_TABLE . " table
    \n"; + } + + if ( is_int($row['user_regdate']) ) + { + // We already converted this post to the new style BBcode, skip this post. + continue; + } + + // + // Nathan's bbcode2 conversion + // + + // undo 1.2.x encoding.. + $row['user_sig'] = bbdecode(stripslashes($row['user_sig'])); + $row['user_sig'] = undo_make_clickable($row['user_sig']); + $row['user_sig'] = str_replace("
    ", "\n", $row['user_sig']); + + // make a uid + $uid = make_bbcode_uid(); + + // do 2.x first-pass encoding.. + $row['user_sig'] = bbencode_first_pass($row['user_sig'], $uid); + $row['user_sig'] = addslashes($row['user_sig']); + + // Check for invalid info like '-' and '?' for a lot of fields + @reset($checklength); + while($field = each($checklength)) + { + $row[$field[1]] = strlen($row[$field[1]]) < 3 ? '' : $row[$field[1]]; + } + + preg_match('/(.*?) (\d{1,2}), (\d{4})/', $row['user_regdate'], $parts); + $row['user_regdate'] = gmmktime(0, 0, 0, $months[$parts[1]], $parts[2], $parts[3]); + + $website = $row['user_website']; + if ( substr(strtolower($website), 0, 7) != "http://" ) + { + $website = "http://" . $website; + } + if( strtolower($website) == 'http://' ) + { + $website = ''; + } + $row['user_website'] = addslashes($website); + + $row['user_icq'] = (ereg("^[0-9]+$", $row['user_icq'])) ? $row['user_icq'] : ''; + reset($checklength); + + while($field = each($checklength)) + { + if ( strlen($row[$field[1]]) < 3 ) + { + $row[$field[1]] = ''; + } + $row[$field[1]] = addslashes($row[$field[1]]); + } + + // + // Is user a super moderator? + // + if( $row['user_level'] == 3 ) + { + $super_mods[] = $row['user_id']; + } + + $row['user_level'] = ( $row['user_level'] == 4 ) ? ADMIN : USER; + + // + // Used to define a 'practical' group moderator user_id + // for super mods a little latter. + // + if( $first_admin == -2 && $row['user_level'] == ADMIN ) + { + $first_admin = $row['user_id']; + } + + // + // Dutch language files have been renamed from 'nederlands' to 'dutch' + // + if( $row['user_lang'] == 'nederlands' ) + { + $row['user_lang'] = 'dutch'; + } + + $sql = "UPDATE " . USERS_TABLE . " + SET + user_sig = '" . $row['user_sig'] . "', + user_sig_bbcode_uid = '$uid', + user_regdate = '" . $row['user_regdate'] . "', + user_website = '" . $row['user_website'] . "', + user_occ = '" . $row['user_occ'] . "', + user_email = '" . $row['user_email'] . "', + user_from = '" . $row['user_from'] . "', + user_intrest = '" . $row['user_intrest'] . "', + user_aim = '" . $row['user_aim'] . "', + user_yim = '" . $row['user_yim'] . "', + user_msnm = '" . $row['user_msnm'] . "', + user_level = '" . $row['user_level'] . "', + user_desmile = NOT(user_desmile), + user_bbcode = 1, + user_theme = 1 + WHERE user_id = " . $row['user_id']; + query($sql, "Couldn't update ".USERS_TABLE." table with new BBcode and regdate for user_id ".$row['user_id']); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + + print " OK
    \n"; + + lock_tables(0); + } + + // + // Handle super-mods, create hidden group for them + // + // Iterate trough access table + if( count($super_mods) && $first_admin != -2 ) + { + print "\n
    \n * Creating new group for super moderators :: "; + flush(); + + $sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user) + VALUES (" . GROUP_HIDDEN . ", 'Super Moderators', 'Converted super moderators', $first_admin, 0)"; + $result = query($sql, "Couldn't create group for ".$row['forum_name']); + + $group_id = $db->sql_nextid(); + + if ( $group_id <= 0 ) + { + print "Group creation failed. Aborting creation of groups...
    \n"; + continue 2; + } + + print "OK
    \n"; + + print " * Updating auth_access for super moderator group :: "; + flush(); + + $sql = "SELECT forum_id + FROM " . FORUMS_TABLE; + $result = query($sql, "Couldn't obtain forum_id list"); + + while( $row = $db->sql_fetchrow($result) ) + { + $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_mod) + VALUES ($group_id, " . $row['forum_id'] . ", 1)"; + $result_insert = query($sql, "Unable to set group auth access for super mods."); + } + + for($i = 0; $i < count($super_mods); $i++) + { + $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) + VALUES ($group_id, " . $super_mods[$i] . ", 0)"; + query($sql, "Unable to add user_id $user_id to group_id $group_id (super mods)
    \n"); + } + + print "OK
    \n"; + } + + end_step('convert_posts'); + + case 'convert_posts': + print " * Adding enable_sig field to " . POSTS_TABLE . " :: "; + flush(); + $sql = "ALTER TABLE " . POSTS_TABLE . " + ADD enable_sig tinyint(1) DEFAULT '1' NOT NULL"; + $result = query($sql, "Couldn't add enable_sig field to " . POSTS_TABLE . "."); + print "OK
    \n"; + + print " * Adding enable_bbcode field to " . POSTS_TEXT_TABLE . " :: "; + flush(); + $sql = "ALTER TABLE " . POSTS_TEXT_TABLE . " + ADD enable_bbcode tinyint(1) DEFAULT '1' NOT NULL"; + $result = query($sql, "Couldn't add enable_bbcode field to " . POSTS_TABLE . "."); + print "OK
    \n"; + + print " * Adding bbcode_uid field to " . POSTS_TEXT_TABLE . " :: "; + flush(); + $sql = "ALTER TABLE " . POSTS_TEXT_TABLE . " + ADD bbcode_uid char(10) NOT NULL"; + $result = query($sql, "Couldn't add bbcode_uid field to " . POSTS_TABLE . "."); + print "OK
    \n"; + + print " * Adding post_edit_time field to " . POSTS_TABLE . " :: "; + flush(); + $sql = "ALTER TABLE " . POSTS_TABLE . " + ADD post_edit_time int(11)"; + $result = query($sql, "Couldn't add post_edit_time field to " . POSTS_TABLE . "."); + print "OK
    \n"; + + print " * Adding post_edit_count field to " . POSTS_TABLE . " :: "; + flush(); + $sql = "ALTER TABLE " . POSTS_TABLE . " + ADD post_edit_count smallint(5) UNSIGNED DEFAULT '0' NOT NULL"; + $result = query($sql, "Couldn't add post_edit_count field to " . POSTS_TABLE . "."); + print "OK
    \n
    \n"; + + $sql = "SELECT COUNT(*) as total, MAX(post_id) as maxid + FROM " . POSTS_TEXT_TABLE; + $result = query($sql, "Couldn't get max post_id."); + + $maxid = $db->sql_fetchrow($result); + + $totalposts = $maxid['total']; + $maxid = $maxid['maxid']; + + $batchsize = 2000; + for($i = 0; $i <= $maxid; $i += $batchsize) + { + $batchstart = $i + 1; + $batchend = $i + $batchsize; + + print " * Converting BBcode ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT * + FROM " . POSTS_TEXT_TABLE . " + WHERE post_id + BETWEEN $batchstart + AND $batchend"; + $result = query($sql, "Couldn't get ". POSTS_TEXT_TABLE .".post_id $batchstart to $batchend"); + + lock_tables(1, array(POSTS_TEXT_TABLE, POSTS_TABLE)); + + $per_pct = ceil( $db->sql_numrows($result) / 40 ); + $inc = 0; + + while( $row = $db->sql_fetchrow($result) ) + { + if ( $row['bbcode_uid'] != '' ) + { + // We already converted this post to the new style BBcode, skip this post. + continue; + } + + // + // Nathan's bbcode2 conversion + // + // undo 1.2.x encoding.. + $row['post_text'] = bbdecode(stripslashes($row['post_text'])); + $row['post_text'] = undo_make_clickable($row['post_text']); + $row['post_text'] = str_replace('
    ', "\n", $row['post_text']); + + // make a uid + $uid = make_bbcode_uid(); + + // do 2.x first-pass encoding.. + $row['post_text'] = smiley_replace($row['post_text']); + $row['post_text'] = bbencode_first_pass($row['post_text'], $uid); + $row['post_text'] = addslashes($row['post_text']); + + $edited_sql = ""; + if ( preg_match('/^(.*?)([\n]+\[ This message was .*?)$/s', $row['post_text'], $matches) ) + { + $row['post_text'] = $matches[1]; + $edit_info = $matches[2]; + + $edit_times = count(explode(' message ', $edit_info)) - 1; // Taken from example for substr_count in annotated PHP manual + + if ( preg_match('/^.* by: (.*?) on (....)-(..)-(..) (..):(..) \]<\/font>/s', $edit_info, $matches) ) + { + $edited_user = $matches[1]; + $edited_time = gmmktime($matches[5], $matches[6], 0, $matches[3], $matches[4], $matches[2]); + + // + // This isn't strictly correct since 2.0 won't include and edit + // statement if the edit wasn't by the user who posted ... + // + $edited_sql = ", post_edit_time = $edited_time, post_edit_count = $edit_times"; + } + } + + if ( preg_match("/^(.*?)\n-----------------\n.*$/is", $row['post_text'], $matches) ) + { + $row['post_text'] = $matches[1]; + $enable_sig = 1; + } + else + { + $checksig = preg_replace('/\[addsig\]$/', '', $row['post_text']); + $enable_sig = ( strlen($checksig) == strlen($row['post_text']) ) ? 0 : 1; + } + + $sql = "UPDATE " . POSTS_TEXT_TABLE . " + SET post_text = '$checksig', bbcode_uid = '$uid' + WHERE post_id = " . $row['post_id']; + query($sql, "Couldn't update " . POSTS_TEXT_TABLE . " table with new BBcode for post_id :: " . $row['post_id']); + + $sql = "UPDATE " . POSTS_TABLE . " + SET enable_sig = $enable_sig" . $edited_sql . " + WHERE post_id = " . $row['post_id']; + query($sql, "Couldn't update " . POSTS_TABLE . " table with signature status for post with post_id :: " . $row['post_id']); + + $inc++; + if ( $inc == $per_pct ) + { + print '.'; + flush(); + $inc = 0; + } + } + + print " OK
    \n"; + + lock_tables(0); + } + + print "
    \n * Updating poster_id for deleted users :: "; + flush(); + + $sql = "SELECT DISTINCT p.post_id + FROM " . POSTS_TABLE . " p + LEFT JOIN " . USERS_TABLE . " u ON p.poster_id = u.user_id + WHERE u.user_id IS NULL"; + $result = query($sql, "Couldn't obtain list of deleted users"); + + $users_removed = $db->sql_numrows($result); + + if ( $users_removed ) + { + $post_id_ary = array(); + while( $row = $db->sql_fetchrow($result) ) + { + $post_id_ary[] = $row['post_id']; + } + + $sql = "UPDATE " . POSTS_TABLE . " + SET poster_id = " . ANONYMOUS . ", enable_sig = 0 + WHERE post_id IN (" . implode(", ", $post_id_ary) . ")"; + query($sql, "Couldn't update posts to remove deleted user poster_id values"); + } + + print "OK ( Removed $users_removed non-existent user references )
    \n"; + + end_step('convert_privmsgs'); + + case 'convert_privmsgs': + $sql = "SELECT COUNT(*) as total, max(msg_id) as maxid + FROM " . PRIVMSGS_TABLE; + $result = query($sql, "Couldn't get max privmsgs_id."); + + $maxid = $db->sql_fetchrow($result); + + $totalposts = $maxid['total']; + $maxid = $maxid['maxid']; + + $sql = "ALTER TABLE " . PRIVMSGS_TABLE . " + ADD privmsgs_subject VARCHAR(255), + ADD privmsgs_attach_sig TINYINT(1) DEFAULT 1"; + query($sql, "Couldn't add privmsgs_subject field to " . PRIVMSGS_TABLE . " table"); + + $batchsize = 2000; + for($i = 0; $i <= $maxid; $i += $batchsize) + { + $batchstart = $i + 1; + $batchend = $i + $batchsize; + + print " * Converting Private Message ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT * + FROM " . PRIVMSGS_TABLE . " + WHERE msg_id + BETWEEN $batchstart + AND $batchend"; + $result = query($sql, "Couldn't get " . POSTS_TEXT_TABLE . " post_id $batchstart to $batchend"); + + lock_tables(1, array(PRIVMSGS_TABLE, PRIVMSGS_TEXT_TABLE)); + + $per_pct = ceil( $db->sql_numrows($result) / 40 ); + $inc = 0; + + while( $row = $db->sql_fetchrow($result) ) + { + if ( $row['msg_text'] == NULL ) + { + // We already converted this post to the new style BBcode, skip this post. + continue; + } + // + // Nathan's bbcode2 conversion + // + // undo 1.2.x encoding.. + $row['msg_text'] = bbdecode(stripslashes($row['msg_text'])); + $row['msg_text'] = undo_make_clickable($row['msg_text']); + $row['msg_text'] = str_replace("
    ", "\n", $row['msg_text']); + + // make a uid + $uid = make_bbcode_uid(); + + // do 2.x first-pass encoding.. + $row['msg_text'] = smiley_replace($row['msg_text']); + $row['msg_text'] = bbencode_first_pass($row['msg_text'], $uid); + + $checksig = preg_replace('/\[addsig\]$/', '', $row['msg_text']); + $enable_sig = (strlen($checksig) == strlen($row['msg_text'])) ? 0 : 1; + + if ( preg_match("/^(.*?)\n-----------------\n.*$/is", $checksig, $matches) ) + { + $checksig = $matches[1]; + $enable_sig = 1; + } + + $row['msg_text'] = $checksig; + + $row['msg_status'] = ($row['msg_status'] == 1) ? PRIVMSGS_READ_MAIL : PRIVMSGS_NEW_MAIL; + + // Subject contains first 60 characters of msg, remove any BBCode tags + $subject = addslashes(strip_tags(substr($row['msg_text'], 0, 60))); + $subject = preg_replace("/\[.*?\:(([a-z0-9]:)?)$uid.*?\]/si", "", $subject); + + $row['msg_text'] = addslashes($row['msg_text']); + + $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) + VALUES ('" . $row['msg_id'] . "', '$uid', '" . $row['msg_text'] . "')"; + query($sql, "Couldn't insert PrivMsg text into " . PRIVMSGS_TEXT_TABLE . " table msg_id " . $row['msg_id']); + + $sql = "UPDATE " . PRIVMSGS_TABLE . " + SET msg_text = NULL, msg_status = " . $row['msg_status'] . ", privmsgs_subject = '$subject', privmsgs_attach_sig = $enable_sig + WHERE msg_id = " . $row['msg_id']; + query($sql, "Couldn't update " . PRIVMSGS_TABLE . " table for msg_id " . $row['post_id']); + + $inc++; + if ( $inc == $per_pct ) + { + print '.'; + flush(); + $inc = 0; + } + } + + print " OK
    \n"; + } + + lock_tables(0); + end_step('convert_moderators'); + + case 'convert_moderators'; + $sql = "SELECT * + FROM forum_mods"; + $result = query($sql, "Couldn't get list with all forum moderators"); + + while( $row = $db->sql_fetchrow($result) ) + { + // Check if this moderator and this forum still exist + $sql = "SELECT user_id + FROM " . USERS_TABLE . ", " . FORUMS_TABLE . " + WHERE user_id = " . $row['user_id'] . " + AND forum_id = " . $row['forum_id']; + $check_data = query($sql, "Couldn't check if user " . $row['user_id'] . " and forum " . $row['forum_id'] . " exist"); + + if ( !($rowtest = $db->sql_fetchrow($check_data)) ) + { + // Either the moderator or the forum have been deleted, this line in forum_mods was redundant, skip it. + continue; + } + + $sql = "SELECT g.group_id + FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE g.group_id = ug.group_id + AND ug.user_id = " . $row['user_id'] . " + AND g.group_single_user = 1"; + $insert_group = query($sql, "Couldn't get group number for user " . $row['user_id'] . "."); + + $group_id = $db->sql_fetchrow($insert_group); + $group_id = $group_id['group_id']; + + print " * Adding moderator for forum " . $row['forum_id'] . " :: "; + flush(); + + $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_mod) VALUES ($group_id, ".$row['forum_id'].", 1)"; + query($sql, "Couldn't set moderator (user_id = " . $row['user_id'] . ") for forum " . $row['forum_id'] . "."); + + print "OK
    \n"; + } + + print " * Setting correct user_level for moderators ::"; + flush(); + + $sql = "SELECT DISTINCT u.user_id + FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa + WHERE aa.auth_mod = 1 + AND ug.group_id = aa.group_id + AND u.user_id = ug.user_id + AND u.user_level <> " . ADMIN; + $result = query($sql, "Couldn't obtain list of moderators"); + + if ( $row = $db->sql_fetchrow($result) ) + { + $ug_sql = ''; + + do + { + $ug_sql .= ( ( $ug_sql != '' ) ? ', ' : '' ) . $row['user_id']; + } + while ( $row = $db->sql_fetchrow($result) ); + + $sql = "UPDATE " . USERS_TABLE . " + SET user_level = " . MOD . " + WHERE user_id IN ($ug_sql)"; + query($sql, "Couldn't set moderator status for users"); + } + + print "OK
    \n"; + + end_step('convert_privforums'); + + case 'convert_privforums': + $sql = "SELECT fa.*, f.forum_name + FROM forum_access fa + LEFT JOIN " . FORUMS_TABLE . " f ON fa.forum_id = f.forum_id + ORDER BY fa.forum_id, fa.user_id"; + $forum_access = query($sql, "Couldn't get list with special forum access (forum_access)"); + + $forum_id = -1; + while( $row = $db->sql_fetchrow($forum_access) ) + { + // Iterate trough access table + if ( $row['forum_id'] != $forum_id ) + { + // This is a new forum, create new group. + $forum_id = $row['forum_id']; + + print " * Creating new group for forum $forum_id :: "; + flush(); + + $sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user) + VALUES (" . GROUP_HIDDEN . ", '" . addslashes($row['forum_name']) . " Group', 'Converted Private Forum Group', " . $row['user_id'] . ", 0)"; + $result = query($sql, "Couldn't create group for ".$row['forum_name']); + + $group_id = $db->sql_nextid(); + + if ( $group_id <= 0 ) + { + print "Group creation failed. Aborting creation of groups...
    \n"; + continue 2; + } + + print "OK
    \n"; + + print " * Creating auth_access group for forum $forum_id :: "; + flush(); + + $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate) + VALUES ($group_id, $forum_id, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1)"; + $result = query($sql, "Unable to set group auth access."); + + if ( $db->sql_affectedrows($result) <= 0 ) + { + print "Group creation failed. Aborting creation of groups...
    \n"; + continue 2; + } + + print "OK
    \n"; + } + + // Add user to the group + $user_id = $row['user_id']; + + $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) + VALUES ($group_id, $user_id, 0)"; + query($sql, "Unable to add user_id $user_id to group_id $group_id
    \n"); + } + + end_step('update_schema'); + + case 'update_schema': + $rename = array( + $table_prefix . "users" => array( + "user_interests" => "user_intrest", + "user_allowsmile" => "user_desmile", + "user_allowhtml" => "user_html", + "user_allowbbcode" => "user_bbcode", + "user_style" => "user_theme" + ), + $table_prefix . "privmsgs" => array( + "privmsgs_id" => "msg_id", + "privmsgs_from_userid" => "from_userid", + "privmsgs_to_userid" => "to_userid", + "privmsgs_date" => "msg_time", + "privmsgs_ip" => "poster_ip", + "privmsgs_type" => "msg_status" + ), + $table_prefix . "smilies" => array( + "smilies_id" => "id" + ) + ); + + $schema = get_schema(); + + $table_def = $schema['table_def']; + $field_def = $schema['field_def']; + + // Loop tables in schema + while (list($table, $table_def) = @each($field_def)) + { + // Loop fields in table + print " * Updating table '$table' :: "; + flush(); + + $sql = "SHOW FIELDS + FROM $table"; + $result = query($sql, "Can't get definition of current $table table"); + + while( $row = $db->sql_fetchrow($result) ) + { + $current_fields[] = $row['Field']; + } + + $alter_sql = "ALTER TABLE $table "; + while (list($field, $definition) = each($table_def)) + { + if ( $field == '' ) + { + // Skip empty fields if any (shouldn't be needed) + continue; + } + + $type = $definition['type']; + $size = $definition['size']; + + $default = isset($definition['default']) ? "DEFAULT " . $definition['default'] : ''; + + $notnull = $definition['notnull'] == 1 ? 'NOT NULL' : ''; + + $auto_increment = $definition['auto_increment'] == 1 ? 'auto_increment' : ''; + + $oldfield = isset($rename[$table][$field]) ? $rename[$table][$field] : $field; + + if ( !inarray($field, $current_fields) && $oldfield == $field ) + { + // If the current is not a key of $current_def and it is not a field that is + // to be renamed then the field doesn't currently exist. + $changes[] = " ADD $field " . $create_def[$table][$field]; + } + else + { + $changes[] = " CHANGE $oldfield $field " . $create_def[$table][$field]; + } + } + + $alter_sql .= join(',', $changes); + unset($changes); + unset($current_fields); + + $sql = "SHOW INDEX + FROM $table"; + $result = query($sql, "Couldn't get list of indices for table $table"); + + unset($indices); + + while( $row = $db->sql_fetchrow($result) ) + { + $indices[] = $row['Key_name']; + } + + while ( list($key_name, $key_field) = each($key_def[$table]) ) + { + if ( !inarray($key_name, $indices) ) + { + $alter_sql .= ($key_name == 'PRIMARY') ? ", ADD PRIMARY KEY ($key_field)" : ", ADD INDEX $key_name ($key_field)"; + } + } + query($alter_sql, "Couldn't alter table $table"); + + print "OK
    \n"; + flush(); + } + + end_step('convert_forums'); + + case 'convert_forums': + $sql = "SELECT * + FROM " . FORUMS_TABLE; + $result = query($sql, "Couldn't get list with all forums"); + + while( $row = $db->sql_fetchrow($result) ) + { + print " * Converting forum '" . $row['forum_name'] . "' :: "; + flush(); + + // forum_access: (only concerns posting) + // 1 = Registered users only + // 2 = Anonymous Posting + // 3 = Moderators/Administrators only + switch( $row['forum_access'] ) + { + case 1: + // Public forum, no anonymous posting + $auth_view = AUTH_ALL; + $auth_read = AUTH_ALL; + $auth_post = AUTH_REG; + $auth_reply = AUTH_REG; + $auth_edit = AUTH_REG; + $auth_delete = AUTH_REG; + $auth_vote = AUTH_REG; + $auth_pollcreate = AUTH_REG; + $auth_sticky = AUTH_MOD; + $auth_announce = AUTH_MOD; + break; + case 2: + $auth_post = AUTH_ALL; + $auth_reply = AUTH_ALL; + $auth_edit = AUTH_REG; + $auth_delete = AUTH_REG; + $auth_vote = AUTH_ALL; + $auth_pollcreate = AUTH_ALL; + $auth_sticky = AUTH_MOD; + $auth_announce = AUTH_MOD; + break; + default: + $auth_post = AUTH_MOD; + $auth_reply = AUTH_MOD; + $auth_edit = AUTH_MOD; + $auth_delete = AUTH_MOD; + $auth_vote = AUTH_MOD; + $auth_pollcreate = AUTH_MOD; + $auth_sticky = AUTH_MOD; + $auth_announce = AUTH_MOD; + break; + } + + // Old auth structure: + // forum_type: (only concerns viewing) + // 0 = Public + // 1 = Private + switch( $row['forum_type'] ) + { + case 0: + $auth_view = AUTH_ALL; + $auth_read = AUTH_ALL; + break; + default: + // + // Make it really private ... + // + $auth_view = AUTH_ACL; + $auth_read = AUTH_ACL; + $auth_post = AUTH_ACL; + $auth_reply = AUTH_ACL; + $auth_edit = AUTH_ACL; + $auth_delete = AUTH_ACL; + $auth_vote = AUTH_ACL; + $auth_pollcreate = AUTH_ACL; + $auth_sticky = AUTH_ACL; + $auth_announce = AUTH_MOD; + break; + } + + $sql = "UPDATE " . FORUMS_TABLE . " SET + auth_view = $auth_view, + auth_read = $auth_read, + auth_post = $auth_post, + auth_reply = $auth_reply, + auth_edit = $auth_edit, + auth_delete = $auth_delete, + auth_vote = $auth_vote, + auth_pollcreate = $auth_pollcreate, + auth_sticky = $auth_sticky, + auth_announce = $auth_announce + WHERE forum_id = ". $row['forum_id']; + query($sql, "Was unable to update forum permissions!"); + + print "OK
    \n"; + } + + end_step('insert_themes'); + + case 'insert_themes': + print " * Inserting new values into themes table :: "; + + @reset($inserts); + while( list($table, $inserts_table) = each($inserts) ) + { + if ( $table == THEMES_TABLE ) + { + $per_pct = ceil( count($inserts_table) / 40 ); + $inc = 0; + + while( list($nr, $insert) = each($inserts_table) ) + { + query($insert, "Couldn't insert value into " . THEMES_TABLE); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + } + } + + print " OK
    \n"; + end_step('fulltext_search_indexing'); + + case 'fulltext_search_indexing': + // + // Generate search word list + // + // Fetch a batch of posts_text entries + // + $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id + FROM " . POSTS_TEXT_TABLE; + $result = query($sql, "Couldn't get post count totals"); + + $max_post_id = $db->sql_fetchrow($result); + + $totalposts = $max_post_id['total']; + $max_post_id = $max_post_id['max_post_id']; + $per_percent = round(( $totalposts / 500 ) * 10); + + $postcounter = ( !isset($HTTP_GET_VARS['batchstart']) ) ? 0 : $HTTP_GET_VARS['batchstart']; + + $batchsize = 150; // Process this many posts per loop + $batchcount = 0; + $total_percent = 0; + + for(;$postcounter <= $max_post_id; $postcounter += $batchsize) + { + $batchstart = $postcounter + 1; + $batchend = $postcounter + $batchsize; + $batchcount++; + + print " * Fulltext Indexing ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT * + FROM " . POSTS_TEXT_TABLE ." + WHERE post_id + BETWEEN $batchstart + AND $batchend"; + $posts_result = query($sql, "Couldn't obtain post_text"); + + $per_pct = ceil( $db->sql_numrows($posts_result) / 40 ); + $inc = 0; + + if ( $row = $db->sql_fetchrow($posts_result) ) + { + do + { + add_search_words($row['post_id'], $row['post_text'], $row['post_subject']); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + while( $row = $db->sql_fetchrow($posts_result) ); + } + + $db->sql_freeresult($posts_result); + + // Remove common words after the first 2 batches and after every 4th batch after that. + if ( $batchcount % 4 == 3 ) + { + remove_common('global', 0.4); + } + + print " OK
    \n"; + } + + end_step('update_topics'); + + case 'update_topics': + $sql = "SELECT MAX(topic_id) AS max_topic + FROM " . TOPICS_TABLE; + $result = query($sql, "Couldn't get max topic id"); + + $row = $db->sql_fetchrow($result); + + $maxid = $row['max_topic']; + + lock_tables(1, array(TOPICS_TABLE, POSTS_TABLE)); + + $batchsize = 1000; + for($i = 0; $i <= $maxid; $i += $batchsize) + { + $batchstart = $i + 1; + $batchend = $i + $batchsize; + + print " * Setting topic first post_id ( $batchstart to $batchend ) :: "; + flush(); + + $sql = "SELECT MIN(post_id) AS first_post_id, topic_id + FROM " . POSTS_TABLE . " + WHERE topic_id + BETWEEN $batchstart + AND $batchend + GROUP BY topic_id + ORDER BY topic_id ASC"; + $result = query($sql, "Couldn't get post id data"); + + $per_pct = ceil( $db->sql_numrows($result) / 40 ); + $inc = 0; + + if ( $row = $db->sql_fetchrow($result) ) + { + do + { + $sql = "UPDATE " . TOPICS_TABLE . " + SET topic_first_post_id = " . $row['first_post_id'] . " + WHERE topic_id = " . $row['topic_id']; + query($sql, "Couldn't update topic first post id in topic :: $topic_id"); + + $inc++; + if ( $inc == $per_pct ) + { + print "."; + flush(); + $inc = 0; + } + } + while ( $row = $db->sql_fetchrow($result) ); + } + + print " OK
    \n"; + } + + lock_tables(0); + end_step('final_configuration'); + + case 'final_configuration': + // + // Update forum last post information + // + $sql = "SELECT forum_id, forum_name + FROM " . FORUMS_TABLE; + $f_result = query($sql, "Couldn't obtain forum_ids"); + + while( $forum_row = $db->sql_fetchrow($f_result) ) + { + print " * Updating '" . $forum_row['forum_name'] . "' post info :: "; + flush(); + + $id = $forum_row['forum_id']; + + $sql = "SELECT MIN(p.post_id) AS first_post, MAX(p.post_id) AS last_post + FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t + WHERE p.forum_id = $id + AND p.topic_id = t.topic_id"; + $result = query($sql, "Could not get post ID forum post information :: $id"); + + if ( $row = $db->sql_fetchrow($result) ) + { + $first_post = ( $row['first_post'] ) ? $row['first_post'] : 0; + $last_post = ($row['last_post']) ? $row['last_post'] : 0; + } + else + { + $first_post = 0; + $last_post = 0; + } + + $sql = "SELECT COUNT(post_id) AS total + FROM " . POSTS_TABLE . " + WHERE forum_id = $id"; + $result = query($sql, "Could not get post count forum post information :: $id"); + + if ( $row = $db->sql_fetchrow($result) ) + { + $total_posts = ($row['total']) ? $row['total'] : 0; + } + else + { + $total_posts = 0; + } + + $sql = "SELECT COUNT(topic_id) AS total + FROM " . TOPICS_TABLE . " + WHERE forum_id = $id + AND topic_status <> " . TOPIC_MOVED; + $result = query($sql, "Could not get topic count forum post information :: $id"); + + if ( $row = $db->sql_fetchrow($result) ) + { + $total_topics = ($row['total']) ? $row['total'] : 0; + } + else + { + $total_topics = 0; + } + + $sql = "UPDATE " . FORUMS_TABLE . " + SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics + WHERE forum_id = $id"; + query($sql, "Could not update forum post information :: $id"); + + print "OK
    \n"; + } + + print "
    \n * Update default user and finalise configuration :: "; + flush(); + + // + // Update the default admin user with their information. + // + $sql = "SELECT MIN(user_regdate) AS oldest_time + FROM " . USERS_TABLE . " + WHERE user_regdate > 0 AND user_id > 0"; + $result = query($sql, "Couldn't obtain oldest post time"); + + $row = $db->sql_fetchrow($result); + + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('board_startdate', " . $row['oldest_time'] . ")"; + query($sql, "Couldn't insert board_startdate"); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $server_name . "' + WHERE config_name = 'server_name' + OR config_name = 'cookie_domain'"; + query($sql, "Couldn't insert Board Server domain"); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $server_port . "' + WHERE config_name = 'server_port'"; + query($sql, "Couldn't insert Board server port"); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $board_email . "' + WHERE config_name = 'board_email'"; + query($sql, "Couldn't insert Board admin email"); + + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '" . $script_path . "' + WHERE config_name = 'script_path'"; + query($sql, "Couldn't insert Board admin email"); + + // + // Change session table to HEAP if MySQL version matches + // + $sql = "SELECT VERSION() AS mysql_version"; + $result = query($sql, "Couldn't obtain MySQL Version"); + + $row = $db->sql_fetchrow($result); + + $version = $row['mysql_version']; + + if ( preg_match("/^(3\.23)|(4\.)/", $version) ) + { + $sql = "ALTER TABLE " . $table_prefix . "sessions + TYPE=HEAP"; + $db->sql_query($sql); + } + + echo "OK
    \n"; + end_step('drop_fields'); + + case 'drop_fields': + $fields = array( + BANLIST_TABLE => array("ban_start", "ban_end", "ban_time_type"), + FORUMS_TABLE => array("forum_access", "forum_moderator", "forum_type"), + PRIVMSGS_TABLE => array("msg_text"), + RANKS_TABLE => array("rank_max"), + SMILIES_TABLE => array("emotion"), + TOPICS_TABLE => array("topic_notify") + ); + + while( list($table, $field_data) = each($fields) ) + { + for($i = 0; $i < count($field_data); $i++) + { + print " * Drop field '" . $field_data[$i] . "' in '$table' :: "; + flush(); + + $sql = "ALTER TABLE $table + DROP COLUMN " . $field_data[$i]; + query($sql, "Couldn't drop field :: " . $field_data[$i] . " from table :: $table"); + + print "OK
    \n"; + + } + } + + end_step('drop_tables'); + + case 'drop_tables': + $drop_tables = array('access', 'forum_access', 'forum_mods', 'headermetafooter', 'whosonline', $table_prefix . 'old_config'); + + for($i = 0; $i < count($drop_tables); $i++) + { + print " * Dropping table '" . $drop_tables[$i] . "' :: "; + flush(); + + $sql = "DROP TABLE " . $drop_tables[$i]; + query($sql, "Couldn't drop table :: " . $drop_tables[$i]); + + print "OK
    \n"; + } + + echo "\n

    \n\nUPGRADE COMPLETED
    \n"; + } +} + +print "
    If the upgrade completed without error you may click Here to proceed to the index
    "; + +common_footer(); + +?>