1: <?php
2: /**
3: *
4: * @package Legacy
5: * @version $Id: IPbanningFilter.class.php,v 1.5 2008/09/25 15:12:43 kilica Exp $
6: * @copyright Copyright 2005-2007 XOOPS Cube Project <https://github.com/xoopscube/legacy>
7: * @license https://github.com/xoopscube/legacy/blob/master/docs/GPL_V2.txt GNU GENERAL PUBLIC LICENSE Version 2
8: *
9: */
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: /***
14: * This burns the access from the specific IP address, which is specified at
15: * the preference.
16: */
17: class Legacy_IPbanningFilter extends XCube_ActionFilter
18: {
19: function preBlockFilter()
20: {
21: if ($this->mRoot->mContext->getXoopsConfig('enable_badips')) {
22: if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
23: foreach ($this->mRoot->mContext->mXoopsConfig['bad_ips'] as $bi) {
24: $bi = str_replace('.', '\.', $bi);
25: if (!empty($bi) && preg_match("/".$bi."/", $_SERVER['REMOTE_ADDR'])) {
26: die();
27: }
28: }
29: }
30: }
31: }
32: }
33:
34: ?>
35: