| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; |
| 3 | 3 | |
| 4 | -if (!class_exists('MCProtectIpstoreFS')) : | |
| 5 | - class MCProtectIpstoreFS { | |
| 4 | +if (!class_exists('WPRProtectIpstoreFS_V672')) : | |
| 5 | + class WPRProtectIpstoreFS_V672 { | |
| 6 | 6 | private $whitelisted_ips; |
| 7 | 7 | private $blacklisted_ips; |
| 8 | 8 | |
| 9 | 9 | const IP_TYPE_BLACKLISTED = 0; |
| @@ -10,23 +10,23 @@ | ||
| 10 | 10 | const IP_TYPE_WHITELISTED = 1; |
| 11 | 11 | |
| 12 | 12 | function __construct() { |
| 13 | 13 | $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf'; |
| 14 | - $ips = MCProtectUtils::parseFile($ip_store_file); | |
| 14 | + $ips = WPRProtectUtils_V672::parseFile($ip_store_file); | |
| 15 | 15 | $this->whitelisted_ips = array_key_exists('whitelisted', $ips) ? $ips['whitelisted'] : array(); |
| 16 | 16 | $this->blacklisted_ips = array_key_exists('blacklisted', $ips) ? $ips['blacklisted'] : array(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function getTypeIfBlacklistedIP($ip) { |
| 20 | - return $this->getIPType($ip, MCProtectIpstoreFS::IP_TYPE_BLACKLISTED); | |
| 20 | + return $this->getIPType($ip, WPRProtectIpstoreFS_V672::IP_TYPE_BLACKLISTED); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function isFWIPBlacklisted($ip) { |
| 24 | - return $this->checkIPPresent($ip, MCProtectIpstoreFS::IP_TYPE_BLACKLISTED); | |
| 24 | + return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V672::IP_TYPE_BLACKLISTED); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function isFWIPWhitelisted($ip) { |
| 28 | - return $this->checkIPPresent($ip, MCProtectIpstoreFS::IP_TYPE_WHITELISTED); | |
| 28 | + return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V672::IP_TYPE_WHITELISTED); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private function checkIPPresent($ip, $type) { |
| 32 | 32 | $ip_category = $this->getIPType($ip, $type); |
| @@ -35,12 +35,12 @@ | ||
| 35 | 35 | |
| 36 | 36 | #XNOTE: getIPCategory or getIPType? |
| 37 | 37 | private function getIPType($ip, $type) { |
| 38 | 38 | switch ($type) { |
| 39 | - case MCProtectIpstoreFS::IP_TYPE_BLACKLISTED: | |
| 39 | + case WPRProtectIpstoreFS_V672::IP_TYPE_BLACKLISTED: | |
| 40 | 40 | return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null; |
| 41 | - case MCProtectIpstoreFS::IP_TYPE_WHITELISTED: | |
| 41 | + case WPRProtectIpstoreFS_V672::IP_TYPE_WHITELISTED: | |
| 42 | 42 | return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | endif; |