diff options
24 files changed, 61 insertions, 242 deletions
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 96efad10f8..f8fbbc2d3e 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -28,7 +28,7 @@ class bbcode * Constructor * Init bbcode cache entries if bitfield is specified */ - function bbcode($bitfield = 0) + function bbcode($bitfield = '') { if ($bitfield) { @@ -126,7 +126,6 @@ class bbcode $sql = ''; $bbcode_ids = $rowset = array(); - $bitlen = strlen(decbin($this->bbcode_bitfield)); $bitfield = new bitfield($this->bbcode_bitfield); $bbcodes_set = $bitfield->get_all_set(); diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index 0dd04c1a7b..b12ff81e0f 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -199,14 +199,7 @@ class dbal } else if (is_string($var)) { - if (strpos($key, 'bitfield') === false) - { - $values[] = "'" . $this->sql_escape($var) . "'"; - } - else - { - $values[] = $this->sql_escape_binary($var); - } + $values[] = "'" . $this->sql_escape($var) . "'"; } else if (is_array($var) && is_string($var[0])) { diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 0e8cc318f1..fe6cf75b12 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -256,7 +256,7 @@ class dbal_mssql extends dbal { foreach ($row as $key => $value) { - $row[$key] = ($value === ' ' && strpos($key, 'bitfield') === false) ? '' : $value; + $row[$key] = ($value === ' ') ? '' : $value; } } @@ -370,14 +370,6 @@ class dbal_mssql extends dbal } /** - * Escape string used in sql query - */ - function sql_escape_binary($msg) - { - return "CAST('" . $msg . "' AS varbinary)"; - } - - /** * return sql error array * @access: private */ diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 38ed91cd55..e1b2675a23 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -380,14 +380,6 @@ class dbal_mssql_odbc extends dbal } /** - * Escape string used in sql query - */ - function sql_escape_binary($msg) - { - return "CAST('" . $msg . "' AS varbinary)"; - } - - /** * Build db-specific query data * @access: private */ diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index ee7918473d..7e363721a9 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -328,16 +328,6 @@ class dbal_mysql extends dbal return @mysql_real_escape_string($msg, $this->db_connect_id); } - function sql_escape_binary($msg) - { - // If the last char is - if (substr($msg, -1) == ' ') - { - $msg .= "\0"; - } - return "'" . $this->sql_escape($msg) . "'"; - } - /** * Build db-specific query data * @access: private diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php index c63d5fb064..071f4c4b55 100644 --- a/phpBB/includes/db/mysql4.php +++ b/phpBB/includes/db/mysql4.php @@ -331,16 +331,6 @@ class dbal_mysql4 extends dbal return @mysql_real_escape_string($msg, $this->db_connect_id); } - function sql_escape_binary($msg) - { - // If the last char is - if (substr($msg, -1) == ' ') - { - $msg .= "\0"; - } - return "'" . $this->sql_escape($msg) . "'"; - } - /** * Build db-specific query data * @access: private diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index 46ddd55569..fa4d3ffdc7 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -311,16 +311,6 @@ class dbal_mysqli extends dbal return @mysqli_real_escape_string($this->db_connect_id, $msg); } - function sql_escape_binary($msg) - { - // If the last char is - if (substr($msg, -1) == ' ') - { - $msg .= "\0"; - } - return "'" . $this->sql_escape($msg) . "'"; - } - /** * Build db-specific query data * @access: private diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index 68dc396232..1836952346 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -397,14 +397,6 @@ class dbal_postgres extends dbal } /** - * Escape string used in sql query - */ - function sql_escape_binary($msg) - { - return "'" . @pg_escape_bytea($msg) . "'"; - } - - /** * return sql error array * @access: private */ diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index c203af9f67..cd6d40e3c7 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -49,7 +49,6 @@ 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); } @@ -217,13 +216,6 @@ class dbal_sqlite extends dbal } $row = @sqlite_fetch_array($query_id, SQLITE_ASSOC); - if ($row) - { - foreach ($row as $key => $value) - { - $row[$key] = (strpos($key, 'bitfield') === false) ? $value : sqlite_udf_decode_binary($value); - } - } return $row; } @@ -317,14 +309,6 @@ class dbal_sqlite extends dbal } /** - * Escape string used in sql query - */ - function sql_escape_binary($msg) - { - return "'" . @sqlite_udf_encode_binary($msg) . "'"; - } - - /** * return sql error array * @access: private */ @@ -384,31 +368,6 @@ 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 48336727f0..a676a717ff 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3012,7 +3012,7 @@ class bitfield function bitfield($bitfield = '') { - $this->data = $bitfield; + $this->data = base64_decode($bitfield); } /** @@ -3072,6 +3072,11 @@ class bitfield return $this->data; } + function get_base64() + { + return base64_encode($this->data); + } + function get_bin() { $bin = ''; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 3fe1fbab9f..1e3fd877b3 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -842,7 +842,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id do { $rowset[] = $row; - $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 9125ae55b1..ce0c47941d 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -886,7 +886,7 @@ function mcp_fork_topic($topic_ids) 'post_checksum' => (string) $row['post_checksum'], 'post_encoding' => (string) $row['post_encoding'], 'post_attachment' => (int) $row['post_attachment'], - 'bbcode_bitfield' => (int) $row['bbcode_bitfield'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index b2c3e21170..75dd9ea2e2 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -92,7 +92,7 @@ function mcp_topic_view($id, $mode, $action) while ($row = $db->sql_fetchrow($result)) { $rowset[] = $row; - $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } $db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 87ed6e93c8..bc428570ab 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -416,7 +416,7 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0) 'enable_smilies' => true, 'enable_urls' => false, 'icon_id' => 0, - 'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'address_list' => array('u' => array($userrow['user_id'] => 'to')), diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 8d51a195c6..94e4d94d04 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -79,7 +79,7 @@ class bbcode_firstpass extends bbcode } } - $this->bbcode_bitfield = $bitfield->get_blob(); + $this->bbcode_bitfield = $bitfield->get_base64(); } /** diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index a4db5bd3e0..620bc9701f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -281,7 +281,7 @@ function message_history($msg_id, $user_id, $message_row, $folder) else { $rowset[$row['msg_id']] = $row; - $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } } while ($row = $db->sql_fetchrow($result)); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 9c825a72b0..34e7530b64 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -981,11 +981,6 @@ class install_install extends module { $sql_query = preg_replace('/^\);$/m', ') DEFAULT CHARACTER SET latin1;', $sql_query); } - else - { - // versions older than 4.1.2 never had a good, working varbinary. TINYBLOB is just as good. - $sql_query = str_replace(array("varbinary(255) DEFAULT ''", 'varbinary(255) DEFAULT 0x90D8'), "TINYBLOB DEFAULT ''", $sql_query); - } break; @@ -1019,22 +1014,6 @@ class install_install extends module // Deal with any special comments and with MySQL < 4.1.2 switch ($dbms) { - case 'mysql': - case 'mysql4': - if (version_compare(mysql_get_server_info(), '4.1.2', '<')) - { - $bitfield = new bitfield(); - $bitfield->set(0); - $bitfield->set(3); - $bitfield->set(8); - $bitfield->set(9); - $bitfield->set(11); - $bitfield->set(12); - - $sql_query = str_replace("INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path) VALUES ('subSilver', '© phpBB Group', 'subSilver');", "INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path, bbcode_bitfield) VALUES ('subSilver', '© phpBB Group', 'subSilver', '" . $bitfield->data . "');", $sql_query); - } - break; - case 'mssql': case 'mssql_odbc': $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 51410cfbe1..d049725d58 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -350,7 +350,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 CHAR(255) DEFAULT '' NOT NULL, + forum_desc_bitfield VARCHAR(252) 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, @@ -359,7 +359,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 CHAR(255) DEFAULT '' NOT NULL, + forum_rules_bitfield VARCHAR(252) 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, @@ -436,7 +436,7 @@ CREATE TABLE phpbb_groups ( group_type INTEGER DEFAULT 1 NOT NULL, group_name VARCHAR(252) DEFAULT '' NOT NULL, group_desc BLOB SUB_TYPE TEXT DEFAULT '' NOT NULL, - group_desc_bitfield CHAR(255) DEFAULT '' NOT NULL, + group_desc_bitfield VARCHAR(252) 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, @@ -639,7 +639,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 CHAR(255) DEFAULT '' NOT NULL, + bbcode_bitfield VARCHAR(252) DEFAULT '' NOT NULL, bbcode_uid VARCHAR(5) DEFAULT '' NOT NULL, post_postcount INTEGER DEFAULT 1 NOT NULL, post_edit_time INTEGER DEFAULT 0 NOT NULL, @@ -688,7 +688,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 CHAR(255) DEFAULT '' NOT NULL, + bbcode_bitfield VARCHAR(252) 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, @@ -1081,7 +1081,7 @@ CREATE TABLE phpbb_styles_template ( template_name VARCHAR(252) DEFAULT '' NOT NULL, template_copyright VARCHAR(255) DEFAULT '' NOT NULL, template_path VARCHAR(100) DEFAULT '' NOT NULL, - bbcode_bitfield CHAR(255) DEFAULT '' NOT NULL, + bbcode_bitfield VARCHAR(252) DEFAULT 'kNg=' NOT NULL, template_storedb INTEGER DEFAULT 0 NOT NULL );; @@ -1423,7 +1423,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 CHAR(255) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield VARCHAR(252) DEFAULT '' NOT NULL, user_from VARCHAR(100) DEFAULT '' NOT NULL, user_icq VARCHAR(15) DEFAULT '' NOT NULL, user_aim VARCHAR(255) DEFAULT '' NOT NULL, @@ -1508,66 +1508,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);; - -# Trigger for phpbb_forums bitfields -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;; - -# Trigger for phpbb_groups bitfields -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;; - -# Trigger for phpbb_posts bitfields -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;; - -# Trigger for phpbb_privmsgs bitfields -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;; - -# Trigger for phpbb_styles_template bitfields -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;; - -# Trigger for phpbb_users bitfields -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;;
\ No newline at end of file +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 b47d8602db..d9b483e407 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -402,7 +402,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] [varbinary] (255) DEFAULT (0x) NOT NULL , + [forum_desc_bitfield] [varchar] (252) DEFAULT ('') 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 , @@ -411,7 +411,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] [varbinary] (255) DEFAULT (0x) NOT NULL , + [forum_rules_bitfield] [varchar] (252) DEFAULT ('') 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 , @@ -517,7 +517,7 @@ CREATE TABLE [phpbb_groups] ( [group_type] [int] DEFAULT (1) NOT NULL , [group_name] [varchar] (252) DEFAULT ('') NOT NULL , [group_desc] [varchar] (8000) DEFAULT ('') NOT NULL , - [group_desc_bitfield] [varbinary] (255) DEFAULT (0x) NOT NULL , + [group_desc_bitfield] [varchar] (252) DEFAULT ('') 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 , @@ -750,7 +750,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] [varbinary] (255) DEFAULT (0x) NOT NULL , + [bbcode_bitfield] [varchar] (252) DEFAULT ('') NOT NULL , [bbcode_uid] [varchar] (5) DEFAULT ('') NOT NULL , [post_postcount] [int] DEFAULT (1) NOT NULL , [post_edit_time] [int] DEFAULT (0) NOT NULL , @@ -810,7 +810,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] [varbinary] (255) DEFAULT (0x) NOT NULL , + [bbcode_bitfield] [varchar] (252) DEFAULT ('') 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 , @@ -1272,7 +1272,7 @@ CREATE TABLE [phpbb_styles_template] ( [template_name] [varchar] (252) DEFAULT ('') NOT NULL , [template_copyright] [varchar] (255) DEFAULT ('') NOT NULL , [template_path] [varchar] (100) DEFAULT ('') NOT NULL , - [bbcode_bitfield] [varbinary] (255) DEFAULT (0x90D8) NOT NULL , + [bbcode_bitfield] [varchar] (252) DEFAULT ('kNg=') NOT NULL , [template_storedb] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1650,7 +1650,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] [varbinary] (255) DEFAULT (0x) NOT NULL , + [user_sig_bbcode_bitfield] [varchar] (252) DEFAULT ('') 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 aa45795cf2..bfcebdc3b1 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -222,7 +222,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 varbinary(255) DEFAULT '' NOT NULL, + forum_desc_bitfield varchar(252) DEFAULT '' 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, @@ -231,7 +231,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 varbinary(255) DEFAULT '' NOT NULL, + forum_rules_bitfield varchar(252) DEFAULT '' 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, @@ -294,7 +294,7 @@ CREATE TABLE phpbb_groups ( group_type tinyint(4) DEFAULT '1' NOT NULL, group_name varchar(252) DEFAULT '' NOT NULL, group_desc text DEFAULT '' NOT NULL, - group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL, + group_desc_bitfield varchar(252) DEFAULT '' 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, @@ -437,7 +437,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 varbinary(255) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT '' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, post_postcount tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, post_edit_time int(11) UNSIGNED DEFAULT '0' NOT NULL, @@ -474,7 +474,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 varbinary(255) DEFAULT '' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT '' 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, @@ -729,7 +729,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar(252) DEFAULT '' NOT NULL, template_copyright varchar(255) DEFAULT '' NOT NULL, template_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield varbinary(255) DEFAULT 0x90D8 NOT NULL, + bbcode_bitfield varchar(252) DEFAULT 'kNg=' NOT NULL, template_storedb tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (template_id), UNIQUE tmplte_nm (template_name) @@ -1010,7 +1010,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 varbinary(255) DEFAULT '' NOT NULL, + user_sig_bbcode_bitfield varchar(252) DEFAULT '' 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 18e321795d..9bd8df274b 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -477,7 +477,7 @@ CREATE TABLE phpbb_forums ( forum_parents clob DEFAULT '' , forum_name varchar2(3000) DEFAULT '' , forum_desc clob DEFAULT '' , - forum_desc_bitfield raw(255) DEFAULT '' , + forum_desc_bitfield varchar(252) DEFAULT '' , forum_desc_options number(11) DEFAULT '0' NOT NULL, forum_desc_uid varchar2(5) DEFAULT '' , forum_link varchar2(255) DEFAULT '' , @@ -486,7 +486,7 @@ CREATE TABLE phpbb_forums ( forum_image varchar2(255) DEFAULT '' , forum_rules clob DEFAULT '' , forum_rules_link varchar2(255) DEFAULT '' , - forum_rules_bitfield raw(255) DEFAULT '' , + forum_rules_bitfield varchar(252) DEFAULT '' , forum_rules_options number(11) DEFAULT '0' NOT NULL, forum_rules_uid varchar2(5) DEFAULT '' , forum_topics_per_page number(4) DEFAULT '0' NOT NULL, @@ -582,7 +582,7 @@ CREATE TABLE phpbb_groups ( group_type number(4) DEFAULT '1' NOT NULL, group_name varchar2(252) DEFAULT '' , group_desc clob DEFAULT '' , - group_desc_bitfield raw(255) DEFAULT '' , + group_desc_bitfield varchar(252) DEFAULT '' , group_desc_options number(11) DEFAULT '0' NOT NULL, group_desc_uid varchar2(5) DEFAULT '' , group_display number(1) DEFAULT '0' NOT NULL, @@ -847,7 +847,7 @@ CREATE TABLE phpbb_posts ( post_checksum varchar2(32) DEFAULT '' , post_encoding varchar2(20) DEFAULT 'iso-8859-1' NOT NULL, post_attachment number(1) DEFAULT '0' NOT NULL, - bbcode_bitfield raw(255) DEFAULT '' , + bbcode_bitfield varchar(252) DEFAULT '' , bbcode_uid varchar2(5) DEFAULT '' , post_postcount number(1) DEFAULT '1' NOT NULL, post_edit_time number(11) DEFAULT '0' NOT NULL, @@ -910,7 +910,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 raw(255) DEFAULT '' , + bbcode_bitfield varchar(252) DEFAULT '' , bbcode_uid varchar2(5) DEFAULT '' , message_edit_time number(11) DEFAULT '0' NOT NULL, message_edit_count number(4) DEFAULT '0' NOT NULL, @@ -1418,7 +1418,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar2(252) DEFAULT '' , template_copyright varchar2(255) DEFAULT '' , template_path varchar2(100) DEFAULT '' , - bbcode_bitfield raw(255) DEFAULT '90D8' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT 'kNg=' NOT NULL, template_storedb number(1) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_styles_template PRIMARY KEY (template_id), CONSTRAINT u_phpbb_tmplte_nm UNIQUE (template_name) @@ -1819,7 +1819,7 @@ CREATE TABLE phpbb_users ( user_avatar_height number(4) DEFAULT '0' NOT NULL, user_sig clob DEFAULT '' , user_sig_bbcode_uid varchar2(5) DEFAULT '' , - user_sig_bbcode_bitfield raw(255) DEFAULT '' , + user_sig_bbcode_bitfield varchar(252) DEFAULT '' , user_from varchar2(100) DEFAULT '' , user_icq varchar2(15) DEFAULT '' , user_aim varchar2(255) DEFAULT '' , diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 35c8a46932..bbe1461d68 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -354,7 +354,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 bytea DEFAULT '\000' NOT NULL, + forum_desc_bitfield varchar(252) DEFAULT '' NOT NULL, forum_desc_options INT4 DEFAULT '0' NOT NULL CHECK (forum_desc_options >= 0), forum_desc_uid varchar(5) DEFAULT '' NOT NULL, forum_link varchar(255) DEFAULT '' NOT NULL, @@ -363,7 +363,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 bytea DEFAULT '\000' NOT NULL, + forum_rules_bitfield varchar(252) DEFAULT '' NOT NULL, forum_rules_options INT4 DEFAULT '0' NOT NULL CHECK (forum_rules_options >= 0), forum_rules_uid varchar(5) DEFAULT '' NOT NULL, forum_topics_per_page INT2 DEFAULT '0' NOT NULL, @@ -436,7 +436,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 bytea DEFAULT '\000' NOT NULL, + group_desc_bitfield varchar(252) DEFAULT '' NOT NULL, group_desc_options INT4 DEFAULT '0' NOT NULL CHECK (group_desc_options >= 0), group_desc_uid varchar(5) DEFAULT '' NOT NULL, group_display INT2 DEFAULT '0' NOT NULL CHECK (group_display >= 0), @@ -605,7 +605,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 bytea DEFAULT '\000' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT '' NOT NULL, bbcode_uid varchar(5) DEFAULT '' NOT NULL, post_postcount INT2 DEFAULT '1' NOT NULL CHECK (post_postcount >= 0), post_edit_time INT4 DEFAULT '0' NOT NULL CHECK (post_edit_time >= 0), @@ -646,7 +646,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 bytea DEFAULT '\000' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT '' 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), @@ -961,7 +961,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar(252) DEFAULT '' NOT NULL, template_copyright varchar(255) DEFAULT '' NOT NULL, template_path varchar(100) DEFAULT '' NOT NULL, - bbcode_bitfield bytea DEFAULT '\220\330' NOT NULL, + bbcode_bitfield varchar(252) DEFAULT 'kNg=' NOT NULL, template_storedb INT2 DEFAULT '0' NOT NULL CHECK (template_storedb >= 0), PRIMARY KEY (template_id) ); @@ -1270,7 +1270,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 bytea DEFAULT '\000' NOT NULL, + user_sig_bbcode_bitfield varchar(252) DEFAULT '' 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/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 840c4420ae..3aef6d01b1 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -215,7 +215,7 @@ CREATE TABLE phpbb_forums ( forum_parents mediumtext(16777215) NOT NULL DEFAULT '', forum_name text(65535) NOT NULL DEFAULT '', forum_desc text(65535) NOT NULL DEFAULT '', - forum_desc_bitfield blob NOT NULL DEFAULT '', + forum_desc_bitfield varchar(252) NOT NULL DEFAULT '', forum_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_desc_uid varchar(5) NOT NULL DEFAULT '', forum_link varchar(255) NOT NULL DEFAULT '', @@ -224,7 +224,7 @@ 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 blob NOT NULL DEFAULT '', + forum_rules_bitfield varchar(252) NOT NULL DEFAULT '', forum_rules_options INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_rules_uid varchar(5) NOT NULL DEFAULT '', forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', @@ -286,7 +286,7 @@ CREATE TABLE phpbb_groups ( group_type tinyint(4) NOT NULL DEFAULT '1', group_name varchar(252) NOT NULL DEFAULT '', group_desc text(65535) NOT NULL DEFAULT '', - group_desc_bitfield blob NOT NULL DEFAULT '', + group_desc_bitfield varchar(252) NOT NULL DEFAULT '', group_desc_options INTEGER UNSIGNED NOT NULL DEFAULT '0', group_desc_uid varchar(5) NOT NULL DEFAULT '', group_display INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -424,7 +424,7 @@ CREATE TABLE phpbb_posts ( post_checksum varchar(32) NOT NULL DEFAULT '', post_encoding varchar(20) NOT NULL DEFAULT 'iso-8859-1', post_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield blob NOT NULL DEFAULT '', + bbcode_bitfield varchar(252) NOT NULL DEFAULT '', bbcode_uid varchar(5) NOT NULL DEFAULT '', post_postcount INTEGER UNSIGNED NOT NULL DEFAULT '1', post_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -460,7 +460,7 @@ CREATE TABLE phpbb_privmsgs ( message_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0', message_encoding varchar(20) NOT NULL DEFAULT 'iso-8859-1', message_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0', - bbcode_bitfield blob NOT NULL DEFAULT '', + bbcode_bitfield varchar(252) NOT NULL DEFAULT '', bbcode_uid varchar(5) NOT NULL DEFAULT '', message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0', message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -704,7 +704,7 @@ CREATE TABLE phpbb_styles_template ( template_name varchar(252) NOT NULL DEFAULT '', template_copyright varchar(255) NOT NULL DEFAULT '', template_path varchar(100) NOT NULL DEFAULT '', - bbcode_bitfield blob NOT NULL DEFAULT '', + bbcode_bitfield varchar(252) NOT NULL DEFAULT 'kNg=', template_storedb INTEGER UNSIGNED NOT NULL DEFAULT '0' );; @@ -981,7 +981,7 @@ CREATE TABLE phpbb_users ( 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 blob NOT NULL DEFAULT '', + user_sig_bbcode_bitfield varchar(252) NOT NULL DEFAULT '', user_from varchar(100) NOT NULL DEFAULT '', user_icq varchar(15) NOT NULL DEFAULT '', user_aim varchar(255) NOT NULL DEFAULT '', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 639cb48bae..1798e1b144 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -924,12 +924,12 @@ while ($row = $db->sql_fetchrow($result)) ); // Define the global bbcode bitfield, will be used to load bbcodes - $bbcode_bitfield = $bbcode_bitfield | $row['bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($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 = $bbcode_bitfield | $row['user_sig_bbcode_bitfield']; + $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']); } // Cache various user specific data ... so we don't have to recompute @@ -1202,7 +1202,7 @@ if (sizeof($attach_list)) if ($bbcode_bitfield !== '') { include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($bbcode_bitfield); + $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } $i_total = sizeof($rowset) - 1; |