mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
time to squash some bugs
git-svn-id: file:///svn/phpbb/trunk@6114 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -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)
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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 . ' <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 .= '
|
||||
|
@@ -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':
|
||||
|
@@ -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)
|
||||
|
@@ -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 . '&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 . '&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),
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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 . '
|
||||
|
@@ -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;
|
||||
|
@@ -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 . '
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -78,6 +78,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(=".*?")?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $this->message);
|
||||
$this->message = preg_replace(array('#\[quote(=".*?")?\]([^\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
|
||||
*/
|
||||
@@ -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(=".*?")?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $in);
|
||||
$in = preg_replace(array('#\[quote(=".*?")?\]([^\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'];
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
if (empty($lang_dates))
|
||||
$lang_dates = $this->lang['datetime'];
|
||||
$format = (!$format) ? $this->date_format : $format;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user