Fixed Bug #45115 - Signature parsing flags are not stored in DB

Authorised by: AcydBurn

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9696 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ruslan Uzdenov 2009-06-27 08:36:40 +00:00
parent 076067f856
commit adaeec1ec9
13 changed files with 56 additions and 16 deletions

View file

@ -178,6 +178,7 @@
<li>[Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)</li>
<li>[Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)</li>
<li>[Feature] Ability to define minimum number of characters for posts/pms</li>
<li>[Feature] Store signature configuration options in database (Bug #45115 - Patch by rxu)</li>
</ul>
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>

View file

@ -1545,9 +1545,9 @@ class acp_users
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
$enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false;
$enable_urls = ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false;
$signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true));
$preview = (isset($_POST['preview'])) ? true : false;
@ -1556,6 +1556,10 @@ class acp_users
{
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
@ -1573,8 +1577,13 @@ class acp_users
if (!sizeof($error) && $submit)
{
$this->optionset($user_row, 'sig_bbcode', $enable_bbcode);
$this->optionset($user_row, 'sig_smilies', $enable_smilies);
$this->optionset($user_row, 'sig_links', $enable_urls);
$sql_ary = array(
'user_sig' => (string) $message_parser->message,
'user_options' => $user_row['user_options'],
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield
);

View file

@ -187,7 +187,7 @@ function user_add($user_row, $cp_data = false)
'user_ip' => '',
'user_regdate' => time(),
'user_passchg' => time(),
'user_options' => 895,
'user_options' => 230271,
// We do not set the new flag here - registration scripts need to specify it
'user_new' => 0,

View file

@ -1431,8 +1431,8 @@ class user extends session
var $img_lang;
var $img_array = array();
// Able to add new option (id 7)
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10);
// Able to add new options (up to id 31)
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
var $keyvalues = array();
/**

View file

@ -456,9 +456,9 @@ class ucp_profile
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
$enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false;
$enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false;
$signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
@ -468,6 +468,10 @@ class ucp_profile
{
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
if (!sizeof($error))
{
$message_parser = new parse_message($signature);
@ -487,8 +491,13 @@ class ucp_profile
if (!sizeof($error) && $submit)
{
$user->optionset('sig_bbcode', $enable_bbcode);
$user->optionset('sig_smilies', $enable_smilies);
$user->optionset('sig_links', $enable_urls);
$sql_ary = array(
'user_sig' => (string) $message_parser->message,
'user_options' => $user->data['user_options'],
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
);

View file

@ -676,6 +676,10 @@ function database_update_info()
'forum_style' => array('UINT', 0),
),
),
'change_columns' => array(
USERS_TABLE => array(
'user_options' => array('UINT:11', 230271),
),
),
// No changes from 3.0.5-RC1 to 3.0.5
@ -1279,6 +1283,23 @@ function change_database_data(&$no_updates, $version)
set_config('allow_quick_reply', '1');
}
// Set every members user_options column to enable
// bbcode, smilies and URLs for signatures by default
$sql = 'SELECT user_options
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query_limit($sql, 1);
$user_option = (int) $db->sql_fetchfield('user_options');
$db->sql_freeresult($result);
// Check if we already updated the database by checking bit 15 which we used to store the sig_bbcode option
if (!($user_option & 1 << 15))
{
// 229376 is the added value to enable all three signature options
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
_sql($sql, $errored, $error_ary);
}
$no_updates = false;
break;
}

View file

@ -1346,7 +1346,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline INTEGER DEFAULT 1 NOT NULL,
user_allow_viewemail INTEGER DEFAULT 1 NOT NULL,
user_allow_massemail INTEGER DEFAULT 1 NOT NULL,
user_options INTEGER DEFAULT 895 NOT NULL,
user_options INTEGER DEFAULT 230271 NOT NULL,
user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
user_avatar_type INTEGER DEFAULT 0 NOT NULL,
user_avatar_width INTEGER DEFAULT 0 NOT NULL,

View file

@ -1617,7 +1617,7 @@ CREATE TABLE [phpbb_users] (
[user_allow_viewonline] [int] DEFAULT (1) NOT NULL ,
[user_allow_viewemail] [int] DEFAULT (1) NOT NULL ,
[user_allow_massemail] [int] DEFAULT (1) NOT NULL ,
[user_options] [int] DEFAULT (895) NOT NULL ,
[user_options] [int] DEFAULT (230271) NOT NULL ,
[user_avatar] [varchar] (255) DEFAULT ('') NOT NULL ,
[user_avatar_type] [int] DEFAULT (0) NOT NULL ,
[user_avatar_width] [int] DEFAULT (0) NOT NULL ,

View file

@ -946,7 +946,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_options int(11) UNSIGNED DEFAULT '895' NOT NULL,
user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL,
user_avatar varbinary(255) DEFAULT '' NOT NULL,
user_avatar_type tinyint(2) DEFAULT '0' NOT NULL,
user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL,

View file

@ -946,7 +946,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
user_options int(11) UNSIGNED DEFAULT '895' NOT NULL,
user_options int(11) UNSIGNED DEFAULT '230271' NOT NULL,
user_avatar varchar(255) DEFAULT '' NOT NULL,
user_avatar_type tinyint(2) DEFAULT '0' NOT NULL,
user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL,

View file

@ -1764,7 +1764,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline number(1) DEFAULT '1' NOT NULL,
user_allow_viewemail number(1) DEFAULT '1' NOT NULL,
user_allow_massemail number(1) DEFAULT '1' NOT NULL,
user_options number(11) DEFAULT '895' NOT NULL,
user_options number(11) DEFAULT '230271' NOT NULL,
user_avatar varchar2(255) DEFAULT '' ,
user_avatar_type number(2) DEFAULT '0' NOT NULL,
user_avatar_width number(4) DEFAULT '0' NOT NULL,

View file

@ -1209,7 +1209,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0),
user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0),
user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0),
user_options INT4 DEFAULT '895' NOT NULL CHECK (user_options >= 0),
user_options INT4 DEFAULT '230271' NOT NULL CHECK (user_options >= 0),
user_avatar varchar(255) DEFAULT '' NOT NULL,
user_avatar_type INT2 DEFAULT '0' NOT NULL,
user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0),

View file

@ -916,7 +916,7 @@ CREATE TABLE phpbb_users (
user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1',
user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1',
user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1',
user_options INTEGER UNSIGNED NOT NULL DEFAULT '895',
user_options INTEGER UNSIGNED NOT NULL DEFAULT '230271',
user_avatar varchar(255) NOT NULL DEFAULT '',
user_avatar_type tinyint(2) NOT NULL DEFAULT '0',
user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0',