From 9532514c2a566437a9524af1dfca298da58fd40a Mon Sep 17 00:00:00 2001 From: David M Date: Mon, 24 Jul 2006 10:08:36 +0000 Subject: [PATCH] OK... This commit should increase the total number of BBCodes from 31 to 2040. Some things to watch out for: Each database likes to deal with binary data in its own, special way. They are, quite frankly, too cool for school. MySQL, MSSQL and Oracle all allow me to send in a default value for their binary column using a hex number. However, MSSQL forces me to send the specific data as a hex number and thus we must CAST it. PostgreSQL allows me to set a binary column, but with a twist. It demands that the default be in _octal_ and its datatype allows somewhere around a gigabyte's worth of BBCodes ( PGSQL users, we shut you down to 2040 for your own good! ) Firebird has no decent mechanism for allowing me to shuttle in binary data so I must force my way in. By virtue of triggers and a UDF, we ram in our default values. SQLite is the most bizarre of them all. They have no mechanism for turning an ASCII code into a ASCII character. Because of this, we have a trigger and a UDF (just like Firebird!) but with a twist! The UDF is defined on the PHP side of things instead of SQL. SQLite also demands that it's data be encoded before being sent off. Other notes: - SQLite installs again :D - Firebird nearly installs again :P - Database backup is not screwed up :P P.S. I hope nothing broke :D git-svn-id: file:///svn/phpbb/trunk@6209 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 2 +- phpBB/includes/acp/acp_database.php | 6 +- phpBB/includes/acp/acp_forums.php | 72 +- phpBB/includes/acp/acp_styles.php | 79 +- phpBB/includes/bbcode.php | 57 +- phpBB/includes/db/mssql.php | 2 +- phpBB/includes/db/sqlite.php | 27 + phpBB/includes/functions.php | 96 +- phpBB/includes/functions_posting.php | 140 ++- phpBB/includes/functions_privmsgs.php | 134 ++- phpBB/includes/functions_user.php | 207 ++++- phpBB/includes/message_parser.php | 16 +- phpBB/includes/ucp/ucp_groups.php | 2 +- phpBB/includes/ucp/ucp_pm_compose.php | 2 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 4 +- phpBB/includes/ucp/ucp_profile.php | 70 +- phpBB/install/install_install.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 151 +++- phpBB/install/schemas/mssql_schema.sql | 14 +- phpBB/install/schemas/mysql_schema.sql | 14 +- phpBB/install/schemas/oracle_schema.sql | 14 +- phpBB/install/schemas/postgres_schema.sql | 18 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 1001 +++++++++++---------- phpBB/posting.php | 2 +- phpBB/viewtopic.php | 8 +- 26 files changed, 1526 insertions(+), 616 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 675048327a..cdb6fce1f8 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -164,7 +164,7 @@ class acp_bbcodes $bbcode_id = NUM_CORE_BBCODES + 1; } - if ($bbcode_id > 31) + if ($bbcode_id > 2039) { trigger_error('TOO_MANY_BBCODES'); } diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 52a9732e82..7fd959b104 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -210,11 +210,11 @@ class acp_database case 'oracle': case 'postgres': case 'firebird': - $sql_data .= 'TRUNCATE TABLE ' . $table_name . "\n"; + $sql_data .= 'TRUNCATE TABLE ' . $table_name . ";\n"; break; case 'sqlite': - $sql_data .= 'DELETE FROM ' . $table_name . "\n"; + $sql_data .= 'DELETE FROM ' . $table_name . ";\n"; break; } } @@ -1686,7 +1686,7 @@ class acp_database if ($row['COLUMN_DEFAULT']) { - $line .= ' CONSTRAINT [DF_' . $table_name . '_' . $row['COLUMN_NAME'] . '] DEFAULT ' . $row['COLUMN_DEFAULT']; + $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT']; } $rows[] = $line; diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 21f633f4f6..8542d44301 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -104,7 +104,7 @@ class acp_forums 'forum_rules' => request_var('forum_rules', '', true), 'forum_rules_uid' => '', 'forum_rules_options' => 0, - 'forum_rules_bitfield' => 0, + 'forum_rules_bitfield' => '', 'forum_rules_link' => request_var('forum_rules_link', ''), 'forum_image' => request_var('forum_image', ''), 'forum_style' => request_var('forum_style', 0), @@ -419,7 +419,7 @@ class acp_forums { // Before we are able to display the preview and plane text, we need to parse our request_var()'d value... $forum_data['forum_rules_uid'] = ''; - $forum_data['forum_rules_bitfield'] = 0; + $forum_data['forum_rules_bitfield'] = ''; $forum_data['forum_rules_options'] = 0; generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smiliess', false)); @@ -439,7 +439,7 @@ class acp_forums { // Before we are able to display the preview and plane text, we need to parse our request_var()'d value... $forum_data['forum_desc_uid'] = ''; - $forum_data['forum_desc_bitfield'] = 0; + $forum_data['forum_desc_bitfield'] = ''; $forum_data['forum_desc_options'] = 0; generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smiliess', false)); @@ -919,8 +919,72 @@ class acp_forums $forum_id = $forum_data_sql['forum_id']; unset($forum_data_sql['forum_id']); + $query = ''; + + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $values = array(); + foreach ($forum_data_sql as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'forum_desc_bitfield' && $key != 'forum_rules_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + case 'sqlite': + $values = array(); + foreach ($forum_data_sql as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'forum_desc_bitfield' && $key != 'forum_rules_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = '" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + default: + $query = $db->sql_build_array('UPDATE', $forum_data_sql); + break; + } + $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . ' + SET ' . $query . ' WHERE forum_id = ' . $forum_id; $db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 92bd515f98..2e27995a81 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -27,7 +27,14 @@ class acp_styles global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; // Hardcoded template bitfield to add for new templates - define('TEMPLATE_BITFIELD', 6921); + $bitfield = new bitfield(); + $bitfield->set(0); + $bitfield->set(3); + $bitfield->set(8); + $bitfield->set(9); + $bitfield->set(11); + $bitfield->set(12); + define('TEMPLATE_BITFIELD', $bitfield->data); $user->add_lang('acp/styles'); @@ -2917,10 +2924,78 @@ pagination_sep = \'{PAGINATION_SEP}\' unset($cfg_data); } + $query = ''; + + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + case 'sqlite': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "'" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + default: + $query = $db->sql_build_array('INSERT', $sql_ary); + break; + } + $db->sql_transaction('begin'); $sql = "INSERT INTO $sql_from - " . $db->sql_build_array('INSERT', $sql_ary); + " . $query; $db->sql_query($sql); $id = $db->sql_nextid(); diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 680d17dd20..96efad10f8 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -15,7 +15,7 @@ class bbcode { var $bbcode_uid = ''; - var $bbcode_bitfield = 0; + var $bbcode_bitfield = ''; var $bbcode_cache = array(); var $bbcode_template = array(); @@ -69,32 +69,31 @@ class bbcode $str = array('search' => array(), 'replace' => array()); $preg = array('search' => array(), 'replace' => array()); - $bitlen = strlen(decbin($this->bbcode_bitfield)); - for ($bbcode_id = 0; $bbcode_id < $bitlen; ++$bbcode_id) + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + foreach ($bbcodes_set as $bbcode_id) { - if ($this->bbcode_bitfield & (1 << $bbcode_id)) + if (!empty($this->bbcode_cache[$bbcode_id])) { - if (!empty($this->bbcode_cache[$bbcode_id])) + foreach ($this->bbcode_cache[$bbcode_id] as $type => $array) { - foreach ($this->bbcode_cache[$bbcode_id] as $type => $array) + foreach ($array as $search => $replace) { - foreach ($array as $search => $replace) - { - ${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search); - ${$type}['replace'][] = $replace; - } + ${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search); + ${$type}['replace'][] = $replace; + } - if (sizeof($str['search'])) - { - $message = str_replace($str['search'], $str['replace'], $message); - $str = array('search' => array(), 'replace' => array()); - } + if (sizeof($str['search'])) + { + $message = str_replace($str['search'], $str['replace'], $message); + $str = array('search' => array(), 'replace' => array()); + } - if (sizeof($preg['search'])) - { - $message = preg_replace($preg['search'], $preg['replace'], $message); - $preg = array('search' => array(), 'replace' => array()); - } + if (sizeof($preg['search'])) + { + $message = preg_replace($preg['search'], $preg['replace'], $message); + $preg = array('search' => array(), 'replace' => array()); } } } @@ -129,9 +128,12 @@ class bbcode $bbcode_ids = $rowset = array(); $bitlen = strlen(decbin($this->bbcode_bitfield)); - for ($bbcode_id = 0; $bbcode_id < $bitlen; ++$bbcode_id) + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + foreach ($bbcodes_set as $bbcode_id) { - if (isset($this->bbcode_cache[$bbcode_id]) || !($this->bbcode_bitfield & (1 << $bbcode_id))) + if (isset($this->bbcode_cache[$bbcode_id])) { // do not try to re-cache it if it's already in continue; @@ -312,9 +314,13 @@ class bbcode break; default: + if (!isset($template_bitfield)) + { + $template_bitfield = new bitfield($this->template_bitfield); + } if (isset($rowset[$bbcode_id])) { - if ($this->template_bitfield & (1 << $bbcode_id)) + if ($template_bitfield->get($bbcode_id)) { // The bbcode requires a custom template to be loaded if (!$bbcode_tpl = $this->bbcode_tpl($rowset[$bbcode_id]['bbcode_tag'], $bbcode_id)) @@ -390,9 +396,10 @@ class bbcode 'color' => '$2', 'email' => '$2' ); + $template_bitfield = new bitfield($this->template_bitfield); } - if ($bbcode_id != -1 && !($this->template_bitfield & (1 << $bbcode_id))) + if ($bbcode_id != -1 && !$template_bitfield->get($bbcode_id)) { return (isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false; } diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index efe0b4333d..6ef8597c18 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -243,7 +243,7 @@ class dbal_mssql extends dbal { foreach ($row as $key => $value) { - $row[$key] = ($value === ' ') ? '' : $value; + $row[$key] = ($value === ' ' && strpos($key, 'bitfield') === false) ? '' : $value; } } diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 7b23171187..95f12175c3 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -47,6 +47,8 @@ class dbal_sqlite extends dbal { @sqlite_query('PRAGMA short_column_names = 1', $this->db_connect_id); } + + sqlite_create_function($this->db_connect_id, 'binary_insert', array('dbal_sqlite', '_sql_insert'), 1); return ($this->db_connect_id) ? true : array('message' => $error); } @@ -328,6 +330,31 @@ class dbal_sqlite extends dbal } } + /** + * Build the proper binary string used for the default + * @access: private + */ + function _sql_insert($mode) + { + if ($mode == 1) + { + $bitfield = new bitfield(); + $bitfield->set(0); + $bitfield->set(3); + $bitfield->set(8); + $bitfield->set(9); + $bitfield->set(11); + $bitfield->set(12); + return sqlite_udf_encode_binary($bitfield->data); + } + /* + else + { + return sqlite_udf_encode_binary("\0"); + } + */ + } + } } // if ... define diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c5d5b2f2a3..d5355ca600 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1857,7 +1857,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb global $phpbb_root_path, $phpEx; $uid = ''; - $bitfield = 0; + $bitfield = ''; if (!$text) { @@ -2863,4 +2863,98 @@ function garbage_collection() $db->sql_close(); } +class bitfield +{ + var $data; + + function bitfield($bitfield = '') + { + $this->data = $bitfield; + } + + function get($n) + { + /** + * Get the ($n / 8)th char + */ + $byte = $n >> 3; + + if (!isset($this->data[$byte])) + { + /** + * Of course, if it doesn't exist then the result if FALSE + */ + return FALSE; + } + + $c = $this->data[$byte]; + + /** + * Lookup the ($n % 8)th bit of the byte + */ + $bit = 7 - ($n & 7); + return (bool) (ord($c) & (1 << $bit)); + } + + function set($n) + { + $byte = $n >> 3; + $bit = 7 - ($n & 7); + + if (isset($this->data[$byte])) + { + $this->data[$byte] = $this->data[$byte] | chr(1 << $bit); + } + else + { + if ($byte - strlen($this->data) > 0) + { + $this->data .= str_repeat("\0", $byte - strlen($this->data)); + } + $this->data .= chr(1 << $bit); + } + } + + function clear($n) + { + $byte = $n >> 3; + + if (!isset($this->data[$byte])) + { + return; + } + + $bit = 7 - ($n & 7); + $this->data[$byte] = $this->data[$byte] &~ chr(1 << $bit); + } + + function get_blob() + { + return $this->data; + } + + function get_bin() + { + $bin = ''; + $len = strlen($this->data); + + for ($i = 0; $i < $len; ++$i) + { + $bin .= str_pad(decbin(ord($this->data[$i])), 8, '0', STR_PAD_LEFT); + } + + return $bin; + } + + function get_all_set() + { + return array_keys(array_filter(str_split($this->get_bin()))); + } + + function merge($bitfield) + { + $this->data = $this->data | $bitfield->get_blob(); + } +} + ?> \ No newline at end of file diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index d2ee32969b..d0567f5e76 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -832,11 +832,11 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id return false; } - $bbcode_bitfield = 0; + $bbcode_bitfield = ''; do { $rowset[] = $row; - $bbcode_bitfield |= $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; } while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); @@ -1537,8 +1537,76 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u ); } - $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . - $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']); + $query = ''; + + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $fields = array(); + foreach ($sql_data[POSTS_TABLE]['sql'] as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + case 'sqlite': + $fields = array(); + foreach ($sql_data[POSTS_TABLE]['sql'] as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "'" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + default: + $query = $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']); + break; + } + + + $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $query; $db->sql_query($sql); $data['post_id'] = $db->sql_nextid(); @@ -1614,8 +1682,70 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u // Update the posts table if (isset($sql_data[POSTS_TABLE]['sql'])) { + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $values = array(); + foreach ($sql_data as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + case 'sqlite': + $values = array(); + foreach ($sql_data as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key ='" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + default: + $query = $db->sql_build_array('UPDATE', $sql_data); + break; + } + $sql = 'UPDATE ' . POSTS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . ' + SET ' . $query . ' WHERE post_id = ' . $data['post_id']; $db->sql_query($sql); } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 238ac76cb5..dde811c3f3 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1302,15 +1302,145 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr if (sizeof($sql_data)) { + $query = ''; + if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') { - $db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data)); + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $fields = array(); + foreach ($sql_data as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + case 'sqlite': + $fields = array(); + foreach ($sql_data as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "'" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + default: + $query = $db->sql_build_array('INSERT', $sql_data); + break; + } + + $db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $query); $data['msg_id'] = $db->sql_nextid(); } else if ($mode == 'edit') { + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $values = array(); + foreach ($sql_data as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'forum_desc_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + case 'sqlite': + $values = array(); + foreach ($sql_data as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'forum_desc_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = '" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + default: + $query = $db->sql_build_array('UPDATE', $sql_data); + break; + } + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' - SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . ' + SET message_edit_count = message_edit_count + 1, ' . $query . ' WHERE msg_id = ' . $data['msg_id']; $db->sql_query($sql); } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 72383c1501..b0c2d4a2b7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -186,7 +186,7 @@ function user_add($user_row, $cp_data = false) 'user_sig' => '', 'user_sig_bbcode_uid' => '', - 'user_sig_bbcode_bitfield' => 0, + 'user_sig_bbcode_bitfield' => '', ); // Now fill the sql array with not required variables @@ -207,7 +207,75 @@ function user_add($user_row, $cp_data = false) } } - $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $query = ''; + + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'user_sig_bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + case 'sqlite': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'user_sig_bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "'" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + default: + $query = $db->sql_build_array('INSERT', $sql_ary); + break; + } + + $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $query; $db->sql_query($sql); $user_id = $db->sql_nextid(); @@ -1388,7 +1456,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow 'group_name' => (string) $name, 'group_desc' => (string) $desc, 'group_desc_uid' => '', - 'group_desc_bitfield' => 0, + 'group_desc_bitfield' => '', 'group_type' => (int) $type, ); @@ -1413,15 +1481,144 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Setting the log message before we set the group id (if group gets added) $log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED'; + $query = ''; + if ($group_id) { + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $values = array(); + foreach ($sql_ary as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'group_desc_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + case 'sqlite': + $values = array(); + foreach ($sql_ary as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'group_desc_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = '" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + default: + $query = $db->sql_build_array('UPDATE', $sql_ary); + break; + } + $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + SET ' . $query . " WHERE group_id = $group_id"; } else { - $sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + case 'sqlite': + $fields = array(); + foreach ($sql_ary as $key => $var) + { + $fields[] = $key; + + if (is_null($var)) + { + $values[] = 'NULL'; + } + else if (is_string($var)) + { + if ($key !== 'bbcode_bitfield') + { + $values[] = "'" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "'" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? intval($var) : $var; + } + } + $query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; + break; + + default: + $query = $db->sql_build_array('INSERT', $sql_ary); + break; + } + $sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $query; } $db->sql_query($sql); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index a44a11d566..37376c17e8 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -43,7 +43,9 @@ class bbcode_firstpass extends bbcode } global $user; - $this->bbcode_bitfield = 0; + + $this->bbcode_bitfield = ''; + $bitfield = new bitfield(); $size = strlen($this->message); foreach ($this->bbcodes as $bbcode_name => $bbcode_data) @@ -72,10 +74,12 @@ class bbcode_firstpass extends bbcode $new_size = strlen($this->message); if ($size != $new_size) { - $this->bbcode_bitfield |= (1 << $bbcode_data['bbcode_id']); + $bitfield->set($bbcode_data['bbcode_id']); $size = $new_size; } } + + $this->bbcode_bitfield = $bitfield->get_blob(); } /** @@ -1376,21 +1380,21 @@ class parse_message extends bbcode_firstpass // Parse Poll Option text ;) $tmp_message = $this->message; $this->message = $poll['poll_option_text']; - $bbcode_bitfield = $this->bbcode_bitfield; + $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false); - $this->bbcode_bitfield |= $bbcode_bitfield; + $this->message = $tmp_message; // Parse Poll Title $tmp_message = $this->message; $this->message = $poll['poll_title']; - $bbcode_bitfield = $this->bbcode_bitfield; + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false); - $this->bbcode_bitfield |= $bbcode_bitfield; + $this->message = $tmp_message; unset($tmp_message); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index a9fb0444f5..4dcacdc575 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -316,7 +316,7 @@ class ucp_groups // Hide hidden groups unless user is an admin with group privileges $sql_and = ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')'; - $sql = 'SELECT group_id, group_name, group_desc, group_desc_uid, group_desc_bitfield, group_type + $sql = 'SELECT group_id, group_name, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type FROM ' . GROUPS_TABLE . ' WHERE group_id NOT IN (' . implode(', ', $group_id_ary) . ") AND group_type $sql_and diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 272b93af55..8ba12650c1 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -520,7 +520,7 @@ function compose_pm($id, $mode, $action) 'enable_bbcode' => (bool) $enable_bbcode, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, - 'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 8e1b580571..3df09a4a0c 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -264,7 +264,7 @@ function message_history($msg_id, $user_id, $message_row, $folder) } $rowset = array(); - $bbcode_bitfield = 0; + $bbcode_bitfield = ''; $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; $title = ($sort_dir == 'd') ? $row['message_subject'] : ''; @@ -281,7 +281,7 @@ function message_history($msg_id, $user_id, $message_row, $folder) else { $rowset[$row['msg_id']] = $row; - $bbcode_bitfield |= $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; } } while ($row = $db->sql_fetchrow($result)); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index c529e55223..522aa29723 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -431,17 +431,81 @@ class ucp_profile { $error[] = implode('
', $message_parser->warn_msg); } - + if (!sizeof($error) && $submit) { $sql_ary = array( 'user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, - 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield + 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield ); + $query = ''; + + switch (SQL_LAYER) + { + case 'mssql': + case 'mssql_odbc': + $values = array(); + foreach ($sql_ary as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'user_sig_bbcode_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = CAST('" . $var . "' AS varbinary)"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + case 'sqlite': + $values = array(); + foreach ($sql_ary as $key => $var) + { + if (is_null($var)) + { + $values[] = "$key = NULL"; + } + else if (is_string($var)) + { + if ($key !== 'user_sig_bbcode_bitfield') + { + $values[] = "$key = '" . $db->sql_escape($var) . "'"; + } + else + { + $values[] = "$key = '" . sqlite_udf_encode_binary($var) . "'"; + } + } + else + { + $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; + } + } + $query = implode(', ', $values); + break; + + default: + $query = $db->sql_build_array('UPDATE', $sql_ary); + break; + } + $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . $query . ' WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 14b703e29f..6e63f38b31 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1881,7 +1881,7 @@ class install_install extends module 'LABEL' => 'SQLite', 'SCHEMA' => 'sqlite', 'MODULE' => 'sqlite', - 'DELIM' => ';', + 'DELIM' => ';;', 'COMMENTS' => 'remove_remarks' ), ); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index be7c161a9c..344c4844a9 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -4,6 +4,24 @@ # $Id$ # +# Function declarations + +# Emulation of STRLEN, might need to be checked out for FB 2.0 +DECLARE EXTERNAL FUNCTION STRLEN CSTRING(32767) +RETURNS INTEGER BY VALUE +ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';; + +# Emulation of LOWER, might need to be checked out for FB 2.0 +DECLARE EXTERNAL FUNCTION LOWER CSTRING(80) +RETURNS CSTRING(80) FREE_IT +ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf';; + +# Only used for insertion of binary strings as defaults +DECLARE EXTERNAL FUNCTION ASCII_CHAR INTEGER +RETURNS CSTRING(1) FREE_IT +ENTRY_POINT 'IB_UDF_ascii_char' MODULE_NAME 'ib_udf';; + + # Table: 'phpbb_attachments' CREATE TABLE phpbb_attachments ( attach_id INTEGER NOT NULL, @@ -40,7 +58,6 @@ BEGIN NEW.attach_id = GEN_ID(phpbb_attachments_gen, 1); END;; - # Table: 'phpbb_acl_groups' CREATE TABLE phpbb_acl_groups ( group_id INTEGER DEFAULT 0 NOT NULL, @@ -166,7 +183,7 @@ CREATE TABLE phpbb_bbcodes ( ALTER TABLE phpbb_bbcodes ADD PRIMARY KEY (bbcode_id);; -CREATE INDEX phpbb_bbcodes_display_in_posting ON phpbb_bbcodes(display_on_posting);; +CREATE INDEX phpbb_bbcodes_display_in_post ON phpbb_bbcodes(display_on_posting);; # Table: 'phpbb_bookmarks' CREATE TABLE phpbb_bookmarks ( @@ -205,7 +222,7 @@ END;; # Table: 'phpbb_config' CREATE TABLE phpbb_config ( - config_name VARCHAR(255) DEFAULT '' NOT NULL, + config_name VARCHAR(252) DEFAULT '' NOT NULL, config_value VARCHAR(255) DEFAULT '' NOT NULL, is_dynamic INTEGER DEFAULT 0 NOT NULL );; @@ -328,7 +345,7 @@ CREATE TABLE phpbb_forums ( forum_parents BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, forum_name BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, forum_desc BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, - forum_desc_bitfield INTEGER DEFAULT 0 NOT NULL, + forum_desc_bitfield CHAR(255) DEFAULT '' NOT NULL, forum_desc_options INTEGER DEFAULT 0 NOT NULL, forum_desc_uid VARCHAR(5) DEFAULT '' NOT NULL, forum_link VARCHAR(255) DEFAULT '' NOT NULL, @@ -337,7 +354,7 @@ CREATE TABLE phpbb_forums ( forum_image VARCHAR(255) DEFAULT '' NOT NULL, forum_rules BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, forum_rules_link VARCHAR(255) DEFAULT '' NOT NULL, - forum_rules_bitfield INTEGER DEFAULT 0 NOT NULL, + forum_rules_bitfield CHAR(255) DEFAULT '' NOT NULL, forum_rules_options INTEGER DEFAULT 0 NOT NULL, forum_rules_uid VARCHAR(5) DEFAULT '' NOT NULL, forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, @@ -376,6 +393,22 @@ BEGIN NEW.forum_id = GEN_ID(phpbb_forums_gen, 1); END;; +CREATE TRIGGER t_phpbb_forums_desc_bitf FOR phpbb_forums +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.forum_desc_bitfield is null) THEN + NEW.forum_desc_bitfield = ASCII_CHAR(0); +END;; + +CREATE TRIGGER t_phpbb_forums_rules_bitf FOR phpbb_forums +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.forum_rules_bitfield is null) THEN + NEW.forum_rules_bitfield = ASCII_CHAR(0); +END;; + # Table: 'phpbb_forums_access' CREATE TABLE phpbb_forums_access ( @@ -406,7 +439,7 @@ CREATE TABLE phpbb_forums_watch ( CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch(forum_id);; CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch(user_id);; -CREATE INDEX phpbb_forums_watch_notify_status ON phpbb_forums_watch(notify_status);; +CREATE INDEX phpbb_forums_watch_notify_stat ON phpbb_forums_watch(notify_status);; # Table: 'phpbb_groups' CREATE TABLE phpbb_groups ( @@ -414,7 +447,7 @@ CREATE TABLE phpbb_groups ( group_type INTEGER DEFAULT 1 NOT NULL, group_name VARCHAR(255) DEFAULT '' NOT NULL, group_desc BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, - group_desc_bitfield INTEGER DEFAULT 0 NOT NULL, + group_desc_bitfield CHAR(255) DEFAULT '' NOT NULL, group_desc_options INTEGER DEFAULT 0 NOT NULL, group_desc_uid VARCHAR(5) DEFAULT '' NOT NULL, group_display INTEGER DEFAULT 0 NOT NULL, @@ -444,6 +477,14 @@ BEGIN NEW.group_id = GEN_ID(phpbb_groups_gen, 1); END;; +CREATE TRIGGER t_phpbb_groups_bitf FOR phpbb_groups +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.group_desc_bitfield is null) THEN + NEW.group_desc_bitfield = ASCII_CHAR(0); +END;; + # Table: 'phpbb_icons' CREATE TABLE phpbb_icons ( @@ -537,7 +578,7 @@ CREATE TABLE phpbb_moderator_cache ( display_on_index INTEGER DEFAULT 1 NOT NULL );; -CREATE INDEX phpbb_moderator_cache_display_on_index ON phpbb_moderator_cache(display_on_index);; +CREATE INDEX phpbb_moderator_cche_dis_on_idx ON phpbb_moderator_cache(display_on_index);; CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache(forum_id);; # Table: 'phpbb_modules' @@ -580,7 +621,7 @@ CREATE TABLE phpbb_poll_options ( poll_option_total INTEGER DEFAULT 0 NOT NULL );; -CREATE INDEX phpbb_poll_options_poll_option_id ON phpbb_poll_options(poll_option_id);; +CREATE INDEX phpbb_poll_options_poll_opt_id ON phpbb_poll_options(poll_option_id);; CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options(topic_id);; # Table: 'phpbb_poll_votes' @@ -616,7 +657,7 @@ CREATE TABLE phpbb_posts ( post_checksum VARCHAR(32) DEFAULT '' NOT NULL, post_encoding VARCHAR(20) DEFAULT 'iso-8859-1' NOT NULL, post_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield CHAR(255) DEFAULT '' NOT NULL, bbcode_uid VARCHAR(5) DEFAULT '' NOT NULL, post_edit_time INTEGER DEFAULT 0 NOT NULL, post_edit_reason BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, @@ -644,6 +685,14 @@ BEGIN NEW.post_id = GEN_ID(phpbb_posts_gen, 1); END;; +CREATE TRIGGER t_phpbb_posts_bitf FOR phpbb_posts +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.bbcode_bitfield is null) THEN + NEW.bbcode_bitfield = ASCII_CHAR(0); +END;; + # Table: 'phpbb_privmsgs' CREATE TABLE phpbb_privmsgs ( @@ -663,7 +712,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_user INTEGER DEFAULT 0 NOT NULL, message_encoding VARCHAR(20) DEFAULT 'iso-8859-1' NOT NULL, message_attachment INTEGER DEFAULT 0 NOT NULL, - bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, + bbcode_bitfield CHAR(255) DEFAULT '' NOT NULL, bbcode_uid VARCHAR(5) DEFAULT '' NOT NULL, message_edit_time INTEGER DEFAULT 0 NOT NULL, message_edit_count INTEGER DEFAULT 0 NOT NULL, @@ -688,6 +737,14 @@ BEGIN NEW.msg_id = GEN_ID(phpbb_privmsgs_gen, 1); END;; +CREATE TRIGGER t_phpbb_privmsgs_bitf FOR phpbb_privmsgs +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.bbcode_bitfield is null) THEN + NEW.bbcode_bitfield = ASCII_CHAR(0); +END;; + # Table: 'phpbb_privmsgs_folder' CREATE TABLE phpbb_privmsgs_folder ( @@ -754,7 +811,7 @@ CREATE TABLE phpbb_privmsgs_to ( );; CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to(msg_id);; -CREATE INDEX phpbb_privmsgs_to_user_folder_id ON phpbb_privmsgs_to(user_id, folder_id);; +CREATE INDEX phpbb_privmsgs_to_usr_flder_id ON phpbb_privmsgs_to(user_id, folder_id);; # Table: 'phpbb_profile_fields' CREATE TABLE phpbb_profile_fields ( @@ -779,7 +836,7 @@ CREATE TABLE phpbb_profile_fields ( ALTER TABLE phpbb_profile_fields ADD PRIMARY KEY (field_id);; CREATE INDEX phpbb_profile_fields_field_type ON phpbb_profile_fields(field_type);; -CREATE INDEX phpbb_profile_fields_field_order ON phpbb_profile_fields(field_order);; +CREATE INDEX phpbb_profile_fields_field_ordr ON phpbb_profile_fields(field_order);; CREATE GENERATOR phpbb_profile_fields_gen;; SET GENERATOR phpbb_profile_fields_gen TO 0;; @@ -1005,7 +1062,7 @@ CREATE TABLE phpbb_smilies ( ALTER TABLE phpbb_smilies ADD PRIMARY KEY (smiley_id);; -CREATE INDEX phpbb_smilies_display_on_posting ON phpbb_smilies(display_on_posting);; +CREATE INDEX phpbb_smilies_display_on_postng ON phpbb_smilies(display_on_posting);; CREATE GENERATOR phpbb_smilies_gen;; SET GENERATOR phpbb_smilies_gen TO 0;; @@ -1021,7 +1078,7 @@ END;; # Table: 'phpbb_styles' CREATE TABLE phpbb_styles ( style_id INTEGER NOT NULL, - style_name VARCHAR(255) DEFAULT '' NOT NULL, + style_name VARCHAR(252) DEFAULT '' NOT NULL, style_copyright VARCHAR(255) DEFAULT '' NOT NULL, style_active INTEGER DEFAULT 1 NOT NULL, template_id INTEGER DEFAULT 0 NOT NULL, @@ -1050,16 +1107,16 @@ END;; # Table: 'phpbb_styles_template' CREATE TABLE phpbb_styles_template ( template_id INTEGER NOT NULL, - template_name VARCHAR(255) DEFAULT '' NOT NULL, + template_name VARCHAR(252) DEFAULT '' NOT NULL, template_copyright VARCHAR(255) DEFAULT '' NOT NULL, template_path VARCHAR(100) DEFAULT '' NOT NULL, - bbcode_bitfield INTEGER DEFAULT 6921 NOT NULL, + bbcode_bitfield CHAR(255) DEFAULT '' NOT NULL, template_storedb INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_styles_template ADD PRIMARY KEY (template_id);; -CREATE UNIQUE INDEX phpbb_styles_template_template_name ON phpbb_styles_template(template_name);; +CREATE UNIQUE INDEX phpbb_styles_template_tmplte_nm ON phpbb_styles_template(template_name);; CREATE GENERATOR phpbb_styles_template_gen;; SET GENERATOR phpbb_styles_template_gen TO 0;; @@ -1071,6 +1128,14 @@ BEGIN NEW.template_id = GEN_ID(phpbb_styles_template_gen, 1); END;; +CREATE TRIGGER t_phpbb_styles_template_bitf FOR phpbb_styles_template +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.bbcode_bitfield is null) THEN + NEW.bbcode_bitfield = ASCII_CHAR(144) || ASCII_CHAR(216); +END;; + # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( @@ -1081,13 +1146,13 @@ CREATE TABLE phpbb_styles_template_data ( template_data BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL );; -CREATE INDEX phpbb_styles_template_data_template_id ON phpbb_styles_template_data(template_id);; -CREATE INDEX phpbb_styles_template_data_template_filename ON phpbb_styles_template_data(template_filename);; +CREATE INDEX phpbb_styles_tmplte_dt_tmplt_id ON phpbb_styles_template_data(template_id);; +CREATE INDEX phpbb_styles_tmplte_d_tmpl_flnm ON phpbb_styles_template_data(template_filename);; CREATE GENERATOR phpbb_styles_template_data_gen;; SET GENERATOR phpbb_styles_template_data_gen TO 0;; -CREATE TRIGGER t_phpbb_styles_template_data_gen FOR phpbb_styles_template_data +CREATE TRIGGER t_phpbb_styles_templte_data_gen FOR phpbb_styles_template_data BEFORE INSERT AS BEGIN @@ -1098,7 +1163,7 @@ END;; # Table: 'phpbb_styles_theme' CREATE TABLE phpbb_styles_theme ( theme_id INTEGER NOT NULL, - theme_name VARCHAR(255) DEFAULT '' NOT NULL, + theme_name VARCHAR(252) DEFAULT '' NOT NULL, theme_copyright VARCHAR(255) DEFAULT '' NOT NULL, theme_path VARCHAR(100) DEFAULT '' NOT NULL, theme_storedb INTEGER DEFAULT 0 NOT NULL, @@ -1124,7 +1189,7 @@ END;; # Table: 'phpbb_styles_imageset' CREATE TABLE phpbb_styles_imageset ( imageset_id INTEGER NOT NULL, - imageset_name VARCHAR(255) DEFAULT '' NOT NULL, + imageset_name VARCHAR(252) DEFAULT '' NOT NULL, imageset_copyright VARCHAR(255) DEFAULT '' NOT NULL, imageset_path VARCHAR(100) DEFAULT '' NOT NULL, site_logo VARCHAR(200) DEFAULT '' NOT NULL, @@ -1220,16 +1285,16 @@ CREATE TABLE phpbb_styles_imageset ( ALTER TABLE phpbb_styles_imageset ADD PRIMARY KEY (imageset_id);; -CREATE UNIQUE INDEX phpbb_styles_imageset_imageset_name ON phpbb_styles_imageset(imageset_name);; +CREATE UNIQUE INDEX phpbb_styles_imageset_imgset_nm ON phpbb_styles_imageset(imageset_name);; -CREATE GENERATOR phpbb_styles_imageset_gen;; -SET GENERATOR phpbb_styles_imageset_gen TO 0;; +CREATE GENERATOR t_phpbb_styles_imageset_gen;; +SET GENERATOR t_phpbb_styles_imageset_gen TO 0;; -CREATE TRIGGER t_phpbb_styles_imageset_gen FOR phpbb_styles_imageset +CREATE TRIGGER phpbb_styles_imageset_imgset_nm FOR phpbb_styles_imageset BEFORE INSERT AS BEGIN - NEW.imageset_id = GEN_ID(phpbb_styles_imageset_gen, 1); + NEW.imageset_id = GEN_ID(t_phpbb_styles_imageset_gen, 1); END;; @@ -1272,7 +1337,7 @@ ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);; CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);; CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);; -CREATE INDEX phpbb_topics_topic_last_post_time ON phpbb_topics(topic_last_post_time);; +CREATE INDEX phpbb_topics_topic_last_pst_tme ON phpbb_topics(topic_last_post_time);; CREATE GENERATOR phpbb_topics_gen;; SET GENERATOR phpbb_topics_gen TO 0;; @@ -1316,7 +1381,7 @@ CREATE TABLE phpbb_topics_watch ( CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch(topic_id);; CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch(user_id);; -CREATE INDEX phpbb_topics_watch_notify_status ON phpbb_topics_watch(notify_status);; +CREATE INDEX phpbb_topics_watch_notify_stat ON phpbb_topics_watch(notify_status);; # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( @@ -1339,7 +1404,7 @@ CREATE TABLE phpbb_users ( user_perm_from INTEGER DEFAULT 0 NOT NULL, user_ip VARCHAR(40) DEFAULT '' NOT NULL, user_regdate INTEGER DEFAULT 0 NOT NULL, - username VARCHAR(255) DEFAULT '' NOT NULL, + username VARCHAR(252) DEFAULT '' NOT NULL, user_password VARCHAR(40) DEFAULT '' NOT NULL, user_passchg INTEGER DEFAULT 0 NOT NULL, user_email VARCHAR(100) DEFAULT '' NOT NULL, @@ -1389,7 +1454,7 @@ CREATE TABLE phpbb_users ( user_avatar_height INTEGER DEFAULT 0 NOT NULL, user_sig BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, user_sig_bbcode_uid VARCHAR(5) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield INTEGER DEFAULT 0 NOT NULL, + user_sig_bbcode_bitfield CHAR(255) DEFAULT '' NOT NULL, user_from VARCHAR(100) DEFAULT '' NOT NULL, user_icq VARCHAR(15) DEFAULT '' NOT NULL, user_aim VARCHAR(255) DEFAULT '' NOT NULL, @@ -1420,6 +1485,14 @@ BEGIN NEW.user_id = GEN_ID(phpbb_users_gen, 1); END;; +CREATE TRIGGER t_phpbb_users_bitf FOR phpbb_users +ACTIVE BEFORE INSERT OR UPDATE POSITION 0 +AS +BEGIN + IF (NEW.user_sig_bbcode_bitfield is null) THEN + NEW.user_sig_bbcode_bitfield = ASCII_CHAR(0); +END;; + # Table: 'phpbb_warnings' CREATE TABLE phpbb_warnings ( @@ -1474,16 +1547,4 @@ CREATE TABLE phpbb_zebra ( );; CREATE INDEX phpbb_zebra_user_id ON phpbb_zebra(user_id);; -CREATE INDEX phpbb_zebra_zebra_id ON phpbb_zebra(zebra_id);; - - - -DECLARE EXTERNAL FUNCTION STRLEN - CSTRING(32767) -RETURNS INTEGER BY VALUE -ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';; - -DECLARE EXTERNAL FUNCTION LOWER CSTRING(80) -RETURNS CSTRING(80) FREE_IT -ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf';; - +CREATE INDEX phpbb_zebra_zebra_id ON phpbb_zebra(zebra_id);; \ No newline at end of file diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 67699a3d80..fe6cdf874f 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -352,7 +352,7 @@ CREATE TABLE [phpbb_forums] ( [forum_parents] [text] DEFAULT ('') NOT NULL , [forum_name] [varchar] (3000) DEFAULT ('') NOT NULL , [forum_desc] [varchar] (8000) DEFAULT ('') NOT NULL , - [forum_desc_bitfield] [int] DEFAULT (0) NOT NULL , + [forum_desc_bitfield] [varbinary] (255) DEFAULT (0x) NOT NULL , [forum_desc_options] [int] DEFAULT (0) NOT NULL , [forum_desc_uid] [varchar] (5) DEFAULT ('') NOT NULL , [forum_link] [varchar] (255) DEFAULT ('') NOT NULL , @@ -361,7 +361,7 @@ CREATE TABLE [phpbb_forums] ( [forum_image] [varchar] (255) DEFAULT ('') NOT NULL , [forum_rules] [varchar] (8000) DEFAULT ('') NOT NULL , [forum_rules_link] [varchar] (255) DEFAULT ('') NOT NULL , - [forum_rules_bitfield] [int] DEFAULT (0) NOT NULL , + [forum_rules_bitfield] [varbinary] (255) DEFAULT (0x) NOT NULL , [forum_rules_options] [int] DEFAULT (0) NOT NULL , [forum_rules_uid] [varchar] (5) DEFAULT ('') NOT NULL , [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , @@ -459,7 +459,7 @@ CREATE TABLE [phpbb_groups] ( [group_type] [int] DEFAULT (1) NOT NULL , [group_name] [varchar] (255) DEFAULT ('') NOT NULL , [group_desc] [varchar] (8000) DEFAULT ('') NOT NULL , - [group_desc_bitfield] [int] DEFAULT (0) NOT NULL , + [group_desc_bitfield] [varbinary] DEFAULT (0x) NOT NULL , [group_desc_options] [int] DEFAULT (0) NOT NULL , [group_desc_uid] [varchar] (5) DEFAULT ('') NOT NULL , [group_display] [int] DEFAULT (0) NOT NULL , @@ -673,7 +673,7 @@ CREATE TABLE [phpbb_posts] ( [post_checksum] [varchar] (32) DEFAULT ('') NOT NULL , [post_encoding] [varchar] (20) DEFAULT ('iso-8859-1') NOT NULL , [post_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varbinary] (255) DEFAULT (0x) NOT NULL , [bbcode_uid] [varchar] (5) DEFAULT ('') NOT NULL , [post_edit_time] [int] DEFAULT (0) NOT NULL , [post_edit_reason] [varchar] (3000) DEFAULT ('') NOT NULL , @@ -727,7 +727,7 @@ CREATE TABLE [phpbb_privmsgs] ( [message_edit_user] [int] DEFAULT (0) NOT NULL , [message_encoding] [varchar] (20) DEFAULT ('iso-8859-1') NOT NULL , [message_attachment] [int] DEFAULT (0) NOT NULL , - [bbcode_bitfield] [int] DEFAULT (0) NOT NULL , + [bbcode_bitfield] [varbinary] (255) DEFAULT (0x) NOT NULL , [bbcode_uid] [varchar] (5) DEFAULT ('') NOT NULL , [message_edit_time] [int] DEFAULT (0) NOT NULL , [message_edit_count] [int] DEFAULT (0) NOT NULL , @@ -1142,7 +1142,7 @@ CREATE TABLE [phpbb_styles_template] ( [template_name] [varchar] (255) DEFAULT ('') NOT NULL , [template_copyright] [varchar] (255) DEFAULT ('') NOT NULL , [template_path] [varchar] (100) DEFAULT ('') NOT NULL , - [bbcode_bitfield] [int] DEFAULT (6921) NOT NULL , + [bbcode_bitfield] [varbinary] (255) DEFAULT (0x90D8) NOT NULL , [template_storedb] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1494,7 +1494,7 @@ CREATE TABLE [phpbb_users] ( [user_avatar_height] [int] DEFAULT (0) NOT NULL , [user_sig] [text] DEFAULT ('') NOT NULL , [user_sig_bbcode_uid] [varchar] (5) DEFAULT ('') NOT NULL , - [user_sig_bbcode_bitfield] [int] DEFAULT (0) NOT NULL , + [user_sig_bbcode_bitfield] [varbinary] DEFAULT (255) NOT NULL , [user_from] [varchar] (100) DEFAULT ('') NOT NULL , [user_icq] [varchar] (15) DEFAULT ('') NOT NULL , [user_aim] [varchar] (255) DEFAULT ('') NOT NULL , diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index e1d39e7c97..f001d8b194 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -216,7 +216,7 @@ CREATE TABLE phpbb_forums ( forum_parents mediumtext DEFAULT '' NOT NULL, forum_name text DEFAULT '' NOT NULL, forum_desc text DEFAULT '' NOT NULL, - forum_desc_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_desc_bitfield varbinary(255) DEFAULT '\0' NOT NULL, forum_desc_options int(11) UNSIGNED DEFAULT '0' NOT NULL, forum_desc_uid varchar(5) DEFAULT '' NOT NULL, forum_link varchar(255) DEFAULT '' NOT NULL, @@ -225,7 +225,7 @@ CREATE TABLE phpbb_forums ( forum_image varchar(255) DEFAULT '' NOT NULL, forum_rules text DEFAULT '' NOT NULL, forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + forum_rules_bitfield varbinary(255) DEFAULT '\0' NOT NULL, forum_rules_options int(11) UNSIGNED DEFAULT '0' NOT NULL, forum_rules_uid varchar(5) DEFAULT '' NOT NULL, forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, @@ -288,7 +288,7 @@ CREATE TABLE phpbb_groups ( group_type tinyint(4) DEFAULT '1' NOT NULL, group_name varchar(255) DEFAULT '' NOT NULL, group_desc text DEFAULT '' NOT NULL, - group_desc_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + group_desc_bitfield varbinary(255) DEFAULT '\0' NOT NULL, group_desc_options int(11) UNSIGNED DEFAULT '0' NOT NULL, group_desc_uid varchar(5) DEFAULT '' NOT NULL, group_display tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, @@ -430,7 +430,7 @@ CREATE TABLE phpbb_posts ( post_checksum varchar(32) DEFAULT '' NOT NULL, post_encoding varchar(20) DEFAULT 'iso-8859-1' NOT NULL, post_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '\0' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, post_edit_reason text DEFAULT '' NOT NULL, @@ -465,7 +465,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, message_encoding varchar(20) DEFAULT 'iso-8859-1' NOT NULL, message_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, - bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT '\0' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, message_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL, @@ -717,7 +717,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar(255) DEFAULT '' NOT NULL, template_copyright varchar(255) DEFAULT '' NOT NULL, template_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield int(11) UNSIGNED DEFAULT '6921' NOT NULL, + bbcode_bitfield varbinary(255) DEFAULT 0x90D8 NOT NULL, template_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (template_id), UNIQUE template_name (template_name) @@ -992,7 +992,7 @@ CREATE TABLE phpbb_users ( user_avatar_height tinyint(4) DEFAULT '0' NOT NULL, user_sig mediumtext DEFAULT '' NOT NULL, user_sig_bbcode_uid varchar(5) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield int(11) UNSIGNED DEFAULT '0' NOT NULL, + user_sig_bbcode_bitfield varbinary(255) DEFAULT '\0' NOT NULL, user_from varchar(100) DEFAULT '' NOT NULL, user_icq varchar(15) DEFAULT '' NOT NULL, user_aim varchar(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 2e6331ac40..adacd64b67 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -432,7 +432,7 @@ CREATE TABLE phpbb_forums ( forum_parents clob DEFAULT '' NOT NULL, forum_name varchar2(3000) DEFAULT '' NOT NULL, forum_desc clob DEFAULT '' NOT NULL, - forum_desc_bitfield number(11) DEFAULT '0' NOT NULL, + forum_desc_bitfield raw(255) DEFAULT '' NOT NULL, forum_desc_options number(1) DEFAULT '0' NOT NULL, forum_desc_uid varchar2(5) DEFAULT '' NOT NULL, forum_link varchar2(255) DEFAULT '' NOT NULL, @@ -441,7 +441,7 @@ CREATE TABLE phpbb_forums ( forum_image varchar2(255) DEFAULT '' NOT NULL, forum_rules clob DEFAULT '' NOT NULL, forum_rules_link varchar2(255) DEFAULT '' NOT NULL, - forum_rules_bitfield number(11) DEFAULT '0' NOT NULL, + forum_rules_bitfield raw(255) DEFAULT '' NOT NULL, forum_rules_options number(1) DEFAULT '0' NOT NULL, forum_rules_uid varchar2(5) DEFAULT '' NOT NULL, forum_topics_per_page number(4) DEFAULT '0' NOT NULL, @@ -529,7 +529,7 @@ CREATE TABLE phpbb_groups ( group_type number(4) DEFAULT '1' NOT NULL, group_name varchar2(255) DEFAULT '' NOT NULL, group_desc clob DEFAULT '' NOT NULL, - group_desc_bitfield number(11) DEFAULT '0' NOT NULL, + group_desc_bitfield raw(255) DEFAULT '' NOT NULL, group_desc_options number(1) DEFAULT '0' NOT NULL, group_desc_uid varchar2(5) DEFAULT '' NOT NULL, group_display number(1) DEFAULT '0' NOT NULL, @@ -776,7 +776,7 @@ CREATE TABLE phpbb_posts ( post_checksum varchar2(32) DEFAULT '' NOT NULL, post_encoding varchar2(20) DEFAULT 'iso-8859-1' NOT NULL, post_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + bbcode_bitfield raw(255) DEFAULT '' NOT NULL, bbcode_uid varchar2(5) DEFAULT '' NOT NULL, post_edit_time number(11) DEFAULT '0' NOT NULL, post_edit_reason varchar2(3000) DEFAULT '' NOT NULL, @@ -834,7 +834,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_user number(8) DEFAULT '0' NOT NULL, message_encoding varchar2(20) DEFAULT 'iso-8859-1' NOT NULL, message_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + bbcode_bitfield raw(255) DEFAULT '' NOT NULL, bbcode_uid varchar2(5) DEFAULT '' NOT NULL, message_edit_time number(11) DEFAULT '0' NOT NULL, message_edit_count number(4) DEFAULT '0' NOT NULL, @@ -1299,7 +1299,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar2(255) DEFAULT '' NOT NULL, template_copyright varchar2(255) DEFAULT '' NOT NULL, template_path varchar2(100) DEFAULT '' NOT NULL, - bbcode_bitfield number(11) DEFAULT '6921' NOT NULL, + bbcode_bitfield raw(255) DEFAULT '90D8' NOT NULL, template_storedb number(1) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_styles_template PRIMARY KEY (template_id), CONSTRAINT u_phpbb_template_name UNIQUE (template_name) @@ -1675,7 +1675,7 @@ CREATE TABLE phpbb_users ( user_avatar_height number(4) DEFAULT '0' NOT NULL, user_sig clob DEFAULT '' NOT NULL, user_sig_bbcode_uid varchar2(5) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield number(11) DEFAULT '0' NOT NULL, + user_sig_bbcode_bitfield raw(255) DEFAULT '' NOT NULL, user_from varchar2(100) DEFAULT '' NOT NULL, user_icq varchar2(15) DEFAULT '' NOT NULL, user_aim varchar2(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 8ccf2a6468..9fb15acc25 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -308,7 +308,8 @@ CREATE TABLE phpbb_forums ( forum_parents TEXT DEFAULT '' NOT NULL, forum_name varchar(3000) DEFAULT '' NOT NULL, forum_desc varchar(8000) DEFAULT '' NOT NULL, - forum_desc_bitfield INT4 DEFAULT '0' NOT NULL CHECK (forum_desc_bitfield >= 0), + forum_desc_bitfield bytea DEFAULT '\000' NOT NULL, + forum_desc_options INT4 DEFAULT 0 NOT NULL, forum_desc_uid varchar(5) DEFAULT '' NOT NULL, forum_link varchar(255) DEFAULT '' NOT NULL, forum_password varchar(40) DEFAULT '' NOT NULL, @@ -316,7 +317,8 @@ CREATE TABLE phpbb_forums ( forum_image varchar(255) DEFAULT '' NOT NULL, forum_rules varchar(8000) DEFAULT '' NOT NULL, forum_rules_link varchar(255) DEFAULT '' NOT NULL, - forum_rules_bitfield INT4 DEFAULT '0' NOT NULL CHECK (forum_rules_bitfield >= 0), + forum_rules_bitfield bytea DEFAULT '\000' NOT NULL, + forum_rules_options INT4 DEFAULT 0 NOT NULL, forum_rules_uid varchar(5) DEFAULT '' NOT NULL, forum_topics_per_page INT2 DEFAULT '0' NOT NULL, forum_type INT2 DEFAULT '0' NOT NULL, @@ -380,7 +382,7 @@ CREATE TABLE phpbb_groups ( group_type INT2 DEFAULT '1' NOT NULL, group_name varchar_ci DEFAULT '' NOT NULL, group_desc varchar(8000) DEFAULT '' NOT NULL, - group_desc_bitfield INT4 DEFAULT '0' NOT NULL CHECK (group_desc_bitfield >= 0), + group_desc_bitfield bytea DEFAULT '\000' NOT NULL, group_desc_uid varchar(5) DEFAULT '' NOT NULL, group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), group_avatar varchar(255) DEFAULT '' NOT NULL, @@ -531,7 +533,7 @@ CREATE TABLE phpbb_posts ( post_checksum varchar(32) DEFAULT '' NOT NULL, post_encoding varchar(20) DEFAULT 'iso-8859-1' NOT NULL, post_attachment INT2 DEFAULT '0' NOT NULL CHECK (post_attachment >= 0), - bbcode_bitfield INT4 DEFAULT '0' NOT NULL CHECK (bbcode_bitfield >= 0), + bbcode_bitfield bytea DEFAULT '\000' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), post_edit_reason varchar(3000) DEFAULT '' NOT NULL, @@ -568,7 +570,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_user INT4 DEFAULT '0' NOT NULL CHECK (message_edit_user >= 0), message_encoding varchar(20) DEFAULT 'iso-8859-1' NOT NULL, message_attachment INT2 DEFAULT '0' NOT NULL CHECK (message_attachment >= 0), - bbcode_bitfield INT4 DEFAULT '0' NOT NULL CHECK (bbcode_bitfield >= 0), + bbcode_bitfield bytea DEFAULT '\000' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, message_edit_time INT4 DEFAULT '0' NOT NULL CHECK (message_edit_time >= 0), message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0), @@ -690,7 +692,7 @@ CREATE SEQUENCE phpbb_ranks_seq; CREATE TABLE phpbb_ranks ( rank_id INT4 DEFAULT nextval('phpbb_ranks_seq'), rank_title varchar(255) DEFAULT '' NOT NULL, - rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= 0), + rank_min INT4 DEFAULT '0' NOT NULL CHECK (rank_min >= -1), rank_special INT2 DEFAULT '0' NOT NULL CHECK (rank_special >= 0), rank_image varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (rank_id) @@ -842,7 +844,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar(255) DEFAULT '' NOT NULL, template_copyright varchar(255) DEFAULT '' NOT NULL, template_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield INT4 DEFAULT '6921' NOT NULL CHECK (bbcode_bitfield >= 0), + bbcode_bitfield bytea DEFAULT '\220\330' NOT NULL, template_storedb INT2 DEFAULT '0' NOT NULL CHECK (template_storedb >= 0), PRIMARY KEY (template_id) ); @@ -1127,7 +1129,7 @@ CREATE TABLE phpbb_users ( user_avatar_height INT2 DEFAULT '0' NOT NULL, user_sig TEXT DEFAULT '' NOT NULL, user_sig_bbcode_uid varchar(5) DEFAULT '' NOT NULL, - user_sig_bbcode_bitfield INT4 DEFAULT '0' NOT NULL CHECK (user_sig_bbcode_bitfield >= 0), + user_sig_bbcode_bitfield bytea DEFAULT '\000' NOT NULL, user_from varchar(100) DEFAULT '' NOT NULL, user_icq varchar(15) DEFAULT '' NOT NULL, user_aim varchar(255) DEFAULT '' NOT NULL, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index b973a14f6f..bbe4d3cd65 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -384,7 +384,7 @@ INSERT INTO phpbb_styles (style_name, style_copyright, template_id, theme_id, im INSERT INTO phpbb_styles_imageset (imageset_name, imageset_copyright, imageset_path, site_logo, btn_post, btn_post_pm, btn_reply, btn_reply_pm, btn_locked, btn_profile, btn_pm, btn_delete, btn_info, btn_quote, btn_search, btn_edit, btn_report, btn_email, btn_www, btn_icq, btn_aim, btn_yim, btn_msnm, btn_jabber, btn_online, btn_offline, btn_friend, btn_foe, icon_unapproved, icon_reported, icon_attach, icon_post, icon_post_new, icon_post_latest, icon_post_newest, forum, forum_new, forum_locked, forum_link, sub_forum, sub_forum_new, folder, folder_moved, folder_posted, folder_new, folder_new_posted, folder_hot, folder_hot_posted, folder_hot_new, folder_hot_new_posted, folder_locked, folder_locked_posted, folder_locked_new, folder_locked_new_posted, folder_locked_announce, folder_locked_announce_new, folder_locked_announce_posted, folder_locked_announce_new_posted, folder_locked_global, folder_locked_global_new, folder_locked_global_posted, folder_locked_global_new_posted, folder_locked_sticky, folder_locked_sticky_new, folder_locked_sticky_posted, folder_locked_sticky_new_posted, folder_sticky, folder_sticky_posted, folder_sticky_new, folder_sticky_new_posted, folder_announce, folder_announce_posted, folder_announce_new, folder_announce_new_posted, folder_global, folder_global_posted, folder_global_new, folder_global_new_posted, poll_left, poll_center, poll_right, attach_progress_bar, user_icon1, user_icon2, user_icon3, user_icon4, user_icon5, user_icon6, user_icon7, user_icon8, user_icon9, user_icon10) VALUES ('subSilver', '© phpBB Group', 'subSilver', 'sitelogo.gif*94*170', '{LANG}/btn_post.gif*27*97', '{LANG}/btn_post_pm.gif*27*97', '{LANG}/btn_reply.gif*27*97', '{LANG}/btn_reply_pm.gif*20*90', '{LANG}/btn_locked.gif*27*97', '{LANG}/btn_profile.gif*20*72', '{LANG}/btn_pm.gif*20*72', '{LANG}/btn_delete.gif*20*20', '{LANG}/btn_info.gif*20*20', '{LANG}/btn_quote.gif*20*90', '{LANG}/btn_search.gif*20*72', '{LANG}/btn_edit.gif*20*90', '{LANG}/btn_report.gif*20*20', '{LANG}/btn_email.gif*20*72', '{LANG}/btn_www.gif*20*72', '{LANG}/btn_icq.gif*20*72', '{LANG}/btn_aim.gif*20*72', '{LANG}/btn_yim.gif*20*72', '{LANG}/btn_msnm.gif*20*72', '{LANG}/btn_jabber.gif*20*72', '{LANG}/btn_online.gif*20*72', '{LANG}/btn_offline.gif*20*72', '', '', 'icon_unapproved.gif*18*19', 'icon_reported.gif*18*19', 'icon_attach.gif*18*14', 'icon_minipost.gif*9*12', 'icon_minipost_new.gif*9*12', 'icon_latest_reply.gif*9*18', 'icon_newest_reply.gif*9*18', 'folder_big.gif*25*46', 'folder_new_big.gif*25*46', 'folder_locked_big.gif*25*46', 'folder_link_big.gif*25*46', 'subfolder_big.gif*25*46', 'subfolder_new_big.gif*25*46', 'folder.gif*18*19', 'folder_moved.gif*18*19', 'folder_posted.gif*18*19', 'folder_new.gif*18*19', 'folder_new_posted.gif*18*19', 'folder_hot.gif*18*19', 'folder_hot_posted.gif*18*19', 'folder_new_hot.gif*18*19', 'folder_new_hot_posted.gif*18*19', 'folder_lock.gif*18*19', 'folder_lock_posted.gif*18*19', 'folder_lock_new.gif*18*19', 'folder_lock_new_posted.gif*18*19', 'folder_lock_announce.gif*18*19', 'folder_lock_announce_new.gif*18*19', 'folder_lock_announce_posted.gif*18*19', 'folder_lock_announce_new_posted.gif*18*19', 'folder_lock_announce.gif*18*19', 'folder_lock_announce_new.gif*18*19', 'folder_lock_announce_posted.gif*18*19', 'folder_lock_announce_new_posted.gif*18*19', 'folder_lock_sticky.gif*18*19', 'folder_lock_sticky_new.gif*18*19', 'folder_lock_sticky_posted.gif*18*19', 'folder_lock_sticky_new_posted.gif*18*19', 'folder_sticky.gif*18*19', 'folder_sticky_posted.gif*18*19', 'folder_sticky_new.gif*18*19', 'folder_sticky_new_posted.gif*18*19', 'folder_announce.gif*18*19', 'folder_announce_posted.gif*18*19', 'folder_announce_new.gif*18*19', 'folder_announce_new_posted.gif*18*19', 'folder_announce.gif*18*19', 'folder_announce_posted.gif*18*19', 'folder_announce_new.gif*18*19', 'folder_announce_new_posted.gif*18*19', 'vote_lcap.gif*12*4', 'voting_bar.gif*12', 'vote_rcap.gif*12*4', 'progress_bar.gif*16*280', '', '', '', '', '', '', '', '', '', ''); # -- phpbb_styles_template -INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path, bbcode_bitfield) VALUES ('subSilver', '© phpBB Group', 'subSilver', 6921); +INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path) VALUES ('subSilver', '© phpBB Group', 'subSilver'); # -- phpbb_styles_theme INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_data) VALUES ('subSilver', '© phpBB Group', 'subSilver', ''); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 6b39fe7c15..265f7b296b 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -4,209 +4,222 @@ # $Id$ # -BEGIN TRANSACTION; +BEGIN TRANSACTION;; # Table: 'phpbb_attachments' CREATE TABLE phpbb_attachments ( - attach_id INTEGER PRIMARY KEY NOT NULL , - post_msg_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - in_message tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - poster_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + attach_id INTEGER NOT NULL , + post_msg_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + in_message tinyint(1) NOT NULL DEFAULT '0', + poster_id mediumint(8) NOT NULL DEFAULT '0', physical_filename varchar(255) NOT NULL DEFAULT '', real_filename varchar(255) NOT NULL DEFAULT '', - download_count mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + download_count mediumint(8) NOT NULL DEFAULT '0', attach_comment text(65535) NOT NULL DEFAULT '', extension varchar(100) NOT NULL DEFAULT '', mimetype varchar(100) NOT NULL DEFAULT '', - filesize int(20) UNSIGNED NOT NULL DEFAULT '0', - filetime int(11) UNSIGNED NOT NULL DEFAULT '0', - thumbnail tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + filesize int(20) NOT NULL DEFAULT '0', + filetime int(11) NOT NULL DEFAULT '0', + thumbnail tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (attach_id) +);; -CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime); -CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id); -CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id); -CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id); -CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments (filesize); +CREATE INDEX phpbb_attachments_filetime ON phpbb_attachments (filetime);; +CREATE INDEX phpbb_attachments_post_msg_id ON phpbb_attachments (post_msg_id);; +CREATE INDEX phpbb_attachments_topic_id ON phpbb_attachments (topic_id);; +CREATE INDEX phpbb_attachments_poster_id ON phpbb_attachments (poster_id);; +CREATE INDEX phpbb_attachments_filesize ON phpbb_attachments (filesize);; # Table: 'phpbb_acl_groups' CREATE TABLE phpbb_acl_groups ( - group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - auth_option_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - auth_role_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + group_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + auth_option_id mediumint(8) NOT NULL DEFAULT '0', + auth_role_id mediumint(8) NOT NULL DEFAULT '0', auth_setting tinyint(2) NOT NULL DEFAULT '0' -); +);; -CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id); -CREATE INDEX phpbb_acl_groups_auth_option_id ON phpbb_acl_groups (auth_option_id); +CREATE INDEX phpbb_acl_groups_group_id ON phpbb_acl_groups (group_id);; +CREATE INDEX phpbb_acl_groups_auth_option_id ON phpbb_acl_groups (auth_option_id);; # Table: 'phpbb_acl_options' CREATE TABLE phpbb_acl_options ( - auth_option_id INTEGER PRIMARY KEY NOT NULL , + auth_option_id INTEGER NOT NULL , auth_option varchar(50) NOT NULL DEFAULT '', - is_global tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - is_local tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - founder_only tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + is_global tinyint(1) NOT NULL DEFAULT '0', + is_local tinyint(1) NOT NULL DEFAULT '0', + founder_only tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (auth_option_id) +);; -CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option); +CREATE INDEX phpbb_acl_options_auth_option ON phpbb_acl_options (auth_option);; # Table: 'phpbb_acl_roles' CREATE TABLE phpbb_acl_roles ( - role_id INTEGER PRIMARY KEY NOT NULL , + role_id INTEGER NOT NULL , role_name varchar(255) NOT NULL DEFAULT '', role_description text(65535) NOT NULL DEFAULT '', role_type varchar(10) NOT NULL DEFAULT '', - role_order mediumint(4) UNSIGNED NOT NULL DEFAULT '0' -); + role_order mediumint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (role_id) +);; -CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type); -CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order); +CREATE INDEX phpbb_acl_roles_role_type ON phpbb_acl_roles (role_type);; +CREATE INDEX phpbb_acl_roles_role_order ON phpbb_acl_roles (role_order);; # Table: 'phpbb_acl_roles_data' CREATE TABLE phpbb_acl_roles_data ( - role_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - auth_option_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - auth_setting tinyint(2) NOT NULL DEFAULT '0' -); + role_id mediumint(8) NOT NULL DEFAULT '0', + auth_option_id mediumint(8) NOT NULL DEFAULT '0', + auth_setting tinyint(2) NOT NULL DEFAULT '0', + PRIMARY KEY (role_id, auth_option_id) +);; # Table: 'phpbb_acl_users' CREATE TABLE phpbb_acl_users ( - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - auth_option_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - auth_role_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + auth_option_id mediumint(8) NOT NULL DEFAULT '0', + auth_role_id mediumint(8) NOT NULL DEFAULT '0', auth_setting tinyint(2) NOT NULL DEFAULT '0' -); +);; -CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id); -CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id); +CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);; +CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);; # Table: 'phpbb_banlist' CREATE TABLE phpbb_banlist ( - ban_id INTEGER PRIMARY KEY NOT NULL , - ban_userid mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + ban_id INTEGER NOT NULL , + ban_userid mediumint(8) NOT NULL DEFAULT '0', ban_ip varchar(40) NOT NULL DEFAULT '', ban_email varchar(100) NOT NULL DEFAULT '', - ban_start int(11) UNSIGNED NOT NULL DEFAULT '0', - ban_end int(11) UNSIGNED NOT NULL DEFAULT '0', - ban_exclude tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + ban_start int(11) NOT NULL DEFAULT '0', + ban_end int(11) NOT NULL DEFAULT '0', + ban_exclude tinyint(1) NOT NULL DEFAULT '0', ban_reason text(65535) NOT NULL DEFAULT '', - ban_give_reason text(65535) NOT NULL DEFAULT '' -); + ban_give_reason text(65535) NOT NULL DEFAULT '', + PRIMARY KEY (ban_id) +);; # Table: 'phpbb_bbcodes' CREATE TABLE phpbb_bbcodes ( - bbcode_id tinyint(3) PRIMARY KEY NOT NULL DEFAULT '0', + bbcode_id tinyint(3) NOT NULL DEFAULT '0', bbcode_tag varchar(16) NOT NULL DEFAULT '', - display_on_posting tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + display_on_posting tinyint(1) NOT NULL DEFAULT '0', bbcode_match varchar(255) NOT NULL DEFAULT '', bbcode_tpl mediumtext(16777215) NOT NULL DEFAULT '', first_pass_match varchar(255) NOT NULL DEFAULT '', first_pass_replace varchar(255) NOT NULL DEFAULT '', second_pass_match varchar(255) NOT NULL DEFAULT '', - second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '' -); + second_pass_replace mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (bbcode_id) +);; -CREATE INDEX phpbb_bbcodes_display_in_posting ON phpbb_bbcodes (display_on_posting); +CREATE INDEX phpbb_bbcodes_display_in_posting ON phpbb_bbcodes (display_on_posting);; # Table: 'phpbb_bookmarks' CREATE TABLE phpbb_bookmarks ( - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - order_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0' -); + topic_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + order_id mediumint(8) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_bookmarks_order_id ON phpbb_bookmarks (order_id); -CREATE INDEX phpbb_bookmarks_topic_user_id ON phpbb_bookmarks (topic_id, user_id); +CREATE INDEX phpbb_bookmarks_order_id ON phpbb_bookmarks (order_id);; +CREATE INDEX phpbb_bookmarks_topic_user_id ON phpbb_bookmarks (topic_id, user_id);; # Table: 'phpbb_bots' CREATE TABLE phpbb_bots ( - bot_id INTEGER PRIMARY KEY NOT NULL , - bot_active tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + bot_id INTEGER NOT NULL , + bot_active tinyint(1) NOT NULL DEFAULT '1', bot_name text(65535) NOT NULL DEFAULT '', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', bot_agent varchar(255) NOT NULL DEFAULT '', - bot_ip varchar(255) NOT NULL DEFAULT '' -); + bot_ip varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (bot_id) +);; -CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active); +CREATE INDEX phpbb_bots_bot_active ON phpbb_bots (bot_active);; # Table: 'phpbb_config' CREATE TABLE phpbb_config ( - config_name varchar(255) PRIMARY KEY NOT NULL DEFAULT '', + config_name varchar(255) NOT NULL DEFAULT '', config_value varchar(255) NOT NULL DEFAULT '', - is_dynamic tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + is_dynamic tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (config_name) +);; -CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic); +CREATE INDEX phpbb_config_is_dynamic ON phpbb_config (is_dynamic);; # Table: 'phpbb_confirm' CREATE TABLE phpbb_confirm ( - confirm_id char(32) PRIMARY KEY NOT NULL DEFAULT '', - session_id char(32) PRIMARY KEY NOT NULL DEFAULT '', + confirm_id char(32) NOT NULL DEFAULT '', + session_id char(32) NOT NULL DEFAULT '', confirm_type tinyint(3) NOT NULL DEFAULT '0', - code varchar(8) NOT NULL DEFAULT '' -); + code varchar(8) NOT NULL DEFAULT '', + PRIMARY KEY (session_id, confirm_id) +);; # Table: 'phpbb_disallow' CREATE TABLE phpbb_disallow ( - disallow_id INTEGER PRIMARY KEY NOT NULL , - disallow_username varchar(255) NOT NULL DEFAULT '' -); + disallow_id INTEGER NOT NULL , + disallow_username varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (disallow_id) +);; # Table: 'phpbb_drafts' CREATE TABLE phpbb_drafts ( - draft_id INTEGER PRIMARY KEY NOT NULL , - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - save_time int(11) UNSIGNED NOT NULL DEFAULT '0', + draft_id INTEGER NOT NULL , + user_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + save_time int(11) NOT NULL DEFAULT '0', draft_subject text(65535) NOT NULL DEFAULT '', - draft_message mediumtext(16777215) NOT NULL DEFAULT '' -); + draft_message mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (draft_id) +);; -CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time); +CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);; # Table: 'phpbb_extensions' CREATE TABLE phpbb_extensions ( - extension_id INTEGER PRIMARY KEY NOT NULL , - group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - extension varchar(100) NOT NULL DEFAULT '' -); + extension_id INTEGER NOT NULL , + group_id mediumint(8) NOT NULL DEFAULT '0', + extension varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (extension_id) +);; # Table: 'phpbb_extension_groups' CREATE TABLE phpbb_extension_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER NOT NULL , group_name varchar(255) NOT NULL DEFAULT '', cat_id tinyint(2) NOT NULL DEFAULT '0', - allow_group tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - download_mode tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + allow_group tinyint(1) NOT NULL DEFAULT '0', + download_mode tinyint(1) NOT NULL DEFAULT '1', upload_icon varchar(255) NOT NULL DEFAULT '', - max_filesize int(20) UNSIGNED NOT NULL DEFAULT '0', + max_filesize int(20) NOT NULL DEFAULT '0', allowed_forums text(65535) NOT NULL DEFAULT '', - allow_in_pm tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + allow_in_pm tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (group_id) +);; # Table: 'phpbb_forums' CREATE TABLE phpbb_forums ( - forum_id INTEGER PRIMARY KEY NOT NULL , - parent_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - left_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - right_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + forum_id INTEGER NOT NULL , + parent_id mediumint(8) NOT NULL DEFAULT '0', + left_id mediumint(8) NOT NULL DEFAULT '0', + right_id mediumint(8) NOT NULL DEFAULT '0', forum_parents mediumtext(16777215) NOT NULL DEFAULT '', forum_name text(65535) NOT NULL DEFAULT '', forum_desc text(65535) NOT NULL DEFAULT '', - forum_desc_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', - forum_desc_options tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + forum_desc_bitfield blob NOT NULL DEFAULT '', + forum_desc_options int(11) NOT NULL DEFAULT '0', forum_desc_uid varchar(5) NOT NULL DEFAULT '', forum_link varchar(255) NOT NULL DEFAULT '', forum_password varchar(40) NOT NULL DEFAULT '', @@ -214,294 +227,306 @@ CREATE TABLE phpbb_forums ( forum_image varchar(255) NOT NULL DEFAULT '', forum_rules text(65535) NOT NULL DEFAULT '', forum_rules_link varchar(255) NOT NULL DEFAULT '', - forum_rules_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', - forum_rules_options tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + forum_rules_bitfield blob NOT NULL DEFAULT '', + forum_rules_options int(11) NOT NULL DEFAULT '0', forum_rules_uid varchar(5) NOT NULL DEFAULT '', forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', forum_type tinyint(4) NOT NULL DEFAULT '0', forum_status tinyint(4) NOT NULL DEFAULT '0', - forum_posts mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_topics mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_topics_real mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_last_poster_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_last_post_time int(11) UNSIGNED NOT NULL DEFAULT '0', + forum_posts mediumint(8) NOT NULL DEFAULT '0', + forum_topics mediumint(8) NOT NULL DEFAULT '0', + forum_topics_real mediumint(8) NOT NULL DEFAULT '0', + forum_last_post_id mediumint(8) NOT NULL DEFAULT '0', + forum_last_poster_id mediumint(8) NOT NULL DEFAULT '0', + forum_last_post_time int(11) NOT NULL DEFAULT '0', forum_last_poster_name varchar(255) NOT NULL DEFAULT '', forum_flags tinyint(4) NOT NULL DEFAULT '32', - display_on_index tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_indexing tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_icons tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_prune tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - prune_next int(11) UNSIGNED NOT NULL DEFAULT '0', + display_on_index tinyint(1) NOT NULL DEFAULT '1', + enable_indexing tinyint(1) NOT NULL DEFAULT '1', + enable_icons tinyint(1) NOT NULL DEFAULT '1', + enable_prune tinyint(1) NOT NULL DEFAULT '0', + prune_next int(11) NOT NULL DEFAULT '0', prune_days tinyint(4) NOT NULL DEFAULT '0', prune_viewed tinyint(4) NOT NULL DEFAULT '0', - prune_freq tinyint(4) NOT NULL DEFAULT '0' -); + prune_freq tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (forum_id) +);; -CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id); -CREATE INDEX phpbb_forums_forum_last_post_id ON phpbb_forums (forum_last_post_id); +CREATE INDEX phpbb_forums_left_right_id ON phpbb_forums (left_id, right_id);; +CREATE INDEX phpbb_forums_forum_last_post_id ON phpbb_forums (forum_last_post_id);; # Table: 'phpbb_forums_access' CREATE TABLE phpbb_forums_access ( - forum_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - session_id char(32) PRIMARY KEY NOT NULL DEFAULT '' -); + forum_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + PRIMARY KEY (forum_id, user_id, session_id) +);; # Table: 'phpbb_forums_track' CREATE TABLE phpbb_forums_track ( - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - mark_time int(11) UNSIGNED NOT NULL DEFAULT '0' -); + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + mark_time int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, forum_id) +);; # Table: 'phpbb_forums_watch' CREATE TABLE phpbb_forums_watch ( - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - notify_status tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + forum_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id); -CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id); -CREATE INDEX phpbb_forums_watch_notify_status ON phpbb_forums_watch (notify_status); +CREATE INDEX phpbb_forums_watch_forum_id ON phpbb_forums_watch (forum_id);; +CREATE INDEX phpbb_forums_watch_user_id ON phpbb_forums_watch (user_id);; +CREATE INDEX phpbb_forums_watch_notify_status ON phpbb_forums_watch (notify_status);; # Table: 'phpbb_groups' CREATE TABLE phpbb_groups ( - group_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER NOT NULL , group_type tinyint(4) NOT NULL DEFAULT '1', group_name varchar(255) NOT NULL DEFAULT '', group_desc text(65535) NOT NULL DEFAULT '', - group_desc_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', - group_desc_options tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + group_desc_bitfield blob NOT NULL DEFAULT '', + group_desc_options int(11) NOT NULL DEFAULT '0', group_desc_uid varchar(5) NOT NULL DEFAULT '', - group_display tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + group_display tinyint(1) NOT NULL DEFAULT '0', group_avatar varchar(255) NOT NULL DEFAULT '', group_avatar_type tinyint(4) NOT NULL DEFAULT '0', group_avatar_width tinyint(4) NOT NULL DEFAULT '0', group_avatar_height tinyint(4) NOT NULL DEFAULT '0', - group_rank mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + group_rank mediumint(8) NOT NULL DEFAULT '0', group_colour varchar(6) NOT NULL DEFAULT '', - group_sig_chars mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - group_receive_pm tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - group_message_limit mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - group_legend tinyint(1) UNSIGNED NOT NULL DEFAULT '1' -); + group_sig_chars mediumint(8) NOT NULL DEFAULT '0', + group_receive_pm tinyint(1) NOT NULL DEFAULT '0', + group_message_limit mediumint(8) NOT NULL DEFAULT '0', + group_legend tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (group_id) +);; -CREATE INDEX phpbb_groups_group_legend ON phpbb_groups (group_legend); +CREATE INDEX phpbb_groups_group_legend ON phpbb_groups (group_legend);; # Table: 'phpbb_icons' CREATE TABLE phpbb_icons ( - icons_id INTEGER PRIMARY KEY NOT NULL , + icons_id INTEGER NOT NULL , icons_url varchar(255) NOT NULL DEFAULT '', icons_width tinyint(4) NOT NULL DEFAULT '0', icons_height tinyint(4) NOT NULL DEFAULT '0', - icons_order mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - display_on_posting tinyint(1) UNSIGNED NOT NULL DEFAULT '1' -); + icons_order mediumint(8) NOT NULL DEFAULT '0', + display_on_posting tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (icons_id) +);; # Table: 'phpbb_lang' CREATE TABLE phpbb_lang ( - lang_id INTEGER PRIMARY KEY NOT NULL , + lang_id INTEGER NOT NULL , lang_iso varchar(30) NOT NULL DEFAULT '', lang_dir varchar(30) NOT NULL DEFAULT '', lang_english_name varchar(100) NOT NULL DEFAULT '', lang_local_name varchar(255) NOT NULL DEFAULT '', - lang_author varchar(255) NOT NULL DEFAULT '' -); + lang_author varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (lang_id) +);; -CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso); +CREATE INDEX phpbb_lang_lang_iso ON phpbb_lang (lang_iso);; # Table: 'phpbb_log' CREATE TABLE phpbb_log ( - log_id INTEGER PRIMARY KEY NOT NULL , + log_id INTEGER NOT NULL , log_type tinyint(4) NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - reportee_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + reportee_id mediumint(8) NOT NULL DEFAULT '0', log_ip varchar(40) NOT NULL DEFAULT '', - log_time int(11) UNSIGNED NOT NULL DEFAULT '0', + log_time int(11) NOT NULL DEFAULT '0', log_operation text(65535) NOT NULL DEFAULT '', - log_data mediumtext(16777215) NOT NULL DEFAULT '' -); + log_data mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (log_id) +);; -CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type); -CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id); -CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id); -CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id); -CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id); +CREATE INDEX phpbb_log_log_type ON phpbb_log (log_type);; +CREATE INDEX phpbb_log_forum_id ON phpbb_log (forum_id);; +CREATE INDEX phpbb_log_topic_id ON phpbb_log (topic_id);; +CREATE INDEX phpbb_log_reportee_id ON phpbb_log (reportee_id);; +CREATE INDEX phpbb_log_user_id ON phpbb_log (user_id);; # Table: 'phpbb_moderator_cache' CREATE TABLE phpbb_moderator_cache ( - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', username varchar(255) NOT NULL DEFAULT '', - group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + group_id mediumint(8) NOT NULL DEFAULT '0', group_name varchar(255) NOT NULL DEFAULT '', - display_on_index tinyint(1) UNSIGNED NOT NULL DEFAULT '1' -); + display_on_index tinyint(1) NOT NULL DEFAULT '1' +);; -CREATE INDEX phpbb_moderator_cache_display_on_index ON phpbb_moderator_cache (display_on_index); -CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id); +CREATE INDEX phpbb_moderator_cache_display_on_index ON phpbb_moderator_cache (display_on_index);; +CREATE INDEX phpbb_moderator_cache_forum_id ON phpbb_moderator_cache (forum_id);; # Table: 'phpbb_modules' CREATE TABLE phpbb_modules ( - module_id INTEGER PRIMARY KEY NOT NULL , - module_enabled tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - module_display tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + module_id INTEGER NOT NULL , + module_enabled tinyint(1) NOT NULL DEFAULT '1', + module_display tinyint(1) NOT NULL DEFAULT '1', module_basename varchar(255) NOT NULL DEFAULT '', module_class varchar(10) NOT NULL DEFAULT '', - parent_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - left_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - right_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + parent_id mediumint(8) NOT NULL DEFAULT '0', + left_id mediumint(8) NOT NULL DEFAULT '0', + right_id mediumint(8) NOT NULL DEFAULT '0', module_langname varchar(255) NOT NULL DEFAULT '', module_mode varchar(255) NOT NULL DEFAULT '', - module_auth varchar(255) NOT NULL DEFAULT '' -); + module_auth varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (module_id) +);; -CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id); -CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled); -CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id); +CREATE INDEX phpbb_modules_left_right_id ON phpbb_modules (left_id, right_id);; +CREATE INDEX phpbb_modules_module_enabled ON phpbb_modules (module_enabled);; +CREATE INDEX phpbb_modules_class_left_id ON phpbb_modules (module_class, left_id);; # Table: 'phpbb_poll_options' CREATE TABLE phpbb_poll_options ( poll_option_id tinyint(4) NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', poll_option_text text(65535) NOT NULL DEFAULT '', - poll_option_total mediumint(8) UNSIGNED NOT NULL DEFAULT '0' -); + poll_option_total mediumint(8) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_poll_options_poll_option_id ON phpbb_poll_options (poll_option_id); -CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id); +CREATE INDEX phpbb_poll_options_poll_option_id ON phpbb_poll_options (poll_option_id);; +CREATE INDEX phpbb_poll_options_topic_id ON phpbb_poll_options (topic_id);; # Table: 'phpbb_poll_votes' CREATE TABLE phpbb_poll_votes ( - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', poll_option_id tinyint(4) NOT NULL DEFAULT '0', - vote_user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + vote_user_id mediumint(8) NOT NULL DEFAULT '0', vote_user_ip varchar(40) NOT NULL DEFAULT '' -); +);; -CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id); -CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id); -CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip); +CREATE INDEX phpbb_poll_votes_topic_id ON phpbb_poll_votes (topic_id);; +CREATE INDEX phpbb_poll_votes_vote_user_id ON phpbb_poll_votes (vote_user_id);; +CREATE INDEX phpbb_poll_votes_vote_user_ip ON phpbb_poll_votes (vote_user_ip);; # Table: 'phpbb_posts' CREATE TABLE phpbb_posts ( - post_id INTEGER PRIMARY KEY NOT NULL , - topic_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - poster_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - icon_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + post_id INTEGER NOT NULL , + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + poster_id mediumint(8) NOT NULL DEFAULT '0', + icon_id mediumint(8) NOT NULL DEFAULT '0', poster_ip varchar(40) NOT NULL DEFAULT '', - post_time int(11) UNSIGNED NOT NULL DEFAULT '0', - post_approved tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - post_reported tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_smilies tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_sig tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + post_time int(11) NOT NULL DEFAULT '0', + post_approved tinyint(1) NOT NULL DEFAULT '1', + post_reported tinyint(1) NOT NULL DEFAULT '0', + enable_bbcode tinyint(1) NOT NULL DEFAULT '1', + enable_smilies tinyint(1) NOT NULL DEFAULT '1', + enable_magic_url tinyint(1) NOT NULL DEFAULT '1', + enable_sig tinyint(1) NOT NULL DEFAULT '1', post_username varchar(255) NOT NULL DEFAULT '', post_subject text(65535) NOT NULL DEFAULT '', post_text mediumtext(16777215) NOT NULL DEFAULT '', post_checksum varchar(32) NOT NULL DEFAULT '', post_encoding varchar(20) NOT NULL DEFAULT 'iso-8859-1', - post_attachment tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', + post_attachment tinyint(1) NOT NULL DEFAULT '0', + bbcode_bitfield blob NOT NULL DEFAULT '', bbcode_uid varchar(5) NOT NULL DEFAULT '', - post_edit_time int(11) UNSIGNED NOT NULL DEFAULT '0', + post_edit_time int(11) NOT NULL DEFAULT '0', post_edit_reason text(65535) NOT NULL DEFAULT '', - post_edit_user mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - post_edit_count mediumint(4) UNSIGNED NOT NULL DEFAULT '0', - post_edit_locked tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + post_edit_user mediumint(8) NOT NULL DEFAULT '0', + post_edit_count mediumint(4) NOT NULL DEFAULT '0', + post_edit_locked tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (post_id) +);; -CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id); -CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id); -CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip); -CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id); -CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved); -CREATE INDEX phpbb_posts_post_time ON phpbb_posts (post_time); +CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id);; +CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id);; +CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip);; +CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id);; +CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved);; +CREATE INDEX phpbb_posts_post_time ON phpbb_posts (post_time);; # Table: 'phpbb_privmsgs' CREATE TABLE phpbb_privmsgs ( - msg_id INTEGER PRIMARY KEY NOT NULL , - root_level mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - author_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - icon_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + msg_id INTEGER NOT NULL , + root_level mediumint(8) NOT NULL DEFAULT '0', + author_id mediumint(8) NOT NULL DEFAULT '0', + icon_id mediumint(8) NOT NULL DEFAULT '0', author_ip varchar(40) NOT NULL DEFAULT '', - message_time int(11) UNSIGNED NOT NULL DEFAULT '0', - enable_bbcode tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_smilies tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_magic_url tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - enable_sig tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + message_time int(11) NOT NULL DEFAULT '0', + enable_bbcode tinyint(1) NOT NULL DEFAULT '1', + enable_smilies tinyint(1) NOT NULL DEFAULT '1', + enable_magic_url tinyint(1) NOT NULL DEFAULT '1', + enable_sig tinyint(1) NOT NULL DEFAULT '1', message_subject text(65535) NOT NULL DEFAULT '', message_text mediumtext(16777215) NOT NULL DEFAULT '', message_edit_reason text(65535) NOT NULL DEFAULT '', - message_edit_user mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + message_edit_user mediumint(8) NOT NULL DEFAULT '0', message_encoding varchar(20) NOT NULL DEFAULT 'iso-8859-1', - message_attachment tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', + message_attachment tinyint(1) NOT NULL DEFAULT '0', + bbcode_bitfield blob NOT NULL DEFAULT '', bbcode_uid varchar(5) NOT NULL DEFAULT '', - message_edit_time int(11) UNSIGNED NOT NULL DEFAULT '0', - message_edit_count mediumint(4) UNSIGNED NOT NULL DEFAULT '0', + message_edit_time int(11) NOT NULL DEFAULT '0', + message_edit_count mediumint(4) NOT NULL DEFAULT '0', to_address text(65535) NOT NULL DEFAULT '', - bcc_address text(65535) NOT NULL DEFAULT '' -); + bcc_address text(65535) NOT NULL DEFAULT '', + PRIMARY KEY (msg_id) +);; -CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip); -CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time); -CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id); -CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level); +CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip);; +CREATE INDEX phpbb_privmsgs_message_time ON phpbb_privmsgs (message_time);; +CREATE INDEX phpbb_privmsgs_author_id ON phpbb_privmsgs (author_id);; +CREATE INDEX phpbb_privmsgs_root_level ON phpbb_privmsgs (root_level);; # Table: 'phpbb_privmsgs_folder' CREATE TABLE phpbb_privmsgs_folder ( - folder_id INTEGER PRIMARY KEY NOT NULL , - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + folder_id INTEGER NOT NULL , + user_id mediumint(8) NOT NULL DEFAULT '0', folder_name varchar(255) NOT NULL DEFAULT '', - pm_count mediumint(8) UNSIGNED NOT NULL DEFAULT '0' -); + pm_count mediumint(8) NOT NULL DEFAULT '0', + PRIMARY KEY (folder_id) +);; -CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id); +CREATE INDEX phpbb_privmsgs_folder_user_id ON phpbb_privmsgs_folder (user_id);; # Table: 'phpbb_privmsgs_rules' CREATE TABLE phpbb_privmsgs_rules ( - rule_id INTEGER PRIMARY KEY NOT NULL , - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rule_check mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rule_connection mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + rule_id INTEGER NOT NULL , + user_id mediumint(8) NOT NULL DEFAULT '0', + rule_check mediumint(8) NOT NULL DEFAULT '0', + rule_connection mediumint(8) NOT NULL DEFAULT '0', rule_string varchar(255) NOT NULL DEFAULT '', - rule_user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rule_group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rule_action mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rule_folder_id int(4) NOT NULL DEFAULT '0' -); + rule_user_id mediumint(8) NOT NULL DEFAULT '0', + rule_group_id mediumint(8) NOT NULL DEFAULT '0', + rule_action mediumint(8) NOT NULL DEFAULT '0', + rule_folder_id int(4) NOT NULL DEFAULT '0', + PRIMARY KEY (rule_id) +);; # Table: 'phpbb_privmsgs_to' CREATE TABLE phpbb_privmsgs_to ( - msg_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - author_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - pm_deleted tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - pm_new tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - pm_unread tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - pm_replied tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - pm_marked tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - pm_forwarded tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + msg_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + author_id mediumint(8) NOT NULL DEFAULT '0', + pm_deleted tinyint(1) NOT NULL DEFAULT '0', + pm_new tinyint(1) NOT NULL DEFAULT '1', + pm_unread tinyint(1) NOT NULL DEFAULT '1', + pm_replied tinyint(1) NOT NULL DEFAULT '0', + pm_marked tinyint(1) NOT NULL DEFAULT '0', + pm_forwarded tinyint(1) NOT NULL DEFAULT '0', folder_id int(4) NOT NULL DEFAULT '0' -); +);; -CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id); -CREATE INDEX phpbb_privmsgs_to_user_folder_id ON phpbb_privmsgs_to (user_id, folder_id); +CREATE INDEX phpbb_privmsgs_to_msg_id ON phpbb_privmsgs_to (msg_id);; +CREATE INDEX phpbb_privmsgs_to_user_folder_id ON phpbb_privmsgs_to (user_id, folder_id);; # Table: 'phpbb_profile_fields' CREATE TABLE phpbb_profile_fields ( - field_id INTEGER PRIMARY KEY NOT NULL , + field_id INTEGER NOT NULL , field_name varchar(255) NOT NULL DEFAULT '', field_type tinyint(4) NOT NULL DEFAULT '0', field_ident varchar(20) NOT NULL DEFAULT '', @@ -511,209 +536,232 @@ CREATE TABLE phpbb_profile_fields ( field_novalue varchar(255) NOT NULL DEFAULT '', field_default_value varchar(255) NOT NULL DEFAULT '', field_validation varchar(20) NOT NULL DEFAULT '', - field_required tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - field_show_on_reg tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - field_hide tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - field_no_view tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - field_active tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - field_order mediumint(8) UNSIGNED NOT NULL DEFAULT '0' -); + field_required tinyint(1) NOT NULL DEFAULT '0', + field_show_on_reg tinyint(1) NOT NULL DEFAULT '0', + field_hide tinyint(1) NOT NULL DEFAULT '0', + field_no_view tinyint(1) NOT NULL DEFAULT '0', + field_active tinyint(1) NOT NULL DEFAULT '0', + field_order mediumint(8) NOT NULL DEFAULT '0', + PRIMARY KEY (field_id) +);; -CREATE INDEX phpbb_profile_fields_field_type ON phpbb_profile_fields (field_type); -CREATE INDEX phpbb_profile_fields_field_order ON phpbb_profile_fields (field_order); +CREATE INDEX phpbb_profile_fields_field_type ON phpbb_profile_fields (field_type);; +CREATE INDEX phpbb_profile_fields_field_order ON phpbb_profile_fields (field_order);; # Table: 'phpbb_profile_fields_data' CREATE TABLE phpbb_profile_fields_data ( - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0' -); + user_id mediumint(8) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id) +);; # Table: 'phpbb_profile_fields_lang' CREATE TABLE phpbb_profile_fields_lang ( - field_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - lang_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - option_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', + field_id mediumint(8) NOT NULL DEFAULT '0', + lang_id mediumint(8) NOT NULL DEFAULT '0', + option_id mediumint(8) NOT NULL DEFAULT '0', field_type tinyint(4) NOT NULL DEFAULT '0', - lang_value varchar(255) NOT NULL DEFAULT '' -); + lang_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id, option_id) +);; # Table: 'phpbb_profile_lang' CREATE TABLE phpbb_profile_lang ( - field_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - lang_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', + field_id mediumint(8) NOT NULL DEFAULT '0', + lang_id mediumint(8) NOT NULL DEFAULT '0', lang_name varchar(255) NOT NULL DEFAULT '', lang_explain text(65535) NOT NULL DEFAULT '', - lang_default_value varchar(255) NOT NULL DEFAULT '' -); + lang_default_value varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (field_id, lang_id) +);; # Table: 'phpbb_ranks' CREATE TABLE phpbb_ranks ( - rank_id INTEGER PRIMARY KEY NOT NULL , + rank_id INTEGER NOT NULL , rank_title varchar(255) NOT NULL DEFAULT '', - rank_min mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - rank_special tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - rank_image varchar(255) NOT NULL DEFAULT '' -); + rank_min mediumint(8) NOT NULL DEFAULT '0', + rank_special tinyint(1) NOT NULL DEFAULT '0', + rank_image varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (rank_id) +);; # Table: 'phpbb_reports' CREATE TABLE phpbb_reports ( - report_id INTEGER PRIMARY KEY NOT NULL , - reason_id mediumint(4) UNSIGNED NOT NULL DEFAULT '0', - post_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_notify tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - report_closed tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - report_time int(11) UNSIGNED NOT NULL DEFAULT '0', - report_text mediumtext(16777215) NOT NULL DEFAULT '' -); + report_id INTEGER NOT NULL , + reason_id mediumint(4) NOT NULL DEFAULT '0', + post_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + user_notify tinyint(1) NOT NULL DEFAULT '0', + report_closed tinyint(1) NOT NULL DEFAULT '0', + report_time int(11) NOT NULL DEFAULT '0', + report_text mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (report_id) +);; # Table: 'phpbb_reports_reasons' CREATE TABLE phpbb_reports_reasons ( - reason_id INTEGER PRIMARY KEY NOT NULL , + reason_id INTEGER NOT NULL , reason_title varchar(255) NOT NULL DEFAULT '', reason_description mediumtext(16777215) NOT NULL DEFAULT '', - reason_order mediumint(4) UNSIGNED NOT NULL DEFAULT '0' -); + reason_order mediumint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (reason_id) +);; # Table: 'phpbb_search_results' CREATE TABLE phpbb_search_results ( - search_key varchar(32) PRIMARY KEY NOT NULL DEFAULT '', - search_time int(11) UNSIGNED NOT NULL DEFAULT '0', + search_key varchar(32) NOT NULL DEFAULT '', + search_time int(11) NOT NULL DEFAULT '0', search_keywords mediumtext(16777215) NOT NULL DEFAULT '', - search_authors mediumtext(16777215) NOT NULL DEFAULT '' -); + search_authors mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (search_key) +);; # Table: 'phpbb_search_wordlist' CREATE TABLE phpbb_search_wordlist ( - word_text varchar(252) PRIMARY KEY NOT NULL DEFAULT '', + word_text varchar(252) NOT NULL DEFAULT '', word_id INTEGER NOT NULL , - word_common tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + word_common tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (word_id) +);; -CREATE INDEX phpbb_search_wordlist_word_id ON phpbb_search_wordlist (word_id); +CREATE INDEX phpbb_search_wordlist_word_text ON phpbb_search_wordlist (word_text);; # 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) UNSIGNED NOT NULL DEFAULT '0' -); + post_id mediumint(8) NOT NULL DEFAULT '0', + word_id mediumint(8) NOT NULL DEFAULT '0', + title_match tinyint(1) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id); +CREATE INDEX phpbb_search_wordmatch_word_id ON phpbb_search_wordmatch (word_id);; # Table: 'phpbb_sessions' CREATE TABLE phpbb_sessions ( - session_id char(32) PRIMARY KEY NOT NULL DEFAULT '', - session_user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - session_last_visit int(11) UNSIGNED NOT NULL DEFAULT '0', - session_start int(11) UNSIGNED NOT NULL DEFAULT '0', - session_time int(11) UNSIGNED NOT NULL DEFAULT '0', + session_id char(32) NOT NULL DEFAULT '', + session_user_id mediumint(8) NOT NULL DEFAULT '0', + session_last_visit int(11) NOT NULL DEFAULT '0', + session_start int(11) NOT NULL DEFAULT '0', + session_time int(11) NOT NULL DEFAULT '0', session_ip varchar(40) NOT NULL DEFAULT '', session_browser varchar(150) NOT NULL DEFAULT '', session_page varchar(255) NOT NULL DEFAULT '', - session_viewonline tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - session_autologin tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - session_admin tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + session_viewonline tinyint(1) NOT NULL DEFAULT '1', + session_autologin tinyint(1) NOT NULL DEFAULT '0', + session_admin tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (session_id) +);; -CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time); -CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id); +CREATE INDEX phpbb_sessions_session_time ON phpbb_sessions (session_time);; +CREATE INDEX phpbb_sessions_session_user_id ON phpbb_sessions (session_user_id);; # Table: 'phpbb_sessions_keys' CREATE TABLE phpbb_sessions_keys ( - key_id char(32) PRIMARY KEY NOT NULL DEFAULT '', - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', + key_id char(32) NOT NULL DEFAULT '', + user_id mediumint(8) NOT NULL DEFAULT '0', last_ip varchar(40) NOT NULL DEFAULT '', - last_login int(11) UNSIGNED NOT NULL DEFAULT '0' -); + last_login int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (key_id, user_id) +);; -CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login); +CREATE INDEX phpbb_sessions_keys_last_login ON phpbb_sessions_keys (last_login);; # Table: 'phpbb_sitelist' CREATE TABLE phpbb_sitelist ( - site_id INTEGER PRIMARY KEY NOT NULL , + site_id INTEGER NOT NULL , site_ip varchar(40) NOT NULL DEFAULT '', site_hostname varchar(255) NOT NULL DEFAULT '', - ip_exclude tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + ip_exclude tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (site_id) +);; # Table: 'phpbb_smilies' CREATE TABLE phpbb_smilies ( - smiley_id INTEGER PRIMARY KEY NOT NULL , + smiley_id INTEGER NOT NULL , code varchar(50) NOT NULL DEFAULT '', emotion varchar(50) NOT NULL DEFAULT '', smiley_url varchar(50) NOT NULL DEFAULT '', smiley_width tinyint(4) NOT NULL DEFAULT '0', smiley_height tinyint(4) NOT NULL DEFAULT '0', - smiley_order mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - display_on_posting tinyint(1) UNSIGNED NOT NULL DEFAULT '1' -); + smiley_order mediumint(8) NOT NULL DEFAULT '0', + display_on_posting tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (smiley_id) +);; -CREATE INDEX phpbb_smilies_display_on_posting ON phpbb_smilies (display_on_posting); +CREATE INDEX phpbb_smilies_display_on_posting ON phpbb_smilies (display_on_posting);; # Table: 'phpbb_styles' CREATE TABLE phpbb_styles ( - style_id INTEGER PRIMARY KEY NOT NULL , + style_id INTEGER NOT NULL , style_name varchar(255) NOT NULL DEFAULT '', style_copyright varchar(255) NOT NULL DEFAULT '', - style_active tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + style_active tinyint(1) NOT NULL DEFAULT '1', template_id tinyint(4) NOT NULL DEFAULT '0', theme_id tinyint(4) NOT NULL DEFAULT '0', - imageset_id tinyint(4) NOT NULL DEFAULT '0' -); + imageset_id tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (style_id) +);; -CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); -CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id); -CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id); -CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id); +CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name);; +CREATE INDEX phpbb_styles_template_id ON phpbb_styles (template_id);; +CREATE INDEX phpbb_styles_theme_id ON phpbb_styles (theme_id);; +CREATE INDEX phpbb_styles_imageset_id ON phpbb_styles (imageset_id);; # Table: 'phpbb_styles_template' CREATE TABLE phpbb_styles_template ( - template_id INTEGER PRIMARY KEY NOT NULL , + template_id INTEGER NOT NULL , template_name varchar(255) NOT NULL DEFAULT '', template_copyright varchar(255) NOT NULL DEFAULT '', template_path varchar(100) NOT NULL DEFAULT '', - bbcode_bitfield int(11) UNSIGNED NOT NULL DEFAULT '6921', - template_storedb tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + bbcode_bitfield blob NOT NULL DEFAULT '', + template_storedb tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (template_id) +);; -CREATE UNIQUE INDEX phpbb_styles_template_template_name ON phpbb_styles_template (template_name); +CREATE UNIQUE INDEX phpbb_styles_template_template_name ON phpbb_styles_template (template_name);; + +CREATE TRIGGER "t_phpbb_styles_template" +AFTER INSERT ON "phpbb_styles_template" +FOR EACH ROW WHEN NEW.bbcode_bitfield = '' +BEGIN + UPDATE phpbb_styles_template SET bbcode_bitfield = binary_insert(1) WHERE template_id = NEW.template_id; +END;; # Table: 'phpbb_styles_template_data' CREATE TABLE phpbb_styles_template_data ( template_id INTEGER NOT NULL , template_filename varchar(100) NOT NULL DEFAULT '', template_included text(65535) NOT NULL DEFAULT '', - template_mtime int(11) UNSIGNED NOT NULL DEFAULT '0', + template_mtime int(11) NOT NULL DEFAULT '0', template_data mediumtext(16777215) NOT NULL DEFAULT '' -); +);; -CREATE INDEX phpbb_styles_template_data_template_id ON phpbb_styles_template_data (template_id); -CREATE INDEX phpbb_styles_template_data_template_filename ON phpbb_styles_template_data (template_filename); +CREATE INDEX phpbb_styles_template_data_template_id ON phpbb_styles_template_data (template_id);; +CREATE INDEX phpbb_styles_template_data_template_filename ON phpbb_styles_template_data (template_filename);; # Table: 'phpbb_styles_theme' CREATE TABLE phpbb_styles_theme ( - theme_id INTEGER PRIMARY KEY NOT NULL , + theme_id INTEGER NOT NULL , theme_name varchar(255) NOT NULL DEFAULT '', theme_copyright varchar(255) NOT NULL DEFAULT '', theme_path varchar(100) NOT NULL DEFAULT '', - theme_storedb tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - theme_mtime int(11) UNSIGNED NOT NULL DEFAULT '0', - theme_data mediumtext(16777215) NOT NULL DEFAULT '' -); + theme_storedb tinyint(1) NOT NULL DEFAULT '0', + theme_mtime int(11) NOT NULL DEFAULT '0', + theme_data mediumtext(16777215) NOT NULL DEFAULT '', + PRIMARY KEY (theme_id) +);; -CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name); +CREATE UNIQUE INDEX phpbb_styles_theme_theme_name ON phpbb_styles_theme (theme_name);; # Table: 'phpbb_styles_imageset' CREATE TABLE phpbb_styles_imageset ( - imageset_id INTEGER PRIMARY KEY NOT NULL , + imageset_id INTEGER NOT NULL , imageset_name varchar(255) NOT NULL DEFAULT '', imageset_copyright varchar(255) NOT NULL DEFAULT '', imageset_path varchar(100) NOT NULL DEFAULT '', @@ -805,151 +853,155 @@ CREATE TABLE phpbb_styles_imageset ( user_icon7 varchar(200) NOT NULL DEFAULT '', user_icon8 varchar(200) NOT NULL DEFAULT '', user_icon9 varchar(200) NOT NULL DEFAULT '', - user_icon10 varchar(200) NOT NULL DEFAULT '' -); + user_icon10 varchar(200) NOT NULL DEFAULT '', + PRIMARY KEY (imageset_id) +);; -CREATE UNIQUE INDEX phpbb_styles_imageset_imageset_name ON phpbb_styles_imageset (imageset_name); +CREATE UNIQUE INDEX phpbb_styles_imageset_imageset_name ON phpbb_styles_imageset (imageset_name);; # Table: 'phpbb_topics' CREATE TABLE phpbb_topics ( - topic_id INTEGER PRIMARY KEY NOT NULL , - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - icon_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_attachment tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - topic_approved tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - topic_reported tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + topic_id INTEGER NOT NULL , + forum_id mediumint(8) NOT NULL DEFAULT '0', + icon_id mediumint(8) NOT NULL DEFAULT '0', + topic_attachment tinyint(1) NOT NULL DEFAULT '0', + topic_approved tinyint(1) NOT NULL DEFAULT '1', + topic_reported tinyint(1) NOT NULL DEFAULT '0', topic_title text(65535) NOT NULL DEFAULT '', - topic_poster mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_time int(11) UNSIGNED NOT NULL DEFAULT '0', - topic_time_limit int(11) UNSIGNED NOT NULL DEFAULT '0', - topic_views mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_replies mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_replies_real mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_poster mediumint(8) NOT NULL DEFAULT '0', + topic_time int(11) NOT NULL DEFAULT '0', + topic_time_limit int(11) NOT NULL DEFAULT '0', + topic_views mediumint(8) NOT NULL DEFAULT '0', + topic_replies mediumint(8) NOT NULL DEFAULT '0', + topic_replies_real mediumint(8) NOT NULL DEFAULT '0', topic_status tinyint(3) NOT NULL DEFAULT '0', topic_type tinyint(3) NOT NULL DEFAULT '0', - topic_first_post_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_first_post_id mediumint(8) NOT NULL DEFAULT '0', topic_first_poster_name varchar(255) NOT NULL DEFAULT '', - topic_last_post_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_last_poster_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_last_post_id mediumint(8) NOT NULL DEFAULT '0', + topic_last_poster_id mediumint(8) NOT NULL DEFAULT '0', topic_last_poster_name varchar(255) NOT NULL DEFAULT '', - topic_last_post_time int(11) UNSIGNED NOT NULL DEFAULT '0', - topic_last_view_time int(11) UNSIGNED NOT NULL DEFAULT '0', - topic_moved_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - topic_bumped tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - topic_bumper mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + topic_last_post_time int(11) NOT NULL DEFAULT '0', + topic_last_view_time int(11) NOT NULL DEFAULT '0', + topic_moved_id mediumint(8) NOT NULL DEFAULT '0', + topic_bumped tinyint(1) NOT NULL DEFAULT '0', + topic_bumper mediumint(8) NOT NULL DEFAULT '0', poll_title text(65535) NOT NULL DEFAULT '', - poll_start int(11) UNSIGNED NOT NULL DEFAULT '0', - poll_length int(11) UNSIGNED NOT NULL DEFAULT '0', + poll_start int(11) NOT NULL DEFAULT '0', + poll_length int(11) NOT NULL DEFAULT '0', poll_max_options tinyint(4) NOT NULL DEFAULT '1', - poll_last_vote int(11) UNSIGNED NOT NULL DEFAULT '0', - poll_vote_change tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + poll_last_vote int(11) NOT NULL DEFAULT '0', + poll_vote_change tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (topic_id) +);; -CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id); -CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type); -CREATE INDEX phpbb_topics_topic_last_post_time ON phpbb_topics (topic_last_post_time); +CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id);; +CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type);; +CREATE INDEX phpbb_topics_topic_last_post_time ON phpbb_topics (topic_last_post_time);; # Table: 'phpbb_topics_track' CREATE TABLE phpbb_topics_track ( - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - forum_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - mark_time int(11) UNSIGNED NOT NULL DEFAULT '0' -); + user_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + forum_id mediumint(8) NOT NULL DEFAULT '0', + mark_time int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +);; -CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id); +CREATE INDEX phpbb_topics_track_forum_id ON phpbb_topics_track (forum_id);; # Table: 'phpbb_topics_posted' CREATE TABLE phpbb_topics_posted ( - user_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - topic_id mediumint(8) UNSIGNED PRIMARY KEY NOT NULL DEFAULT '0', - topic_posted tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + user_id mediumint(8) NOT NULL DEFAULT '0', + topic_id mediumint(8) NOT NULL DEFAULT '0', + topic_posted tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (user_id, topic_id) +);; # 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) UNSIGNED NOT NULL DEFAULT '0' -); + topic_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + notify_status tinyint(1) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id); -CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id); -CREATE INDEX phpbb_topics_watch_notify_status ON phpbb_topics_watch (notify_status); +CREATE INDEX phpbb_topics_watch_topic_id ON phpbb_topics_watch (topic_id);; +CREATE INDEX phpbb_topics_watch_user_id ON phpbb_topics_watch (user_id);; +CREATE INDEX phpbb_topics_watch_notify_status ON phpbb_topics_watch (notify_status);; # Table: 'phpbb_user_group' CREATE TABLE phpbb_user_group ( - group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - group_leader tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - user_pending tinyint(1) UNSIGNED NOT NULL DEFAULT '1' -); + group_id mediumint(8) NOT NULL DEFAULT '0', + user_id mediumint(8) NOT NULL DEFAULT '0', + group_leader tinyint(1) NOT NULL DEFAULT '0', + user_pending tinyint(1) NOT NULL DEFAULT '1' +);; -CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id); -CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id); -CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader); +CREATE INDEX phpbb_user_group_group_id ON phpbb_user_group (group_id);; +CREATE INDEX phpbb_user_group_user_id ON phpbb_user_group (user_id);; +CREATE INDEX phpbb_user_group_group_leader ON phpbb_user_group (group_leader);; # Table: 'phpbb_users' CREATE TABLE phpbb_users ( - user_id INTEGER PRIMARY KEY NOT NULL , + user_id INTEGER NOT NULL , user_type tinyint(2) NOT NULL DEFAULT '0', - group_id mediumint(8) UNSIGNED NOT NULL DEFAULT '3', + group_id mediumint(8) NOT NULL DEFAULT '3', user_permissions mediumtext(16777215) NOT NULL DEFAULT '', - user_perm_from mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_perm_from mediumint(8) NOT NULL DEFAULT '0', user_ip varchar(40) NOT NULL DEFAULT '', - user_regdate int(11) UNSIGNED NOT NULL DEFAULT '0', + user_regdate int(11) NOT NULL DEFAULT '0', username varchar(255) NOT NULL DEFAULT '', user_password varchar(40) NOT NULL DEFAULT '', - user_passchg int(11) UNSIGNED NOT NULL DEFAULT '0', + user_passchg int(11) NOT NULL DEFAULT '0', user_email varchar(100) NOT NULL DEFAULT '', user_email_hash bigint(20) NOT NULL DEFAULT '0', user_birthday varchar(10) NOT NULL DEFAULT '', - user_lastvisit int(11) UNSIGNED NOT NULL DEFAULT '0', - user_lastmark int(11) UNSIGNED NOT NULL DEFAULT '0', - user_lastpost_time int(11) UNSIGNED NOT NULL DEFAULT '0', + user_lastvisit int(11) NOT NULL DEFAULT '0', + user_lastmark int(11) NOT NULL DEFAULT '0', + user_lastpost_time int(11) NOT NULL DEFAULT '0', user_lastpage varchar(200) NOT NULL DEFAULT '', user_last_confirm_key varchar(10) NOT NULL DEFAULT '', - user_last_search int(11) UNSIGNED NOT NULL DEFAULT '0', + user_last_search int(11) NOT NULL DEFAULT '0', user_warnings tinyint(4) NOT NULL DEFAULT '0', - user_last_warning int(11) UNSIGNED NOT NULL DEFAULT '0', + user_last_warning int(11) NOT NULL DEFAULT '0', user_login_attempts tinyint(4) NOT NULL DEFAULT '0', - user_posts mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_posts mediumint(8) NOT NULL DEFAULT '0', user_lang varchar(30) NOT NULL DEFAULT '', user_timezone decimal(5,2) NOT NULL DEFAULT '0', - user_dst tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + user_dst tinyint(1) NOT NULL DEFAULT '0', user_dateformat varchar(30) NOT NULL DEFAULT 'd M Y H:i', user_style tinyint(4) NOT NULL DEFAULT '0', - user_rank mediumint(8) UNSIGNED NOT NULL DEFAULT '0', + user_rank mediumint(8) NOT NULL DEFAULT '0', user_colour varchar(6) NOT NULL DEFAULT '', user_new_privmsg tinyint(4) NOT NULL DEFAULT '0', user_unread_privmsg tinyint(4) NOT NULL DEFAULT '0', - user_last_privmsg int(11) UNSIGNED NOT NULL DEFAULT '0', - user_message_rules tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + user_last_privmsg int(11) NOT NULL DEFAULT '0', + user_message_rules tinyint(1) NOT NULL DEFAULT '0', user_full_folder int(11) NOT NULL DEFAULT '-3', - user_emailtime int(11) UNSIGNED NOT NULL DEFAULT '0', - user_topic_show_days mediumint(4) UNSIGNED NOT NULL DEFAULT '0', + user_emailtime int(11) NOT NULL DEFAULT '0', + user_topic_show_days mediumint(4) NOT NULL DEFAULT '0', user_topic_sortby_type varchar(1) NOT NULL DEFAULT 't', user_topic_sortby_dir varchar(1) NOT NULL DEFAULT 'd', - user_post_show_days mediumint(4) UNSIGNED NOT NULL DEFAULT '0', + user_post_show_days mediumint(4) NOT NULL DEFAULT '0', user_post_sortby_type varchar(1) NOT NULL DEFAULT 't', user_post_sortby_dir varchar(1) NOT NULL DEFAULT 'a', - user_notify tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - user_notify_pm tinyint(1) UNSIGNED NOT NULL DEFAULT '1', + user_notify tinyint(1) NOT NULL DEFAULT '0', + user_notify_pm tinyint(1) NOT NULL DEFAULT '1', user_notify_type tinyint(4) NOT NULL DEFAULT '0', - user_allow_pm tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - user_allow_email tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewonline tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - user_allow_viewemail tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - user_allow_massemail tinyint(1) UNSIGNED NOT NULL DEFAULT '1', - user_options int(11) UNSIGNED NOT NULL DEFAULT '893', + user_allow_pm tinyint(1) NOT NULL DEFAULT '1', + user_allow_email tinyint(1) NOT NULL DEFAULT '1', + user_allow_viewonline tinyint(1) NOT NULL DEFAULT '1', + user_allow_viewemail tinyint(1) NOT NULL DEFAULT '1', + user_allow_massemail tinyint(1) NOT NULL DEFAULT '1', + user_options int(11) NOT NULL DEFAULT '893', user_avatar varchar(255) NOT NULL DEFAULT '', user_avatar_type tinyint(2) NOT NULL DEFAULT '0', user_avatar_width tinyint(4) NOT NULL DEFAULT '0', user_avatar_height tinyint(4) NOT NULL DEFAULT '0', user_sig mediumtext(16777215) NOT NULL DEFAULT '', user_sig_bbcode_uid varchar(5) NOT NULL DEFAULT '', - user_sig_bbcode_bitfield int(11) UNSIGNED NOT NULL DEFAULT '0', + user_sig_bbcode_bitfield blob NOT NULL DEFAULT '', user_from varchar(100) NOT NULL DEFAULT '', user_icq varchar(15) NOT NULL DEFAULT '', user_aim varchar(255) NOT NULL DEFAULT '', @@ -960,42 +1012,45 @@ CREATE TABLE phpbb_users ( user_occ varchar(255) NOT NULL DEFAULT '', user_interests text(65535) NOT NULL DEFAULT '', user_actkey varchar(32) NOT NULL DEFAULT '', - user_newpasswd varchar(32) NOT NULL DEFAULT '' -); + user_newpasswd varchar(32) NOT NULL DEFAULT '', + PRIMARY KEY (user_id) +);; -CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday); -CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash); -CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type); -CREATE INDEX phpbb_users_username ON phpbb_users (username); +CREATE INDEX phpbb_users_user_birthday ON phpbb_users (user_birthday);; +CREATE INDEX phpbb_users_user_email_hash ON phpbb_users (user_email_hash);; +CREATE INDEX phpbb_users_user_type ON phpbb_users (user_type);; +CREATE INDEX phpbb_users_username ON phpbb_users (username);; # Table: 'phpbb_warnings' CREATE TABLE phpbb_warnings ( - warning_id INTEGER PRIMARY KEY NOT NULL , - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - post_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - log_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - warning_time int(11) UNSIGNED NOT NULL DEFAULT '0' -); + warning_id INTEGER NOT NULL , + user_id mediumint(8) NOT NULL DEFAULT '0', + post_id mediumint(8) NOT NULL DEFAULT '0', + log_id mediumint(8) NOT NULL DEFAULT '0', + warning_time int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (warning_id) +);; # Table: 'phpbb_words' CREATE TABLE phpbb_words ( - word_id INTEGER PRIMARY KEY NOT NULL , + word_id INTEGER NOT NULL , word varchar(255) NOT NULL DEFAULT '', - replacement varchar(255) NOT NULL DEFAULT '' -); + replacement varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (word_id) +);; # Table: 'phpbb_zebra' CREATE TABLE phpbb_zebra ( - user_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - zebra_id mediumint(8) UNSIGNED NOT NULL DEFAULT '0', - friend tinyint(1) UNSIGNED NOT NULL DEFAULT '0', - foe tinyint(1) UNSIGNED NOT NULL DEFAULT '0' -); + user_id mediumint(8) NOT NULL DEFAULT '0', + zebra_id mediumint(8) NOT NULL DEFAULT '0', + friend tinyint(1) NOT NULL DEFAULT '0', + foe tinyint(1) NOT NULL DEFAULT '0' +);; -CREATE INDEX phpbb_zebra_user_id ON phpbb_zebra (user_id); -CREATE INDEX phpbb_zebra_zebra_id ON phpbb_zebra (zebra_id); +CREATE INDEX phpbb_zebra_user_id ON phpbb_zebra (user_id);; +CREATE INDEX phpbb_zebra_zebra_id ON phpbb_zebra (zebra_id);; -COMMIT; \ No newline at end of file +COMMIT;; \ No newline at end of file diff --git a/phpBB/posting.php b/phpBB/posting.php index 164fedb262..077fd2557f 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -868,7 +868,7 @@ if ($submit || $preview || $refresh) 'notify_set' => $post_data['notify_set'], 'poster_ip' => (isset($post_data['poster_ip'])) ? $post_data['poster_ip'] : $user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], - 'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 088e5c3aaf..b77df89c33 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -796,8 +796,8 @@ else // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array(); $has_attachments = $display_notice = false; -$force_encoding = ''; -$bbcode_bitfield = $i = $i_total = 0; +$bbcode_bitfield = $force_encoding = ''; +$i = $i_total = 0; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id @@ -917,12 +917,12 @@ while ($row = $db->sql_fetchrow($result)) ); // Define the global bbcode bitfield, will be used to load bbcodes - $bbcode_bitfield |= $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; // Is a signature attached? Are we going to display it? if ($row['enable_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) { - $bbcode_bitfield |= $row['user_sig_bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | $row['user_sig_bbcode_bitfield']; } // Cache various user specific data ... so we don't have to recompute