aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_forums.php39
-rw-r--r--phpBB/includes/acp/acp_language.php81
-rw-r--r--phpBB/includes/acp/acp_permissions.php5
-rw-r--r--phpBB/includes/acp/acp_profile.php2
-rw-r--r--phpBB/includes/acp/acp_users.php33
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_admin.php5
-rw-r--r--phpBB/includes/functions_messenger.php5
-rw-r--r--phpBB/includes/functions_privmsgs.php5
-rw-r--r--phpBB/includes/functions_user.php25
-rw-r--r--phpBB/includes/mcp/mcp_post.php2
-rw-r--r--phpBB/includes/message_parser.php49
-rw-r--r--phpBB/includes/session.php70
-rw-r--r--phpBB/includes/ucp/ucp_groups.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm.php2
16 files changed, 252 insertions, 79 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index cb27314f74..af5dcc6acc 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -363,7 +363,7 @@ class acp_board
}
$this->new_config = $config;
- $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config;
+ $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : $this->new_config;
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 75395d4b81..257ad8e333 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -293,7 +293,7 @@ class acp_forums
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
}
- $sql = 'SELECT forum_name
+ $sql = 'SELECT forum_name, forum_type
FROM ' . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
@@ -1377,6 +1377,43 @@ class acp_forums
$db->sql_transaction('commit');
+ // Make sure the overall post/topic count is correct...
+ $sql = 'SELECT COUNT(post_id) AS stat
+ FROM ' . POSTS_TABLE . '
+ WHERE post_approved = 1';
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ set_config('num_posts', (int) $row['stat'], true);
+
+ $sql = 'SELECT COUNT(topic_id) AS stat
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_approved = 1';
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ set_config('num_topics', (int) $row['stat'], true);
+
+ $sql = 'SELECT COUNT(attach_id) as stat
+ FROM ' . ATTACHMENTS_TABLE;
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ set_config('num_files', (int) $row['stat'], true);
+
+ $sql = 'SELECT SUM(filesize) as stat
+ FROM ' . ATTACHMENTS_TABLE;
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ set_config('upload_dir_size', (int) $row['stat'], true);
+
+ add_log('admin', 'LOG_RESYNC_STATS');
+
return array();
}
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 668422a90b..9c32aa74db 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -211,7 +211,6 @@ class acp_language
{
// Email Template
$entry = (STRIP) ? stripslashes($_POST['entry']) : $_POST['entry'];
- $entry = preg_replace('#&(\#[0-9]+;)#', '&\1', $entry);
fwrite($fp, $entry);
}
else
@@ -237,15 +236,14 @@ class acp_language
foreach ($value as $_key => $_value)
{
$_value = (STRIP) ? stripslashes($_value) : $_value;
- $_value = preg_replace('#&(\#[0-9]+;)#', '&\1', $_value);
$entry .= "\t\t" . (int) $_key . "\t=> '" . str_replace("'", "\\'", $_value) . "',\n";
}
-
+
$entry .= "\t),\n";
}
-
+
fwrite($fp, $entry);
- }
+ }
}
else
{
@@ -258,7 +256,6 @@ class acp_language
if (!is_array($value))
{
$value = (STRIP) ? stripslashes($value) : $value;
- $value = preg_replace('#&(\#[0-9]+;)#', '&\1', $value);
$entry = "\t'" . $key . "'\t=> '" . str_replace("'", "\\'", $value) . "',\n";
}
else
@@ -267,9 +264,23 @@ class acp_language
foreach ($value as $_key => $_value)
{
- $_value = (STRIP) ? stripslashes($_value) : $_value;
- $_value = preg_replace('#&(\#[0-9]+;)#', '&\1', $_value);
- $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n";
+ if (!is_array($_value))
+ {
+ $_value = (STRIP) ? stripslashes($_value) : $_value;
+ $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n";
+ }
+ else
+ {
+ $entry .= "\n\t\t'" . $_key . "'\t=> array(\n";
+
+ foreach ($_value as $__key => $__value)
+ {
+ $__value = (STRIP) ? stripslashes($__value) : $__value;
+ $entry .= "\t\t\t'" . $__key . "'\t=> '" . str_replace("'", "\\'", $__value) . "',\n";
+ }
+
+ $entry .= "\t\t),\n\n";
+ }
}
$entry .= "\t),\n\n";
@@ -1041,22 +1052,52 @@ $lang = array_merge($lang, array(
foreach ($value as $_key => $_value)
{
- $tpl .= '
- <tr>
- <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $_key . '</b></td>
- <td class="row2">';
-
- if ($input_field)
+ if (is_array($_value))
{
- $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . ']" value="' . htmlspecialchars($_value) . '" size="50" />';
+ $tpl .= '
+ <tr>
+ <td class="row3" colspan="2">' . $key_prefix . '&nbsp; &nbsp;<b>' . $_key . '</b></td>
+ </tr>';
+
+ foreach ($_value as $__key => $__value)
+ {
+ $tpl .= '
+ <tr>
+ <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $__key . '</b></td>
+ <td class="row2">';
+
+ if ($input_field)
+ {
+ $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . '][' . $__key . ']" value="' . htmlspecialchars($__value) . '" size="50" />';
+ }
+ else
+ {
+ $tpl .= '<b>' . htmlspecialchars($__value) . '</b>';
+ }
+
+ $tpl .= '</td>
+ </tr>';
+ }
}
else
{
- $tpl .= '<b>' . htmlspecialchars($_value) . '</b>';
+ $tpl .= '
+ <tr>
+ <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $_key . '</b></td>
+ <td class="row2">';
+
+ if ($input_field)
+ {
+ $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . ']" value="' . htmlspecialchars($_value) . '" size="50" />';
+ }
+ else
+ {
+ $tpl .= '<b>' . htmlspecialchars($_value) . '</b>';
+ }
+
+ $tpl .= '</td>
+ </tr>';
}
-
- $tpl .= '</td>
- </tr>';
}
$tpl .= '
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index 5505794999..04766eccab 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -213,7 +213,10 @@ class acp_permissions
switch ($action)
{
case 'delete':
- $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id);
+ if (sizeof($user_id) || sizeof($group_id))
+ {
+ $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id);
+ }
break;
case 'apply_permissions':
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 7299192773..738eda5101 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -536,7 +536,7 @@ class acp_profile
if ($cp->vars['lang_name'] == '')
{
- $error[] = $user->lang['EMPTY_USER_FIELD_IDENT'];
+ $error[] = $user->lang['EMPTY_USER_FIELD_NAME'];
}
if ($field_type == FIELD_BOOL || $field_type == FIELD_DROPDOWN)
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index a30078d7bf..6875d19178 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -133,7 +133,7 @@ class acp_users
// Prevent normal users/admins change/view founders if they are not a founder by themselves
if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER)
{
- trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action));
+ trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
}
switch ($mode)
@@ -657,9 +657,34 @@ class acp_users
$sql_ary['user_warnings'] = $data['warnings'];
}
- if (($user_row['user_type'] == USER_FOUNDER && !$data['user_founder']) || ($user_row['user_type'] != USER_FOUNDER && $data['user_founder']))
+ // Only allow founders updating the founder status...
+ if ($user->data['user_type'] == USER_FOUNDER)
{
- $sql_ary['user_type'] = ($data['user_founder']) ? USER_FOUNDER : USER_NORMAL;
+ // Setting a normal member to be a founder
+ if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER)
+ {
+ $sql_ary['user_type'] = USER_FOUNDER;
+ }
+ else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER)
+ {
+ // Check if at least one founder is present
+ $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . '
+ WHERE user_type = ' . USER_FOUNDER . '
+ AND user_id <> ' . $user_id;
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if ($row)
+ {
+ $sql_ary['user_type'] = USER_NORMAL;
+ }
+ else
+ {
+ trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
+ }
+ }
}
}
@@ -1252,7 +1277,7 @@ class acp_users
'S_LANG_OPTIONS' => language_select($lang),
'S_STYLE_OPTIONS' => style_select($style),
- 'S_TZ_OPTIONS' => tz_select($tz),
+ 'S_TZ_OPTIONS' => tz_select($tz, true),
)
);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 9115ac2b6a..1c631469cb 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2658,7 +2658,7 @@ function page_header($page_title = '', $display_online_list = true)
{
header('Content-type: text/html; charset=' . $user->lang['ENCODING']);
}
- header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0');
+ header('Cache-Control: private, no-cache="set-cookie"');
header('Expires: 0');
header('Pragma: no-cache');
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index a7935965cf..b1aae21a00 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1360,6 +1360,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
}
$db->sql_freeresult($result);
+ if (!sizeof($forum_ids))
+ {
+ break;
+ }
+
// 2: Get topic counts for each forum
$sql = 'SELECT forum_id, topic_approved, COUNT(topic_id) AS forum_topics
FROM ' . TOPICS_TABLE . '
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 5bd9b0ab41..20101f1750 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -808,8 +808,11 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $encoding, $headers
$smtp = new smtp_class;
+ $errno = 0;
+ $errstr = '';
+
// Ok we have error checked as much as we can to this point let's get on it already.
- if (!$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20))
+ if (!$smtp->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20))
{
$err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr";
return false;
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index b5afbf436e..86c573e7c6 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1479,6 +1479,11 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]);
+ if (!sizeof($recipients))
+ {
+ return;
+ }
+
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . '
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 0eab7d8a6f..1b4dc37cd2 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -37,6 +37,8 @@ function user_get_id_name(&$user_id_ary, &$username_ary)
$sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', $$which_ary) : preg_replace('#^\s*(.*)\s*$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", $$which_ary);
unset($$which_ary);
+ $user_id_ary = $username_ary = array();
+
// Grab the user id/username records
$sql_where = ($which_ary == 'user_id_ary') ? 'user_id' : 'username';
$sql = 'SELECT user_id, username
@@ -50,7 +52,6 @@ function user_get_id_name(&$user_id_ary, &$username_ary)
return 'NO_USERS';
}
- $user_id_ary = $username_ary = array();
do
{
$username_ary[$row['user_id']] = $row['username'];
@@ -234,6 +235,9 @@ function user_add($user_row, $cp_data = false)
$db->sql_transaction('commit');
+ // Now make it the users default group...
+ group_set_user_default($user_row['group_id'], array($user_id));
+
return $user_id;
}
@@ -1092,7 +1096,7 @@ function validate_email($email)
return 'EMAIL_INVALID';
}
- if ($user->check_ban('', '', $email, true) == true)
+ if ($user->check_ban(false, false, $email, true) == true)
{
return 'EMAIL_BANNED';
}
@@ -1513,6 +1517,9 @@ function group_delete($group_id, $group_name = false)
WHERE group_id = $group_id";
$db->sql_query($sql);
+ // Re-cache moderators
+ cache_moderators();
+
add_log('admin', 'LOG_GROUP_DELETE', $group_name);
return 'GROUP_DELETED';
@@ -1526,9 +1533,9 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
global $db, $auth;
// We need both username and user_id info
- user_get_id_name($user_id_ary, $username_ary);
+ $result = user_get_id_name($user_id_ary, $username_ary);
- if (!sizeof($user_id_ary))
+ if (!sizeof($user_id_ary) || $result !== false)
{
return 'NO_USER';
}
@@ -1629,9 +1636,9 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
$group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS');
// We need both username and user_id info
- user_get_id_name($user_id_ary, $username_ary);
+ $result = user_get_id_name($user_id_ary, $username_ary);
- if (!sizeof($user_id_ary))
+ if (!sizeof($user_id_ary) || $result !== false)
{
return 'NO_USER';
}
@@ -1762,9 +1769,9 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
global $db, $auth, $phpbb_root_path, $phpEx, $config;
// We need both username and user_id info
- user_get_id_name($user_id_ary, $username_ary);
+ $result = user_get_id_name($user_id_ary, $username_ary);
- if (!sizeof($user_id_ary))
+ if (!sizeof($user_id_ary) || $result !== false)
{
return false;
}
@@ -1869,7 +1876,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
{
global $db;
- if (!$user_id_ary)
+ if (empty($user_id_ary))
{
return;
}
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index f9e0494fc8..05ffde7ca5 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -334,7 +334,7 @@ function change_poster(&$post_info, $userdata)
$db->sql_query($sql);
// Resync topic/forum if needed
- if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id)
+ if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id)
{
sync('topic', 'topic_id', $post_info['topic_id'], false, false);
sync('forum', 'forum_id', $post_info['forum_id'], false, false);
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index a4d003c3a2..d74a58524f 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -79,6 +79,23 @@ class bbcode_firstpass extends bbcode
}
/**
+ * Prepare some bbcodes for better parsing
+ */
+ function prepare_bbcodes()
+ {
+ // Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.)
+ if (strpos($this->message, '[quote') !== false)
+ {
+ $in = str_replace("\r\n", "\n", $this->message);
+
+ $this->message = preg_replace(array('#\[quote(=&quot;.*?&quot;)?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $this->message);
+ $this->message = preg_replace(array('#\[quote(=&quot;.*?&quot;)?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $this->message);
+ }
+
+ // Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...)
+ }
+
+ /**
* Init bbcode data for later parsing
*/
function bbcode_init()
@@ -565,12 +582,6 @@ class bbcode_firstpass extends bbcode
$tok = ']';
$out = '[';
- // Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.)
- $in = preg_replace(array('#\[quote(=&quot;.*?&quot;)?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $in);
- $in = preg_replace(array('#\[quote(=&quot;.*?&quot;)?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $in);
-
- $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
-
$in = substr($in, 1);
$close_tags = $error_ary = array();
$buffer = '';
@@ -897,15 +908,7 @@ class parse_message extends bbcode_firstpass
}
}
- // Parse smilies
- if ($allow_smilies)
- {
- $this->smilies($config['max_' . $mode . '_smilies']);
- }
-
- $num_urls = 0;
-
- // Parse BBCode
+ // Prepare BBcode (just prepares some tags for better parsing)
if ($allow_bbcode && strpos($this->message, '[') !== false)
{
$this->bbcode_init();
@@ -917,8 +920,22 @@ class parse_message extends bbcode_firstpass
$this->bbcodes[$bool]['disabled'] = true;
}
}
- $this->parse_bbcode();
+ $this->prepare_bbcodes();
+ }
+
+ // Parse smilies
+ if ($allow_smilies)
+ {
+ $this->smilies($config['max_' . $mode . '_smilies']);
+ }
+
+ $num_urls = 0;
+
+ // Parse BBCode
+ if ($allow_bbcode && strpos($this->message, '[') !== false)
+ {
+ $this->parse_bbcode();
$num_urls += $this->parsed_items['url'];
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 5f921fcc22..e1db457b99 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -82,7 +82,7 @@ class session
}
// Current page from phpBB root (for example: adm/index.php?i=10&b=2)
- $page = (($page_dir) ? urlencode($page_dir) . '/' : '') . urlencode($page_name) . (($query_string) ? "?$query_string" : '');
+ $page = (($page_dir) ? $page_dir . '/' : '') . $page_name . (($query_string) ? "?$query_string" : '');
// The script path from the webroot to the current directory (for example: /phpBB2/adm/) : always prefixed with / and ends in /
$script_path = trim(str_replace('\\', '/', dirname($script_name)));
@@ -102,12 +102,12 @@ class session
$root_script_path .= (substr($root_script_path, -1, 1) == '/') ? '' : '/';
$page_array += array(
- 'page_name' => urlencode($page_name),
- 'page_dir' => urlencode($page_dir),
+ 'page_name' => $page_name,
+ 'page_dir' => $page_dir,
'query_string' => $query_string,
- 'script_path' => urlencode(htmlspecialchars($script_path)),
- 'root_script_path' => urlencode(htmlspecialchars($root_script_path)),
+ 'script_path' => str_replace(' ', '%20', htmlspecialchars($script_path)),
+ 'root_script_path' => str_replace(' ', '%20', htmlspecialchars($root_script_path)),
'page' => $page
);
@@ -437,7 +437,7 @@ class session
// @todo Change to !$this->data['user_type'] & USER_FOUNDER && !$this->data['user_type'] & USER_BOT in time
if ($this->data['user_type'] != USER_FOUNDER)
{
- $this->check_ban();
+ $this->check_ban($this->data['user_id'], $this->ip);
}
//
@@ -755,19 +755,44 @@ class session
{
global $config, $db;
- $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id;
- $user_ip = ($user_ip === false) ? $this->ip : $user_ip;
- $user_email = ($user_email === false) ? $this->data['user_email'] : $user_email;
-
$banned = false;
$sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end
FROM ' . BANLIST_TABLE . '
- WHERE (ban_end >= ' . time() . " OR ban_end = 0)
- AND (
- ban_ip <> '' OR ban_email <> '' OR
- (ban_userid <> 0 AND ban_userid = " . $user_id . ')
- )';
+ WHERE (ban_end >= ' . time() . ' OR ban_end = 0)';
+
+ // Determine which entries to check, only return those
+ if ($user_email === false)
+ {
+ $sql .= " AND ban_email = ''";
+ }
+
+ if ($user_ip === false)
+ {
+ $sql .= " AND (ban_ip = '' OR (ban_ip <> '' AND ban_exclude = 1))";
+ }
+
+ if ($user_id === false)
+ {
+ $sql .= ' AND (ban_userid = 0 OR (ban_userid <> 0 AND ban_exclude = 1))';
+ }
+ else
+ {
+ $sql .= ' AND (ban_userid = ' . $user_id;
+
+ if ($user_email !== false)
+ {
+ $sql .= " OR ban_email <> ''";
+ }
+
+ if ($user_ip !== false)
+ {
+ $sql .= " OR ban_ip <> ''";
+ }
+
+ $sql .= ')';
+ }
+
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -1208,17 +1233,18 @@ class user extends session
*/
function format_date($gmepoch, $format = false, $forcedate = false)
{
- static $lang_dates, $midnight;
+ static $midnight;
+
+ $lang_dates = $this->lang['datetime'];
+ $format = (!$format) ? $this->date_format : $format;
- if (empty($lang_dates))
+ // Short representation of month in format
+ if ((strpos($format, '\M') === false && strpos($format, 'M') !== false) || (strpos($format, '\r') === false && strpos($format, 'r') !== false))
{
- foreach ($this->lang['datetime'] as $match => $replace)
- {
- $lang_dates[$match] = $replace;
- }
+ $lang_dates['May'] = $lang_dates['May_short'];
}
- $format = (!$format) ? $this->date_format : $format;
+ unset($lang_dates['May_short']);
if (!$midnight)
{
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 23dda1438f..164c06d99c 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -33,6 +33,8 @@ class ucp_groups
switch ($mode)
{
case 'membership':
+
+ $this->page_title = 'UCP_USERGROUPS_MEMBER';
if ($submit || isset($_POST['change_default']))
{
@@ -377,6 +379,7 @@ class ucp_groups
case 'manage':
+ $this->page_title = 'UCP_USERGROUPS_MANAGE';
$action = (isset($_POST['addusers'])) ? 'addusers' : request_var('action', '');
$group_id = request_var('g', 0);
@@ -922,7 +925,6 @@ class ucp_groups
}
$this->tpl_name = 'ucp_groups_' . $mode;
- $this->page_title = 'UCP_GROUPS_' . strtoupper($mode);
}
}
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index f3a92f6adb..394004ccc4 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -150,7 +150,9 @@ class ucp_pm
$module = new ucp_main($this);
$module->u_action = $this->u_action;
$module->main($id, $mode);
+
$this->tpl_name = $module->tpl_name;
+ $this->page_title = 'UCP_PM_DRAFTS';
unset($module);
return;