| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; |
| 3 | 3 | |
| 4 | -if (!class_exists('WPRProtectIpstoreDB_V553')) : | |
| 5 | -class WPRProtectIpstoreDB_V553 { | |
| 4 | +if (!class_exists('WPRProtectIpstoreDB_V676')) : | |
| 5 | +class WPRProtectIpstoreDB_V676 { | |
| 6 | 6 | const TABLE_NAME = 'ip_store'; |
| 7 | 7 | |
| 8 | 8 | const CATEGORY_FW = 3; |
| 9 | 9 | const CATEGORY_LP = 4; |
| @@ -9,37 +9,37 @@ | ||
| 9 | 9 | const CATEGORY_LP = 4; |
| 10 | 10 | |
| 11 | 11 | #XNOTE: check this. |
| 12 | 12 | public static function blacklistedTypes() { |
| 13 | - return WPRProtectRequest_V553::blacklistedCategories(); | |
| 13 | + return WPRProtectRequest_V676::blacklistedCategories(); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public static function whitelistedTypes() { |
| 17 | - return WPRProtectRequest_V553::whitelistedCategories(); | |
| 17 | + return WPRProtectRequest_V676::whitelistedCategories(); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public static function uninstall() { |
| 21 | - WPRProtect_V553::$db->dropBVTable(WPRProtectIpstoreDB_V553::TABLE_NAME); | |
| 21 | + WPRProtect_V676::$db->dropBVTable(WPRProtectIpstoreDB_V676::TABLE_NAME); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function isLPIPBlacklisted($ip) { |
| 25 | - return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V553::CATEGORY_LP); | |
| 25 | + return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V676::CATEGORY_LP); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function isLPIPWhitelisted($ip) { |
| 29 | - return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V553::CATEGORY_LP); | |
| 29 | + return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V676::CATEGORY_LP); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function getTypeIfBlacklistedIP($ip) { |
| 33 | - return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V553::CATEGORY_FW); | |
| 33 | + return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V676::CATEGORY_FW); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function isFWIPBlacklisted($ip) { |
| 37 | - return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V553::CATEGORY_FW); | |
| 37 | + return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V676::CATEGORY_FW); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function isFWIPWhitelisted($ip) { |
| 41 | - return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V553::CATEGORY_FW); | |
| 41 | + return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V676::CATEGORY_FW); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | private function checkIPPresent($ip, $types, $category) { |
| 45 | 45 | $ip_category = $this->getIPType($ip, $types, $category); |
| @@ -48,17 +48,17 @@ | ||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | #XNOTE: getIPCategory or getIPType? |
| 51 | 51 | private function getIPType($ip, $types, $category) { |
| 52 | - $table = WPRProtect_V553::$db->getBVTable(WPRProtectIpstoreDB_V553::TABLE_NAME); | |
| 52 | + $table = WPRProtect_V676::$db->getBVTable(WPRProtectIpstoreDB_V676::TABLE_NAME); | |
| 53 | 53 | |
| 54 | - if (WPRProtect_V553::$db->isTablePresent($table)) { | |
| 55 | - $binIP = WPRProtectUtils_V553::bvInetPton($ip); | |
| 56 | - $is_v6 = WPRProtectUtils_V553::isIPv6($ip); | |
| 54 | + if (WPRProtect_V676::$db->isTablePresent($table)) { | |
| 55 | + $binIP = WPRProtectUtils_V676::bvInetPton($ip); | |
| 56 | + $is_v6 = WPRProtectUtils_V676::isIPv6($ip); | |
| 57 | 57 | |
| 58 | 58 | if ($binIP !== false) { |
| 59 | 59 | $query_str = "SELECT * FROM $table WHERE %s >= `start_ip_range` && %s <= `end_ip_range` && "; |
| 60 | - if ($category == WPRProtectIpstoreDB_V553::CATEGORY_FW) { | |
| 60 | + if ($category == WPRProtectIpstoreDB_V676::CATEGORY_FW) { | |
| 61 | 61 | $query_str .= "`is_fw` = true"; |
| 62 | 62 | } else { |
| 63 | 63 | $query_str .= "`is_lp` = true"; |
| 64 | 64 | } |
| @@ -63,12 +63,12 @@ | ||
| 63 | 63 | $query_str .= "`is_lp` = true"; |
| 64 | 64 | } |
| 65 | 65 | $query_str .= " && `type` in (" . implode(',', $types) . ") && `is_v6` = %d LIMIT 1;"; |
| 66 | 66 | |
| 67 | - $query = WPRProtect_V553::$db->prepare($query_str, array($binIP, $binIP, $is_v6)); | |
| 67 | + $query = WPRProtect_V676::$db->prepare($query_str, array($binIP, $binIP, $is_v6)); | |
| 68 | 68 | |
| 69 | - return WPRProtect_V553::$db->getVar($query, 5); | |
| 69 | + return WPRProtect_V676::$db->getVar($query, 5); | |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | endif; |