git-svn-id: file:///svn/phpbb/trunk@7005 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2007-02-17 23:09:58 +00:00
parent e7de77fd8d
commit af4a2033c5
3 changed files with 15 additions and 5 deletions

View file

@ -26,7 +26,7 @@ class acp_ban
$unbansubmit= (isset($_POST['unbansubmit'])) ? true : false; $unbansubmit= (isset($_POST['unbansubmit'])) ? true : false;
$current_time = time(); $current_time = time();
$user->add_lang('acp/ban'); $user->add_lang(array('acp/ban', 'acp/users'));
$this->tpl_name = 'acp_ban'; $this->tpl_name = 'acp_ban';
// Ban submitted? // Ban submitted?

View file

@ -602,12 +602,12 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$ban_end = 0; $ban_end = 0;
} }
$founder = array(); $founder = $founder_names = array();
if (!$ban_exclude) if (!$ban_exclude)
{ {
// Create a list of founder... // Create a list of founder...
$sql = 'SELECT user_id, user_email $sql = 'SELECT user_id, user_email, username_clean
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_FOUNDER; WHERE user_type = ' . USER_FOUNDER;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -615,6 +615,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$founder[$row['user_id']] = $row['user_email']; $founder[$row['user_id']] = $row['user_email'];
$founder_names[$row['user_id']] = $row['username_clean'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
@ -641,7 +642,16 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$username = trim($username); $username = trim($username);
if ($username != '') if ($username != '')
{ {
$sql_usernames[] = utf8_clean_string($username); $clean_name = utf8_clean_string($username);
if ($clean_name == $user->data['username_clean'])
{
trigger_error($user->lang['CANNOT_BAN_YOURSELF']);
}
if (in_array($clean_name, $founder_names))
{
trigger_error($user->lang['CANNOT_BAN_FOUNDER']);
}
$sql_usernames[] = $clean_name;
} }
} }

View file

@ -29,7 +29,7 @@ class mcp_ban
$unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false;
$current_time = time(); $current_time = time();
$user->add_lang('acp/ban'); $user->add_lang(array('acp/ban', 'acp/users'));
$this->tpl_name = 'mcp_ban'; $this->tpl_name = 'mcp_ban';
// Ban submitted? // Ban submitted?