aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:09:11 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:09:11 +0100
commit35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40 (patch)
tree098e3b3e043f6c3e31c9c922287f76e5ec726e03 /phpBB/includes
parent3b46681652ad0c235ccdcafc449c3d759335df17 (diff)
parent05b5dc316779f67641e17859d5c69f296b24288d (diff)
downloadforums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.gz
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.bz2
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.xz
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.zip
Merge commit 'release-3.0.7-RC2'
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php206
-rw-r--r--phpBB/includes/acp/acp_board.php25
-rw-r--r--phpBB/includes/acp/acp_icons.php5
-rw-r--r--phpBB/includes/acp/acp_language.php5
-rw-r--r--phpBB/includes/bbcode.php4
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php4
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/db/dbal.php18
-rw-r--r--phpBB/includes/db/firebird.php5
-rw-r--r--phpBB/includes/db/oracle.php5
-rw-r--r--phpBB/includes/functions.php6
-rw-r--r--phpBB/includes/functions_admin.php35
-rw-r--r--phpBB/includes/functions_convert.php22
-rw-r--r--phpBB/includes/functions_posting.php2
14 files changed, 228 insertions, 116 deletions
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index b827d1107e..ab042f15bf 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -33,7 +33,7 @@ class acp_bbcodes
// Set up general vars
$action = request_var('action', '');
$bbcode_id = request_var('bbcode', 0);
-
+
$this->tpl_name = 'acp_bbcodes';
$this->page_title = 'ACP_BBCODES';
$form_key = 'acp_bbcodes';
@@ -123,122 +123,138 @@ class acp_bbcodes
case 'modify':
case 'create':
+
+ $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl);
+ if (!$warn_text || confirm_box(true))
+ {
+ $data = $this->build_regexp($bbcode_match, $bbcode_tpl);
- $data = $this->build_regexp($bbcode_match, $bbcode_tpl);
-
- // Make sure the user didn't pick a "bad" name for the BBCode tag.
- $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash=');
+ // Make sure the user didn't pick a "bad" name for the BBCode tag.
+ $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash=');
- if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create'))
- {
- $sql = 'SELECT 1 as test
- FROM ' . BBCODES_TABLE . "
- WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'";
- $result = $db->sql_query($sql);
- $info = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // Grab the end, interrogate the last closing tag
- if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)))
+ if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create'))
{
- trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $sql = 'SELECT 1 as test
+ FROM ' . BBCODES_TABLE . "
+ WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'";
+ $result = $db->sql_query($sql);
+ $info = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // Grab the end, interrogate the last closing tag
+ if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)))
+ {
+ trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
}
- }
- if (substr($data['bbcode_tag'], -1) === '=')
- {
- $test = substr($data['bbcode_tag'], 0, -1);
- }
- else
- {
- $test = $data['bbcode_tag'];
- }
-
- if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match))
- {
- trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+ if (substr($data['bbcode_tag'], -1) === '=')
+ {
+ $test = substr($data['bbcode_tag'], 0, -1);
+ }
+ else
+ {
+ $test = $data['bbcode_tag'];
+ }
- if (strlen($data['bbcode_tag']) > 16)
- {
- trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+ if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match))
+ {
+ trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
- if (strlen($bbcode_match) > 4000)
- {
- trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
-
- if (strlen($bbcode_helpline) > 255)
- {
- trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+ if (strlen($data['bbcode_tag']) > 16)
+ {
+ trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
- $sql_ary = array(
- 'bbcode_tag' => $data['bbcode_tag'],
- 'bbcode_match' => $bbcode_match,
- 'bbcode_tpl' => $bbcode_tpl,
- 'display_on_posting' => $display_on_posting,
- 'bbcode_helpline' => $bbcode_helpline,
- 'first_pass_match' => $data['first_pass_match'],
- 'first_pass_replace' => $data['first_pass_replace'],
- 'second_pass_match' => $data['second_pass_match'],
- 'second_pass_replace' => $data['second_pass_replace']
- );
+ if (strlen($bbcode_match) > 4000)
+ {
+ trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+
+ if (strlen($bbcode_helpline) > 255)
+ {
+ trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
- if ($action == 'create')
- {
- $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
- FROM ' . BBCODES_TABLE;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $sql_ary = array(
+ 'bbcode_tag' => $data['bbcode_tag'],
+ 'bbcode_match' => $bbcode_match,
+ 'bbcode_tpl' => $bbcode_tpl,
+ 'display_on_posting' => $display_on_posting,
+ 'bbcode_helpline' => $bbcode_helpline,
+ 'first_pass_match' => $data['first_pass_match'],
+ 'first_pass_replace' => $data['first_pass_replace'],
+ 'second_pass_match' => $data['second_pass_match'],
+ 'second_pass_replace' => $data['second_pass_replace']
+ );
- if ($row)
+ if ($action == 'create')
{
- $bbcode_id = $row['max_bbcode_id'] + 1;
+ $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
+ FROM ' . BBCODES_TABLE;
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- // Make sure it is greater than the core bbcode ids...
- if ($bbcode_id <= NUM_CORE_BBCODES)
+ if ($row)
+ {
+ $bbcode_id = $row['max_bbcode_id'] + 1;
+
+ // Make sure it is greater than the core bbcode ids...
+ if ($bbcode_id <= NUM_CORE_BBCODES)
+ {
+ $bbcode_id = NUM_CORE_BBCODES + 1;
+ }
+ }
+ else
{
$bbcode_id = NUM_CORE_BBCODES + 1;
}
+
+ if ($bbcode_id > 1511)
+ {
+ trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $sql_ary['bbcode_id'] = (int) $bbcode_id;
+
+ $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
+ $cache->destroy('sql', BBCODES_TABLE);
+
+ $lang = 'BBCODE_ADDED';
+ $log_action = 'LOG_BBCODE_ADD';
}
else
{
- $bbcode_id = NUM_CORE_BBCODES + 1;
- }
+ $sql = 'UPDATE ' . BBCODES_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE bbcode_id = ' . $bbcode_id;
+ $db->sql_query($sql);
+ $cache->destroy('sql', BBCODES_TABLE);
- if ($bbcode_id > 1511)
- {
- trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $lang = 'BBCODE_EDITED';
+ $log_action = 'LOG_BBCODE_EDIT';
}
- $sql_ary['bbcode_id'] = (int) $bbcode_id;
-
- $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
- $cache->destroy('sql', BBCODES_TABLE);
+ add_log('admin', $log_action, $data['bbcode_tag']);
- $lang = 'BBCODE_ADDED';
- $log_action = 'LOG_BBCODE_ADD';
+ trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
}
else
- {
- $sql = 'UPDATE ' . BBCODES_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE bbcode_id = ' . $bbcode_id;
- $db->sql_query($sql);
- $cache->destroy('sql', BBCODES_TABLE);
-
- $lang = 'BBCODE_EDITED';
- $log_action = 'LOG_BBCODE_EDIT';
+ {
+ confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array(
+ 'action' => $action,
+ 'bbcode' => $bbcode_id,
+ 'bbcode_match' => $bbcode_match,
+ 'bbcode_tpl' => htmlspecialchars($bbcode_tpl),
+ 'bbcode_helpline' => $bbcode_helpline,
+ 'display_on_posting' => $display_on_posting,
+ ))
+ , 'confirm_bbcode.html');
}
- add_log('admin', $log_action, $data['bbcode_tag']);
-
- trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
-
break;
case 'delete':
@@ -299,6 +315,7 @@ class acp_bbcodes
{
$bbcode_match = trim($bbcode_match);
$bbcode_tpl = trim($bbcode_tpl);
+ $utf8 = strpos($bbcode_match, 'INTTEXT') !== false;
$fp_match = preg_quote($bbcode_match, '!');
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
@@ -326,6 +343,9 @@ class acp_bbcodes
'SIMPLETEXT' => array(
'!([a-zA-Z0-9-+.,_ ]+)!' => "$1"
),
+ 'INTTEXT' => array(
+ '!([\p{L}\p{N}+-,_.\s]+)!u' => "$1"
+ ),
'IDENTIFIER' => array(
'!([a-zA-Z0-9-_]+)!' => "$1"
),
@@ -343,6 +363,7 @@ class acp_bbcodes
'EMAIL' => '(' . get_preg_expression('email') . ')',
'TEXT' => '(.*?)',
'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
+ 'INTTEXT' => '([\p{L}\p{N}+-,_.\s]+)',
'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
'NUMBER' => '([0-9]+)',
@@ -350,7 +371,8 @@ class acp_bbcodes
$pad = 0;
$modifiers = 'i';
-
+ $modifiers .= ($utf8) ? 'u' : '';
+
if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
{
foreach ($m[0] as $n => $token)
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 20a63e646e..a5feac1902 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -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),
@@ -173,7 +173,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),
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', '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' => 'POSTING',
'bump_type' => false,
@@ -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));
+ }
}
}
@@ -859,6 +864,20 @@ class acp_board
}
/**
+ * 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
*/
function dateformat_select($value, $key)
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index e1deb7e533..3d64a2acda 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -941,11 +941,12 @@ class acp_icons
{
global $db;
- $sql = "SELECT COUNT(*) AS count
+ $sql = "SELECT COUNT(*) AS item_count
FROM $table";
$result = $db->sql_query($sql);
- $item_count = (int) $db->sql_fetchfield('count');
+ $item_count = (int) $db->sql_fetchfield('item_count');
$db->sql_freeresult($result);
+
return $item_count;
}
}
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 8ca45a27f6..fedae6fe67 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -1120,6 +1120,11 @@ class acp_language
{
while (($file = readdir($dp)) !== false)
{
+ if (!is_dir($phpbb_root_path . 'language/' . $file))
+ {
+ continue;
+ }
+
if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
{
if (!in_array($file, $installed))
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index f58852c00b..d77bb3c4a7 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -137,7 +137,7 @@ class bbcode
if (!@file_exists($this->template_filename))
{
- if (isset($template->orig_tpl_inherits_id) && $template->orig_tpl_inherits_id)
+ if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
{
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html';
if (!@file_exists($this->template_filename))
@@ -360,7 +360,7 @@ class bbcode
// In order to use templates with custom bbcodes we need
// to replace all {VARS} to corresponding backreferences
// Note that backreferences are numbered from bbcode_match
- if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m))
+ if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|INTTEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m))
{
foreach ($m[0] as $i => $tok)
{
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index ef4d8e9fac..49a64b9339 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -137,14 +137,14 @@ class phpbb_captcha_qa
return false;
}
- $sql = 'SELECT COUNT(question_id) as count
+ $sql = 'SELECT COUNT(question_id) AS question_count
FROM ' . CAPTCHA_QUESTIONS_TABLE . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- return ((bool) $row['count']);
+ return ((bool) $row['question_count']);
}
/**
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index c592e7ef57..0157fbd422 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
*/
// phpBB Version
-define('PHPBB_VERSION', '3.0.7-RC1');
+define('PHPBB_VERSION', '3.0.7-RC2');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index a962696bb8..eeddf1f41b 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -430,6 +430,24 @@ class dbal
}
/**
+ * 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.
*
* @param string $table table name to run the statements on
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index fb1ef44c55..e554b0f2fb 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -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
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 63cdb7126d..55b3599800 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -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
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 823c71dbf0..4b73aa4af9 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -556,11 +556,11 @@ function _hash_crypt_private($password, $setting, &$itoa64)
*
* @param string $email Email address
*
-* @return string Big Integer
+* @return string Unsigned Big Integer
*/
function phpbb_email_hash($email)
{
- return crc32(strtolower($email)) . strlen($email);
+ return sprintf('%u', crc32(strtolower($email))) . strlen($email);
}
/**
@@ -3531,7 +3531,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
}
}
- if (defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT'))
+ if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db))
{
// let's avoid loops
$db->sql_return_on_error(true);
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index a1bc2e7795..c033684ae1 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -102,7 +102,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
{
$disabled = true;
}
- else if (!$only_acl_post && !$auth->acl_gets(array('a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id']))
+ else if (!$only_acl_post && !$auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id']))
{
$disabled = true;
}
@@ -913,7 +913,13 @@ function delete_attachments($mode, $ids, $resync = true)
{
global $db, $config;
- if (is_array($ids) && sizeof($ids))
+ // 0 is as bad as an empty array
+ if (empty($ids))
+ {
+ return false;
+ }
+
+ if (is_array($ids))
{
$ids = array_unique($ids);
$ids = array_map('intval', $ids);
@@ -923,11 +929,6 @@ function delete_attachments($mode, $ids, $resync = true)
$ids = array((int) $ids);
}
- if (!sizeof($ids))
- {
- return false;
- }
-
$sql_where = '';
switch ($mode)
@@ -3308,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);
+}
+
?> \ No newline at end of file
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 82ec114c09..048212bcfe 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -205,10 +205,12 @@ function get_group_id($group_name)
/**
* Generate the email hash stored in the users table
+*
+* Note: Deprecated, calls should directly go to phpbb_email_hash()
*/
function gen_email_hash($email)
{
- return (crc32(strtolower($email)) . strlen($email));
+ return phpbb_email_hash($email);
}
/**
@@ -1232,6 +1234,11 @@ function get_config()
$convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__);
}
+ if (isset($convert->config_schema['array_name']))
+ {
+ unset($convert->config_schema['array_name']);
+ }
+
$convert_config = extract_variables_from_file($filename);
if (!empty($convert->config_schema['array_name']))
{
@@ -1264,6 +1271,7 @@ function restore_config($schema)
global $db, $config;
$convert_config = get_config();
+
foreach ($schema['settings'] as $config_name => $src)
{
if (preg_match('/(.*)\((.*)\)/', $src, $m))
@@ -1274,8 +1282,16 @@ function restore_config($schema)
}
else
{
- $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : '';
- }
+ if ($schema['table_format'] != 'file' || empty($schema['array_name']))
+ {
+ $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : '';
+ }
+ else if (!empty($schema['array_name']))
+ {
+ $src_ary = $schema['array_name'];
+ $config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : '';
+ }
+ }
if ($config_value !== '')
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 0a31ea49a8..49ea382411 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -46,7 +46,7 @@ function generate_smilies($mode, $forum_id)
page_header($user->lang['SMILIES']);
- $sql = 'SELECT COUNT(smiley_id) AS count
+ $sql = 'SELECT COUNT(smiley_id) AS item_count
FROM ' . SMILIES_TABLE . '
GROUP BY smiley_url';
$result = $db->sql_query($sql, 3600);