aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:05:36 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:05:36 +0100
commit1ceddd9eeccde56ab307631a16e40b943eac883a (patch)
treed1045042f004c0d551658e8192b75965139f3707 /phpBB/includes
parent0e0c8d78199cfa2dd56a62266df33655c93367ff (diff)
parentaadda939732ee163c3babedf4afcd914af12a2cc (diff)
downloadforums-1ceddd9eeccde56ab307631a16e40b943eac883a.tar
forums-1ceddd9eeccde56ab307631a16e40b943eac883a.tar.gz
forums-1ceddd9eeccde56ab307631a16e40b943eac883a.tar.bz2
forums-1ceddd9eeccde56ab307631a16e40b943eac883a.tar.xz
forums-1ceddd9eeccde56ab307631a16e40b943eac883a.zip
Merge commit 'release-3.0-RC3'
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acm/acm_file.php31
-rw-r--r--phpBB/includes/acp/acp_attachments.php2
-rw-r--r--phpBB/includes/acp/acp_bots.php60
-rw-r--r--phpBB/includes/acp/acp_icons.php6
-rw-r--r--phpBB/includes/acp/acp_main.php4
-rw-r--r--phpBB/includes/acp/acp_php_info.php11
-rw-r--r--phpBB/includes/acp/acp_styles.php20
-rw-r--r--phpBB/includes/acp/acp_update.php13
-rw-r--r--phpBB/includes/acp/auth.php2
-rw-r--r--phpBB/includes/db/firebird.php8
-rw-r--r--phpBB/includes/db/oracle.php16
-rw-r--r--phpBB/includes/functions.php6
-rw-r--r--phpBB/includes/functions_convert.php18
-rw-r--r--phpBB/includes/functions_install.php9
-rw-r--r--phpBB/includes/functions_jabber.php27
-rw-r--r--phpBB/includes/functions_messenger.php7
-rw-r--r--phpBB/includes/functions_module.php16
-rw-r--r--phpBB/includes/functions_posting.php56
-rw-r--r--phpBB/includes/functions_profile_fields.php7
-rw-r--r--phpBB/includes/functions_template.php3
-rw-r--r--phpBB/includes/mcp/mcp_ban.php2
-rwxr-xr-xphpBB/includes/mcp/mcp_reports.php22
-rw-r--r--phpBB/includes/message_parser.php7
-rw-r--r--phpBB/includes/session.php63
-rw-r--r--phpBB/includes/ucp/ucp_groups.php6
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php2
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php1
27 files changed, 329 insertions, 96 deletions
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php
index f98873fdbf..63eaa341f5 100644
--- a/phpBB/includes/acm/acm_file.php
+++ b/phpBB/includes/acm/acm_file.php
@@ -79,6 +79,8 @@ class acm
fwrite($fp, "<?php\n\$this->vars = " . var_export($this->vars, true) . ";\n\n\$this->var_expires = " . var_export($this->var_expires, true) . "\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
+
+ @chmod($this->cache_dir . 'data_global.' . $phpEx, 0666);
}
else
{
@@ -119,7 +121,7 @@ class acm
@include($this->cache_dir . $entry);
if ($expired)
{
- @unlink($this->cache_dir . $entry);
+ $this->remove_file($this->cache_dir . $entry);
}
}
closedir($dir);
@@ -181,6 +183,8 @@ class acm
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\n\$data = " . var_export($var, true) . ";\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
+
+ @chmod($this->cache_dir . "data{$var_name}.$phpEx", 0666);
}
}
else
@@ -211,7 +215,7 @@ class acm
continue;
}
- @unlink($this->cache_dir . $entry);
+ $this->remove_file($this->cache_dir . $entry);
}
closedir($dir);
@@ -269,7 +273,7 @@ class acm
if ($found)
{
- @unlink($this->cache_dir . $entry);
+ $this->remove_file($this->cache_dir . $entry);
}
}
closedir($dir);
@@ -284,7 +288,7 @@ class acm
if ($var_name[0] == '_')
{
- @unlink($this->cache_dir . 'data' . $var_name . ".$phpEx");
+ $this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx");
}
else if (isset($this->vars[$var_name]))
{
@@ -347,7 +351,7 @@ class acm
}
else if ($expired)
{
- @unlink($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
+ $this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx");
return false;
}
@@ -365,8 +369,9 @@ class acm
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
+ $filename = $this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx;
- if ($fp = @fopen($this->cache_dir . 'sql_' . md5($query) . '.' . $phpEx, 'wb'))
+ if ($fp = @fopen($filename, 'wb'))
{
@flock($fp, LOCK_EX);
@@ -387,6 +392,8 @@ class acm
@flock($fp, LOCK_UN);
fclose($fp);
+ @chmod($filename, 0666);
+
$query_result = $query_id;
}
}
@@ -454,6 +461,18 @@ class acm
return true;
}
+
+ /**
+ * Removes/unlinks file
+ */
+ function remove_file($filename)
+ {
+ if (!@unlink($filename))
+ {
+ // E_USER_ERROR - not using language entry - intended.
+ trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
+ }
+ }
}
?> \ No newline at end of file
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 1db18f6d5c..a0aaf8d67e 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -78,7 +78,7 @@ class acp_attachments
}
$db->sql_freeresult($result);
- $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . ((sizeof($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']';
+ $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']';
$display_vars = array(
'title' => 'ACP_ATTACHMENT_SETTINGS',
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php
index 3c7fe9f1f3..5bab27d5b2 100644
--- a/phpBB/includes/acp/acp_bots.php
+++ b/phpBB/includes/acp/acp_bots.php
@@ -162,7 +162,32 @@ class acp_bots
{
$error[] = $user->lang['ERR_BOT_AGENT_MATCHES_UA'];
}
+
+ $bot_name = false;
+ if ($bot_id)
+ {
+ $sql = 'SELECT u.username_clean
+ FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u
+ WHERE b.bot_id = $bot_id
+ AND u.user_id = b.user_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ if (!$bot_row)
+ {
+ $error[] = $user->lang['NO_BOT'];
+ }
+ else
+ {
+ $bot_name = $row['username_clean'];
+ }
+ }
+ if (!$this->validate_botname($bot_row['bot_name'], $bot_name))
+ {
+ $error[] = $user->lang['BOT_NAME_TAKEN'];
+ }
+
if (!sizeof($error))
{
// New bot? Create a new user and group entry
@@ -180,6 +205,7 @@ class acp_bots
{
trigger_error($user->lang['NO_BOT_GROUP'] . adm_back_link($this->u_action . "&amp;id=$bot_id&amp;action=$action"), E_USER_WARNING);
}
+
$user_id = user_add(array(
'user_type' => (int) USER_IGNORE,
@@ -193,7 +219,7 @@ class acp_bots
'user_style' => (int) $bot_row['bot_style'],
'user_allow_massemail' => 0,
));
-
+
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => (int) $user_id,
'bot_name' => (string) $bot_row['bot_name'],
@@ -202,7 +228,7 @@ class acp_bots
'bot_ip' => (string) $bot_row['bot_ip'])
);
$db->sql_query($sql);
-
+
$log = 'ADDED';
}
else if ($bot_id)
@@ -249,11 +275,12 @@ class acp_bots
$log = 'UPDATED';
}
-
+
$cache->destroy('_bots');
-
+
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action . "&amp;id=$bot_id&amp;action=$action"));
+
}
}
else if ($bot_id)
@@ -348,6 +375,31 @@ class acp_bots
}
$db->sql_freeresult($result);
}
+
+ function validate_botname($newname, $oldname = false)
+ {
+ global $db;
+ if ($oldname && utf8_clean_string($newname) === $oldname)
+ {
+ return true;
+ }
+ // Admins might want to use names otherwise forbidden, thus we only check for duplicates.
+ $sql = 'SELECT username
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($newname)) . "'";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if ($row)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
}
?> \ No newline at end of file
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 66bc377490..ebf058850f 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -276,14 +276,14 @@ class acp_icons
$image_height = (isset($_POST['height'])) ? request_var('height', array('' => 0)) : array();
$image_add = (isset($_POST['add_img'])) ? request_var('add_img', array('' => 0)) : array();
$image_emotion = request_var('emotion', array('' => ''), true);
- $image_code = request_var('code', array('' => ''));
+ $image_code = request_var('code', array('' => ''), true);
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array();
// Ok, add the relevant bits if we are adding new codes to existing emoticons...
if (!empty($_POST['add_additional_code']))
{
$add_image = request_var('add_image', '');
- $add_code = request_var('add_code', '');
+ $add_code = request_var('add_code', '', true);
$add_emotion = request_var('add_emotion', '', true);
if ($add_image && $add_emotion && $add_code)
@@ -336,7 +336,7 @@ class acp_icons
}
// Image_order holds the 'new' order value
- if (!empty($image_order[$image]))
+ if (!empty($image_order[$image]) && !empty($$image_id[$image]))
{
$img_sql = array_merge($img_sql, array(
$fields . '_order' => $image_order[$image])
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index b944765011..f7205a6b7a 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -270,6 +270,10 @@ class acp_main
global $cache;
$cache->purge();
+
+ // Clear permissions
+ $auth->acl_clear_prefetch();
+
add_log('admin', 'LOG_PURGE_CACHE');
break;
}
diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php
index 342d89addd..d18d64b076 100644
--- a/phpBB/includes/acp/acp_php_info.php
+++ b/phpBB/includes/acp/acp_php_info.php
@@ -49,9 +49,16 @@ class acp_php_info
$output = preg_replace('#<table[^>]+>#i', '<table>', $output);
$output = preg_replace('#<img border="0"#i', '<img', $output);
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
-
+
+ if (empty($output))
+ {
+ trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
+ }
+
+ $orig_output = $output;
+
preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
- $output = $output[1][0];
+ $output = (!empty($output[1][0])) ? $output[1][0] : $orig_output;
$template->assign_var('PHPINFO', $output);
}
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 9f2b3579e8..db5bca1ba6 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -249,8 +249,8 @@ parse_css_file = {PARSE_CSS_FILE}
while ($row = $db->sql_fetchrow($result))
{
- if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime'])
- {
+// if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime'])
+// {
// get folder info from the filename
if (($slash_pos = strrpos($row['template_filename'], '/')) === false)
{
@@ -258,9 +258,9 @@ parse_css_file = {PARSE_CSS_FILE}
}
else
{
- $filelist[substr($row['template_filename'], 0, $slash_pos + 1)] = substr($row['template_filename'], $slash_pos + 1, strlen($row['template_filename']) - $slash_pos - 1);
+ $filelist[substr($row['template_filename'], 0, $slash_pos + 1)][] = substr($row['template_filename'], $slash_pos + 1, strlen($row['template_filename']) - $slash_pos - 1);
}
- }
+// }
}
$db->sql_freeresult($result);
@@ -739,6 +739,8 @@ parse_css_file = {PARSE_CSS_FILE}
// destroy the cached version of the template (filename without extension)
$this->clear_template_cache($template_info, array(substr($template_file, 0, -5)));
+ $cache->destroy('sql', STYLES_TABLE);
+
add_log('admin', 'LOG_TEMPLATE_EDIT', $template_info['template_name'], $template_file);
trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&amp;action=edit&amp;id=$template_id&amp;text_rows=$text_rows&amp;template_file=$template_file"));
}
@@ -779,7 +781,7 @@ parse_css_file = {PARSE_CSS_FILE}
}
else
{
- $filelist[$file_info['dirname'] . '/'][] = "{$file_info['basename']}.{$file_info['extension']}";
+ $filelist[$file_info['dirname'] . '/'][] = $file_info['basename'];
}
}
@@ -2169,6 +2171,14 @@ parse_css_file = {PARSE_CSS_FILE}
$filelist = filelist("{$phpbb_root_path}styles/{$style_row['template_path']}/template", '', 'html');
$this->store_templates('insert', $style_id, $style_row['template_path'], $filelist);
}
+ else
+ {
+ // We no longer store within the db, but are also not able to update the file structure
+ // Since the admin want to switch this, we adhere to his decision. But we also need to remove the cache
+ $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
+ WHERE template_id = $style_id";
+ $db->sql_query($sql);
+ }
$sql_ary += array(
'template_storedb' => $store_db,
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php
index 02d4c6bb3c..03f2db7d15 100644
--- a/phpBB/includes/acp/acp_update.php
+++ b/phpBB/includes/acp/acp_update.php
@@ -42,15 +42,28 @@ class acp_update
$announcement_url = trim($info[1]);
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
+ // Determine automatic update...
+ $sql = 'SELECT config_value
+ FROM ' . CONFIG_TABLE . "
+ WHERE config_name = 'version_update_from'";
+ $result = $db->sql_query($sql);
+ $version_update_from = (string) $db->sql_fetchfield('config_value');
+ $db->sql_freeresult($result);
+
+ $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
+
+ $up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
$up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
$template->assign_vars(array(
'S_UP_TO_DATE' => $up_to_date,
+ 'S_UP_TO_DATE_AUTO' => $up_to_date_automatic,
'S_VERSION_CHECK' => true,
'U_ACTION' => $this->u_action,
'LATEST_VERSION' => $latest_version,
'CURRENT_VERSION' => $config['version'],
+ 'AUTO_VERSION' => $version_update_from,
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
));
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 7d0b00cc25..a7518a287c 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -591,7 +591,7 @@ class auth_admin extends auth
ORDER BY left_id';
$result = $db->sql_query($sql);
- $forum_names = array();
+ $forum_names = array(0 => '');
while ($row = $db->sql_fetchrow($result))
{
$forum_names[$row['forum_id']] = $row['forum_name'];
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index d9200ee182..af8d523ab1 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -118,7 +118,7 @@ class dbal_firebird extends dbal
{
if (strlen($regs[3]) > 32767)
{
- preg_match_all('/\'(?:[^\']++|\'\')*+\'|\\d+/', $regs[3], $vals, PREG_PATTERN_ORDER);
+ preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER);
$inserts = $vals[0];
unset($vals);
@@ -135,13 +135,13 @@ class dbal_firebird extends dbal
$query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')';
}
}
- else if (preg_match('/^(UPDATE ([\\w_]++)\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+))*+)\\s+(WHERE.*)$/s', $query, $data))
+ else if (preg_match('/^(UPDATE ([\\w_]++)\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data))
{
if (strlen($data[3]) > 32767)
{
$update = $data[1];
$where = $data[4];
- preg_match_all('/(\\w++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|\\d++)/', $data[3], $temp, PREG_SET_ORDER);
+ preg_match_all('/(\\w++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[3], $temp, PREG_SET_ORDER);
unset($data);
$cols = array();
@@ -164,7 +164,7 @@ class dbal_firebird extends dbal
}
}
- if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|\d+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|\d+))*+\s+(WHERE.*)$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*WHERE\s*(.*)$/s', $query, $regs)))
+ if (!function_exists('ibase_affected_rows') && (preg_match('/^UPDATE ([\w_]++)\s+SET [\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\s*[\w_]++\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+\s+(WHERE.*)$/s', $query, $regs) || preg_match('/^DELETE FROM ([\w_]++)\s*WHERE\s*(.*)$/s', $query, $regs)))
{
$affected_sql = 'SELECT COUNT(*) as num_rows_affected FROM ' . $regs[1] . ' ' . $regs[2];
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 76a920d4b8..888a9fd4bf 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -115,7 +115,7 @@ class dbal_oracle extends dbal
*/
function _rewrite_where($where_clause)
{
- preg_match_all('/\s*(AND|OR)?\s*([\w_.]++)\s*(?:(=|<>)\s*((?>\'(?>[^\']++|\'\')*+\'|\d+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|\d+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER);
+ preg_match_all('/\s*(AND|OR)?\s*([\w_.]++)\s*(?:(=|<>)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER);
$out = '';
foreach ($result as $val)
{
@@ -143,7 +143,7 @@ class dbal_oracle extends dbal
$in_clause = array();
$sub_exp = substr($val[5], strpos($val[5], '(') + 1, -1);
$extra = false;
- preg_match_all('/\'(?>[^\']++|\'\')*+\'|\d++/', $sub_exp, $sub_vals, PREG_PATTERN_ORDER);
+ preg_match_all('/\'(?>[^\']++|\'\')*+\'|[\d-.]++/', $sub_exp, $sub_vals, PREG_PATTERN_ORDER);
$i = 0;
foreach ($sub_vals[0] as $sub_val)
{
@@ -239,7 +239,7 @@ class dbal_oracle extends dbal
if (strlen($regs[3]) > 4000)
{
$cols = explode(', ', $regs[2]);
- preg_match_all('/\'(?:[^\']++|\'\')*+\'|\\d+/', $regs[3], $vals, PREG_PATTERN_ORDER);
+ preg_match_all('/\'(?:[^\']++|\'\')*+\'|\[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER);
$inserts = $vals[0];
unset($vals);
@@ -256,13 +256,13 @@ class dbal_oracle extends dbal
$query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')';
}
}
- else if (preg_match_all('/^(UPDATE [\\w_]++\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|\\d+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER))
+ else if (preg_match_all('/^(UPDATE [\\w_]++\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER))
{
if (strlen($data[0][2]) > 4000)
{
$update = $data[0][1];
$where = $data[0][3];
- preg_match_all('/([\\w_]++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|\\d++)/', $data[0][2], $temp, PREG_SET_ORDER);
+ preg_match_all('/([\\w_]++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[0][2], $temp, PREG_SET_ORDER);
unset($data);
$cols = array();
@@ -288,7 +288,7 @@ class dbal_oracle extends dbal
switch (substr($query, 0, 6))
{
case 'DELETE':
- if (preg_match('/^(DELETE FROM [\w_]++ WHERE)((?:\s*(?:AND|OR)?\s*[\w_]+\s*(?:(?:=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|\d+)|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|\d+,? ?)*+\)))*+)$/', $query, $regs))
+ if (preg_match('/^(DELETE FROM [\w_]++ WHERE)((?:\s*(?:AND|OR)?\s*[\w_]+\s*(?:(?:=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]+)|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))*+)$/', $query, $regs))
{
$query = $regs[1] . $this->_rewrite_where($regs[2]);
unset($regs);
@@ -296,7 +296,7 @@ class dbal_oracle extends dbal
break;
case 'UPDATE':
- if (preg_match('/^(UPDATE [\\w_]++\\s+SET [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|\\d++|:\w++)(?:, [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|\\d++|:\w++))*+\\s+WHERE)(.*)$/s', $query, $regs))
+ if (preg_match('/^(UPDATE [\\w_]++\\s+SET [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++)(?:, [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++))*+\\s+WHERE)(.*)$/s', $query, $regs))
{
$query = $regs[1] . $this->_rewrite_where($regs[2]);
unset($regs);
@@ -304,7 +304,7 @@ class dbal_oracle extends dbal
break;
case 'SELECT':
- $query = preg_replace_callback('/([\w_.]++)\s*(?:(=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|\d++|([\w_.]++))|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|\d++,? ?)*+\))/', array($this, '_rewrite_col_compare'), $query);
+ $query = preg_replace_callback('/([\w_.]++)\s*(?:(=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]++|([\w_.]++))|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]++,? ?)*+\))/', array($this, '_rewrite_col_compare'), $query);
break;
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a91bddd9b8..caf26bf379 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -472,7 +472,7 @@ if (!function_exists('stripos'))
if (!function_exists('realpath'))
{
- if (substr(PHP_OS, 0, 3) != 'WIN' && !(bool) ini_get('safe_mode') && function_exists('shell_exec') && trim(`realpath .`))
+ if (DIRECTORY_SEPARATOR != '\\' && !(bool) ini_get('safe_mode') && function_exists('shell_exec') && trim(`realpath .`))
{
/**
* @author Chris Smith <chris@project-minerva.org>
@@ -497,7 +497,7 @@ if (!function_exists('realpath'))
*/
function is_absolute($path)
{
- return ($path[0] == '/' || (substr(PHP_OS, 0, 3) == 'WIN' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
+ return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
}
/**
@@ -3608,7 +3608,7 @@ function phpbb_checkdnsrr($host, $type = '')
{
$type = (!$type) ? 'MX' : $type;
- if (strpos(PHP_OS, 'WIN') !== false)
+ if (DIRECTORY_SEPARATOR == '\\')
{
if (!function_exists('exec'))
{
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 414f6f2f20..4037fb4872 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -224,7 +224,13 @@ function make_uid($timestamp)
*/
function validate_website($url)
{
- return ($url == 'http://') ? '' : $url;
+ if ($url === 'http://'){
+ return '';
+ }
+ else if (strpos(strtolower($url), 'http://') !== 0)
+ {
+ return 'http://' . $url;
+ }
}
/**
@@ -2413,4 +2419,14 @@ function get_smiley_display()
return ($smiley_count < 50) ? 1 : 0;
}
+
+function fill_dateformat($user_dateformat)
+{
+ global $config;
+
+ return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat);
+}
+
+
+
?> \ No newline at end of file
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 61ac1883b3..133ef294b0 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -13,14 +13,7 @@
*/
function can_load_dll($dll)
{
- global $suffix;
-
- if (empty($suffix))
- {
- $suffix = (defined('PHP_OS') && strpos(strtolower(PHP_OS), 'win') === 0) ? 'dll' : 'so';
- }
-
- return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && @dl($dll . ".$suffix")) ? true : false;
+ return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false;
}
/**
diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php
index eb2a7245a5..def15c67c7 100644
--- a/phpBB/includes/functions_jabber.php
+++ b/phpBB/includes/functions_jabber.php
@@ -12,7 +12,7 @@
*
* Jabber class from Flyspray project
*
-* @version class.jabber2.php 1244 2007-05-28
+* @version class.jabber2.php 1306 2007-06-21
* @copyright 2006 Flyspray.org
* @author: Florian Schmitz (floele)
*
@@ -31,6 +31,7 @@ class jabber
var $username;
var $password;
var $use_ssl;
+ var $resource = 'functions_jabber.phpbb.php';
var $enable_logging;
var $log_array;
@@ -76,18 +77,32 @@ class jabber
return false;
}
- // Make sure the encryption stream is supported
+ /**
+ * Make sure the encryption stream is supported
+ * Also seem to work without the crypto stream if correctly compiled
+
$streams = stream_get_wrappers();
if (!in_array('streams.crypto', $streams))
{
return false;
}
+ */
return true;
}
/**
+ * Sets the resource which is used. No validation is done here, only escaping.
+ * @param string $name
+ * @access public
+ */
+ function set_resource($name)
+ {
+ $this->resource = $name;
+ }
+
+ /**
* Connect
*/
function connect()
@@ -126,7 +141,7 @@ class jabber
// disconnect gracefully
if (isset($this->session['sent_presence']))
{
- $this->presence('offline', '', true);
+ $this->send_presence('offline', '', true);
}
$this->send('</stream:stream>');
@@ -379,7 +394,7 @@ class jabber
}
// go on with authentication?
- if (isset($this->features['stream:features'][0]['#']['bind']))
+ if (isset($this->features['stream:features'][0]['#']['bind']) || $this->session['tls'])
{
return $this->response($this->features);
}
@@ -394,9 +409,9 @@ class jabber
$this->send("<iq type='set' id='bind_1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
- <resource>functions_jabber.phpbb.php</resource>
+ <resource>" . utf8_htmlspecialchars($this->resource) . '</resource>
</bind>
- </iq>");
+ </iq>');
return $this->response($this->listen());
}
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 26ff1491fb..b2cb5ec054 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -52,7 +52,7 @@ class messenger
$this->addresses['to'][$pos]['email'] = trim($address);
// If empty sendmail_path on windows, PHP changes the to line
- if (!$config['smtp_delivery'] && strpos(strtolower(PHP_OS), 'win') === 0)
+ if (!$config['smtp_delivery'] && DIRECTORY_SEPARATOR == '\\')
{
$this->addresses['to'][$pos]['name'] = '';
}
@@ -556,6 +556,7 @@ class queue
$fp = @fopen($this->cache_file . '.lock', 'wb');
fclose($fp);
+ @chmod($this->cache_file . '.lock', 0666);
include($this->cache_file);
@@ -683,6 +684,8 @@ class queue
fwrite($fp, "<?php\n\$this->queue_data = " . var_export($this->queue_data, true) . ";\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
+
+ @chmod($this->cache_file, 0666);
}
}
@@ -722,6 +725,8 @@ class queue
fwrite($fp, "<?php\n\$this->queue_data = " . var_export($this->data, true) . ";\n?>");
@flock($fp, LOCK_UN);
fclose($fp);
+
+ @chmod($this->cache_file, 0666);
}
}
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index bbb44d4b3d..1010de643b 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -123,6 +123,22 @@ class p_master
// Re-index (this is needed, else we are not able to array_slice later)
$this->module_cache['modules'] = array_merge($this->module_cache['modules']);
+ // Include MOD _info files for populating language entries within the menus
+ if (file_exists($user->lang_path . 'mods'))
+ {
+ $add_files = array();
+
+ foreach (glob($user->lang_path . 'mods/info_' . strtolower($this->p_class) . '_*.' . $phpEx, GLOB_NOSORT) as $file)
+ {
+ $add_files[] = 'mods/' . substr(basename($file), 0, -(strlen($phpEx) + 1));
+ }
+
+ if (sizeof($add_files))
+ {
+ $user->add_lang($add_files);
+ }
+ }
+
// Now build the module array, but exclude completely empty categories...
$right_id = false;
$names = array();
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 282e74fa7c..21b2677483 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -115,11 +115,16 @@ function update_post_information($type, $ids, $return_update_sql = false)
{
global $db;
+ if (empty($ids))
+ {
+ return;
+ }
if (!is_array($ids))
{
$ids = array($ids);
}
+
$update_sql = $empty_forums = $not_empty_forums = array();
if ($type != 'topic')
@@ -1310,6 +1315,29 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_transaction('begin');
+ // we must make sure to update forums that contain the shadow'd topic
+ if ($post_mode == 'delete_topic')
+ {
+ $shadow_forum_ids = array();
+
+ $sql = 'SELECT forum_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_moved_id', $topic_id);
+ $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (!isset($shadow_forum_ids[(int) $row['forum_id']]))
+ {
+ $shadow_forum_ids[(int) $row['forum_id']] = 1;
+ }
+ else
+ {
+ $shadow_forum_ids[(int) $row['forum_id']]++;
+ }
+ }
+ $db->sql_freeresult($result);
+ }
+
if (!delete_posts('post_id', array($post_id), false, false))
{
// Try to delete topic, we may had an previous error causing inconsistency
@@ -1327,6 +1355,15 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
switch ($post_mode)
{
case 'delete_topic':
+
+ foreach ($shadow_forum_ids as $updated_forum => $topic_count)
+ {
+ // counting is fun! we only have to do sizeof($forum_ids) number of queries,
+ // even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
+ $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_topics_real = forum_topics_real - ' . $topic_count . ', forum_topics = forum_topics - ' . $topic_count . ' WHERE forum_id = ' . $updated_forum);
+ update_post_information('forum', $updated_forum);
+ }
+
delete_topics('topic_id', array($topic_id), false);
if ($data['topic_type'] != POST_GLOBAL)
@@ -2005,6 +2042,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// We make a new topic
// We reply to a topic
// We edit the last post in a topic and this post is the latest in the forum (maybe)
+ // We edit the only post in the topic
+ // We edit the first post in the topic and all the other posts are not approved
if (($post_mode == 'post' || $post_mode == 'reply') && $post_approved)
{
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
@@ -2014,9 +2053,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'";
}
- else if ($post_mode == 'edit_last_post')
+ else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
{
- // edit_last_post does not _necessarily_ mean that we must update the info again,
+ // this does not _necessarily_ mean that we must update the info again,
// it just means that we might have to
$sql = 'SELECT forum_last_post_id, forum_last_post_subject
FROM ' . FORUMS_TABLE . '
@@ -2025,7 +2064,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- // this post is the last post in the forum, better update
+ // this post is the latest post in the forum, better update
if ($row['forum_last_post_id'] == $data['post_id'])
{
if ($post_approved && $row['forum_last_post_subject'] !== $subject)
@@ -2065,7 +2104,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
else
{
- // just our luck, the last topic in the forum has just been globalized...
+ // just our luck, the last topic in the forum has just been turned unapproved...
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = 0';
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = ''";
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = 0';
@@ -2164,13 +2203,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $current_time;
}
- else if ($post_mode == 'edit_last_post')
+ else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
{
// only the subject can be changed from edit
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
}
}
- else if (!$data['post_approved'] && $post_mode == 'edit_last_post')
+ else if (!$data['post_approved'] && ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])))
{
// like having the rug pulled from under us
$sql = 'SELECT MAX(post_id) as last_post_id
@@ -2248,7 +2287,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
trigger_error('NO_SUCH_SEARCH_MODULE');
}
- require_once("{$phpbb_root_path}includes/search/$search_type.$phpEx");
+ if (!class_exists($search_type))
+ {
+ include("{$phpbb_root_path}includes/search/$search_type.$phpEx");
+ }
$error = false;
$search = new $search_type($error);
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index 47d3ae03a9..7c5e39c3a7 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -469,8 +469,8 @@ class custom_profile
// case 'datetime':
case 'date':
$date = explode('-', $value);
- $month = (isset($date[0])) ? (int) $date[0] : 0;
- $day = (isset($date[1])) ? (int) $date[1] : 0;
+ $day = (isset($date[0])) ? (int) $date[0] : 0;
+ $month = (isset($date[1])) ? (int) $date[1] : 0;
$year = (isset($date[2])) ? (int) $date[2] : 0;
if (!$day && !$month && !$year)
@@ -479,7 +479,8 @@ class custom_profile
}
else if ($day && $month && $year)
{
- return sprintf('%4d-%02d-%02d', $year, $month, $day);
+ global $user;
+ return $user->format_date(mktime(0, 0, 0, $month, $day, $year), $user->lang['DATE_FORMAT'], true);
}
return $value;
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php
index aacb4c6ddb..0d8a39eaee 100644
--- a/phpBB/includes/functions_template.php
+++ b/phpBB/includes/functions_template.php
@@ -752,8 +752,7 @@ class template_compile
@flock($fp, LOCK_UN);
@fclose($fp);
- @umask(0);
- @chmod($filename, 0644);
+ @chmod($filename, 0666);
}
return;
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php
index c317260a2e..f2ecbdef5b 100644
--- a/phpBB/includes/mcp/mcp_ban.php
+++ b/phpBB/includes/mcp/mcp_ban.php
@@ -37,7 +37,7 @@ class mcp_ban
{
// Grab the list of entries
- $ban = request_var('ban', '');
+ $ban = request_var('ban', '', ($mode === 'user') true ? false);
$ban_len = request_var('banlength', 0);
$ban_len_other = request_var('banlengthother', '');
$ban_exclude = request_var('banexclude', 0);
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index be94521b14..8617cb5ca7 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -451,6 +451,8 @@ function close_report($report_id_list, $mode, $action)
$redirect = request_var('redirect', build_url(array('_f_', 'quickmod')));
}
$success_msg = '';
+ $forum_ids = array();
+ $topic_ids = array();
$s_hidden_fields = build_hidden_fields(array(
'i' => 'reports',
@@ -586,6 +588,13 @@ function close_report($report_id_list, $mode, $action)
$messenger->send($reporter['user_notify_type']);
}
}
+
+ foreach($post_info as $post)
+ {
+ $forum_ids[$post['forum_id']] = $post['forum_id'];
+ $topic_ids[$post['topic_id']] = $post['topic_id'];
+ }
+
unset($notify_reporters, $post_info, $reports);
$messenger->save_queue();
@@ -607,7 +616,18 @@ function close_report($report_id_list, $mode, $action)
else
{
meta_refresh(3, $redirect);
- trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
+ $return_forum = '';
+ if (sizeof($forum_ids == 1))
+ {
+ $return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
+ }
+ $return_topic = '';
+ if (sizeof($topic_ids == 1))
+ {
+ $return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
+ }
+
+ trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
}
}
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 1a70a7fd80..3579467bff 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1229,7 +1229,7 @@ class parse_message extends bbcode_firstpass
while ($row = $db->sql_fetchrow($result))
{
// (assertion)
- $match[] = '#(?<=^|[\n .])' . preg_quote($row['code'], '#') . '(?![^<>]*>)#';
+ $match[] = '(?<=^|[\n .])' . preg_quote($row['code'], '#') . '(?![^<>]*>)';
$replace[] = '<!-- s' . $row['code'] . ' --><img src="{SMILIES_PATH}/' . $row['smiley_url'] . '" alt="' . $row['code'] . '" title="' . $row['emotion'] . '" /><!-- s' . $row['code'] . ' -->';
}
$db->sql_freeresult($result);
@@ -1239,7 +1239,7 @@ class parse_message extends bbcode_firstpass
{
if ($max_smilies)
{
- $num_matches = preg_match_all('#' . str_replace('#', '', implode('|', $match)) . '#', $this->message, $matches);
+ $num_matches = preg_match_all('#' . implode('|', $match) . '#', $this->message, $matches);
unset($matches);
if ($num_matches !== false && $num_matches > $max_smilies)
@@ -1249,7 +1249,8 @@ class parse_message extends bbcode_firstpass
}
}
- $this->message = trim(preg_replace($match, $replace, $this->message));
+ // Make sure the delimiter # is added in front and at the end of every element within $match
+ $this->message = trim(preg_replace(explode(chr(0), '#' . implode('#' . chr(0) . '#', $match) . '#'), $replace, $this->message));
}
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index c297a961a8..495fdcee48 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -43,6 +43,7 @@ class session
if (!$script_name)
{
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
+ $script_name = (($pos = strpos($script_name, '?')) !== false) ? substr($script_name, 0, strpos($script_name, '?')) : $script_name;
$page_array['failover'] = 1;
}
@@ -884,13 +885,13 @@ class session
{
if (!is_array($user_ips))
{
- $ip_banned = preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ips);
+ $ip_banned = preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ips);
}
else
{
foreach ($user_ips as $user_ip)
{
- if (preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ip))
+ if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ip))
{
$ip_banned = true;
break;
@@ -901,7 +902,7 @@ class session
if ((!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) ||
$ip_banned ||
- (!empty($row['ban_email']) && preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#i', $user_email)))
+ (!empty($row['ban_email']) && preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_email'], '#')) . '$#i', $user_email)))
{
if (!empty($row['ban_exclude']))
{
@@ -917,7 +918,7 @@ class session
{
$ban_triggered_by = 'user';
}
- else if (!empty($row['ban_ip']) && preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ips))
+ else if (!empty($row['ban_ip']) && preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ips))
{
$ban_triggered_by = 'ip';
}
@@ -1510,29 +1511,32 @@ class user extends session
}
}
- // Make sure the user is able to hide his session
- if (!$this->data['session_viewonline'])
+ if (isset($this->data['session_viewonline']))
{
- // Reset online status if not allowed to hide the session...
- if (!$auth->acl_get('u_hideonline'))
+ // Make sure the user is able to hide his session
+ if (!$this->data['session_viewonline'])
{
- $sql = 'UPDATE ' . SESSIONS_TABLE . '
- SET session_viewonline = 1
- WHERE session_user_id = ' . $this->data['user_id'];
- $db->sql_query($sql);
- $this->data['session_viewonline'] = 1;
+ // Reset online status if not allowed to hide the session...
+ if (!$auth->acl_get('u_hideonline'))
+ {
+ $sql = 'UPDATE ' . SESSIONS_TABLE . '
+ SET session_viewonline = 1
+ WHERE session_user_id = ' . $this->data['user_id'];
+ $db->sql_query($sql);
+ $this->data['session_viewonline'] = 1;
+ }
}
- }
- else if (!$this->data['user_allow_viewonline'])
- {
- // the user wants to hide and is allowed to -> cloaking device on.
- if ($auth->acl_get('u_hideonline'))
+ else if (!$this->data['user_allow_viewonline'])
{
- $sql = 'UPDATE ' . SESSIONS_TABLE . '
- SET session_viewonline = 0
- WHERE session_user_id = ' . $this->data['user_id'];
- $db->sql_query($sql);
- $this->data['session_viewonline'] = 0;
+ // the user wants to hide and is allowed to -> cloaking device on.
+ if ($auth->acl_get('u_hideonline'))
+ {
+ $sql = 'UPDATE ' . SESSIONS_TABLE . '
+ SET session_viewonline = 0
+ WHERE session_user_id = ' . $this->data['user_id'];
+ $db->sql_query($sql);
+ $this->data['session_viewonline'] = 0;
+ }
}
}
@@ -1624,9 +1628,18 @@ class user extends session
// - add appropriate variables here, name them as they are used within the language file...
if (!$use_db)
{
- if ((include($this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx")) === false)
+ if ($use_help && strpos($lang_file, '/') !== false)
+ {
+ $language_filename = $this->lang_path . substr($lang_file, 0, stripos($lang_file, '/') + 1) . 'help_' . substr($lang_file, stripos($lang_file, '/') + 1) . '.' . $phpEx;
+ }
+ else
+ {
+ $language_filename = $this->lang_path . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx;
+ }
+
+ if ((include($language_filename)) === false)
{
- trigger_error("Language file {$this->lang_path}" . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx couldn't be opened.", E_USER_ERROR);
+ trigger_error("Language file $language_filename couldn't be opened.", E_USER_ERROR);
}
}
else if ($use_db)
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index d926801b2f..d517ca2d1b 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -812,7 +812,7 @@ class ucp_groups
$user->add_lang('acp/groups');
// Approve, demote or promote
- group_user_attributes('approve', $group_id, $mark_ary, false, ($group_id) ? $group_row['group_name'] : false);
+ group_user_attributes('approve', $group_id, $mark_ary, false, false);
trigger_error($user->lang['USERS_APPROVED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
@@ -836,6 +836,8 @@ class ucp_groups
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}
+ $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
+
if (confirm_box(true))
{
if (!sizeof($mark_ary))
@@ -910,6 +912,8 @@ class ucp_groups
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}
+ $group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
+
if (confirm_box(true))
{
if (!$group_id)
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 105dda1d8c..e296ad12b1 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -345,6 +345,8 @@ function compose_pm($id, $mode, $action)
// "{$phpbb_root_path}ucp.$phpEx?i=pm&amp;mode=compose"
confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields));
}
+
+ redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=view&amp;action=view_message&amp;p=' . $msg_id));
}
// Handle User/Group adding/removing
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 8a10254a6e..b0e8f098c2 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -123,6 +123,7 @@ class ucp_prefs
'S_DST' => $data['dst'],
'DATE_FORMAT' => $data['dateformat'],
+ 'A_DATE_FORMAT' => addslashes($data['dateformat']),
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
'S_CUSTOM_DATEFORMAT' => $s_custom,
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],