mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/9687] Properly display error messages in ACP
PHPBB3-9687
This commit is contained in:
parent
1a4e6fe3e8
commit
872439b8f4
6 changed files with 38 additions and 26 deletions
|
@ -103,7 +103,14 @@ class acp_ban
|
||||||
$ban_end = $ban_manager->get_ban_end($ban_start, $ban_length, $ban_length_other);
|
$ban_end = $ban_manager->get_ban_end($ban_start, $ban_length, $ban_length_other);
|
||||||
|
|
||||||
$ban = explode("\n", $ban);
|
$ban = explode("\n", $ban);
|
||||||
|
try
|
||||||
|
{
|
||||||
$ban_manager->ban($mode, $ban, $ban_start, $ban_end, $ban_reason, $ban_give_reason);
|
$ban_manager->ban($mode, $ban, $ban_start, $ban_end, $ban_reason, $ban_give_reason);
|
||||||
|
}
|
||||||
|
catch (\phpbb\exception\exception_interface $exception)
|
||||||
|
{
|
||||||
|
trigger_error($language->lang_array($exception->getMessage(), $exception->get_parameters()), E_USER_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this event to perform actions after the ban has been performed
|
* Use this event to perform actions after the ban has been performed
|
||||||
|
|
|
@ -79,14 +79,14 @@ class manager
|
||||||
{
|
{
|
||||||
if ($start > $end && $end->getTimestamp() !== 0)
|
if ($start > $end && $end->getTimestamp() !== 0)
|
||||||
{
|
{
|
||||||
throw new invalid_length_exception(); // TODO
|
throw new invalid_length_exception('LENGTH_BAN_INVALID');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var type_interface $ban_mode */
|
/** @var type_interface $ban_mode */
|
||||||
$ban_mode = $this->find_type($mode);
|
$ban_mode = $this->find_type($mode);
|
||||||
if ($ban_mode === false)
|
if ($ban_mode === false)
|
||||||
{
|
{
|
||||||
throw new type_not_found_exception(); // TODO
|
throw new type_not_found_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->user))
|
if (!empty($this->user))
|
||||||
|
@ -154,14 +154,17 @@ class manager
|
||||||
$ban_mode = $this->find_type($mode);
|
$ban_mode = $this->find_type($mode);
|
||||||
if ($ban_mode === false)
|
if ($ban_mode === false)
|
||||||
{
|
{
|
||||||
throw new type_not_found_exception(); // TODO
|
throw new type_not_found_exception();
|
||||||
}
|
}
|
||||||
$this->tidy();
|
$this->tidy();
|
||||||
|
|
||||||
$sql_ids = array_map('intval', $items);
|
$sql_ids = array_map('intval', $items);
|
||||||
|
|
||||||
|
if (count($sql_ids))
|
||||||
|
{
|
||||||
$sql = 'SELECT ban_item
|
$sql = 'SELECT ban_item
|
||||||
FROM ' . $this->bans_table . '
|
FROM ' . $this->bans_table . '
|
||||||
WHERE ' . $this->db->sql_in_set('ban_id', $sql_ids); // TODO (what if empty?)
|
WHERE ' . $this->db->sql_in_set('ban_id', $sql_ids);
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$unbanned_items = [];
|
$unbanned_items = [];
|
||||||
|
@ -179,6 +182,8 @@ class manager
|
||||||
'items' => $unbanned_items,
|
'items' => $unbanned_items,
|
||||||
];
|
];
|
||||||
$unbanned_users = $ban_mode->after_unban($unban_data);
|
$unbanned_users = $ban_mode->after_unban($unban_data);
|
||||||
|
// @todo: add logging for unbanned users
|
||||||
|
}
|
||||||
|
|
||||||
$this->cache->destroy(self::CACHE_KEY_INFO);
|
$this->cache->destroy(self::CACHE_KEY_INFO);
|
||||||
$this->cache->destroy(self::CACHE_KEY_USERS);
|
$this->cache->destroy(self::CACHE_KEY_USERS);
|
||||||
|
@ -389,7 +394,7 @@ class manager
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new invalid_length_exception();
|
throw new invalid_length_exception('LENGTH_BAN_INVALID');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ class email extends base
|
||||||
|
|
||||||
if (empty($ban_items))
|
if (empty($ban_items))
|
||||||
{
|
{
|
||||||
throw new no_valid_emails_exception(); // TODO
|
throw new no_valid_emails_exception('NO_EMAILS_DEFINED');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ban_items;
|
return $ban_items;
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ip extends base
|
||||||
|
|
||||||
if (empty($ban_items))
|
if (empty($ban_items))
|
||||||
{
|
{
|
||||||
throw new no_valid_ips_exception(); // TODO
|
throw new no_valid_ips_exception('NO_IPS_DEFINED');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ban_items;
|
return $ban_items;
|
||||||
|
|
|
@ -147,7 +147,7 @@ class user extends base
|
||||||
|
|
||||||
if (empty($ban_items))
|
if (empty($ban_items))
|
||||||
{
|
{
|
||||||
throw new no_valid_users_exception(); // TODO
|
throw new no_valid_users_exception('NO_USER_SPECIFIED');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ban_items;
|
return $ban_items;
|
||||||
|
|
|
@ -1136,7 +1136,7 @@ class session
|
||||||
*/
|
*/
|
||||||
function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)
|
function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)
|
||||||
{
|
{
|
||||||
global $db, $phpbb_container, $phpbb_dispatcher;
|
global $phpbb_container, $phpbb_dispatcher;
|
||||||
|
|
||||||
if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN'))
|
if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN'))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue