1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 21:21:54 +02:00

Issue - changes to mitigate sending of multiple notifies on flood ban

This commit is contained in:
SteveD 2013-05-15 22:27:23 +01:00
parent e4ebdfbce7
commit 77b9ec50e9
2 changed files with 16 additions and 3 deletions

@ -912,7 +912,7 @@ class eIPHandler
* @param integer $ban_user
* @param string $ban_notes
*
* @return boolean check result - FALSE if ban rejected. TRUE if ban added.
* @return boolean|integer check result - FALSE if ban rejected. TRUE if ban added. 1 if IP address already banned
*/
public function add_ban($bantype, $ban_message = '', $ban_ip = '', $ban_user = 0, $ban_notes = '')
{
@ -938,12 +938,25 @@ class eIPHandler
{
return FALSE;
}
// See if address already in the banlist
if ($sql->db_Select('banlist', '`banlist_bantype`', "`banlist_ip`='{$ban_ip}'"))
{
list($banType) = $sql->fetch(MYSQL_ASSOC);
if ($banType >= eIPHandler::BAN_TYPE_WHITELIST)
{ // Got a whitelist entry for this
//$admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
return FALSE;
}
return 1; // Already in ban list
}
/*
// See if the address is in the whitelist
if ($sql->db_Select('banlist', '*', "`banlist_ip`='{$ban_ip}' AND `banlist_bantype` >= ".eIPHandler::BAN_TYPE_WHITELIST))
{ // Got a whitelist entry for this
//$admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "BANLIST_11", 'LAN_AL_BANLIST_11', $ban_ip, FALSE, LOG_TO_ROLLING);
return FALSE;
}
} */
if(varsettrue($pref['enable_rdns_on_ban']))
{
$ban_message .= 'Host: '.$this->get_host_name($ban_ip);

@ -218,7 +218,7 @@ class e_online
if ($row['online_pagecount'] > $online_bancount)
{
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php');
if (e107::getIPHandler()->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0))
if (TRUE === e107::getIPHandler()->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0))
{
e107::getEvent()->trigger('flood', $ip);
exit;