<?php
/**
 * @package Legacy
 * @version $Id: IPbanningFilter.class.php,v 1.1.2.3 2006/10/20 08:06:23 minahito Exp $
 */

if (!defined('XOOPS_ROOT_PATH')) exit();

/**
 * This burns the access from the specific IP address, which is specified at
 * the preference.
 */
class Legacy_IPbanningFilter extends XCube_ActionFilter
{
	function preBlockFilter()
	{
		if ($this->mRoot->mContext->getXoopsConfig('enable_badips')) {
			if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
				foreach ($this->mRoot->mContext->mXoopsConfig['bad_ips'] as $bi) {
					if(!empty($bi) && strstr($_SERVER['REMOTE_ADDR'], $bi)!==false) {
						die();
					}
				}
			}
		}
	}
}

?>