1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 07:07:51 +02:00

so.... what does this thing do?

well, the super fast, ultra efficient, massively huge BBCode handling system was implemented differently on each DBMS. Although this provided the best performance, the solution was a bit hacky.

So what does this new thing do? We use base64 encoding to make everything nice and shiny, it turns into nice, safe characters that we can just jam into varchars on essentially any database. This has two implications: we must decode every bitfield we get AND we have slightly fewer IDs to work with. It goes down from 2040 BBCodes to 1512. We lose like a quarter of them :P

P.S. I hope nothing broke :P


git-svn-id: file:///svn/phpbb/trunk@6263 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-08-11 21:52:46 +00:00
parent 9086adad3c
commit 86f3d738a0
24 changed files with 61 additions and 242 deletions

View File

@ -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();

View File

@ -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]))
{

View File

@ -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;
}
}
@ -369,14 +369,6 @@ class dbal_mssql extends dbal
return str_replace("'", "''", $msg);
}
/**
* Escape string used in sql query
*/
function sql_escape_binary($msg)
{
return "CAST('" . $msg . "' AS varbinary)";
}
/**
* return sql error array
* @access: private

View File

@ -379,14 +379,6 @@ class dbal_mssql_odbc extends dbal
return str_replace("'", "''", $msg);
}
/**
* Escape string used in sql query
*/
function sql_escape_binary($msg)
{
return "CAST('" . $msg . "' AS varbinary)";
}
/**
* Build db-specific query data
* @access: private

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -396,14 +396,6 @@ class dbal_postgres extends dbal
return @pg_escape_string($msg);
}
/**
* Escape string used in sql query
*/
function sql_escape_binary($msg)
{
return "'" . @pg_escape_bytea($msg) . "'";
}
/**
* return sql error array
* @access: private

View File

@ -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;
}
@ -316,14 +308,6 @@ class dbal_sqlite extends dbal
return @sqlite_escape_string($msg);
}
/**
* 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

View File

@ -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 = '';

View File

@ -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);

View File

@ -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'],

View File

@ -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);

View File

@ -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')),

View File

@ -79,7 +79,7 @@ class bbcode_firstpass extends bbcode
}
}
$this->bbcode_bitfield = $bitfield->get_blob();
$this->bbcode_bitfield = $bitfield->get_base64();
}
/**

View File

@ -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));

View File

@ -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', '&copy; phpBB Group', 'subSilver');", "INSERT INTO phpbb_styles_template (template_name, template_copyright, template_path, bbcode_bitfield) VALUES ('subSilver', '&copy; 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);

View File

@ -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;;
CREATE INDEX phpbb_zebra_zebra_id ON phpbb_zebra(zebra_id);;

View File

@ -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 ,

View File

@ -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,

View File

@ -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 '' ,

View File

@ -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,

View File

@ -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 '',

View File

@ -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;