mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-15 05:24:41 +01:00
Add sql_bit_or() dbal method. Add ability to enable quick reply in all forums. -- Voila ;-)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10491 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7332b3b741
commit
c6e176d88e
@ -97,6 +97,7 @@
|
||||
<li>[Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)</li>
|
||||
<li>[Fix] Some XHTML corrections in subsilver2. (Bug #57505)</li>
|
||||
<li>[Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)</li>
|
||||
<li>[Feature] Add ability to enable quick reply in all forums.</li>
|
||||
</ul>
|
||||
|
||||
<a name="v306"></a><h3>1.ii. Changes since 3.0.6</h3>
|
||||
|
@ -34,7 +34,7 @@ class acp_board
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
$action = request_var('action', '');
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;
|
||||
|
||||
$form_key = 'acp_board';
|
||||
add_form_key($form_key);
|
||||
@ -89,7 +89,7 @@ class acp_board
|
||||
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
|
||||
|
||||
'legend2' => 'ACP_LOAD_SETTINGS',
|
||||
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
@ -472,6 +472,11 @@ class acp_board
|
||||
if ($submit)
|
||||
{
|
||||
set_config($config_name, $config_value);
|
||||
|
||||
if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
|
||||
{
|
||||
enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,6 +863,20 @@ class acp_board
|
||||
return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Global quick reply enable/disable setting and button to enable in all forums
|
||||
*/
|
||||
function quick_reply($value, $key)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$radio_ary = array(1 => 'YES', 0 => 'NO');
|
||||
|
||||
return h_radio('config[allow_quick_reply]', $radio_ary, $value) .
|
||||
'<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select default dateformat
|
||||
*/
|
||||
|
@ -429,6 +429,24 @@ class dbal
|
||||
return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run binary OR operator on DB column.
|
||||
* Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}"
|
||||
*
|
||||
* @param string $column_name The column name to use
|
||||
* @param int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
|
||||
* @param string $compare Any custom SQL code after the check (for example "= 0")
|
||||
*/
|
||||
function sql_bit_or($column_name, $bit, $compare = '')
|
||||
{
|
||||
if (method_exists($this, '_sql_bit_or'))
|
||||
{
|
||||
return $this->_sql_bit_or($column_name, $bit, $compare);
|
||||
}
|
||||
|
||||
return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run more than one insert statement.
|
||||
*
|
||||
|
@ -451,6 +451,11 @@ class dbal_firebird extends dbal
|
||||
return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
function _sql_bit_or($column_name, $bit, $compare = '')
|
||||
{
|
||||
return 'BIN_OR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* return sql error array
|
||||
* @access private
|
||||
|
@ -622,6 +622,11 @@ class dbal_oracle extends dbal
|
||||
return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
function _sql_bit_or($column_name, $bit, $compare = '')
|
||||
{
|
||||
return 'BITOR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* return sql error array
|
||||
* @access private
|
||||
|
@ -3309,4 +3309,24 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a particular flag in a bitfield column of a given table.
|
||||
*
|
||||
* @param string $table_name The table to update
|
||||
* @param string $column_name The column containing a bitfield to update
|
||||
* @param int $flag The binary flag which is OR-ed with the current column value
|
||||
* @param string $sql_more This string is attached to the sql query generated to update the table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '')
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'UPDATE ' . $table_name . '
|
||||
SET ' . $column_name . ' = ' . $db->sql_bit_or($column_name, $flag) . '
|
||||
' . $sql_more;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
?>
|
@ -74,6 +74,7 @@ $lang = array_merge($lang, array(
|
||||
'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.',
|
||||
'ALLOW_QUICK_REPLY' => 'Allow quick reply',
|
||||
'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.',
|
||||
'ALLOW_QUICK_REPLY_BUTTON' => 'Submit and enable quick reply in all forums',
|
||||
'ALLOW_SIG' => 'Allow signatures',
|
||||
'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures',
|
||||
'ALLOW_SIG_FLASH' => 'Allow use of <code>[FLASH]</code> BBCode tag in user signatures',
|
||||
|
Loading…
x
Reference in New Issue
Block a user