mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Update spamfilter to use Rhymix IP filter
This commit is contained in:
parent
3d571142a4
commit
e2df99d440
2 changed files with 43 additions and 23 deletions
|
|
@ -32,9 +32,8 @@ class spamfilterModel extends spamfilter
|
|||
$args = new stdClass();
|
||||
$args->sort_index = "regdate";
|
||||
$args->page = Context::get('page')?Context::get('page'):1;
|
||||
$output = executeQuery('spamfilter.getDeniedIPList', $args);
|
||||
$output = executeQueryArray('spamfilter.getDeniedIPList', $args);
|
||||
if(!$output->data) return;
|
||||
if(!is_array($output->data)) return array($output->data);
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
|
|
@ -43,18 +42,20 @@ class spamfilterModel extends spamfilter
|
|||
*/
|
||||
function isDeniedIP()
|
||||
{
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ip_list = $this->getDeniedIPList();
|
||||
if(!count($ip_list)) return new Object();
|
||||
|
||||
$count = count($ip_list);
|
||||
for($i=0;$i<$count;$i++)
|
||||
|
||||
$ip_ranges = array();
|
||||
foreach ($ip_list as $ip_range)
|
||||
{
|
||||
$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
|
||||
if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new Object(-1,'msg_alert_registered_denied_ip');
|
||||
$ip_ranges[] = $ip_range->ipaddress;
|
||||
}
|
||||
|
||||
|
||||
if (Rhymix\Framework\Filters\IpFilter::inRanges(\RX_CLIENT_IP, $ip_ranges))
|
||||
{
|
||||
return new Object(-1, 'msg_alert_registered_denied_ip');
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue