Changeset 3795707
- Timestamp:
- 11/11/2026 05:46:47 AM (10 hours ago)
- Location:
- wpremote
- Files:
-
- 8 added
- 62 edited
- 1 copied
-
tags/6.83 (copied) (copied from wpremote/trunk )
-
tags/6.83/broken_link_checker (added)
-
tags/6.83/broken_link_checker/highlight.css (added)
-
tags/6.83/broken_link_checker/highlight.js (added)
-
tags/6.83/callback/base.php (modified) (2 diffs)
-
tags/6.83/callback/handler.php (modified) (2 diffs)
-
tags/6.83/callback/wings/info.php (modified) (2 diffs)
-
tags/6.83/callback/wings/ipstore.php (modified) (2 diffs)
-
tags/6.83/callback/wings/links.php (added)
-
tags/6.83/callback/wings/protect.php (modified) (1 diff)
-
tags/6.83/callback/wings/watch.php (modified) (2 diffs)
-
tags/6.83/info.php (modified) (1 diff)
-
tags/6.83/plugin.php (modified) (3 diffs)
-
tags/6.83/protect/fw.php (modified) (31 diffs)
-
tags/6.83/protect/fw/rule.php (modified) (5 diffs)
-
tags/6.83/protect/fw/rule/engine.php (modified) (26 diffs)
-
tags/6.83/protect/fw/rule/errors.php (modified) (1 diff)
-
tags/6.83/protect/fw/rule/functions/array.php (modified) (22 diffs)
-
tags/6.83/protect/fw/rule/functions/misc.php (modified) (5 diffs)
-
tags/6.83/protect/fw/rule/functions/request.php (modified) (2 diffs)
-
tags/6.83/protect/fw/rule/functions/string.php (modified) (11 diffs)
-
tags/6.83/protect/fw/rule/functions/wp.php (modified) (17 diffs)
-
tags/6.83/protect/ipstore.php (modified) (3 diffs)
-
tags/6.83/protect/ipstore/db.php (modified) (4 diffs)
-
tags/6.83/protect/ipstore/fs.php (modified) (4 diffs)
-
tags/6.83/protect/lib/utils.php (modified) (2 diffs)
-
tags/6.83/protect/logger.php (modified) (2 diffs)
-
tags/6.83/protect/logger/db.php (modified) (2 diffs)
-
tags/6.83/protect/logger/fs.php (modified) (1 diff)
-
tags/6.83/protect/lp.php (modified) (14 diffs)
-
tags/6.83/protect/prepend/ignitor.php (modified) (1 diff)
-
tags/6.83/protect/protect.php (modified) (10 diffs)
-
tags/6.83/protect/request.php (modified) (5 diffs)
-
tags/6.83/protect/wp_user.php (modified) (3 diffs)
-
tags/6.83/readme.txt (modified) (2 diffs)
-
tags/6.83/wp_actions.php (modified) (1 diff)
-
trunk/broken_link_checker (added)
-
trunk/broken_link_checker/highlight.css (added)
-
trunk/broken_link_checker/highlight.js (added)
-
trunk/callback/base.php (modified) (2 diffs)
-
trunk/callback/handler.php (modified) (2 diffs)
-
trunk/callback/wings/info.php (modified) (2 diffs)
-
trunk/callback/wings/ipstore.php (modified) (2 diffs)
-
trunk/callback/wings/links.php (added)
-
trunk/callback/wings/protect.php (modified) (1 diff)
-
trunk/callback/wings/watch.php (modified) (2 diffs)
-
trunk/info.php (modified) (1 diff)
-
trunk/plugin.php (modified) (3 diffs)
-
trunk/protect/fw.php (modified) (31 diffs)
-
trunk/protect/fw/rule.php (modified) (5 diffs)
-
trunk/protect/fw/rule/engine.php (modified) (26 diffs)
-
trunk/protect/fw/rule/errors.php (modified) (1 diff)
-
trunk/protect/fw/rule/functions/array.php (modified) (22 diffs)
-
trunk/protect/fw/rule/functions/misc.php (modified) (5 diffs)
-
trunk/protect/fw/rule/functions/request.php (modified) (2 diffs)
-
trunk/protect/fw/rule/functions/string.php (modified) (11 diffs)
-
trunk/protect/fw/rule/functions/wp.php (modified) (17 diffs)
-
trunk/protect/ipstore.php (modified) (3 diffs)
-
trunk/protect/ipstore/db.php (modified) (4 diffs)
-
trunk/protect/ipstore/fs.php (modified) (4 diffs)
-
trunk/protect/lib/utils.php (modified) (2 diffs)
-
trunk/protect/logger.php (modified) (2 diffs)
-
trunk/protect/logger/db.php (modified) (2 diffs)
-
trunk/protect/logger/fs.php (modified) (1 diff)
-
trunk/protect/lp.php (modified) (14 diffs)
-
trunk/protect/prepend/ignitor.php (modified) (1 diff)
-
trunk/protect/protect.php (modified) (10 diffs)
-
trunk/protect/request.php (modified) (5 diffs)
-
trunk/protect/wp_user.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp_actions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpremote/tags/6.83/callback/base.php
r3775063 r3795707 15 15 "MISC_WING_VERSION" => '1.4', 16 16 "FS_WING_VERSION" => '1.4', 17 "INFO_WING_VERSION" => '2. 8',17 "INFO_WING_VERSION" => '2.9', 18 18 "WATCH_WING_VERSION" => '1.7', 19 19 "FS_WRITE_WING_VERSION" => '1.2', … … 22 22 "PROTECT_WING_VERSION" => '1.3', 23 23 "SECURITY_WING_VERSION" => '1.4', 24 "LINKS_WING_VERSION" => '1.0', 24 25 "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0', 25 26 ); -
wpremote/tags/6.83/callback/handler.php
r3648236 r3795707 170 170 $module = new WPRSecurityCallback($this); 171 171 break; 172 case 'links': 173 // Only the BlogVault, MalCare and WP Remote plugins carry this wing; the rest answer Bad Command. 174 $links_wing = dirname( __FILE__ ) . '/wings/links.php'; 175 if (!file_exists($links_wing)) { 176 $module = null; 177 break; 178 } 179 require_once $links_wing; 180 $module = new WPRLinksCallback($this); 181 break; 172 182 default: 173 183 require_once dirname( __FILE__ ) . '/wings/misc.php'; … … 175 185 break; 176 186 } 177 $resp = $module ->process($this->request);187 $resp = $module ? $module->process($this->request) : false; 178 188 if ($resp === false) { 179 189 $resp = array( -
wpremote/tags/6.83/callback/wings/info.php
r3775063 r3795707 11 11 public $bvapi; 12 12 13 const INFO_WING_VERSION = 2. 8;13 const INFO_WING_VERSION = 2.9; 14 14 15 15 public function __construct($callback_handler) { … … 150 150 $sys_info['webgid'] = posix_getgid(); 151 151 } 152 if (function_exists('ini_get')) { 153 $sys_info['max_execution_time'] = (int) @ini_get('max_execution_time'); 154 $sys_info['memory_limit'] = (string) @ini_get('memory_limit'); 155 } 156 $sys_info['link_checks'] = $this->getLinkCheckInfo(); 152 157 return $sys_info; 158 } 159 160 // What this server can do for broken link checks. Local and read-only: constants, functions 161 // and settings only, with no request, DNS lookup or write, so it can never slow or fail a sync. 162 // A value it cannot tell is null. 163 public function getLinkCheckInfo() { 164 $info = array( 165 'curl' => function_exists('curl_init'), 166 'curl_multi' => function_exists('curl_multi_init'), 167 'address_pinning' => defined('CURLOPT_RESOLVE'), 168 'dns_lookup' => function_exists('gethostbynamel'), 169 'curl_version' => null, 170 'ssl_version' => null, 171 'external_requests_blocked' => null, 172 'proxy_configured' => null 173 ); 174 try { 175 if (function_exists('curl_version')) { 176 $curl = curl_version(); 177 $info['curl_version'] = isset($curl['version']) ? (string) $curl['version'] : null; 178 $info['ssl_version'] = isset($curl['ssl_version']) ? (string) $curl['ssl_version'] : null; 179 } 180 if (class_exists('WP_Http')) { 181 $http = new WP_Http(); 182 $info['external_requests_blocked'] = (bool) $http->block_request('https://example.com/'); 183 } 184 if (class_exists('WP_HTTP_Proxy')) { 185 $proxy = new WP_HTTP_Proxy(); 186 $info['proxy_configured'] = (bool) $proxy->is_enabled(); 187 } 188 } catch (Exception $e) { 189 // Leave what could not be read as null; system info must still be returned. 190 } 191 return $info; 153 192 } 154 193 -
wpremote/tags/6.83/callback/wings/ipstore.php
r3775063 r3795707 51 51 public function getIPs($table, $auto_increment_offset, $type, $category) { 52 52 $query = "SELECT `start_ip_range` FROM $table WHERE id < $auto_increment_offset AND `type` in (" . implode(',', $type) . ") AND "; 53 $query .= ($category == WPRProtectIpstoreDB_V68 1::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";53 $query .= ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;"; 54 54 return $this->db->getCol($query); 55 55 } … … 65 65 66 66 $info['fw_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, 67 WPRProtectIpstoreDB_V68 1::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);67 WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 68 68 $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, 69 WPRProtectIpstoreDB_V68 1::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);69 WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 70 70 $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, 71 WPRProtectIpstoreDB_V68 1::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);71 WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 72 72 $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, 73 WPRProtectIpstoreDB_V68 1::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);73 WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 74 74 $info['ip_store_offset'] = $this->getIPStoreOffset($table, $auto_increment_offset); 75 75 $info['country_ips_size'] = intval($db->getVar("SELECT COUNT(id) FROM $table WHERE id >= $auto_increment_offset")); -
wpremote/tags/6.83/callback/wings/protect.php
r3775063 r3795707 41 41 42 42 public function unBlockIP($ip, $attempts, $time) { 43 $transient_name = WPRProtectLP_V68 1::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;43 $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip; 44 44 $this->settings->setTransient($transient_name, $attempts, $time); 45 45 return $this->settings->getTransient($transient_name); -
wpremote/tags/6.83/callback/wings/watch.php
r3775063 r3795707 145 145 require_once dirname( __FILE__ ) . '/../../protect/lp.php'; 146 146 $lp_params = $params['lp']; 147 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V68 1::TABLE_NAME))) {147 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V683::TABLE_NAME))) { 148 148 $limit = intval($lp_params['limit']); 149 149 $filter = $lp_params['filter']; 150 150 $offset = isset($lp_params['offset']) ? intval($lp_params['offset']) : 0; 151 $table = $db->getBVTable(WPRProtectLP_V68 1::TABLE_NAME);151 $table = $db->getBVTable(WPRProtectLP_V683::TABLE_NAME); 152 152 $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table); 153 153 if (empty($resp["lplogs"])) { 154 $db->deleteBVTableContent(WPRProtectLP_V68 1::TABLE_NAME, $lp_params['rmfilter']);154 $db->deleteBVTableContent(WPRProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']); 155 155 $resp["lplogs"] = $this->getData($table, $limit, $filter); 156 156 } … … 168 168 require_once dirname( __FILE__ ) . '/../../protect/fw.php'; 169 169 $fw_params = $params['fw']; 170 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V68 1::TABLE_NAME))) {170 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V683::TABLE_NAME))) { 171 171 $limit = intval($fw_params['limit']); 172 172 $filter = $fw_params['filter']; 173 173 $offset = isset($fw_params['offset']) ? intval($fw_params['offset']) : 0; 174 $table = $db->getBVTable(WPRProtectFW_V68 1::TABLE_NAME);174 $table = $db->getBVTable(WPRProtectFW_V683::TABLE_NAME); 175 175 $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table); 176 176 if (empty($resp["fwlogs"])){ 177 $db->deleteBVTableContent(WPRProtectFW_V68 1::TABLE_NAME, $fw_params['rmfilter']);177 $db->deleteBVTableContent(WPRProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']); 178 178 $resp["fwlogs"] = $this->getData($table, $limit, $filter); 179 179 } -
wpremote/tags/6.83/info.php
r3775063 r3795707 12 12 public $brand_option = 'bv_whitelabel_infos'; 13 13 public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; 14 public $version = '6.8 1';14 public $version = '6.83'; 15 15 public $webpage = 'https://wpremote.com'; 16 16 public $appurl = 'https://app.wpremote.com'; -
wpremote/tags/6.83/plugin.php
r3775063 r3795707 6 6 Author: WP Remote 7 7 Author URI: https://wpremote.com 8 Version: 6.8 18 Version: 6.83 9 9 Network: True 10 10 License: GPLv2 or later … … 64 64 65 65 add_action('wp_footer', array($wp_action, 'footerHandler'), 100); 66 add_action('wp_enqueue_scripts', array($wp_action, 'enqueueBrokenLinkHighlight')); 66 67 add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); 67 68 add_action('wpr_clear_mu_plugin', array($wp_action, 'clear_mu_plugin')); … … 186 187 require_once dirname( __FILE__ ) . '/protect/protect.php'; 187 188 //For backward compatibility. 188 WPRProtect_V68 1::$settings = new WPRWPSettings();189 WPRProtect_V68 1::$db = new WPRWPDb();190 WPRProtect_V68 1::$info = new WPRInfo(WPRProtect_V681::$settings);191 192 add_action('wpr_clear_pt_config', array('WPRProtect_V68 1', 'uninstall'));189 WPRProtect_V683::$settings = new WPRWPSettings(); 190 WPRProtect_V683::$db = new WPRWPDb(); 191 WPRProtect_V683::$info = new WPRInfo(WPRProtect_V683::$settings); 192 193 add_action('wpr_clear_pt_config', array('WPRProtect_V683', 'uninstall')); 193 194 194 195 if ($bvinfo->isActivePlugin()) { 195 WPRProtect_V68 1::init(WPRProtect_V681::MODE_WP);196 WPRProtect_V683::init(WPRProtect_V683::MODE_WP); 196 197 } 197 198 } -
wpremote/tags/6.83/protect/fw.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectFW_V68 1')) :4 if (!class_exists('WPRProtectFW_V683')) : 5 5 require_once dirname( __FILE__ ) . '/fw/rule/errors.php'; 6 6 require_once dirname( __FILE__ ) . '/fw/rule/engine.php'; 7 7 require_once dirname( __FILE__ ) . '/fw/rule.php'; 8 8 9 class WPRProtectFW_V68 1{9 class WPRProtectFW_V683 { 10 10 private $brand_name; 11 11 private $protect_mode; … … 24 24 private $has_valid_bypass_cookie; 25 25 26 private $mode = WPRProtectFW_V68 1::MODE_DISABLED;27 private $ip_cookie_mode = WPRProtectFW_V68 1::IP_COOKIE_MODE_DISABLED;28 private $admin_cookie_mode = WPRProtectFW_V68 1::ADMIN_COOKIE_MODE_DISABLED;29 private $bypass_level = WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CONTRIBUTOR;30 private $wpf_rule_init_mode = WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_WP;26 private $mode = WPRProtectFW_V683::MODE_DISABLED; 27 private $ip_cookie_mode = WPRProtectFW_V683::IP_COOKIE_MODE_DISABLED; 28 private $admin_cookie_mode = WPRProtectFW_V683::ADMIN_COOKIE_MODE_DISABLED; 29 private $bypass_level = WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CONTRIBUTOR; 30 private $wpf_rule_init_mode = WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP; 31 31 private $custom_roles = array(); 32 32 private $cookie_key = ""; … … 35 35 private $cookie_validity = 2592000; 36 36 private $can_set_cache_prevention_cookie = false; 37 private $rules_mode = WPRProtectFW_V68 1::RULES_MODE_DISABLED;37 private $rules_mode = WPRProtectFW_V683::RULES_MODE_DISABLED; 38 38 private $is_geo_blocking = false; 39 39 private $is_wp_user_cookie_enabled = false; 40 40 private $log_config = array(); 41 private $request_profiling_mode = WPRProtectFW_V68 1::REQ_PROFILING_MODE_DISABLED;42 private $logging_mode = WPRProtectFW_V68 1::LOGGING_MODE_VISITOR;41 private $request_profiling_mode = WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED; 42 private $logging_mode = WPRProtectFW_V683::LOGGING_MODE_VISITOR; 43 43 private $skip_log_config = array(); 44 44 private $skip_log_cookies = array(); … … 55 55 private $break_rule_matching = false; 56 56 private $can_log_raw_body = false; 57 private $log_slice_size = WPRProtectFW_V68 1::LOG_SLICE_SIZE;57 private $log_slice_size = WPRProtectFW_V683::LOG_SLICE_SIZE; 58 58 59 59 private static $instance = null; … … 101 101 102 102 const DEFAULT_WP_USER_ROLE_LEVELS = array( 103 'administrator' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_ADMIN,104 'editor' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_EDITOR,105 'author' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_AUTHOR,106 'contributor' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CONTRIBUTOR,107 'subscriber' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_SUBSCRIBER103 'administrator' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN, 104 'editor' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_EDITOR, 105 'author' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_AUTHOR, 106 'contributor' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CONTRIBUTOR, 107 'subscriber' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_SUBSCRIBER 108 108 ); 109 109 110 110 const EXTRA_WP_USER_ROLE_LEVELS = array( 111 'custom' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CUSTOM,112 'unknown' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_UNKNOWN111 'custom' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM, 112 'unknown' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_UNKNOWN 113 113 ); 114 114 … … 249 249 if ($this->isPrependMode()) { 250 250 $log_file = MCDATAPATH . MCCONFKEY . '-mc.log'; 251 $this->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_FS);252 $this->logger = new WPRProtectLogger_V68 1($log_file, WPRProtectLogger_V681::TYPE_FS);251 $this->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_FS); 252 $this->logger = new WPRProtectLogger_V683($log_file, WPRProtectLogger_V683::TYPE_FS); 253 253 } else { 254 $this->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_DB);255 $this->logger = new WPRProtectLogger_V68 1(WPRProtectFW_V681::TABLE_NAME, WPRProtectLogger_V681::TYPE_DB);254 $this->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB); 255 $this->logger = new WPRProtectLogger_V683(WPRProtectFW_V683::TABLE_NAME, WPRProtectLogger_V683::TYPE_DB); 256 256 } 257 257 … … 266 266 if (!isset(self::$instance)) { 267 267 self::$instance = new self($protect_mode, $request, $config, $brand_name); 268 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V68 1::MODE_WP) {268 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V683::MODE_WP) { 269 269 self::$instance->protect_mode = $protect_mode; 270 270 self::$instance->brand_name = $brand_name; 271 self::$instance->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_DB);271 self::$instance->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB); 272 272 self::$instance->initRules(); 273 273 } … … 277 277 278 278 public static function uninstall() { 279 WPRProtect_V68 1::$db->dropBVTable(WPRProtectFW_V681::TABLE_NAME);279 WPRProtect_V683::$db->dropBVTable(WPRProtectFW_V683::TABLE_NAME); 280 280 } 281 281 … … 297 297 298 298 private function isPrependMode() { 299 return ($this->protect_mode === WPRProtect_V68 1::MODE_PREPEND);299 return ($this->protect_mode === WPRProtect_V683::MODE_PREPEND); 300 300 } 301 301 302 302 private function isWPMode() { 303 return ($this->protect_mode === WPRProtect_V68 1::MODE_WP);303 return ($this->protect_mode === WPRProtect_V683::MODE_WP); 304 304 } 305 305 306 306 private function isModeDisabled() { 307 return ($this->mode === WPRProtectFW_V68 1::MODE_DISABLED);307 return ($this->mode === WPRProtectFW_V683::MODE_DISABLED); 308 308 } 309 309 310 310 private function isModeProtect() { 311 return ($this->mode === WPRProtectFW_V68 1::MODE_PROTECT);311 return ($this->mode === WPRProtectFW_V683::MODE_PROTECT); 312 312 } 313 313 314 314 private function isAdminCookieEnabled() { 315 return ($this->admin_cookie_mode === WPRProtectFW_V68 1::ADMIN_COOKIE_MODE_ENABLED);315 return ($this->admin_cookie_mode === WPRProtectFW_V683::ADMIN_COOKIE_MODE_ENABLED); 316 316 } 317 317 318 318 private function isIPCookieEnabled() { 319 return ($this->ip_cookie_mode === WPRProtectFW_V68 1::IP_COOKIE_MODE_ENABLED);319 return ($this->ip_cookie_mode === WPRProtectFW_V683::IP_COOKIE_MODE_ENABLED); 320 320 } 321 321 322 322 private function isRequestProfilingDisabled() { 323 return ($this->request_profiling_mode === WPRProtectFW_V68 1::REQ_PROFILING_MODE_DISABLED);323 return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED); 324 324 } 325 325 326 326 private function isRequestProfilingModeDebug() { 327 return ($this->request_profiling_mode === WPRProtectFW_V68 1::REQ_PROFILING_MODE_DEBUG);327 return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DEBUG); 328 328 } 329 329 330 330 private function isRequestHasValidBypassCookie() { 331 331 if (!isset($this->has_valid_bypass_cookie)) { 332 $cookie = (string) $this->request->getCookies(WPRProtectFW_V68 1::BYPASS_COOKIE_NAME);332 $cookie = (string) $this->request->getCookies(WPRProtectFW_V683::BYPASS_COOKIE_NAME); 333 333 $new_cookie = $this->generateBypassCookie(); 334 334 $is_valid = ($this->isAdminCookieEnabled() && $new_cookie && ($cookie === $new_cookie)); … … 340 340 341 341 private function isRulesModeProtect() { 342 return ($this->rules_mode === WPRProtectFW_V68 1::RULES_MODE_PROTECT);342 return ($this->rules_mode === WPRProtectFW_V683::RULES_MODE_PROTECT); 343 343 } 344 344 345 345 public function isLoggingModeComplete() { 346 return ($this->logging_mode === WPRProtectFW_V68 1::LOGGING_MODE_COMPLETE);346 return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_COMPLETE); 347 347 } 348 348 349 349 public function isLoggingModeVisitor() { 350 return ($this->logging_mode === WPRProtectFW_V68 1::LOGGING_MODE_VISITOR);350 return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_VISITOR); 351 351 } 352 352 … … 356 356 357 357 private function isWPFRuleInitModePrepend() { 358 return ($this->wpf_rule_init_mode === WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_PREPEND);358 return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_PREPEND); 359 359 } 360 360 361 361 private function isWPFRuleInitModeWP() { 362 return ($this->wpf_rule_init_mode === WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_WP);362 return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP); 363 363 } 364 364 … … 389 389 390 390 if (!$current_wp_user->isIdentical($this->request->wp_user)) { 391 $serialized_wp_user = WPRProtectWPUser_V68 1::_serialize($current_wp_user);391 $serialized_wp_user = WPRProtectWPUser_V683::_serialize($current_wp_user); 392 392 $cookie_val = $serialized_wp_user . '_' . 393 WPRProtectUtils_V68 1::signMessage($serialized_wp_user, $this->cookie_key);393 WPRProtectUtils_V683::signMessage($serialized_wp_user, $this->cookie_key); 394 394 $cookie_val = base64_encode($cookie_val); 395 395 396 $this->setCookie(WPRProtectWPUser_V68 1::COOKIE_NAME, $cookie_val);396 $this->setCookie(WPRProtectWPUser_V683::COOKIE_NAME, $cookie_val); 397 397 } 398 398 } elseif ($this->request->wp_user->isLoggedIn()) { 399 $this->request->wp_user = WPRProtectWPUser_V68 1::defaultUser();400 $this->unsetCookie(WPRProtectWPUser_V68 1::COOKIE_NAME);399 $this->request->wp_user = WPRProtectWPUser_V683::defaultUser(); 400 $this->unsetCookie(WPRProtectWPUser_V683::COOKIE_NAME); 401 401 } 402 402 } … … 415 415 } 416 416 417 return (new WPRProtectWPUser_V68 1($id, $role_level, $capabilities, $time));417 return (new WPRProtectWPUser_V683($id, $role_level, $capabilities, $time)); 418 418 } 419 419 … … 434 434 435 435 private function loadWPUser() { 436 $this->request->wp_user = WPRProtectWPUser_V68 1::defaultUser();437 438 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V68 1::COOKIE_NAME);436 $this->request->wp_user = WPRProtectWPUser_V683::defaultUser(); 437 438 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V683::COOKIE_NAME); 439 439 if (!is_string($cookie_val)) { 440 440 return; … … 452 452 list($serialized_user, $signature) = $cookie_val_array; 453 453 454 if (WPRProtectUtils_V68 1::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {455 $wp_user = WPRProtectWPUser_V68 1::_unserialize($serialized_user);454 if (WPRProtectUtils_V683::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) { 455 $wp_user = WPRProtectWPUser_V683::_unserialize($serialized_user); 456 456 457 457 if (!isset($wp_user) || $wp_user->time !== (int) floor(time() / $this->cookie_validity)) { … … 468 468 } 469 469 470 $role_by_level = array_flip(array_merge(WPRProtectFW_V68 1::DEFAULT_WP_USER_ROLE_LEVELS,471 WPRProtectFW_V68 1::EXTRA_WP_USER_ROLE_LEVELS));470 $role_by_level = array_flip(array_merge(WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS, 471 WPRProtectFW_V683::EXTRA_WP_USER_ROLE_LEVELS)); 472 472 $this->request->wp_user->role = $role_by_level[$this->request->wp_user->role_level]; 473 473 } … … 493 493 if ($this->isPrependMode()) { 494 494 $rules_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_rules.json'; 495 $rule_arrays = WPRProtectUtils_V68 1::parseFile($rules_file);495 $rule_arrays = WPRProtectUtils_V683::parseFile($rules_file); 496 496 } else { 497 $rule_arrays = WPRProtect_V68 1::$settings->getOption('bvruleset');497 $rule_arrays = WPRProtect_V683::$settings->getOption('bvruleset'); 498 498 if(!is_array($rule_arrays)) { 499 499 $rule_arrays = array(); … … 507 507 508 508 foreach($rule_arrays as $rule_array) { 509 $rule = WPRProtectFWRule_V68 1::init($rule_array);509 $rule = WPRProtectFWRule_V683::init($rule_array); 510 510 511 511 if ($rule) { … … 532 532 private function initWPFRule($rule) { 533 533 switch ($rule->execute_on) { 534 case WPRProtectFWRule_V68 1::EXE_ON_PRE_UPDATE_OPTION:534 case WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION: 535 535 $this->addWPHook($rule, 'pre_update_option', 'handleRequestOnPreUpdateOption', 3); 536 536 break; 537 case WPRProtectFWRule_V68 1::EXE_ON_PRE_DELETE_POST:537 case WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST: 538 538 $this->addWPHook($rule, 'pre_delete_post', 'handleRequestOnPreDeletePost', 3); 539 539 break; 540 case WPRProtectFWRule_V68 1::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:540 case WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT: 541 541 $this->addWPHook($rule, 'wp_insert_post_empty_content', 542 542 'handleRequestOnWPInsertPostEmptyContent', 2); 543 543 break; 544 case WPRProtectFWRule_V68 1::EXE_ON_INSERT_USER_META:544 case WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META: 545 545 $this->addWPHook($rule, 'insert_user_meta', 'handleRequestOnInsertUserMeta', 4); 546 546 break; 547 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_OPTION:547 case WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION: 548 548 $this->addWPHook($rule, 'delete_option', 'handleRequestOnDeleteOption', 1, 'action'); 549 549 break; 550 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER:550 case WPRProtectFWRule_V683::EXE_ON_DELETE_USER: 551 551 $this->addWPHook($rule, 'delete_user', 'handleRequestOnDeleteUser', 3, 'action'); 552 552 break; 553 case WPRProtectFWRule_V68 1::EXE_ON_PASSWORD_RESET:553 case WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET: 554 554 $this->addWPHook($rule, 'password_reset', 'handleRequestOnPasswordReset', 2, 'action'); 555 555 break; 556 case WPRProtectFWRule_V68 1::EXE_ON_SEND_AUTH_COOKIES:556 case WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES: 557 557 $this->addWPHook($rule, 'send_auth_cookies', 'handleRequestOnSendAuthCookies', 6); 558 558 break; 559 case WPRProtectFWRule_V68 1::EXE_ON_SET_AUTH_COOKIE:559 case WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE: 560 560 $this->addWPHook($rule, 'set_auth_cookie', 'handleRequestOnSetAuthCookie', 6, 'action'); 561 561 break; 562 case WPRProtectFWRule_V68 1::EXE_ON_INIT:562 case WPRProtectFWRule_V683::EXE_ON_INIT: 563 563 $this->addWPHook($rule, 'init', 'handleRequestOnInit', 0, 'action'); 564 564 break; 565 case WPRProtectFWRule_V68 1::EXE_ON_USER_REGISTER:565 case WPRProtectFWRule_V683::EXE_ON_USER_REGISTER: 566 566 $this->addWPHook($rule, 'user_register', 'handleRequestOnUserRegister', 2, 'action'); 567 567 break; 568 case WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_META:568 case WPRProtectFWRule_V683::EXE_ON_ADD_USER_META: 569 569 $this->addWPHook($rule, 'add_user_meta', 'handleRequestOnAddUserMeta', 3, 'action'); 570 570 break; 571 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_METADATA:571 case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA: 572 572 $this->addWPHook($rule, 'update_user_metadata', 'handleRequestOnUpdateUserMetadata', 5); 573 573 break; 574 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_META:574 case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META: 575 575 $this->addWPHook($rule, 'update_user_meta', 'handleRequestOnUpdateUserMeta', 4, 'action'); 576 576 break; 577 case WPRProtectFWRule_V68 1::EXE_ON_ADD_OPTION:577 case WPRProtectFWRule_V683::EXE_ON_ADD_OPTION: 578 578 $this->addWPHook($rule, 'add_option', 'handleRequestOnAddOption', 2, 'action'); 579 579 break; 580 case WPRProtectFWRule_V68 1::EXE_ON_WP_PRE_INSERT_USER_DATA:580 case WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA: 581 581 $this->addWPHook($rule, 'wp_pre_insert_user_data', 'handleRequestOnWPPreInsertUserData', 4); 582 582 break; 583 case WPRProtectFWRule_V68 1::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:583 case WPRProtectFWRule_V683::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS: 584 584 $this->addWPHook($rule, 'rest_request_before_callbacks', 585 585 'handleRequestOnRestRequestBeforeCallbacks', 3); 586 586 break; 587 case WPRProtectFWRule_V68 1::EXE_ON_ADMIN_INIT:587 case WPRProtectFWRule_V683::EXE_ON_ADMIN_INIT: 588 588 $this->addWPHook($rule, 'admin_init', 'handleRequestOnAdminInit', 0, 'action'); 589 589 break; 590 case WPRProtectFWRule_V68 1::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:590 case WPRProtectFWRule_V683::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER: 591 591 $this->addWPHook($rule, 'wp_handle_upload_prefilter', 592 592 'handleRequestOnWPHandleUploadPrefilter', 1); 593 593 break; 594 case WPRProtectFWRule_V68 1::EXE_ON_TEMPLATE_REDIRECT:594 case WPRProtectFWRule_V683::EXE_ON_TEMPLATE_REDIRECT: 595 595 $this->addWPHook($rule, 'template_redirect', 'handleRequestOnTemplateRedirect', 0, 'action'); 596 596 break; 597 case WPRProtectFWRule_V68 1::EXE_ON_WP_LOADED:597 case WPRProtectFWRule_V683::EXE_ON_WP_LOADED: 598 598 $this->addWPHook($rule, 'wp_loaded', 'handleRequestOnWPLoaded', 0, 'action'); 599 599 break; 600 case WPRProtectFWRule_V68 1::EXE_ON_ADD_POST_METADATA:600 case WPRProtectFWRule_V683::EXE_ON_ADD_POST_METADATA: 601 601 $this->addWPHook($rule, 'add_post_metadata', 'handleRequestOnAddPostMetadata', 5); 602 602 break; 603 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_POST_METADATA:603 case WPRProtectFWRule_V683::EXE_ON_UPDATE_POST_METADATA: 604 604 $this->addWPHook($rule, 'update_post_metadata', 'handleRequestOnUpdatePostMetadata', 5); 605 605 break; 606 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_POST_METADATA:606 case WPRProtectFWRule_V683::EXE_ON_DELETE_POST_METADATA: 607 607 $this->addWPHook($rule, 'delete_post_metadata', 'handleRequestOnDeletePostMetadata', 5); 608 608 break; 609 case WPRProtectFWRule_V68 1::EXE_ON_ADD_TERM_METADATA:609 case WPRProtectFWRule_V683::EXE_ON_ADD_TERM_METADATA: 610 610 $this->addWPHook($rule, 'add_term_metadata', 'handleRequestOnAddTermMetadata', 5); 611 611 break; 612 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_TERM_METADATA:612 case WPRProtectFWRule_V683::EXE_ON_UPDATE_TERM_METADATA: 613 613 $this->addWPHook($rule, 'update_term_metadata', 'handleRequestOnUpdateTermMetadata', 5); 614 614 break; 615 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_TERM_METADATA:615 case WPRProtectFWRule_V683::EXE_ON_DELETE_TERM_METADATA: 616 616 $this->addWPHook($rule, 'delete_term_metadata', 'handleRequestOnDeleteTermMetadata', 5); 617 617 break; 618 case WPRProtectFWRule_V68 1::EXE_ON_ADD_COMMENT_METADATA:618 case WPRProtectFWRule_V683::EXE_ON_ADD_COMMENT_METADATA: 619 619 $this->addWPHook($rule, 'add_comment_metadata', 'handleRequestOnAddCommentMetadata', 5); 620 620 break; 621 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_COMMENT_METADATA:621 case WPRProtectFWRule_V683::EXE_ON_UPDATE_COMMENT_METADATA: 622 622 $this->addWPHook($rule, 'update_comment_metadata', 'handleRequestOnUpdateCommentMetadata', 5); 623 623 break; 624 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_COMMENT_METADATA:624 case WPRProtectFWRule_V683::EXE_ON_DELETE_COMMENT_METADATA: 625 625 $this->addWPHook($rule, 'delete_comment_metadata', 'handleRequestOnDeleteCommentMetadata', 5); 626 626 break; 627 case WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_METADATA:627 case WPRProtectFWRule_V683::EXE_ON_ADD_USER_METADATA: 628 628 $this->addWPHook($rule, 'add_user_metadata', 'handleRequestOnAddUserMetadata', 5); 629 629 break; 630 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER_METADATA:630 case WPRProtectFWRule_V683::EXE_ON_DELETE_USER_METADATA: 631 631 $this->addWPHook($rule, 'delete_user_metadata', 'handleRequestOnDeleteUserMetadata', 5); 632 632 break; … … 646 646 } 647 647 } else { 648 WPRProtectUtils_V68 1::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);648 WPRProtectUtils_V683::preInitWPHook($hook_name, $callback, -9999999, $accepted_args); 649 649 } 650 650 } … … 1204 1204 private function setIPCookie() { 1205 1205 if (!$this->is_ip_cookie_set && $this->isIPCookieEnabled() && 1206 !$this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME)) {1206 !$this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME)) { 1207 1207 1208 1208 $time = floor(time() / 86400); 1209 1209 $cookie = hash('sha256', $this->request->ip . $time . $this->cookie_key); 1210 1210 if ($cookie) { 1211 $this->setCookie(WPRProtectFW_V68 1::IP_COOKIE_NAME, $cookie, time() + 86400);1211 $this->setCookie(WPRProtectFW_V683::IP_COOKIE_NAME, $cookie, time() + 86400); 1212 1212 } 1213 1213 } … … 1217 1217 if (function_exists('current_user_can')) { 1218 1218 if (function_exists('is_super_admin') && is_super_admin()) { 1219 return WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_ADMIN;1219 return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN; 1220 1220 } 1221 1221 1222 1222 foreach ($this->custom_roles as $role) { 1223 1223 if (current_user_can($role)) { 1224 return WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CUSTOM;1224 return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM; 1225 1225 } 1226 1226 } 1227 1227 1228 foreach (WPRProtectFW_V68 1::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {1228 foreach (WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) { 1229 1229 if (current_user_can($role)) { 1230 1230 return $level; … … 1334 1334 $cookies = array(); 1335 1335 1336 if ($this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME) !== NULL) {1337 $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME);1338 $cookies[WPRProtectFW_V68 1::IP_COOKIE_NAME] = $cookie_val;1336 if ($this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME) !== NULL) { 1337 $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME); 1338 $cookies[WPRProtectFW_V683::IP_COOKIE_NAME] = $cookie_val; 1339 1339 } 1340 1340 … … 1500 1500 1501 1501 private function getUserBy($attribute, $value) { 1502 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V68 1::havePluginsLoaded()) {1502 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V683::havePluginsLoaded()) { 1503 1503 return get_user_by($attribute, $value); 1504 1504 } … … 1604 1604 } 1605 1605 1606 if ($this->matchCount(WPRProtectFWRule_V68 1::SQLIREGEX, $value) > 2) {1606 if ($this->matchCount(WPRProtectFWRule_V683::SQLIREGEX, $value) > 2) { 1607 1607 $profiled_data[$key]["sql"] = true; 1608 1608 } … … 1693 1693 private function canRequestBypassFirewall() { 1694 1694 if ($this->isRequestIPWhitelisted() || $this->isRequestHasValidBypassCookie()) { 1695 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_WHITELISTED;1696 $this->request->status = WPRProtectRequest_V68 1::STATUS_BYPASSED;1695 $this->request->category = WPRProtectRequest_V683::CATEGORY_WHITELISTED; 1696 $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED; 1697 1697 1698 1698 return true; 1699 } elseif (WPRProtectUtils_V68 1::isPrivateIP($this->request->ip)) {1700 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_PRIVATEIP;1701 $this->request->status = WPRProtectRequest_V68 1::STATUS_BYPASSED;1699 } elseif (WPRProtectUtils_V683::isPrivateIP($this->request->ip)) { 1700 $this->request->category = WPRProtectRequest_V683::CATEGORY_PRIVATEIP; 1701 $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED; 1702 1702 1703 1703 return true; … … 1723 1723 1724 1724 private function handleRequestOnRuleMatch($rules, $engine_vars = array(), $log_data = array()) { 1725 $normalized_engine_vars = WPRProtectFWRuleEngine_V68 1::normalizeVariables($engine_vars);1725 $normalized_engine_vars = WPRProtectFWRuleEngine_V683::normalizeVariables($engine_vars); 1726 1726 1727 1727 foreach ($rules as $rule) { … … 1733 1733 if (array_key_exists('variables', $rule->opts)) { 1734 1734 $_engine_vars = array_merge($_engine_vars, 1735 WPRProtectFWRuleEngine_V68 1::normalizeVariables($rule->opts['variables']));1736 } 1737 1738 $rule_engine = new WPRProtectFWRuleEngine_V68 1($this->request, $_engine_vars);1735 WPRProtectFWRuleEngine_V683::normalizeVariables($rule->opts['variables'])); 1736 } 1737 1738 $rule_engine = new WPRProtectFWRuleEngine_V683($this->request, $_engine_vars); 1739 1739 1740 1740 if ($rule_engine->evaluate($rule) && !$rule_engine->hasError()) { … … 1749 1749 case "ALLOW": 1750 1750 $this->break_rule_matching = true; 1751 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_RULE_ALLOWED;1751 $this->request->category = WPRProtectRequest_V683::CATEGORY_RULE_ALLOWED; 1752 1752 return; 1753 1753 case "BLOCK": 1754 1754 if ($this->isModeProtect()) { 1755 $this->terminateRequest(WPRProtectRequest_V68 1::CATEGORY_RULE_BLOCKED);1755 $this->terminateRequest(WPRProtectRequest_V683::CATEGORY_RULE_BLOCKED); 1756 1756 } 1757 1757 return; … … 1769 1769 private function terminateRequest($category) { 1770 1770 $this->request->category = $category; 1771 $this->request->status = WPRProtectRequest_V68 1::STATUS_BLOCKED;1771 $this->request->status = WPRProtectRequest_V683::STATUS_BLOCKED; 1772 1772 $this->request->setRespCode(403); 1773 1773 1774 1774 if ($this->can_set_cache_prevention_cookie && 1775 !$this->request->getCookies(WPRProtectFW_V68 1::PREVENT_CACHE_COOKIE_NAME)) {1775 !$this->request->getCookies(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME)) { 1776 1776 $value = "Prevent Caching Response."; 1777 $this->setCookie(WPRProtectFW_V68 1::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);1777 $this->setCookie(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200); 1778 1778 } 1779 1779 … … 1803 1803 $cookie = $this->generateBypassCookie(); 1804 1804 if ($cookie) { 1805 $this->setCookie(WPRProtectFW_V68 1::BYPASS_COOKIE_NAME, $cookie);1805 $this->setCookie(WPRProtectFW_V683::BYPASS_COOKIE_NAME, $cookie); 1806 1806 } 1807 1807 } -
wpremote/tags/6.83/protect/fw/rule.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectFWRule_V68 1')) :5 class WPRProtectFWRule_V68 1{4 if (!class_exists('WPRProtectFWRule_V683')) : 5 class WPRProtectFWRule_V683 { 6 6 public $id; 7 7 public $logic; … … 105 105 106 106 if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) || 107 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V68 1::VERSION) {107 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V683::VERSION) { 108 108 109 109 return false; … … 111 111 112 112 if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) || 113 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V68 1::VERSION)) {113 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V683::VERSION)) { 114 114 115 115 return false; … … 130 130 if (!array_key_exists('execute_on', $attributes)) { 131 131 if (array_key_exists('level', $attributes) && $attributes['level'] === 1) { 132 $attributes['execute_on'] = WPRProtectFWRule_V68 1::EXE_ON_BOOT;132 $attributes['execute_on'] = WPRProtectFWRule_V683::EXE_ON_BOOT; 133 133 } else { 134 134 return false; … … 136 136 } 137 137 138 return new WPRProtectFWRule_V68 1($attributes);138 return new WPRProtectFWRule_V683($attributes); 139 139 } 140 140 141 141 public function isExeOnBoot() { 142 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_BOOT);142 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_BOOT); 143 143 } 144 144 145 145 public function isExeOnPreUpdateOption() { 146 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PRE_UPDATE_OPTION);146 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION); 147 147 } 148 148 149 149 public function isExeOnPreDeletePost() { 150 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PRE_DELETE_POST);150 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST); 151 151 } 152 152 153 153 public function isExeOnWPInsertPostEmptyContent() { 154 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);154 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT); 155 155 } 156 156 157 157 public function isExeOnInsertUserMeta() { 158 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_INSERT_USER_META);158 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META); 159 159 } 160 160 161 161 public function isExeOnDeleteOption() { 162 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_DELETE_OPTION);162 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION); 163 163 } 164 164 165 165 public function isExeOnDeleteUser() { 166 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER);166 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_USER); 167 167 } 168 168 169 169 public function isExeOnPasswordReset() { 170 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PASSWORD_RESET);170 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET); 171 171 } 172 172 173 173 public function isExeOnSendAuthCookies() { 174 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_SEND_AUTH_COOKIES);174 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES); 175 175 } 176 176 177 177 public function isExeOnSetAuthCookie() { 178 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_SET_AUTH_COOKIE);178 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE); 179 179 } 180 180 181 181 public function isExeOnInit() { 182 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_INIT);182 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INIT); 183 183 } 184 184 185 185 public function isExeOnUserRegister() { 186 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_USER_REGISTER);186 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_USER_REGISTER); 187 187 } 188 188 189 189 public function isExeOnAddUserMeta() { 190 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_META);190 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_USER_META); 191 191 } 192 192 193 193 public function isExeOnUpdateUserMetadata() { 194 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_METADATA);194 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA); 195 195 } 196 196 197 197 public function isExeOnUpdateUserMeta() { 198 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_META);198 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META); 199 199 } 200 200 201 201 public function isExeOnAddOption() { 202 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_ADD_OPTION);202 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_OPTION); 203 203 } 204 204 205 205 public function isExeOnWpPreInsertUserData() { 206 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_WP_PRE_INSERT_USER_DATA);206 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA); 207 207 } 208 208 } -
wpremote/tags/6.83/protect/fw/rule/engine.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!class_exists('WPRProtectFWRuleEngine_V68 1')) :5 if (!class_exists('WPRProtectFWRuleEngine_V683')) : 6 6 require_once dirname( __FILE__ ) . '/functions.php'; 7 7 8 class WPRProtectFWRuleEngine_V68 1{9 use WPRProtectFWRuleStringFunc_V68 1;10 use WPRProtectFWRuleArrayFunc_V68 1;11 use WPRProtectFWRuleMiscFunc_V68 1;12 use WPRProtectFWRuleRequestFunc_V68 1;13 use WPRProtectFWRuleWPFunc_V68 1;8 class WPRProtectFWRuleEngine_V683 { 9 use WPRProtectFWRuleStringFunc_V683; 10 use WPRProtectFWRuleArrayFunc_V683; 11 use WPRProtectFWRuleMiscFunc_V683; 12 use WPRProtectFWRuleRequestFunc_V683; 13 use WPRProtectFWRuleWPFunc_V683; 14 14 15 15 private $request; … … 26 26 const WILDCARD_KEY = '*'; 27 27 const FUNC_NAME_PREFIX = '_rf_'; 28 const CONST_NAME_PREFIX = 'WPRProtectFWRule_V68 1::';28 const CONST_NAME_PREFIX = 'WPRProtectFWRule_V683::'; 29 29 const ALLOWED_EXT_CONSTANTS = [ 30 30 'DOING_CRON' … … 53 53 try { 54 54 return $this->executeStmt($rule->logic); 55 } catch (WPRProtectRuleError_V68 1$e) {55 } catch (WPRProtectRuleError_V683 $e) { 56 56 $this->error = $e; 57 57 } … … 124 124 private function getValue($stmt) { 125 125 if (!is_array($stmt) || empty($stmt["type"])) { 126 throw new WPRProtectRuleError_V68 1(126 throw new WPRProtectRuleError_V683( 127 127 $this->addExState("InvalidStatementError: Malformed value statement")); 128 128 } … … 133 133 case "NUMBER": 134 134 if (!isset($stmt["value"]) || !is_int($stmt["value"])) { 135 throw new WPRProtectRuleError_V68 1(135 throw new WPRProtectRuleError_V683( 136 136 $this->addExState("TypeError: Value is not a number") 137 137 ); … … 141 141 case "STRING": 142 142 if (!isset($stmt["value"]) || !is_string($stmt["value"])) { 143 throw new WPRProtectRuleError_V68 1(143 throw new WPRProtectRuleError_V683( 144 144 $this->addExState("TypeError: Value is not a string") 145 145 ); … … 149 149 case "BOOL": 150 150 if (!isset($stmt["value"]) || !is_bool($stmt["value"])) { 151 throw new WPRProtectRuleError_V68 1(151 throw new WPRProtectRuleError_V683( 152 152 $this->addExState("TypeError: Value is not a boolean") 153 153 ); … … 157 157 case "CONST": 158 158 if (!isset($stmt["value"]) || !is_string($stmt["value"])) { 159 throw new WPRProtectRuleError_V68 1(159 throw new WPRProtectRuleError_V683( 160 160 $this->addExState("TypeError: Invalid constant name") 161 161 ); … … 169 169 170 170 if (!defined($name)) { 171 throw new WPRProtectRuleError_V68 1(171 throw new WPRProtectRuleError_V683( 172 172 $this->addExState("TypeError: Undefined constant" . $stmt["value"]) 173 173 ); … … 177 177 case "ARRAY": 178 178 if (!isset($stmt["value"]) || !is_array($stmt["value"])) { 179 throw new WPRProtectRuleError_V68 1(179 throw new WPRProtectRuleError_V683( 180 180 $this->addExState("TypeError: Value is not a array") 181 181 ); … … 208 208 private function executeStmt($stmt) { 209 209 if (!is_array($stmt) || empty($stmt["type"])) { 210 throw new WPRProtectRuleError_V68 1(210 throw new WPRProtectRuleError_V683( 211 211 $this->addExState("InvalidStatementError: Malformed logic statement") 212 212 ); … … 220 220 case "AND": 221 221 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) { 222 throw new WPRProtectRuleError_V68 1(222 throw new WPRProtectRuleError_V683( 223 223 $this->addExState("InvalidOperandError: Malformed operand(s)") 224 224 ); … … 229 229 case "OR": 230 230 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) { 231 throw new WPRProtectRuleError_V68 1(231 throw new WPRProtectRuleError_V683( 232 232 $this->addExState("InvalidOperandError: Malformed operand(s)") 233 233 ); … … 238 238 case "NOT": 239 239 if (empty($stmt["value"])) { 240 throw new WPRProtectRuleError_V68 1(240 throw new WPRProtectRuleError_V683( 241 241 $this->addExState("InvalidOperandError: Malformed operand") 242 242 ); … … 247 247 case "FUNCTION": 248 248 if (empty($stmt["name"]) || !is_string($stmt["name"])) { 249 throw new WPRProtectRuleError_V68 1(249 throw new WPRProtectRuleError_V683( 250 250 $this->addExState("InvalidFunctionName: Malformed name") 251 251 ); … … 256 256 257 257 if (!is_callable($handler)) { 258 throw new WPRProtectRuleError_V68 1(258 throw new WPRProtectRuleError_V683( 259 259 $this->addExState("UndefinedFunctionCall: " . $stmt["name"]) 260 260 ); … … 262 262 263 263 if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) { 264 throw new WPRProtectRuleError_V68 1(264 throw new WPRProtectRuleError_V683( 265 265 $this->addExState("InvalidArguments: Malformed args") 266 266 ); … … 275 275 break; 276 276 default: 277 throw new WPRProtectRuleError_V68 1(277 throw new WPRProtectRuleError_V683( 278 278 $this->addExState("UnknownOperation: -") 279 279 ); … … 286 286 private function processRuleFunctionParams($func_name, $args_cnt, $args, $required_params = 0, $param_types = array()) { 287 287 if (($args_cnt < $required_params)) { 288 throw new WPRProtectRuleError_V68 1(288 throw new WPRProtectRuleError_V683( 289 289 $this->addExState("ArgumentCountError: Too few arguments for " . $func_name) 290 290 ); … … 293 293 foreach ($param_types as $pos => $type) { 294 294 if (!is_int($pos)) { 295 throw new WPRProtectRuleError_V68 1(295 throw new WPRProtectRuleError_V683( 296 296 $this->addExState("InvalidParamType: " . $pos) 297 297 ); … … 301 301 case "string": 302 302 if (!isset($args[$pos]) || !is_string($args[$pos])) { 303 throw new WPRProtectRuleError_V68 1(303 throw new WPRProtectRuleError_V683( 304 304 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a string.") 305 305 ); … … 308 308 case 'integer': 309 309 if (!isset($args[$pos]) || !is_int($args[$pos])) { 310 throw new WPRProtectRuleError_V68 1(310 throw new WPRProtectRuleError_V683( 311 311 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a integer.") 312 312 ); … … 315 315 case 'double': 316 316 if (!isset($args[$pos]) || !is_double($args[$pos])) { 317 throw new WPRProtectRuleError_V68 1(317 throw new WPRProtectRuleError_V683( 318 318 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a double.") 319 319 ); … … 322 322 case 'boolean': 323 323 if (!isset($args[$pos]) || !is_bool($args[$pos])) { 324 throw new WPRProtectRuleError_V68 1(324 throw new WPRProtectRuleError_V683( 325 325 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a boolean.") 326 326 ); … … 329 329 case 'array': 330 330 if (!isset($args[$pos]) || !is_array($args[$pos])) { 331 throw new WPRProtectRuleError_V68 1(331 throw new WPRProtectRuleError_V683( 332 332 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.") 333 333 ); … … 337 337 break; 338 338 default: 339 throw new WPRProtectRuleError_V68 1(339 throw new WPRProtectRuleError_V683( 340 340 $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name) 341 341 ); -
wpremote/tags/6.83/protect/fw/rule/errors.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectRuleError_V68 1')) :5 class WPRProtectRuleError_V68 1extends Exception {4 if (!class_exists('WPRProtectRuleError_V683')) : 5 class WPRProtectRuleError_V683 extends Exception { 6 6 //Root rule error class. 7 7 } -
wpremote/tags/6.83/protect/fw/rule/functions/array.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V68 1')) :6 trait WPRProtectFWRuleArrayFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V683')) : 6 trait WPRProtectFWRuleArrayFunc_V683 { 7 7 private function _rf_inArray() { 8 8 $args = $this->processRuleFunctionParams( … … 17 17 18 18 if (!is_array($array)) { 19 throw new WPRProtectRuleError_V68 1(19 throw new WPRProtectRuleError_V683( 20 20 $this->addExState("inArray: 2nd param is not an array") 21 21 ); … … 23 23 24 24 if (!is_bool($strict)) { 25 throw new WPRProtectRuleError_V68 1(25 throw new WPRProtectRuleError_V683( 26 26 $this->addExState("inArray: 3rd param is not a boolean") 27 27 ); … … 54 54 } 55 55 } else { 56 throw new WPRProtectRuleError_V68 1(56 throw new WPRProtectRuleError_V683( 57 57 $this->addExState("recInArray: Expects an array") 58 58 ); … … 73 73 74 74 if (!is_array($array)) { 75 throw new WPRProtectRuleError_V68 1(75 throw new WPRProtectRuleError_V683( 76 76 $this->addExState("arrayKeyExists: Array must be of type array") 77 77 ); 78 78 } elseif (!is_string($key) && !is_int($key)) { 79 throw new WPRProtectRuleError_V68 1(79 throw new WPRProtectRuleError_V683( 80 80 $this->addExState("arrayKeyExists: Key must be of type string or int") 81 81 ); … … 110 110 111 111 if (!is_bool($recursive)) { 112 throw new WPRProtectRuleError_V68 1(112 throw new WPRProtectRuleError_V683( 113 113 $this->addExState("getArrayKeys: 2nd param must be a boolean") 114 114 ); … … 140 140 141 141 if (!is_bool($recursive)) { 142 throw new WPRProtectRuleError_V68 1(142 throw new WPRProtectRuleError_V683( 143 143 $this->addExState("hasAnyArrayKey: 3rd param must be a boolean") 144 144 ); … … 148 148 foreach ($keys as $key) { 149 149 if (!is_int($key) && !is_string($key)) { 150 throw new WPRProtectRuleError_V68 1(150 throw new WPRProtectRuleError_V683( 151 151 $this->addExState("hasAnyArrayKey: Key must be of type string or int") 152 152 ); … … 189 189 190 190 if (!is_bool($recursive)) { 191 throw new WPRProtectRuleError_V68 1(191 throw new WPRProtectRuleError_V683( 192 192 $this->addExState("keyMatches: 3rd param must be a boolean") 193 193 ); … … 224 224 225 225 if ($resp === false) { 226 throw new WPRProtectRuleError_V68 1(226 throw new WPRProtectRuleError_V683( 227 227 $this->addExState("keyMatches: Invalid regular expression") 228 228 ); … … 233 233 $resp = WPRHelper::safePregMatch($pattern, (string) $key); 234 234 if ($resp === false) { 235 throw new WPRProtectRuleError_V68 1(235 throw new WPRProtectRuleError_V683( 236 236 $this->addExState("keyMatches: Regex match failed") 237 237 ); … … 242 242 243 243 private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) { 244 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {244 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 245 245 return false; 246 246 } … … 262 262 263 263 private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) { 264 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {264 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 265 265 return; 266 266 } … … 277 277 278 278 private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) { 279 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {279 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 280 280 return false; 281 281 } … … 297 297 298 298 private function enforceArrayTraversalLimit($func_name, $traversed_keys) { 299 if ($traversed_keys > WPRProtectFWRuleEngine_V68 1::MAX_ARRAY_KEYS_TO_TRAVERSE) {300 throw new WPRProtectRuleError_V68 1(299 if ($traversed_keys > WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) { 300 throw new WPRProtectRuleError_V683( 301 301 $this->addExState( 302 302 "TraversalLimitError: " . $func_name . " exceeded " . 303 WPRProtectFWRuleEngine_V68 1::MAX_ARRAY_KEYS_TO_TRAVERSE .303 WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE . 304 304 " array keys" 305 305 ) … … 321 321 foreach ($keys as $key) { 322 322 if (!is_int($key) && !is_string($key)) { 323 throw new WPRProtectRuleError_V68 1(323 throw new WPRProtectRuleError_V683( 324 324 $this->addExState("digArray: Keys must be a valid array of string, or integer type") 325 325 ); … … 342 342 343 343 if (empty($keys)) { 344 throw new WPRProtectRuleError_V68 1(344 throw new WPRProtectRuleError_V683( 345 345 $this->addExState("digArrayValues: Keys must not be empty") 346 346 ); 347 347 } 348 348 349 if (count($keys) > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {350 throw new WPRProtectRuleError_V68 1(349 if (count($keys) > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 350 throw new WPRProtectRuleError_V683( 351 351 $this->addExState( 352 352 "digArrayValues: Keys exceeded " . 353 WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .353 WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC . 354 354 " levels of traversal" 355 355 ) … … 359 359 foreach ($keys as $key) { 360 360 if (!is_int($key) && !is_string($key)) { 361 throw new WPRProtectRuleError_V68 1(361 throw new WPRProtectRuleError_V683( 362 362 $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type") 363 363 ); … … 376 376 } 377 377 378 if ($key === WPRProtectFWRuleEngine_V68 1::WILDCARD_KEY) {378 if ($key === WPRProtectFWRuleEngine_V683::WILDCARD_KEY) { 379 379 foreach ($node as $value) { 380 380 $traversed_keys += 1; … … 417 417 foreach ($keys as $key) { 418 418 if (!is_int($key) && !is_string($key)) { 419 throw new WPRProtectRuleError_V68 1(419 throw new WPRProtectRuleError_V683( 420 420 $this->addExState("filterArray: Keys must be a valid array of string, or integer type") 421 421 ); … … 438 438 439 439 if (!is_string($key) && !is_int($key)) { 440 throw new WPRProtectRuleError_V68 1(440 throw new WPRProtectRuleError_V683( 441 441 $this->addExState("getArrayVal: Key must be a valid string or integer") 442 442 ); … … 519 519 foreach ($array as $element) { 520 520 if (!is_scalar($element)) { 521 throw new WPRProtectRuleError_V68 1(521 throw new WPRProtectRuleError_V683( 522 522 $this->addExState("arrayJoin: Array element must be of scalar type") 523 523 ); -
wpremote/tags/6.83/protect/fw/rule/functions/misc.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V68 1')) :6 trait WPRProtectFWRuleMiscFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V683')) : 6 trait WPRProtectFWRuleMiscFunc_V683 { 7 7 private function _rf_isTrue() { 8 8 $args = $this->processRuleFunctionParams( … … 73 73 74 74 if (!array_key_exists($name, $this->variables)) { 75 throw new WPRProtectRuleError_V68 1(75 throw new WPRProtectRuleError_V683( 76 76 $this->addExState("UndefinedVariableError: " . $name . " is not defined.") 77 77 ); … … 134 134 $resp = WPRHelper::safePregMatch((string) $pattern, (string) $subject); 135 135 if ($resp === false) { 136 throw new WPRProtectRuleError_V68 1(136 throw new WPRProtectRuleError_V683( 137 137 $this->addExState('BVHelper::safePregMatch' . serialize($subject)) 138 138 ); … … 175 175 $count = preg_match_all((string) $pattern, (string) $subject, $matches); 176 176 if ($count === false) { 177 throw new WPRProtectRuleError_V68 1(177 throw new WPRProtectRuleError_V683( 178 178 $this->addExState("preg_match_all: " . serialize($subject)) 179 179 ); … … 201 201 $count = preg_match_all((string) $pattern, (string) $subject, $matches); 202 202 if ($count === false) { 203 throw new WPRProtectRuleError_V68 1(203 throw new WPRProtectRuleError_V683( 204 204 $this->addExState("preg_match_all: " . serialize($subject)) 205 205 ); -
wpremote/tags/6.83/protect/fw/rule/functions/request.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V68 1')) :6 trait WPRProtectFWRuleRequestFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V683')) : 6 trait WPRProtectFWRuleRequestFunc_V683 { 7 7 private function _rf_getAction() { 8 8 $args = $this->processRuleFunctionParams( … … 496 496 497 497 if (!array_key_exists('ID', $user)) { 498 throw new WPRProtectRuleError_V68 1(498 throw new WPRProtectRuleError_V683( 499 499 $this->addExState("wpUserId: user's id doesn't exist") 500 500 ); -
wpremote/tags/6.83/protect/fw/rule/functions/string.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleStringFunc_V68 1')) :6 trait WPRProtectFWRuleStringFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleStringFunc_V683')) : 6 trait WPRProtectFWRuleStringFunc_V683 { 7 7 private function _rf_isNumeric() { 8 8 $args = $this->processRuleFunctionParams( … … 239 239 } 240 240 } else { 241 throw new WPRProtectRuleError_V68 1(241 throw new WPRProtectRuleError_V683( 242 242 $this->addExState("containsAnySubstring: Expects an array of substrings.") 243 243 ); … … 274 274 275 275 if (!is_int($offset)) { 276 throw new WPRProtectRuleError_V68 1(276 throw new WPRProtectRuleError_V683( 277 277 $this->addExState("strPos: Offset should be an integer") 278 278 ); … … 319 319 320 320 if (empty($separator)) { 321 throw new WPRProtectRuleError_V68 1(321 throw new WPRProtectRuleError_V683( 322 322 $this->addExState("splitString: Separator cannot be empty") 323 323 ); … … 325 325 326 326 if (!is_int($limit)) { 327 throw new WPRProtectRuleError_V68 1(327 throw new WPRProtectRuleError_V683( 328 328 $this->addExState("splitString: Limit should be an integer") 329 329 ); … … 344 344 345 345 if (!is_bool($recursive)) { 346 throw new WPRProtectRuleError_V68 1(346 throw new WPRProtectRuleError_V683( 347 347 $this->addExState("urlDecode: Recursive flag should be a boolean") 348 348 ); … … 363 363 364 364 if (!is_bool($recursive)) { 365 throw new WPRProtectRuleError_V68 1(365 throw new WPRProtectRuleError_V683( 366 366 $this->addExState("rawUrlDecode: Recursive flag should be a boolean") 367 367 ); … … 382 382 383 383 if (!is_bool($recursive)) { 384 throw new WPRProtectRuleError_V68 1(384 throw new WPRProtectRuleError_V683( 385 385 $this->addExState("htmlEntityDecode: Recursive flag should be a boolean") 386 386 ); … … 401 401 402 402 if (!is_bool($recursive)) { 403 throw new WPRProtectRuleError_V68 1(403 throw new WPRProtectRuleError_V683( 404 404 $this->addExState("stripSlashes: Recursive flag should be a boolean") 405 405 ); … … 410 410 411 411 private function normalizeStringValue($value, $operation, $recursive, $depth = 1) { 412 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {412 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 413 413 return null; 414 414 } … … 442 442 } 443 443 444 throw new WPRProtectRuleError_V68 1(444 throw new WPRProtectRuleError_V683( 445 445 $this->addExState("normalizeStringValue: Invalid normalization operation") 446 446 ); -
wpremote/tags/6.83/protect/fw/rule/functions/wp.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleWPFunc_V68 1')) :6 trait WPRProtectFWRuleWPFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleWPFunc_V683')) : 6 trait WPRProtectFWRuleWPFunc_V683 { 7 7 private function _rf_sanitizeUser() { 8 8 $args = $this->processRuleFunctionParams( … … 16 16 $strict = $args[1]; 17 17 18 if (!function_exists('sanitize_user') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {19 throw new WPRProtectRuleError_V68 1(18 if (!function_exists('sanitize_user') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 19 throw new WPRProtectRuleError_V683( 20 20 $this->addExState("sanitizeUser: Func sanitize_user doesn't exist.") 21 21 ); … … 34 34 $data = $args[0]; 35 35 36 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {37 throw new WPRProtectRuleError_V68 1(36 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 37 throw new WPRProtectRuleError_V683( 38 38 $this->addExState("maybeSerialize: Func maybe_serialize doesn't exist.") 39 39 ); … … 50 50 ); 51 51 52 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {53 throw new WPRProtectRuleError_V68 1(52 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V683::havePluginsLoaded()) { 53 throw new WPRProtectRuleError_V683( 54 54 $this->addExState("isUserLoggedIn: Func is_user_logged_in doesn't exist.") 55 55 ); … … 66 66 ); 67 67 68 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {69 throw new WPRProtectRuleError_V68 1(68 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V683::havePluginsLoaded()) { 69 throw new WPRProtectRuleError_V683( 70 70 $this->addExState("getCurrentWPUser: Func wp_get_current_user doesn't exist.") 71 71 ); 72 72 } 73 73 74 return WPRProtectFWRuleEngine_V68 1::toAllowedType(wp_get_current_user());74 return WPRProtectFWRuleEngine_V683::toAllowedType(wp_get_current_user()); 75 75 } 76 76 … … 87 87 $arg2 = isset($args[2]) ? $args[2] : null; 88 88 89 if (!function_exists('current_user_can') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {90 throw new WPRProtectRuleError_V68 1(89 if (!function_exists('current_user_can') || !WPRProtectUtils_V683::havePluginsLoaded()) { 90 throw new WPRProtectRuleError_V683( 91 91 $this->addExState("currentUserCan: Required funcs doesn't exist.") 92 92 ); … … 115 115 $value = $args[1]; 116 116 117 if (!function_exists('get_user_by') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {118 throw new WPRProtectRuleError_V68 1(117 if (!function_exists('get_user_by') || !WPRProtectUtils_V683::havePluginsLoaded()) { 118 throw new WPRProtectRuleError_V683( 119 119 $this->addExState("getUserBy: Func get_user_by doesn't exist") 120 120 ); … … 123 123 if ($field === 'ID' || $field === 'id') { 124 124 if (!is_string($value) && !is_int($value)) { 125 throw new WPRProtectRuleError_V68 1(125 throw new WPRProtectRuleError_V683( 126 126 $this->addExState("getUserBy: Value must be a valid string or an integer") 127 127 ); 128 128 } 129 129 } elseif (!is_string($value)) { 130 throw new WPRProtectRuleError_V68 1(130 throw new WPRProtectRuleError_V683( 131 131 $this->addExState("getUserBy: Value must be a valid string") 132 132 ); … … 138 138 } 139 139 140 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user);140 return WPRProtectFWRuleEngine_V683::toAllowedType($user); 141 141 } 142 142 … … 151 151 152 152 if (!array_key_exists("allcaps", $user)) { 153 throw new WPRProtectRuleError_V68 1(153 throw new WPRProtectRuleError_V683( 154 154 $this->addExState("getCurrentWPUserCapabilities: allcaps doesn't exist in user.") 155 155 ); 156 156 } 157 157 158 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user["allcaps"]);158 return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]); 159 159 } 160 160 … … 174 174 175 175 if (!array_key_exists("allcaps", $user)) { 176 throw new WPRProtectRuleError_V68 1(176 throw new WPRProtectRuleError_V683( 177 177 $this->addExState("getUserCapabilities: allcaps doesn't exist in user.") 178 178 ); 179 179 } 180 180 181 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user["allcaps"]);181 return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]); 182 182 } 183 183 … … 203 203 $default_value = isset($args[1]) ? $args[1] : false; 204 204 205 if (!function_exists('get_option') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {206 throw new WPRProtectRuleError_V68 1(205 if (!function_exists('get_option') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 206 throw new WPRProtectRuleError_V683( 207 207 $this->addExState("getOption: Func get_option doesn't exist.") 208 208 ); 209 209 } 210 210 211 return WPRProtectFWRuleEngine_V68 1::toAllowedType(get_option($option, $default_value));211 return WPRProtectFWRuleEngine_V683::toAllowedType(get_option($option, $default_value)); 212 212 } 213 213 … … 223 223 $login = $args[1]; 224 224 225 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {226 throw new WPRProtectRuleError_V68 1(225 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V683::havePluginsLoaded()) { 226 throw new WPRProtectRuleError_V683( 227 227 $this->addExState("checkPasswordResetKey: Func check_password_reset_key doesn't exist.") 228 228 ); … … 232 232 233 233 if (is_a($user, "WP_User")) { 234 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user);234 return WPRProtectFWRuleEngine_V683::toAllowedType($user); 235 235 } 236 236 … … 287 287 $value = $args[0]; 288 288 289 if (!function_exists('wp_unslash') || !WPRProtectUtils_V68 1::haveMuPluginsLoaded()) {290 throw new WPRProtectRuleError_V68 1(289 if (!function_exists('wp_unslash') || !WPRProtectUtils_V683::haveMuPluginsLoaded()) { 290 throw new WPRProtectRuleError_V683( 291 291 $this->addExState("wpUnslash: Func wp_unslash doesn't exist.") 292 292 ); … … 294 294 295 295 if (!is_string($value) && !is_array($value)) { 296 throw new WPRProtectRuleError_V68 1(296 throw new WPRProtectRuleError_V683( 297 297 $this->addExState("wpUnslash: Value must be a valid string or an array") 298 298 ); … … 310 310 311 311 if (!defined('COOKIEHASH')) { 312 throw new WPRProtectRuleError_V68 1(312 throw new WPRProtectRuleError_V683( 313 313 $this->addExState("parseResetPassCookie: COOKIEHASH is not defined.") 314 314 ); -
wpremote/tags/6.83/protect/ipstore.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstore_V68 1')) :4 if (!class_exists('WPRProtectIpstore_V683')) : 5 5 require_once dirname( __FILE__ ) . '/request.php'; 6 6 require_once dirname( __FILE__ ) . '/ipstore/fs.php'; 7 7 require_once dirname( __FILE__ ) . '/ipstore/db.php'; 8 8 9 class WPRProtectIpstore_V68 1{9 class WPRProtectIpstore_V683 { 10 10 private $storage; 11 11 private $storage_type; … … 14 14 const STORAGE_TYPE_DB = 1; 15 15 16 function __construct($storage_type = WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {16 function __construct($storage_type = WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 17 17 $this->storage_type = $storage_type; 18 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_FS) {19 $this->storage = new WPRProtectIpstoreFS_V68 1();18 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_FS) { 19 $this->storage = new WPRProtectIpstoreFS_V683(); 20 20 } else { 21 $this->storage = new WPRProtectIpstoreDB_V68 1();21 $this->storage = new WPRProtectIpstoreDB_V683(); 22 22 } 23 23 } 24 24 25 25 public static function uninstall() { 26 WPRProtectIpstoreDB_V68 1::uninstall();26 WPRProtectIpstoreDB_V683::uninstall(); 27 27 } 28 28 29 29 public function isLPIPBlacklisted($ip) { 30 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {30 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 31 31 return $this->storage->isLPIPBlacklisted($ip); 32 32 } … … 34 34 35 35 public function isLPIPWhitelisted($ip) { 36 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {36 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 37 37 return $this->storage->isLPIPWhitelisted($ip); 38 38 } -
wpremote/tags/6.83/protect/ipstore/db.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstoreDB_V68 1')) :5 class WPRProtectIpstoreDB_V68 1{4 if (!class_exists('WPRProtectIpstoreDB_V683')) : 5 class WPRProtectIpstoreDB_V683 { 6 6 const TABLE_NAME = 'ip_store'; 7 7 … … 11 11 #XNOTE: check this. 12 12 public static function blacklistedTypes() { 13 return WPRProtectRequest_V68 1::blacklistedCategories();13 return WPRProtectRequest_V683::blacklistedCategories(); 14 14 } 15 15 16 16 public static function whitelistedTypes() { 17 return WPRProtectRequest_V68 1::whitelistedCategories();17 return WPRProtectRequest_V683::whitelistedCategories(); 18 18 } 19 19 20 20 public static function uninstall() { 21 WPRProtect_V68 1::$db->dropBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);21 WPRProtect_V683::$db->dropBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME); 22 22 } 23 23 24 24 public function isLPIPBlacklisted($ip) { 25 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_LP);25 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 26 26 } 27 27 28 28 public function isLPIPWhitelisted($ip) { 29 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_LP);29 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 30 30 } 31 31 32 32 public function getTypeIfBlacklistedIP($ip) { 33 return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);33 return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 34 34 } 35 35 36 36 public function isFWIPBlacklisted($ip) { 37 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);37 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 38 38 } 39 39 40 40 public function isFWIPWhitelisted($ip) { 41 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);41 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 42 42 } 43 43 … … 50 50 #XNOTE: getIPCategory or getIPType? 51 51 private function getIPType($ip, $types, $category) { 52 $table = WPRProtect_V68 1::$db->getBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);52 $table = WPRProtect_V683::$db->getBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME); 53 53 54 if (WPRProtect_V68 1::$db->isTablePresent($table)) {55 $binIP = WPRProtectUtils_V68 1::bvInetPton($ip);56 $is_v6 = WPRProtectUtils_V68 1::isIPv6($ip);54 if (WPRProtect_V683::$db->isTablePresent($table)) { 55 $binIP = WPRProtectUtils_V683::bvInetPton($ip); 56 $is_v6 = WPRProtectUtils_V683::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_V68 1::CATEGORY_FW) {60 if ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) { 61 61 $query_str .= "`is_fw` = true"; 62 62 } else { … … 65 65 $query_str .= " && `type` in (" . implode(',', $types) . ") && `is_v6` = %d LIMIT 1;"; 66 66 67 $query = WPRProtect_V68 1::$db->prepare($query_str, array($binIP, $binIP, $is_v6));67 $query = WPRProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6)); 68 68 69 return WPRProtect_V68 1::$db->getVar($query, 5);69 return WPRProtect_V683::$db->getVar($query, 5); 70 70 } 71 71 } -
wpremote/tags/6.83/protect/ipstore/fs.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstoreFS_V68 1')) :5 class WPRProtectIpstoreFS_V68 1{4 if (!class_exists('WPRProtectIpstoreFS_V683')) : 5 class WPRProtectIpstoreFS_V683 { 6 6 private $whitelisted_ips; 7 7 private $blacklisted_ips; … … 12 12 function __construct() { 13 13 $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf'; 14 $ips = WPRProtectUtils_V68 1::parseFile($ip_store_file);14 $ips = WPRProtectUtils_V683::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(); … … 18 18 19 19 public function getTypeIfBlacklistedIP($ip) { 20 return $this->getIPType($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED);20 return $this->getIPType($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED); 21 21 } 22 22 23 23 public function isFWIPBlacklisted($ip) { 24 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED);24 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED); 25 25 } 26 26 27 27 public function isFWIPWhitelisted($ip) { 28 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_WHITELISTED);28 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED); 29 29 } 30 30 … … 37 37 private function getIPType($ip, $type) { 38 38 switch ($type) { 39 case WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED:39 case WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED: 40 40 return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null; 41 case WPRProtectIpstoreFS_V68 1::IP_TYPE_WHITELISTED:41 case WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED: 42 42 return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null; 43 43 } -
wpremote/tags/6.83/protect/lib/utils.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectUtils_V68 1')) :5 class WPRProtectUtils_V68 1{4 if (!class_exists('WPRProtectUtils_V683')) : 5 class WPRProtectUtils_V683 { 6 6 public static function getIP($ip_header) { 7 7 $ip = null; … … 131 131 if (is_array($val)) { 132 132 foreach ($val as $e) { 133 $length += WPRProtectUtils_V68 1::getLength($e);133 $length += WPRProtectUtils_V683::getLength($e); 134 134 } 135 135 -
wpremote/tags/6.83/protect/logger.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLogger_V68 1')) :4 if (!class_exists('WPRProtectLogger_V683')) : 5 5 require_once dirname( __FILE__ ) . '/logger/fs.php'; 6 6 require_once dirname( __FILE__ ) . '/logger/db.php'; 7 7 8 class WPRProtectLogger_V68 1{8 class WPRProtectLogger_V683 { 9 9 private $log_destination; 10 10 … … 12 12 const TYPE_DB = 1; 13 13 14 function __construct($name, $type = WPRProtectLogger_V68 1::TYPE_DB) {15 if ($type == WPRProtectLogger_V68 1::TYPE_FS) {16 $this->log_destination = new WPRProtectLoggerFS_V68 1($name);14 function __construct($name, $type = WPRProtectLogger_V683::TYPE_DB) { 15 if ($type == WPRProtectLogger_V683::TYPE_FS) { 16 $this->log_destination = new WPRProtectLoggerFS_V683($name); 17 17 } else { 18 $this->log_destination = new WPRProtectLoggerDB_V68 1($name);18 $this->log_destination = new WPRProtectLoggerDB_V683($name); 19 19 } 20 20 } -
wpremote/tags/6.83/protect/logger/db.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLoggerDB_V68 1')) :5 class WPRProtectLoggerDB_V68 1{4 if (!class_exists('WPRProtectLoggerDB_V683')) : 5 class WPRProtectLoggerDB_V683 { 6 6 private $tablename; 7 7 private $bv_tablename; … … 11 11 function __construct($tablename) { 12 12 $this->tablename = $tablename; 13 $this->bv_tablename = WPRProtect_V68 1::$db->getBVTable($tablename);13 $this->bv_tablename = WPRProtect_V683::$db->getBVTable($tablename); 14 14 } 15 15 16 16 public function log($data) { 17 17 if (is_array($data)) { 18 if (WPRProtect_V68 1::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V681::MAXROWCOUNT) {19 WPRProtect_V68 1::$db->deleteRowsFromtable($this->tablename, 1);18 if (WPRProtect_V683::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V683::MAXROWCOUNT) { 19 WPRProtect_V683::$db->deleteRowsFromtable($this->tablename, 1); 20 20 } 21 21 22 WPRProtect_V68 1::$db->replaceIntoBVTable($this->tablename, $data);22 WPRProtect_V683::$db->replaceIntoBVTable($this->tablename, $data); 23 23 } 24 24 } -
wpremote/tags/6.83/protect/logger/fs.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLoggerFS_V68 1')) :5 class WPRProtectLoggerFS_V68 1{4 if (!class_exists('WPRProtectLoggerFS_V683')) : 5 class WPRProtectLoggerFS_V683 { 6 6 public $logFile; 7 7 -
wpremote/tags/6.83/protect/lp.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLP_V68 1')) :5 class WPRProtectLP_V68 1{4 if (!class_exists('WPRProtectLP_V683')) : 5 class WPRProtectLP_V683 { 6 6 private $ip; 7 7 private $time; … … 10 10 private $brand_name; 11 11 12 private $mode = WPRProtectLP_V68 1::MODE_DISABLED;12 private $mode = WPRProtectLP_V683::MODE_DISABLED; 13 13 private $captcha_limit = 3; 14 14 private $temp_block_limit = 10; … … 18 18 private $all_blocked_gap = 1800; 19 19 20 private $category = WPRProtectLP_V68 1::CATEGORY_ALLOWED;20 private $category = WPRProtectLP_V683::CATEGORY_ALLOWED; 21 21 private $username = ''; 22 22 private $message = ''; … … 47 47 $this->ip = $request->getIP(); 48 48 $this->brand_name = $brand_name; 49 $this->ipstore = new WPRProtectIpstore_V68 1();50 $this->logger = new WPRProtectLogger_V68 1(WPRProtectLP_V681::TABLE_NAME);49 $this->ipstore = new WPRProtectIpstore_V683(); 50 $this->logger = new WPRProtectLogger_V683(WPRProtectLP_V683::TABLE_NAME); 51 51 $this->time = strtotime(gmdate("Y-m-d H:i:s")); 52 52 … … 91 91 92 92 public static function uninstall() { 93 WPRProtect_V68 1::$db->dropBVTable(WPRProtectLP_V681::TABLE_NAME);93 WPRProtect_V683::$db->dropBVTable(WPRProtectLP_V683::TABLE_NAME); 94 94 } 95 95 … … 103 103 104 104 private function getCaptchaLink() { 105 $account = WPRAccount::apiPublicAccount(WPRProtect_V68 1::$settings);105 $account = WPRAccount::apiPublicAccount(WPRProtect_V683::$settings); 106 106 107 107 $url = $account->authenticatedUrl('/captcha/solve'); … … 112 112 113 113 private function getAllowLoginsTransient() { 114 return WPRProtect_V68 1::$settings->getTransient('bvlp_allow_logins');114 return WPRProtect_V683::$settings->getTransient('bvlp_allow_logins'); 115 115 } 116 116 117 117 private function getBlockLoginsTransient() { 118 return WPRProtect_V68 1::$settings->getTransient('bvlp_block_logins');118 return WPRProtect_V683::$settings->getTransient('bvlp_block_logins'); 119 119 } 120 120 … … 142 142 143 143 private function isProtecting() { 144 return $this->mode === WPRProtectLP_V68 1::MODE_PROTECT;144 return $this->mode === WPRProtectLP_V683::MODE_PROTECT; 145 145 } 146 146 147 147 private function isActive() { 148 return $this->mode !== WPRProtectLP_V68 1::MODE_DISABLED;148 return $this->mode !== WPRProtectLP_V683::MODE_DISABLED; 149 149 } 150 150 … … 158 158 159 159 private function isUnBlockedIP() { 160 $transient_name = WPRProtectLP_V68 1::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;161 $attempts = WPRProtect_V68 1::$settings->getTransient($transient_name);160 $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip; 161 $attempts = WPRProtect_V683::$settings->getTransient($transient_name); 162 162 163 163 if ($attempts && $attempts > 0) { 164 WPRProtect_V68 1::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);164 WPRProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts); 165 165 return true; 166 166 } … … 171 171 private function isLoginBlocked() { 172 172 if ($this->getAllowLoginsTransient() || 173 ($this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) {173 ($this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) { 174 174 return false; 175 175 } … … 194 194 private function terminateLogin() { 195 195 $this->message = 'Login Blocked'; 196 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_BLOCKED);196 $this->log(WPRProtectLP_V683::LOGIN_STATUS_BLOCKED); 197 197 if ($this->isProtecting()) { 198 198 header("Cache-Control: no-cache, no-store, must-revalidate"); … … 208 208 public function loginInit($user, $username = '', $password = '') { 209 209 if ($this->isUnBlockedIP()) { 210 $this->category = WPRProtectLP_V68 1::CATEGORY_UNBLOCKED;210 $this->category = WPRProtectLP_V683::CATEGORY_UNBLOCKED; 211 211 } else { 212 $failed_attempts = $this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE,212 $failed_attempts = $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE, 213 213 $this->ip, $this->failed_login_gap); 214 214 215 215 if ($this->isWhitelistedIP()) { 216 $this->category = WPRProtectLP_V68 1::CATEGORY_BYPASSED;217 } elseif (WPRProtectUtils_V68 1::isPrivateIP($this->ip)) {218 $this->category = WPRProtectLP_V68 1::CATEGORY_PRIVATEIP;216 $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED; 217 } elseif (WPRProtectUtils_V683::isPrivateIP($this->ip)) { 218 $this->category = WPRProtectLP_V683::CATEGORY_PRIVATEIP; 219 219 } elseif ($this->isBlacklistedIP()) { 220 $this->category = WPRProtectLP_V68 1::CATEGORY_BLACKLISTED;220 $this->category = WPRProtectLP_V683::CATEGORY_BLACKLISTED; 221 221 $this->terminateLogin(); 222 222 } elseif ($this->isKnownLogin()) { 223 $this->category = WPRProtectLP_V68 1::CATEGORY_BYPASSED;223 $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED; 224 224 } elseif ($this->isLoginBlocked()) { 225 $this->category = WPRProtectLP_V68 1::CATEGORY_ALL_BLOCKED;225 $this->category = WPRProtectLP_V683::CATEGORY_ALL_BLOCKED; 226 226 $this->terminateLogin(); 227 227 } elseif ($failed_attempts >= $this->temp_block_limit) { 228 $this->category = WPRProtectLP_V68 1::CATEGORY_TEMP_BLOCK;228 $this->category = WPRProtectLP_V683::CATEGORY_TEMP_BLOCK; 229 229 $this->terminateLogin(); 230 230 } elseif ($failed_attempts >= $this->captcha_limit) { 231 $this->category = WPRProtectLP_V68 1::CATEGORY_CAPTCHA_BLOCK;231 $this->category = WPRProtectLP_V683::CATEGORY_CAPTCHA_BLOCK; 232 232 $this->terminateLogin(); 233 233 } … … 243 243 public function loginFailed($username) { 244 244 $this->username = $username; 245 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE);245 $this->log(WPRProtectLP_V683::LOGIN_STATUS_FAILURE); 246 246 } 247 247 … … 249 249 $this->username = $username; 250 250 $this->message = 'Login Success'; 251 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_SUCCESS);251 $this->log(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS); 252 252 } 253 253 254 254 private function isKnownLogin() { 255 return $this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_SUCCESS,255 return $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS, 256 256 $this->ip, $this->success_login_gap) > 0; 257 257 } 258 258 259 259 private function getLoginCount($status, $ip, $gap) { 260 $table = WPRProtect_V68 1::$db->getBVTable(WPRProtectLP_V681::TABLE_NAME);260 $table = WPRProtect_V683::$db->getBVTable(WPRProtectLP_V683::TABLE_NAME); 261 261 $query_str = "SELECT COUNT(*) as count from `$table` WHERE status=%d && time > %d"; 262 262 $query_args = array($status, ($this->time - $gap)); 263 263 264 $query = WPRProtect_V68 1::$db->prepare($query_str, $query_args);264 $query = WPRProtect_V683::$db->prepare($query_str, $query_args); 265 265 if ($ip) { 266 $query .= WPRProtect_V68 1::$db->prepare(" && ip=%s", $ip);267 } 268 269 $rows = WPRProtect_V68 1::$db->getResult($query);266 $query .= WPRProtect_V683::$db->prepare(" && ip=%s", $ip); 267 } 268 269 $rows = WPRProtect_V683::$db->getResult($query); 270 270 if (!$rows) { 271 271 return 0; -
wpremote/tags/6.83/protect/prepend/ignitor.php
r3775063 r3795707 5 5 require_once dirname( __FILE__ ) . '/../protect.php'; 6 6 7 WPRProtect_V68 1::init(WPRProtect_V681::MODE_PREPEND);7 WPRProtect_V683::init(WPRProtect_V683::MODE_PREPEND); 8 8 } -
wpremote/tags/6.83/protect/protect.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtect_V68 1')) :4 if (!class_exists('WPRProtect_V683')) : 5 5 require_once dirname( __FILE__ ) . '/logger.php'; 6 6 require_once dirname( __FILE__ ) . '/ipstore.php'; … … 12 12 require_once dirname( __FILE__ ) . '/../helper.php'; 13 13 14 class WPRProtect_V68 1{14 class WPRProtect_V683 { 15 15 public static $settings; 16 16 public static $db; … … 27 27 } 28 28 29 if ($mode == WPRProtect_V68 1::MODE_PREPEND) {29 if ($mode == WPRProtect_V683::MODE_PREPEND) { 30 30 $config_file = MCDATAPATH . MCCONFKEY . '-' . 'mc.conf'; 31 $config = WPRProtectUtils_V68 1::parseFile($config_file);31 $config = WPRProtectUtils_V683::parseFile($config_file); 32 32 33 33 if (empty($config['time']) || !($config['time'] > time() - (48*3600)) || 34 34 !isset($config['mc_conf_version']) || 35 (WPRProtect_V68 1::CONF_VERSION !== $config['mc_conf_version'])) {35 (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) { 36 36 return false; 37 37 … … 41 41 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null; 42 42 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array(); 43 $request = new WPRProtectRequest_V68 1($request_ip_header, $req_config);43 $request = new WPRProtectRequest_V683($request_ip_header, $req_config); 44 44 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array(); 45 45 46 WPRProtectFW_V68 1::getInstance($mode, $request, $fw_config, $brand_name)->init();46 WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init(); 47 47 } else { 48 48 $plug_config = self::$settings->getOption(self::$info->services_option_name); 49 49 $config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array(); 50 50 if (!is_array($config) || !array_key_exists('mc_conf_version', $config) || 51 (WPRProtect_V68 1::CONF_VERSION !== $config['mc_conf_version'])) {51 (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) { 52 52 53 53 return false; … … 57 57 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null; 58 58 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array(); 59 $request = new WPRProtectRequest_V68 1($request_ip_header, $req_config);59 $request = new WPRProtectRequest_V683($request_ip_header, $req_config); 60 60 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array(); 61 61 $lp_config = array_key_exists('lp', $config) ? $config['lp'] : array(); 62 62 63 WPRProtectFW_V68 1::getInstance($mode, $request, $fw_config, $brand_name)->init();64 WPRProtectLP_V68 1::getInstance($request, $lp_config, $brand_name)->init();63 WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init(); 64 WPRProtectLP_V683::getInstance($request, $lp_config, $brand_name)->init(); 65 65 } 66 66 } … … 69 69 self::$settings->deleteOption('bvptconf'); 70 70 self::$settings->deleteOption('bvptplug'); 71 WPRProtectIpstore_V68 1::uninstall();72 WPRProtectFW_V68 1::uninstall();73 WPRProtectLP_V68 1::uninstall();71 WPRProtectIpstore_V683::uninstall(); 72 WPRProtectFW_V683::uninstall(); 73 WPRProtectLP_V683::uninstall(); 74 74 75 WPRProtect_V68 1::removeWPPrepend();76 WPRProtect_V68 1::removePHPPrepend();77 WPRProtect_V68 1::removeMCData();75 WPRProtect_V683::removeWPPrepend(); 76 WPRProtect_V683::removePHPPrepend(); 77 WPRProtect_V683::removeMCData(); 78 78 79 79 return true; … … 96 96 $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';"; 97 97 98 WPRProtectUtils_V68 1::fileRemovePattern($fname, $pattern);98 WPRProtectUtils_V683::fileRemovePattern($fname, $pattern); 99 99 } 100 100 101 101 private static function removePHPPrepend() { 102 WPRProtect_V68 1::removeHtaccessPrepend();103 WPRProtect_V68 1::removeUseriniPrepend();102 WPRProtect_V683::removeHtaccessPrepend(); 103 WPRProtect_V683::removeUseriniPrepend(); 104 104 } 105 105 … … 107 107 $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i"; 108 108 109 WPRProtectUtils_V68 1::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);109 WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true); 110 110 } 111 111 … … 113 113 $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i"; 114 114 115 WPRProtectUtils_V68 1::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);115 WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true); 116 116 } 117 117 … … 120 120 $mc_data_dir = $content_dir . "/mc_data"; 121 121 122 WPRProtectUtils_V68 1::rrmdir($mc_data_dir);122 WPRProtectUtils_V683::rrmdir($mc_data_dir); 123 123 } 124 124 } -
wpremote/tags/6.83/protect/request.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!class_exists('WPRProtectRequest_V68 1')) :6 class WPRProtectRequest_V68 1{5 if (!class_exists('WPRProtectRequest_V683')) : 6 class WPRProtectRequest_V683 { 7 7 public $ip; 8 8 public $host = ''; … … 20 20 public $files; 21 21 public $respcode; 22 public $status = WPRProtectRequest_V68 1::STATUS_ALLOWED;23 public $category = WPRProtectRequest_V68 1::CATEGORY_NORMAL;22 public $status = WPRProtectRequest_V683::STATUS_ALLOWED; 23 public $category = WPRProtectRequest_V683::CATEGORY_NORMAL; 24 24 25 25 public $wp_user; … … 60 60 61 61 public function __construct($ip_header, $config) { 62 $this->ip = WPRProtectUtils_V68 1::getIP($ip_header);62 $this->ip = WPRProtectUtils_V683::getIP($ip_header); 63 63 $this->timestamp = time(); 64 64 $this->get_params = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended … … 142 142 public static function blacklistedCategories() { 143 143 return array( 144 WPRProtectRequest_V68 1::CATEGORY_BOT_BLOCKED,145 WPRProtectRequest_V68 1::CATEGORY_COUNTRY_BLOCKED,146 WPRProtectRequest_V68 1::CATEGORY_USER_BLACKLISTED,147 WPRProtectRequest_V68 1::CATEGORY_GLOBAL_BOT_BLOCKED144 WPRProtectRequest_V683::CATEGORY_BOT_BLOCKED, 145 WPRProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED, 146 WPRProtectRequest_V683::CATEGORY_USER_BLACKLISTED, 147 WPRProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED 148 148 ); 149 149 } 150 150 151 151 public static function whitelistedCategories() { 152 return array(WPRProtectRequest_V68 1::CATEGORY_WHITELISTED);152 return array(WPRProtectRequest_V683::CATEGORY_WHITELISTED); 153 153 } 154 154 … … 488 488 } 489 489 490 $_json_params = WPRProtectUtils_V68 1::safeDecodeJSON(490 $_json_params = WPRProtectUtils_V683::safeDecodeJSON( 491 491 $this->raw_body, 492 492 true, -
wpremote/tags/6.83/protect/wp_user.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectWPUser_V68 1')) :5 class WPRProtectWPUser_V68 1{4 if (!class_exists('WPRProtectWPUser_V683')) : 5 class WPRProtectWPUser_V683 { 6 6 public $id; 7 7 public $role; … … 22 22 public static function defaultUser() { 23 23 $time = (int) floor(time() / 43200); 24 return (new WPRProtectWPUser_V68 1(0, 0, array(), $time));24 return (new WPRProtectWPUser_V683(0, 0, array(), $time)); 25 25 } 26 26 … … 42 42 $capabilities = array_map('intval', explode(',', $capabilities)); 43 43 44 return (new WPRProtectWPUser_V68 1((int) $id, (int) $role_level, $capabilities, (int) $time));44 return (new WPRProtectWPUser_V683((int) $id, (int) $role_level, $capabilities, (int) $time)); 45 45 } 46 46 -
wpremote/tags/6.83/readme.txt
r3775063 r3795707 7 7 Tested up to: 7.1 8 8 Requires PHP: 7.0 9 Stable tag: 6.8 19 Stable tag: 6.83 10 10 License: GPLv2 or later 11 11 License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) … … 47 47 48 48 == CHANGELOG == 49 = 6.83 = 50 * New: Broken Link Checker: checks your links from your own site, and highlights the broken ones on the page when you open it from the dashboard. 51 49 52 = 6.81 = 50 53 * New: Added a must-use plugin loader. -
wpremote/tags/6.83/wp_actions.php
r3775063 r3795707 85 85 } 86 86 87 public function enqueueBrokenLinkHighlight() { 88 // Read-only visual aid: this flag grants no access and executes no callback. 89 if (!in_array('wpr', array('bv', 'mc', 'wpr'), true) || 90 WPRHelper::getRawParam('GET', 'bv-blc') !== '1' || is_admin() || is_feed() || (function_exists('is_embed') && is_embed())) { 91 return; 92 } 93 94 // A cache that drops unknown query parameters from its key must not store this 95 // page and serve the overlay to every visitor. 96 if (!headers_sent()) { 97 header('Cache-Control: no-store, max-age=0'); 98 } 99 // The selection travels in the URL fragment, which browsers never send. This 100 // request carries no input, so there is nothing here to read, decode or echo. 101 // Share handles across plugin families so only one helper is loaded. 102 wp_enqueue_style('blogvault-blc-highlight', plugins_url('broken_link_checker/highlight.css', __FILE__), array(), '1.3.1'); 103 wp_enqueue_script('blogvault-blc-highlight', plugins_url('broken_link_checker/highlight.js', __FILE__), array(), '1.3.1', true); 104 } 105 87 106 private function process_deactivation_feedback(&$info) { 88 107 //phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -
wpremote/trunk/callback/base.php
r3775063 r3795707 15 15 "MISC_WING_VERSION" => '1.4', 16 16 "FS_WING_VERSION" => '1.4', 17 "INFO_WING_VERSION" => '2. 8',17 "INFO_WING_VERSION" => '2.9', 18 18 "WATCH_WING_VERSION" => '1.7', 19 19 "FS_WRITE_WING_VERSION" => '1.2', … … 22 22 "PROTECT_WING_VERSION" => '1.3', 23 23 "SECURITY_WING_VERSION" => '1.4', 24 "LINKS_WING_VERSION" => '1.0', 24 25 "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0', 25 26 ); -
wpremote/trunk/callback/handler.php
r3648236 r3795707 170 170 $module = new WPRSecurityCallback($this); 171 171 break; 172 case 'links': 173 // Only the BlogVault, MalCare and WP Remote plugins carry this wing; the rest answer Bad Command. 174 $links_wing = dirname( __FILE__ ) . '/wings/links.php'; 175 if (!file_exists($links_wing)) { 176 $module = null; 177 break; 178 } 179 require_once $links_wing; 180 $module = new WPRLinksCallback($this); 181 break; 172 182 default: 173 183 require_once dirname( __FILE__ ) . '/wings/misc.php'; … … 175 185 break; 176 186 } 177 $resp = $module ->process($this->request);187 $resp = $module ? $module->process($this->request) : false; 178 188 if ($resp === false) { 179 189 $resp = array( -
wpremote/trunk/callback/wings/info.php
r3775063 r3795707 11 11 public $bvapi; 12 12 13 const INFO_WING_VERSION = 2. 8;13 const INFO_WING_VERSION = 2.9; 14 14 15 15 public function __construct($callback_handler) { … … 150 150 $sys_info['webgid'] = posix_getgid(); 151 151 } 152 if (function_exists('ini_get')) { 153 $sys_info['max_execution_time'] = (int) @ini_get('max_execution_time'); 154 $sys_info['memory_limit'] = (string) @ini_get('memory_limit'); 155 } 156 $sys_info['link_checks'] = $this->getLinkCheckInfo(); 152 157 return $sys_info; 158 } 159 160 // What this server can do for broken link checks. Local and read-only: constants, functions 161 // and settings only, with no request, DNS lookup or write, so it can never slow or fail a sync. 162 // A value it cannot tell is null. 163 public function getLinkCheckInfo() { 164 $info = array( 165 'curl' => function_exists('curl_init'), 166 'curl_multi' => function_exists('curl_multi_init'), 167 'address_pinning' => defined('CURLOPT_RESOLVE'), 168 'dns_lookup' => function_exists('gethostbynamel'), 169 'curl_version' => null, 170 'ssl_version' => null, 171 'external_requests_blocked' => null, 172 'proxy_configured' => null 173 ); 174 try { 175 if (function_exists('curl_version')) { 176 $curl = curl_version(); 177 $info['curl_version'] = isset($curl['version']) ? (string) $curl['version'] : null; 178 $info['ssl_version'] = isset($curl['ssl_version']) ? (string) $curl['ssl_version'] : null; 179 } 180 if (class_exists('WP_Http')) { 181 $http = new WP_Http(); 182 $info['external_requests_blocked'] = (bool) $http->block_request('https://example.com/'); 183 } 184 if (class_exists('WP_HTTP_Proxy')) { 185 $proxy = new WP_HTTP_Proxy(); 186 $info['proxy_configured'] = (bool) $proxy->is_enabled(); 187 } 188 } catch (Exception $e) { 189 // Leave what could not be read as null; system info must still be returned. 190 } 191 return $info; 153 192 } 154 193 -
wpremote/trunk/callback/wings/ipstore.php
r3775063 r3795707 51 51 public function getIPs($table, $auto_increment_offset, $type, $category) { 52 52 $query = "SELECT `start_ip_range` FROM $table WHERE id < $auto_increment_offset AND `type` in (" . implode(',', $type) . ") AND "; 53 $query .= ($category == WPRProtectIpstoreDB_V68 1::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";53 $query .= ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;"; 54 54 return $this->db->getCol($query); 55 55 } … … 65 65 66 66 $info['fw_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, 67 WPRProtectIpstoreDB_V68 1::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);67 WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 68 68 $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset, 69 WPRProtectIpstoreDB_V68 1::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);69 WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 70 70 $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, 71 WPRProtectIpstoreDB_V68 1::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);71 WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 72 72 $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset, 73 WPRProtectIpstoreDB_V68 1::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);73 WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 74 74 $info['ip_store_offset'] = $this->getIPStoreOffset($table, $auto_increment_offset); 75 75 $info['country_ips_size'] = intval($db->getVar("SELECT COUNT(id) FROM $table WHERE id >= $auto_increment_offset")); -
wpremote/trunk/callback/wings/protect.php
r3775063 r3795707 41 41 42 42 public function unBlockIP($ip, $attempts, $time) { 43 $transient_name = WPRProtectLP_V68 1::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;43 $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip; 44 44 $this->settings->setTransient($transient_name, $attempts, $time); 45 45 return $this->settings->getTransient($transient_name); -
wpremote/trunk/callback/wings/watch.php
r3775063 r3795707 145 145 require_once dirname( __FILE__ ) . '/../../protect/lp.php'; 146 146 $lp_params = $params['lp']; 147 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V68 1::TABLE_NAME))) {147 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V683::TABLE_NAME))) { 148 148 $limit = intval($lp_params['limit']); 149 149 $filter = $lp_params['filter']; 150 150 $offset = isset($lp_params['offset']) ? intval($lp_params['offset']) : 0; 151 $table = $db->getBVTable(WPRProtectLP_V68 1::TABLE_NAME);151 $table = $db->getBVTable(WPRProtectLP_V683::TABLE_NAME); 152 152 $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table); 153 153 if (empty($resp["lplogs"])) { 154 $db->deleteBVTableContent(WPRProtectLP_V68 1::TABLE_NAME, $lp_params['rmfilter']);154 $db->deleteBVTableContent(WPRProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']); 155 155 $resp["lplogs"] = $this->getData($table, $limit, $filter); 156 156 } … … 168 168 require_once dirname( __FILE__ ) . '/../../protect/fw.php'; 169 169 $fw_params = $params['fw']; 170 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V68 1::TABLE_NAME))) {170 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V683::TABLE_NAME))) { 171 171 $limit = intval($fw_params['limit']); 172 172 $filter = $fw_params['filter']; 173 173 $offset = isset($fw_params['offset']) ? intval($fw_params['offset']) : 0; 174 $table = $db->getBVTable(WPRProtectFW_V68 1::TABLE_NAME);174 $table = $db->getBVTable(WPRProtectFW_V683::TABLE_NAME); 175 175 $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table); 176 176 if (empty($resp["fwlogs"])){ 177 $db->deleteBVTableContent(WPRProtectFW_V68 1::TABLE_NAME, $fw_params['rmfilter']);177 $db->deleteBVTableContent(WPRProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']); 178 178 $resp["fwlogs"] = $this->getData($table, $limit, $filter); 179 179 } -
wpremote/trunk/info.php
r3775063 r3795707 12 12 public $brand_option = 'bv_whitelabel_infos'; 13 13 public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; 14 public $version = '6.8 1';14 public $version = '6.83'; 15 15 public $webpage = 'https://wpremote.com'; 16 16 public $appurl = 'https://app.wpremote.com'; -
wpremote/trunk/plugin.php
r3775063 r3795707 6 6 Author: WP Remote 7 7 Author URI: https://wpremote.com 8 Version: 6.8 18 Version: 6.83 9 9 Network: True 10 10 License: GPLv2 or later … … 64 64 65 65 add_action('wp_footer', array($wp_action, 'footerHandler'), 100); 66 add_action('wp_enqueue_scripts', array($wp_action, 'enqueueBrokenLinkHighlight')); 66 67 add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); 67 68 add_action('wpr_clear_mu_plugin', array($wp_action, 'clear_mu_plugin')); … … 186 187 require_once dirname( __FILE__ ) . '/protect/protect.php'; 187 188 //For backward compatibility. 188 WPRProtect_V68 1::$settings = new WPRWPSettings();189 WPRProtect_V68 1::$db = new WPRWPDb();190 WPRProtect_V68 1::$info = new WPRInfo(WPRProtect_V681::$settings);191 192 add_action('wpr_clear_pt_config', array('WPRProtect_V68 1', 'uninstall'));189 WPRProtect_V683::$settings = new WPRWPSettings(); 190 WPRProtect_V683::$db = new WPRWPDb(); 191 WPRProtect_V683::$info = new WPRInfo(WPRProtect_V683::$settings); 192 193 add_action('wpr_clear_pt_config', array('WPRProtect_V683', 'uninstall')); 193 194 194 195 if ($bvinfo->isActivePlugin()) { 195 WPRProtect_V68 1::init(WPRProtect_V681::MODE_WP);196 WPRProtect_V683::init(WPRProtect_V683::MODE_WP); 196 197 } 197 198 } -
wpremote/trunk/protect/fw.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectFW_V68 1')) :4 if (!class_exists('WPRProtectFW_V683')) : 5 5 require_once dirname( __FILE__ ) . '/fw/rule/errors.php'; 6 6 require_once dirname( __FILE__ ) . '/fw/rule/engine.php'; 7 7 require_once dirname( __FILE__ ) . '/fw/rule.php'; 8 8 9 class WPRProtectFW_V68 1{9 class WPRProtectFW_V683 { 10 10 private $brand_name; 11 11 private $protect_mode; … … 24 24 private $has_valid_bypass_cookie; 25 25 26 private $mode = WPRProtectFW_V68 1::MODE_DISABLED;27 private $ip_cookie_mode = WPRProtectFW_V68 1::IP_COOKIE_MODE_DISABLED;28 private $admin_cookie_mode = WPRProtectFW_V68 1::ADMIN_COOKIE_MODE_DISABLED;29 private $bypass_level = WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CONTRIBUTOR;30 private $wpf_rule_init_mode = WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_WP;26 private $mode = WPRProtectFW_V683::MODE_DISABLED; 27 private $ip_cookie_mode = WPRProtectFW_V683::IP_COOKIE_MODE_DISABLED; 28 private $admin_cookie_mode = WPRProtectFW_V683::ADMIN_COOKIE_MODE_DISABLED; 29 private $bypass_level = WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CONTRIBUTOR; 30 private $wpf_rule_init_mode = WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP; 31 31 private $custom_roles = array(); 32 32 private $cookie_key = ""; … … 35 35 private $cookie_validity = 2592000; 36 36 private $can_set_cache_prevention_cookie = false; 37 private $rules_mode = WPRProtectFW_V68 1::RULES_MODE_DISABLED;37 private $rules_mode = WPRProtectFW_V683::RULES_MODE_DISABLED; 38 38 private $is_geo_blocking = false; 39 39 private $is_wp_user_cookie_enabled = false; 40 40 private $log_config = array(); 41 private $request_profiling_mode = WPRProtectFW_V68 1::REQ_PROFILING_MODE_DISABLED;42 private $logging_mode = WPRProtectFW_V68 1::LOGGING_MODE_VISITOR;41 private $request_profiling_mode = WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED; 42 private $logging_mode = WPRProtectFW_V683::LOGGING_MODE_VISITOR; 43 43 private $skip_log_config = array(); 44 44 private $skip_log_cookies = array(); … … 55 55 private $break_rule_matching = false; 56 56 private $can_log_raw_body = false; 57 private $log_slice_size = WPRProtectFW_V68 1::LOG_SLICE_SIZE;57 private $log_slice_size = WPRProtectFW_V683::LOG_SLICE_SIZE; 58 58 59 59 private static $instance = null; … … 101 101 102 102 const DEFAULT_WP_USER_ROLE_LEVELS = array( 103 'administrator' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_ADMIN,104 'editor' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_EDITOR,105 'author' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_AUTHOR,106 'contributor' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CONTRIBUTOR,107 'subscriber' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_SUBSCRIBER103 'administrator' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN, 104 'editor' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_EDITOR, 105 'author' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_AUTHOR, 106 'contributor' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CONTRIBUTOR, 107 'subscriber' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_SUBSCRIBER 108 108 ); 109 109 110 110 const EXTRA_WP_USER_ROLE_LEVELS = array( 111 'custom' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CUSTOM,112 'unknown' => WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_UNKNOWN111 'custom' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM, 112 'unknown' => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_UNKNOWN 113 113 ); 114 114 … … 249 249 if ($this->isPrependMode()) { 250 250 $log_file = MCDATAPATH . MCCONFKEY . '-mc.log'; 251 $this->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_FS);252 $this->logger = new WPRProtectLogger_V68 1($log_file, WPRProtectLogger_V681::TYPE_FS);251 $this->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_FS); 252 $this->logger = new WPRProtectLogger_V683($log_file, WPRProtectLogger_V683::TYPE_FS); 253 253 } else { 254 $this->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_DB);255 $this->logger = new WPRProtectLogger_V68 1(WPRProtectFW_V681::TABLE_NAME, WPRProtectLogger_V681::TYPE_DB);254 $this->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB); 255 $this->logger = new WPRProtectLogger_V683(WPRProtectFW_V683::TABLE_NAME, WPRProtectLogger_V683::TYPE_DB); 256 256 } 257 257 … … 266 266 if (!isset(self::$instance)) { 267 267 self::$instance = new self($protect_mode, $request, $config, $brand_name); 268 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V68 1::MODE_WP) {268 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V683::MODE_WP) { 269 269 self::$instance->protect_mode = $protect_mode; 270 270 self::$instance->brand_name = $brand_name; 271 self::$instance->ipstore = new WPRProtectIpstore_V68 1(WPRProtectIpstore_V681::STORAGE_TYPE_DB);271 self::$instance->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB); 272 272 self::$instance->initRules(); 273 273 } … … 277 277 278 278 public static function uninstall() { 279 WPRProtect_V68 1::$db->dropBVTable(WPRProtectFW_V681::TABLE_NAME);279 WPRProtect_V683::$db->dropBVTable(WPRProtectFW_V683::TABLE_NAME); 280 280 } 281 281 … … 297 297 298 298 private function isPrependMode() { 299 return ($this->protect_mode === WPRProtect_V68 1::MODE_PREPEND);299 return ($this->protect_mode === WPRProtect_V683::MODE_PREPEND); 300 300 } 301 301 302 302 private function isWPMode() { 303 return ($this->protect_mode === WPRProtect_V68 1::MODE_WP);303 return ($this->protect_mode === WPRProtect_V683::MODE_WP); 304 304 } 305 305 306 306 private function isModeDisabled() { 307 return ($this->mode === WPRProtectFW_V68 1::MODE_DISABLED);307 return ($this->mode === WPRProtectFW_V683::MODE_DISABLED); 308 308 } 309 309 310 310 private function isModeProtect() { 311 return ($this->mode === WPRProtectFW_V68 1::MODE_PROTECT);311 return ($this->mode === WPRProtectFW_V683::MODE_PROTECT); 312 312 } 313 313 314 314 private function isAdminCookieEnabled() { 315 return ($this->admin_cookie_mode === WPRProtectFW_V68 1::ADMIN_COOKIE_MODE_ENABLED);315 return ($this->admin_cookie_mode === WPRProtectFW_V683::ADMIN_COOKIE_MODE_ENABLED); 316 316 } 317 317 318 318 private function isIPCookieEnabled() { 319 return ($this->ip_cookie_mode === WPRProtectFW_V68 1::IP_COOKIE_MODE_ENABLED);319 return ($this->ip_cookie_mode === WPRProtectFW_V683::IP_COOKIE_MODE_ENABLED); 320 320 } 321 321 322 322 private function isRequestProfilingDisabled() { 323 return ($this->request_profiling_mode === WPRProtectFW_V68 1::REQ_PROFILING_MODE_DISABLED);323 return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED); 324 324 } 325 325 326 326 private function isRequestProfilingModeDebug() { 327 return ($this->request_profiling_mode === WPRProtectFW_V68 1::REQ_PROFILING_MODE_DEBUG);327 return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DEBUG); 328 328 } 329 329 330 330 private function isRequestHasValidBypassCookie() { 331 331 if (!isset($this->has_valid_bypass_cookie)) { 332 $cookie = (string) $this->request->getCookies(WPRProtectFW_V68 1::BYPASS_COOKIE_NAME);332 $cookie = (string) $this->request->getCookies(WPRProtectFW_V683::BYPASS_COOKIE_NAME); 333 333 $new_cookie = $this->generateBypassCookie(); 334 334 $is_valid = ($this->isAdminCookieEnabled() && $new_cookie && ($cookie === $new_cookie)); … … 340 340 341 341 private function isRulesModeProtect() { 342 return ($this->rules_mode === WPRProtectFW_V68 1::RULES_MODE_PROTECT);342 return ($this->rules_mode === WPRProtectFW_V683::RULES_MODE_PROTECT); 343 343 } 344 344 345 345 public function isLoggingModeComplete() { 346 return ($this->logging_mode === WPRProtectFW_V68 1::LOGGING_MODE_COMPLETE);346 return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_COMPLETE); 347 347 } 348 348 349 349 public function isLoggingModeVisitor() { 350 return ($this->logging_mode === WPRProtectFW_V68 1::LOGGING_MODE_VISITOR);350 return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_VISITOR); 351 351 } 352 352 … … 356 356 357 357 private function isWPFRuleInitModePrepend() { 358 return ($this->wpf_rule_init_mode === WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_PREPEND);358 return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_PREPEND); 359 359 } 360 360 361 361 private function isWPFRuleInitModeWP() { 362 return ($this->wpf_rule_init_mode === WPRProtectFW_V68 1::WPF_RULE_INIT_MODE_WP);362 return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP); 363 363 } 364 364 … … 389 389 390 390 if (!$current_wp_user->isIdentical($this->request->wp_user)) { 391 $serialized_wp_user = WPRProtectWPUser_V68 1::_serialize($current_wp_user);391 $serialized_wp_user = WPRProtectWPUser_V683::_serialize($current_wp_user); 392 392 $cookie_val = $serialized_wp_user . '_' . 393 WPRProtectUtils_V68 1::signMessage($serialized_wp_user, $this->cookie_key);393 WPRProtectUtils_V683::signMessage($serialized_wp_user, $this->cookie_key); 394 394 $cookie_val = base64_encode($cookie_val); 395 395 396 $this->setCookie(WPRProtectWPUser_V68 1::COOKIE_NAME, $cookie_val);396 $this->setCookie(WPRProtectWPUser_V683::COOKIE_NAME, $cookie_val); 397 397 } 398 398 } elseif ($this->request->wp_user->isLoggedIn()) { 399 $this->request->wp_user = WPRProtectWPUser_V68 1::defaultUser();400 $this->unsetCookie(WPRProtectWPUser_V68 1::COOKIE_NAME);399 $this->request->wp_user = WPRProtectWPUser_V683::defaultUser(); 400 $this->unsetCookie(WPRProtectWPUser_V683::COOKIE_NAME); 401 401 } 402 402 } … … 415 415 } 416 416 417 return (new WPRProtectWPUser_V68 1($id, $role_level, $capabilities, $time));417 return (new WPRProtectWPUser_V683($id, $role_level, $capabilities, $time)); 418 418 } 419 419 … … 434 434 435 435 private function loadWPUser() { 436 $this->request->wp_user = WPRProtectWPUser_V68 1::defaultUser();437 438 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V68 1::COOKIE_NAME);436 $this->request->wp_user = WPRProtectWPUser_V683::defaultUser(); 437 438 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V683::COOKIE_NAME); 439 439 if (!is_string($cookie_val)) { 440 440 return; … … 452 452 list($serialized_user, $signature) = $cookie_val_array; 453 453 454 if (WPRProtectUtils_V68 1::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {455 $wp_user = WPRProtectWPUser_V68 1::_unserialize($serialized_user);454 if (WPRProtectUtils_V683::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) { 455 $wp_user = WPRProtectWPUser_V683::_unserialize($serialized_user); 456 456 457 457 if (!isset($wp_user) || $wp_user->time !== (int) floor(time() / $this->cookie_validity)) { … … 468 468 } 469 469 470 $role_by_level = array_flip(array_merge(WPRProtectFW_V68 1::DEFAULT_WP_USER_ROLE_LEVELS,471 WPRProtectFW_V68 1::EXTRA_WP_USER_ROLE_LEVELS));470 $role_by_level = array_flip(array_merge(WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS, 471 WPRProtectFW_V683::EXTRA_WP_USER_ROLE_LEVELS)); 472 472 $this->request->wp_user->role = $role_by_level[$this->request->wp_user->role_level]; 473 473 } … … 493 493 if ($this->isPrependMode()) { 494 494 $rules_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_rules.json'; 495 $rule_arrays = WPRProtectUtils_V68 1::parseFile($rules_file);495 $rule_arrays = WPRProtectUtils_V683::parseFile($rules_file); 496 496 } else { 497 $rule_arrays = WPRProtect_V68 1::$settings->getOption('bvruleset');497 $rule_arrays = WPRProtect_V683::$settings->getOption('bvruleset'); 498 498 if(!is_array($rule_arrays)) { 499 499 $rule_arrays = array(); … … 507 507 508 508 foreach($rule_arrays as $rule_array) { 509 $rule = WPRProtectFWRule_V68 1::init($rule_array);509 $rule = WPRProtectFWRule_V683::init($rule_array); 510 510 511 511 if ($rule) { … … 532 532 private function initWPFRule($rule) { 533 533 switch ($rule->execute_on) { 534 case WPRProtectFWRule_V68 1::EXE_ON_PRE_UPDATE_OPTION:534 case WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION: 535 535 $this->addWPHook($rule, 'pre_update_option', 'handleRequestOnPreUpdateOption', 3); 536 536 break; 537 case WPRProtectFWRule_V68 1::EXE_ON_PRE_DELETE_POST:537 case WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST: 538 538 $this->addWPHook($rule, 'pre_delete_post', 'handleRequestOnPreDeletePost', 3); 539 539 break; 540 case WPRProtectFWRule_V68 1::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:540 case WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT: 541 541 $this->addWPHook($rule, 'wp_insert_post_empty_content', 542 542 'handleRequestOnWPInsertPostEmptyContent', 2); 543 543 break; 544 case WPRProtectFWRule_V68 1::EXE_ON_INSERT_USER_META:544 case WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META: 545 545 $this->addWPHook($rule, 'insert_user_meta', 'handleRequestOnInsertUserMeta', 4); 546 546 break; 547 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_OPTION:547 case WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION: 548 548 $this->addWPHook($rule, 'delete_option', 'handleRequestOnDeleteOption', 1, 'action'); 549 549 break; 550 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER:550 case WPRProtectFWRule_V683::EXE_ON_DELETE_USER: 551 551 $this->addWPHook($rule, 'delete_user', 'handleRequestOnDeleteUser', 3, 'action'); 552 552 break; 553 case WPRProtectFWRule_V68 1::EXE_ON_PASSWORD_RESET:553 case WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET: 554 554 $this->addWPHook($rule, 'password_reset', 'handleRequestOnPasswordReset', 2, 'action'); 555 555 break; 556 case WPRProtectFWRule_V68 1::EXE_ON_SEND_AUTH_COOKIES:556 case WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES: 557 557 $this->addWPHook($rule, 'send_auth_cookies', 'handleRequestOnSendAuthCookies', 6); 558 558 break; 559 case WPRProtectFWRule_V68 1::EXE_ON_SET_AUTH_COOKIE:559 case WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE: 560 560 $this->addWPHook($rule, 'set_auth_cookie', 'handleRequestOnSetAuthCookie', 6, 'action'); 561 561 break; 562 case WPRProtectFWRule_V68 1::EXE_ON_INIT:562 case WPRProtectFWRule_V683::EXE_ON_INIT: 563 563 $this->addWPHook($rule, 'init', 'handleRequestOnInit', 0, 'action'); 564 564 break; 565 case WPRProtectFWRule_V68 1::EXE_ON_USER_REGISTER:565 case WPRProtectFWRule_V683::EXE_ON_USER_REGISTER: 566 566 $this->addWPHook($rule, 'user_register', 'handleRequestOnUserRegister', 2, 'action'); 567 567 break; 568 case WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_META:568 case WPRProtectFWRule_V683::EXE_ON_ADD_USER_META: 569 569 $this->addWPHook($rule, 'add_user_meta', 'handleRequestOnAddUserMeta', 3, 'action'); 570 570 break; 571 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_METADATA:571 case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA: 572 572 $this->addWPHook($rule, 'update_user_metadata', 'handleRequestOnUpdateUserMetadata', 5); 573 573 break; 574 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_META:574 case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META: 575 575 $this->addWPHook($rule, 'update_user_meta', 'handleRequestOnUpdateUserMeta', 4, 'action'); 576 576 break; 577 case WPRProtectFWRule_V68 1::EXE_ON_ADD_OPTION:577 case WPRProtectFWRule_V683::EXE_ON_ADD_OPTION: 578 578 $this->addWPHook($rule, 'add_option', 'handleRequestOnAddOption', 2, 'action'); 579 579 break; 580 case WPRProtectFWRule_V68 1::EXE_ON_WP_PRE_INSERT_USER_DATA:580 case WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA: 581 581 $this->addWPHook($rule, 'wp_pre_insert_user_data', 'handleRequestOnWPPreInsertUserData', 4); 582 582 break; 583 case WPRProtectFWRule_V68 1::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:583 case WPRProtectFWRule_V683::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS: 584 584 $this->addWPHook($rule, 'rest_request_before_callbacks', 585 585 'handleRequestOnRestRequestBeforeCallbacks', 3); 586 586 break; 587 case WPRProtectFWRule_V68 1::EXE_ON_ADMIN_INIT:587 case WPRProtectFWRule_V683::EXE_ON_ADMIN_INIT: 588 588 $this->addWPHook($rule, 'admin_init', 'handleRequestOnAdminInit', 0, 'action'); 589 589 break; 590 case WPRProtectFWRule_V68 1::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:590 case WPRProtectFWRule_V683::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER: 591 591 $this->addWPHook($rule, 'wp_handle_upload_prefilter', 592 592 'handleRequestOnWPHandleUploadPrefilter', 1); 593 593 break; 594 case WPRProtectFWRule_V68 1::EXE_ON_TEMPLATE_REDIRECT:594 case WPRProtectFWRule_V683::EXE_ON_TEMPLATE_REDIRECT: 595 595 $this->addWPHook($rule, 'template_redirect', 'handleRequestOnTemplateRedirect', 0, 'action'); 596 596 break; 597 case WPRProtectFWRule_V68 1::EXE_ON_WP_LOADED:597 case WPRProtectFWRule_V683::EXE_ON_WP_LOADED: 598 598 $this->addWPHook($rule, 'wp_loaded', 'handleRequestOnWPLoaded', 0, 'action'); 599 599 break; 600 case WPRProtectFWRule_V68 1::EXE_ON_ADD_POST_METADATA:600 case WPRProtectFWRule_V683::EXE_ON_ADD_POST_METADATA: 601 601 $this->addWPHook($rule, 'add_post_metadata', 'handleRequestOnAddPostMetadata', 5); 602 602 break; 603 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_POST_METADATA:603 case WPRProtectFWRule_V683::EXE_ON_UPDATE_POST_METADATA: 604 604 $this->addWPHook($rule, 'update_post_metadata', 'handleRequestOnUpdatePostMetadata', 5); 605 605 break; 606 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_POST_METADATA:606 case WPRProtectFWRule_V683::EXE_ON_DELETE_POST_METADATA: 607 607 $this->addWPHook($rule, 'delete_post_metadata', 'handleRequestOnDeletePostMetadata', 5); 608 608 break; 609 case WPRProtectFWRule_V68 1::EXE_ON_ADD_TERM_METADATA:609 case WPRProtectFWRule_V683::EXE_ON_ADD_TERM_METADATA: 610 610 $this->addWPHook($rule, 'add_term_metadata', 'handleRequestOnAddTermMetadata', 5); 611 611 break; 612 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_TERM_METADATA:612 case WPRProtectFWRule_V683::EXE_ON_UPDATE_TERM_METADATA: 613 613 $this->addWPHook($rule, 'update_term_metadata', 'handleRequestOnUpdateTermMetadata', 5); 614 614 break; 615 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_TERM_METADATA:615 case WPRProtectFWRule_V683::EXE_ON_DELETE_TERM_METADATA: 616 616 $this->addWPHook($rule, 'delete_term_metadata', 'handleRequestOnDeleteTermMetadata', 5); 617 617 break; 618 case WPRProtectFWRule_V68 1::EXE_ON_ADD_COMMENT_METADATA:618 case WPRProtectFWRule_V683::EXE_ON_ADD_COMMENT_METADATA: 619 619 $this->addWPHook($rule, 'add_comment_metadata', 'handleRequestOnAddCommentMetadata', 5); 620 620 break; 621 case WPRProtectFWRule_V68 1::EXE_ON_UPDATE_COMMENT_METADATA:621 case WPRProtectFWRule_V683::EXE_ON_UPDATE_COMMENT_METADATA: 622 622 $this->addWPHook($rule, 'update_comment_metadata', 'handleRequestOnUpdateCommentMetadata', 5); 623 623 break; 624 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_COMMENT_METADATA:624 case WPRProtectFWRule_V683::EXE_ON_DELETE_COMMENT_METADATA: 625 625 $this->addWPHook($rule, 'delete_comment_metadata', 'handleRequestOnDeleteCommentMetadata', 5); 626 626 break; 627 case WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_METADATA:627 case WPRProtectFWRule_V683::EXE_ON_ADD_USER_METADATA: 628 628 $this->addWPHook($rule, 'add_user_metadata', 'handleRequestOnAddUserMetadata', 5); 629 629 break; 630 case WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER_METADATA:630 case WPRProtectFWRule_V683::EXE_ON_DELETE_USER_METADATA: 631 631 $this->addWPHook($rule, 'delete_user_metadata', 'handleRequestOnDeleteUserMetadata', 5); 632 632 break; … … 646 646 } 647 647 } else { 648 WPRProtectUtils_V68 1::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);648 WPRProtectUtils_V683::preInitWPHook($hook_name, $callback, -9999999, $accepted_args); 649 649 } 650 650 } … … 1204 1204 private function setIPCookie() { 1205 1205 if (!$this->is_ip_cookie_set && $this->isIPCookieEnabled() && 1206 !$this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME)) {1206 !$this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME)) { 1207 1207 1208 1208 $time = floor(time() / 86400); 1209 1209 $cookie = hash('sha256', $this->request->ip . $time . $this->cookie_key); 1210 1210 if ($cookie) { 1211 $this->setCookie(WPRProtectFW_V68 1::IP_COOKIE_NAME, $cookie, time() + 86400);1211 $this->setCookie(WPRProtectFW_V683::IP_COOKIE_NAME, $cookie, time() + 86400); 1212 1212 } 1213 1213 } … … 1217 1217 if (function_exists('current_user_can')) { 1218 1218 if (function_exists('is_super_admin') && is_super_admin()) { 1219 return WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_ADMIN;1219 return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN; 1220 1220 } 1221 1221 1222 1222 foreach ($this->custom_roles as $role) { 1223 1223 if (current_user_can($role)) { 1224 return WPRProtectFW_V68 1::WP_USER_ROLE_LEVEL_CUSTOM;1224 return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM; 1225 1225 } 1226 1226 } 1227 1227 1228 foreach (WPRProtectFW_V68 1::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {1228 foreach (WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) { 1229 1229 if (current_user_can($role)) { 1230 1230 return $level; … … 1334 1334 $cookies = array(); 1335 1335 1336 if ($this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME) !== NULL) {1337 $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V68 1::IP_COOKIE_NAME);1338 $cookies[WPRProtectFW_V68 1::IP_COOKIE_NAME] = $cookie_val;1336 if ($this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME) !== NULL) { 1337 $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME); 1338 $cookies[WPRProtectFW_V683::IP_COOKIE_NAME] = $cookie_val; 1339 1339 } 1340 1340 … … 1500 1500 1501 1501 private function getUserBy($attribute, $value) { 1502 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V68 1::havePluginsLoaded()) {1502 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V683::havePluginsLoaded()) { 1503 1503 return get_user_by($attribute, $value); 1504 1504 } … … 1604 1604 } 1605 1605 1606 if ($this->matchCount(WPRProtectFWRule_V68 1::SQLIREGEX, $value) > 2) {1606 if ($this->matchCount(WPRProtectFWRule_V683::SQLIREGEX, $value) > 2) { 1607 1607 $profiled_data[$key]["sql"] = true; 1608 1608 } … … 1693 1693 private function canRequestBypassFirewall() { 1694 1694 if ($this->isRequestIPWhitelisted() || $this->isRequestHasValidBypassCookie()) { 1695 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_WHITELISTED;1696 $this->request->status = WPRProtectRequest_V68 1::STATUS_BYPASSED;1695 $this->request->category = WPRProtectRequest_V683::CATEGORY_WHITELISTED; 1696 $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED; 1697 1697 1698 1698 return true; 1699 } elseif (WPRProtectUtils_V68 1::isPrivateIP($this->request->ip)) {1700 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_PRIVATEIP;1701 $this->request->status = WPRProtectRequest_V68 1::STATUS_BYPASSED;1699 } elseif (WPRProtectUtils_V683::isPrivateIP($this->request->ip)) { 1700 $this->request->category = WPRProtectRequest_V683::CATEGORY_PRIVATEIP; 1701 $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED; 1702 1702 1703 1703 return true; … … 1723 1723 1724 1724 private function handleRequestOnRuleMatch($rules, $engine_vars = array(), $log_data = array()) { 1725 $normalized_engine_vars = WPRProtectFWRuleEngine_V68 1::normalizeVariables($engine_vars);1725 $normalized_engine_vars = WPRProtectFWRuleEngine_V683::normalizeVariables($engine_vars); 1726 1726 1727 1727 foreach ($rules as $rule) { … … 1733 1733 if (array_key_exists('variables', $rule->opts)) { 1734 1734 $_engine_vars = array_merge($_engine_vars, 1735 WPRProtectFWRuleEngine_V68 1::normalizeVariables($rule->opts['variables']));1736 } 1737 1738 $rule_engine = new WPRProtectFWRuleEngine_V68 1($this->request, $_engine_vars);1735 WPRProtectFWRuleEngine_V683::normalizeVariables($rule->opts['variables'])); 1736 } 1737 1738 $rule_engine = new WPRProtectFWRuleEngine_V683($this->request, $_engine_vars); 1739 1739 1740 1740 if ($rule_engine->evaluate($rule) && !$rule_engine->hasError()) { … … 1749 1749 case "ALLOW": 1750 1750 $this->break_rule_matching = true; 1751 $this->request->category = WPRProtectRequest_V68 1::CATEGORY_RULE_ALLOWED;1751 $this->request->category = WPRProtectRequest_V683::CATEGORY_RULE_ALLOWED; 1752 1752 return; 1753 1753 case "BLOCK": 1754 1754 if ($this->isModeProtect()) { 1755 $this->terminateRequest(WPRProtectRequest_V68 1::CATEGORY_RULE_BLOCKED);1755 $this->terminateRequest(WPRProtectRequest_V683::CATEGORY_RULE_BLOCKED); 1756 1756 } 1757 1757 return; … … 1769 1769 private function terminateRequest($category) { 1770 1770 $this->request->category = $category; 1771 $this->request->status = WPRProtectRequest_V68 1::STATUS_BLOCKED;1771 $this->request->status = WPRProtectRequest_V683::STATUS_BLOCKED; 1772 1772 $this->request->setRespCode(403); 1773 1773 1774 1774 if ($this->can_set_cache_prevention_cookie && 1775 !$this->request->getCookies(WPRProtectFW_V68 1::PREVENT_CACHE_COOKIE_NAME)) {1775 !$this->request->getCookies(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME)) { 1776 1776 $value = "Prevent Caching Response."; 1777 $this->setCookie(WPRProtectFW_V68 1::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);1777 $this->setCookie(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200); 1778 1778 } 1779 1779 … … 1803 1803 $cookie = $this->generateBypassCookie(); 1804 1804 if ($cookie) { 1805 $this->setCookie(WPRProtectFW_V68 1::BYPASS_COOKIE_NAME, $cookie);1805 $this->setCookie(WPRProtectFW_V683::BYPASS_COOKIE_NAME, $cookie); 1806 1806 } 1807 1807 } -
wpremote/trunk/protect/fw/rule.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectFWRule_V68 1')) :5 class WPRProtectFWRule_V68 1{4 if (!class_exists('WPRProtectFWRule_V683')) : 5 class WPRProtectFWRule_V683 { 6 6 public $id; 7 7 public $logic; … … 105 105 106 106 if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) || 107 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V68 1::VERSION) {107 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V683::VERSION) { 108 108 109 109 return false; … … 111 111 112 112 if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) || 113 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V68 1::VERSION)) {113 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V683::VERSION)) { 114 114 115 115 return false; … … 130 130 if (!array_key_exists('execute_on', $attributes)) { 131 131 if (array_key_exists('level', $attributes) && $attributes['level'] === 1) { 132 $attributes['execute_on'] = WPRProtectFWRule_V68 1::EXE_ON_BOOT;132 $attributes['execute_on'] = WPRProtectFWRule_V683::EXE_ON_BOOT; 133 133 } else { 134 134 return false; … … 136 136 } 137 137 138 return new WPRProtectFWRule_V68 1($attributes);138 return new WPRProtectFWRule_V683($attributes); 139 139 } 140 140 141 141 public function isExeOnBoot() { 142 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_BOOT);142 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_BOOT); 143 143 } 144 144 145 145 public function isExeOnPreUpdateOption() { 146 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PRE_UPDATE_OPTION);146 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION); 147 147 } 148 148 149 149 public function isExeOnPreDeletePost() { 150 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PRE_DELETE_POST);150 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST); 151 151 } 152 152 153 153 public function isExeOnWPInsertPostEmptyContent() { 154 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);154 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT); 155 155 } 156 156 157 157 public function isExeOnInsertUserMeta() { 158 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_INSERT_USER_META);158 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META); 159 159 } 160 160 161 161 public function isExeOnDeleteOption() { 162 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_DELETE_OPTION);162 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION); 163 163 } 164 164 165 165 public function isExeOnDeleteUser() { 166 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_DELETE_USER);166 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_USER); 167 167 } 168 168 169 169 public function isExeOnPasswordReset() { 170 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_PASSWORD_RESET);170 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET); 171 171 } 172 172 173 173 public function isExeOnSendAuthCookies() { 174 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_SEND_AUTH_COOKIES);174 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES); 175 175 } 176 176 177 177 public function isExeOnSetAuthCookie() { 178 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_SET_AUTH_COOKIE);178 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE); 179 179 } 180 180 181 181 public function isExeOnInit() { 182 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_INIT);182 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INIT); 183 183 } 184 184 185 185 public function isExeOnUserRegister() { 186 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_USER_REGISTER);186 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_USER_REGISTER); 187 187 } 188 188 189 189 public function isExeOnAddUserMeta() { 190 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_ADD_USER_META);190 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_USER_META); 191 191 } 192 192 193 193 public function isExeOnUpdateUserMetadata() { 194 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_METADATA);194 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA); 195 195 } 196 196 197 197 public function isExeOnUpdateUserMeta() { 198 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_UPDATE_USER_META);198 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META); 199 199 } 200 200 201 201 public function isExeOnAddOption() { 202 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_ADD_OPTION);202 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_OPTION); 203 203 } 204 204 205 205 public function isExeOnWpPreInsertUserData() { 206 return ($this->execute_on === WPRProtectFWRule_V68 1::EXE_ON_WP_PRE_INSERT_USER_DATA);206 return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA); 207 207 } 208 208 } -
wpremote/trunk/protect/fw/rule/engine.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!class_exists('WPRProtectFWRuleEngine_V68 1')) :5 if (!class_exists('WPRProtectFWRuleEngine_V683')) : 6 6 require_once dirname( __FILE__ ) . '/functions.php'; 7 7 8 class WPRProtectFWRuleEngine_V68 1{9 use WPRProtectFWRuleStringFunc_V68 1;10 use WPRProtectFWRuleArrayFunc_V68 1;11 use WPRProtectFWRuleMiscFunc_V68 1;12 use WPRProtectFWRuleRequestFunc_V68 1;13 use WPRProtectFWRuleWPFunc_V68 1;8 class WPRProtectFWRuleEngine_V683 { 9 use WPRProtectFWRuleStringFunc_V683; 10 use WPRProtectFWRuleArrayFunc_V683; 11 use WPRProtectFWRuleMiscFunc_V683; 12 use WPRProtectFWRuleRequestFunc_V683; 13 use WPRProtectFWRuleWPFunc_V683; 14 14 15 15 private $request; … … 26 26 const WILDCARD_KEY = '*'; 27 27 const FUNC_NAME_PREFIX = '_rf_'; 28 const CONST_NAME_PREFIX = 'WPRProtectFWRule_V68 1::';28 const CONST_NAME_PREFIX = 'WPRProtectFWRule_V683::'; 29 29 const ALLOWED_EXT_CONSTANTS = [ 30 30 'DOING_CRON' … … 53 53 try { 54 54 return $this->executeStmt($rule->logic); 55 } catch (WPRProtectRuleError_V68 1$e) {55 } catch (WPRProtectRuleError_V683 $e) { 56 56 $this->error = $e; 57 57 } … … 124 124 private function getValue($stmt) { 125 125 if (!is_array($stmt) || empty($stmt["type"])) { 126 throw new WPRProtectRuleError_V68 1(126 throw new WPRProtectRuleError_V683( 127 127 $this->addExState("InvalidStatementError: Malformed value statement")); 128 128 } … … 133 133 case "NUMBER": 134 134 if (!isset($stmt["value"]) || !is_int($stmt["value"])) { 135 throw new WPRProtectRuleError_V68 1(135 throw new WPRProtectRuleError_V683( 136 136 $this->addExState("TypeError: Value is not a number") 137 137 ); … … 141 141 case "STRING": 142 142 if (!isset($stmt["value"]) || !is_string($stmt["value"])) { 143 throw new WPRProtectRuleError_V68 1(143 throw new WPRProtectRuleError_V683( 144 144 $this->addExState("TypeError: Value is not a string") 145 145 ); … … 149 149 case "BOOL": 150 150 if (!isset($stmt["value"]) || !is_bool($stmt["value"])) { 151 throw new WPRProtectRuleError_V68 1(151 throw new WPRProtectRuleError_V683( 152 152 $this->addExState("TypeError: Value is not a boolean") 153 153 ); … … 157 157 case "CONST": 158 158 if (!isset($stmt["value"]) || !is_string($stmt["value"])) { 159 throw new WPRProtectRuleError_V68 1(159 throw new WPRProtectRuleError_V683( 160 160 $this->addExState("TypeError: Invalid constant name") 161 161 ); … … 169 169 170 170 if (!defined($name)) { 171 throw new WPRProtectRuleError_V68 1(171 throw new WPRProtectRuleError_V683( 172 172 $this->addExState("TypeError: Undefined constant" . $stmt["value"]) 173 173 ); … … 177 177 case "ARRAY": 178 178 if (!isset($stmt["value"]) || !is_array($stmt["value"])) { 179 throw new WPRProtectRuleError_V68 1(179 throw new WPRProtectRuleError_V683( 180 180 $this->addExState("TypeError: Value is not a array") 181 181 ); … … 208 208 private function executeStmt($stmt) { 209 209 if (!is_array($stmt) || empty($stmt["type"])) { 210 throw new WPRProtectRuleError_V68 1(210 throw new WPRProtectRuleError_V683( 211 211 $this->addExState("InvalidStatementError: Malformed logic statement") 212 212 ); … … 220 220 case "AND": 221 221 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) { 222 throw new WPRProtectRuleError_V68 1(222 throw new WPRProtectRuleError_V683( 223 223 $this->addExState("InvalidOperandError: Malformed operand(s)") 224 224 ); … … 229 229 case "OR": 230 230 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) { 231 throw new WPRProtectRuleError_V68 1(231 throw new WPRProtectRuleError_V683( 232 232 $this->addExState("InvalidOperandError: Malformed operand(s)") 233 233 ); … … 238 238 case "NOT": 239 239 if (empty($stmt["value"])) { 240 throw new WPRProtectRuleError_V68 1(240 throw new WPRProtectRuleError_V683( 241 241 $this->addExState("InvalidOperandError: Malformed operand") 242 242 ); … … 247 247 case "FUNCTION": 248 248 if (empty($stmt["name"]) || !is_string($stmt["name"])) { 249 throw new WPRProtectRuleError_V68 1(249 throw new WPRProtectRuleError_V683( 250 250 $this->addExState("InvalidFunctionName: Malformed name") 251 251 ); … … 256 256 257 257 if (!is_callable($handler)) { 258 throw new WPRProtectRuleError_V68 1(258 throw new WPRProtectRuleError_V683( 259 259 $this->addExState("UndefinedFunctionCall: " . $stmt["name"]) 260 260 ); … … 262 262 263 263 if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) { 264 throw new WPRProtectRuleError_V68 1(264 throw new WPRProtectRuleError_V683( 265 265 $this->addExState("InvalidArguments: Malformed args") 266 266 ); … … 275 275 break; 276 276 default: 277 throw new WPRProtectRuleError_V68 1(277 throw new WPRProtectRuleError_V683( 278 278 $this->addExState("UnknownOperation: -") 279 279 ); … … 286 286 private function processRuleFunctionParams($func_name, $args_cnt, $args, $required_params = 0, $param_types = array()) { 287 287 if (($args_cnt < $required_params)) { 288 throw new WPRProtectRuleError_V68 1(288 throw new WPRProtectRuleError_V683( 289 289 $this->addExState("ArgumentCountError: Too few arguments for " . $func_name) 290 290 ); … … 293 293 foreach ($param_types as $pos => $type) { 294 294 if (!is_int($pos)) { 295 throw new WPRProtectRuleError_V68 1(295 throw new WPRProtectRuleError_V683( 296 296 $this->addExState("InvalidParamType: " . $pos) 297 297 ); … … 301 301 case "string": 302 302 if (!isset($args[$pos]) || !is_string($args[$pos])) { 303 throw new WPRProtectRuleError_V68 1(303 throw new WPRProtectRuleError_V683( 304 304 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a string.") 305 305 ); … … 308 308 case 'integer': 309 309 if (!isset($args[$pos]) || !is_int($args[$pos])) { 310 throw new WPRProtectRuleError_V68 1(310 throw new WPRProtectRuleError_V683( 311 311 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a integer.") 312 312 ); … … 315 315 case 'double': 316 316 if (!isset($args[$pos]) || !is_double($args[$pos])) { 317 throw new WPRProtectRuleError_V68 1(317 throw new WPRProtectRuleError_V683( 318 318 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a double.") 319 319 ); … … 322 322 case 'boolean': 323 323 if (!isset($args[$pos]) || !is_bool($args[$pos])) { 324 throw new WPRProtectRuleError_V68 1(324 throw new WPRProtectRuleError_V683( 325 325 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a boolean.") 326 326 ); … … 329 329 case 'array': 330 330 if (!isset($args[$pos]) || !is_array($args[$pos])) { 331 throw new WPRProtectRuleError_V68 1(331 throw new WPRProtectRuleError_V683( 332 332 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.") 333 333 ); … … 337 337 break; 338 338 default: 339 throw new WPRProtectRuleError_V68 1(339 throw new WPRProtectRuleError_V683( 340 340 $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name) 341 341 ); -
wpremote/trunk/protect/fw/rule/errors.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectRuleError_V68 1')) :5 class WPRProtectRuleError_V68 1extends Exception {4 if (!class_exists('WPRProtectRuleError_V683')) : 5 class WPRProtectRuleError_V683 extends Exception { 6 6 //Root rule error class. 7 7 } -
wpremote/trunk/protect/fw/rule/functions/array.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V68 1')) :6 trait WPRProtectFWRuleArrayFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V683')) : 6 trait WPRProtectFWRuleArrayFunc_V683 { 7 7 private function _rf_inArray() { 8 8 $args = $this->processRuleFunctionParams( … … 17 17 18 18 if (!is_array($array)) { 19 throw new WPRProtectRuleError_V68 1(19 throw new WPRProtectRuleError_V683( 20 20 $this->addExState("inArray: 2nd param is not an array") 21 21 ); … … 23 23 24 24 if (!is_bool($strict)) { 25 throw new WPRProtectRuleError_V68 1(25 throw new WPRProtectRuleError_V683( 26 26 $this->addExState("inArray: 3rd param is not a boolean") 27 27 ); … … 54 54 } 55 55 } else { 56 throw new WPRProtectRuleError_V68 1(56 throw new WPRProtectRuleError_V683( 57 57 $this->addExState("recInArray: Expects an array") 58 58 ); … … 73 73 74 74 if (!is_array($array)) { 75 throw new WPRProtectRuleError_V68 1(75 throw new WPRProtectRuleError_V683( 76 76 $this->addExState("arrayKeyExists: Array must be of type array") 77 77 ); 78 78 } elseif (!is_string($key) && !is_int($key)) { 79 throw new WPRProtectRuleError_V68 1(79 throw new WPRProtectRuleError_V683( 80 80 $this->addExState("arrayKeyExists: Key must be of type string or int") 81 81 ); … … 110 110 111 111 if (!is_bool($recursive)) { 112 throw new WPRProtectRuleError_V68 1(112 throw new WPRProtectRuleError_V683( 113 113 $this->addExState("getArrayKeys: 2nd param must be a boolean") 114 114 ); … … 140 140 141 141 if (!is_bool($recursive)) { 142 throw new WPRProtectRuleError_V68 1(142 throw new WPRProtectRuleError_V683( 143 143 $this->addExState("hasAnyArrayKey: 3rd param must be a boolean") 144 144 ); … … 148 148 foreach ($keys as $key) { 149 149 if (!is_int($key) && !is_string($key)) { 150 throw new WPRProtectRuleError_V68 1(150 throw new WPRProtectRuleError_V683( 151 151 $this->addExState("hasAnyArrayKey: Key must be of type string or int") 152 152 ); … … 189 189 190 190 if (!is_bool($recursive)) { 191 throw new WPRProtectRuleError_V68 1(191 throw new WPRProtectRuleError_V683( 192 192 $this->addExState("keyMatches: 3rd param must be a boolean") 193 193 ); … … 224 224 225 225 if ($resp === false) { 226 throw new WPRProtectRuleError_V68 1(226 throw new WPRProtectRuleError_V683( 227 227 $this->addExState("keyMatches: Invalid regular expression") 228 228 ); … … 233 233 $resp = WPRHelper::safePregMatch($pattern, (string) $key); 234 234 if ($resp === false) { 235 throw new WPRProtectRuleError_V68 1(235 throw new WPRProtectRuleError_V683( 236 236 $this->addExState("keyMatches: Regex match failed") 237 237 ); … … 242 242 243 243 private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) { 244 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {244 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 245 245 return false; 246 246 } … … 262 262 263 263 private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) { 264 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {264 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 265 265 return; 266 266 } … … 277 277 278 278 private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) { 279 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {279 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 280 280 return false; 281 281 } … … 297 297 298 298 private function enforceArrayTraversalLimit($func_name, $traversed_keys) { 299 if ($traversed_keys > WPRProtectFWRuleEngine_V68 1::MAX_ARRAY_KEYS_TO_TRAVERSE) {300 throw new WPRProtectRuleError_V68 1(299 if ($traversed_keys > WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) { 300 throw new WPRProtectRuleError_V683( 301 301 $this->addExState( 302 302 "TraversalLimitError: " . $func_name . " exceeded " . 303 WPRProtectFWRuleEngine_V68 1::MAX_ARRAY_KEYS_TO_TRAVERSE .303 WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE . 304 304 " array keys" 305 305 ) … … 321 321 foreach ($keys as $key) { 322 322 if (!is_int($key) && !is_string($key)) { 323 throw new WPRProtectRuleError_V68 1(323 throw new WPRProtectRuleError_V683( 324 324 $this->addExState("digArray: Keys must be a valid array of string, or integer type") 325 325 ); … … 342 342 343 343 if (empty($keys)) { 344 throw new WPRProtectRuleError_V68 1(344 throw new WPRProtectRuleError_V683( 345 345 $this->addExState("digArrayValues: Keys must not be empty") 346 346 ); 347 347 } 348 348 349 if (count($keys) > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {350 throw new WPRProtectRuleError_V68 1(349 if (count($keys) > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 350 throw new WPRProtectRuleError_V683( 351 351 $this->addExState( 352 352 "digArrayValues: Keys exceeded " . 353 WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .353 WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC . 354 354 " levels of traversal" 355 355 ) … … 359 359 foreach ($keys as $key) { 360 360 if (!is_int($key) && !is_string($key)) { 361 throw new WPRProtectRuleError_V68 1(361 throw new WPRProtectRuleError_V683( 362 362 $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type") 363 363 ); … … 376 376 } 377 377 378 if ($key === WPRProtectFWRuleEngine_V68 1::WILDCARD_KEY) {378 if ($key === WPRProtectFWRuleEngine_V683::WILDCARD_KEY) { 379 379 foreach ($node as $value) { 380 380 $traversed_keys += 1; … … 417 417 foreach ($keys as $key) { 418 418 if (!is_int($key) && !is_string($key)) { 419 throw new WPRProtectRuleError_V68 1(419 throw new WPRProtectRuleError_V683( 420 420 $this->addExState("filterArray: Keys must be a valid array of string, or integer type") 421 421 ); … … 438 438 439 439 if (!is_string($key) && !is_int($key)) { 440 throw new WPRProtectRuleError_V68 1(440 throw new WPRProtectRuleError_V683( 441 441 $this->addExState("getArrayVal: Key must be a valid string or integer") 442 442 ); … … 519 519 foreach ($array as $element) { 520 520 if (!is_scalar($element)) { 521 throw new WPRProtectRuleError_V68 1(521 throw new WPRProtectRuleError_V683( 522 522 $this->addExState("arrayJoin: Array element must be of scalar type") 523 523 ); -
wpremote/trunk/protect/fw/rule/functions/misc.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V68 1')) :6 trait WPRProtectFWRuleMiscFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V683')) : 6 trait WPRProtectFWRuleMiscFunc_V683 { 7 7 private function _rf_isTrue() { 8 8 $args = $this->processRuleFunctionParams( … … 73 73 74 74 if (!array_key_exists($name, $this->variables)) { 75 throw new WPRProtectRuleError_V68 1(75 throw new WPRProtectRuleError_V683( 76 76 $this->addExState("UndefinedVariableError: " . $name . " is not defined.") 77 77 ); … … 134 134 $resp = WPRHelper::safePregMatch((string) $pattern, (string) $subject); 135 135 if ($resp === false) { 136 throw new WPRProtectRuleError_V68 1(136 throw new WPRProtectRuleError_V683( 137 137 $this->addExState('BVHelper::safePregMatch' . serialize($subject)) 138 138 ); … … 175 175 $count = preg_match_all((string) $pattern, (string) $subject, $matches); 176 176 if ($count === false) { 177 throw new WPRProtectRuleError_V68 1(177 throw new WPRProtectRuleError_V683( 178 178 $this->addExState("preg_match_all: " . serialize($subject)) 179 179 ); … … 201 201 $count = preg_match_all((string) $pattern, (string) $subject, $matches); 202 202 if ($count === false) { 203 throw new WPRProtectRuleError_V68 1(203 throw new WPRProtectRuleError_V683( 204 204 $this->addExState("preg_match_all: " . serialize($subject)) 205 205 ); -
wpremote/trunk/protect/fw/rule/functions/request.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V68 1')) :6 trait WPRProtectFWRuleRequestFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V683')) : 6 trait WPRProtectFWRuleRequestFunc_V683 { 7 7 private function _rf_getAction() { 8 8 $args = $this->processRuleFunctionParams( … … 496 496 497 497 if (!array_key_exists('ID', $user)) { 498 throw new WPRProtectRuleError_V68 1(498 throw new WPRProtectRuleError_V683( 499 499 $this->addExState("wpUserId: user's id doesn't exist") 500 500 ); -
wpremote/trunk/protect/fw/rule/functions/string.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleStringFunc_V68 1')) :6 trait WPRProtectFWRuleStringFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleStringFunc_V683')) : 6 trait WPRProtectFWRuleStringFunc_V683 { 7 7 private function _rf_isNumeric() { 8 8 $args = $this->processRuleFunctionParams( … … 239 239 } 240 240 } else { 241 throw new WPRProtectRuleError_V68 1(241 throw new WPRProtectRuleError_V683( 242 242 $this->addExState("containsAnySubstring: Expects an array of substrings.") 243 243 ); … … 274 274 275 275 if (!is_int($offset)) { 276 throw new WPRProtectRuleError_V68 1(276 throw new WPRProtectRuleError_V683( 277 277 $this->addExState("strPos: Offset should be an integer") 278 278 ); … … 319 319 320 320 if (empty($separator)) { 321 throw new WPRProtectRuleError_V68 1(321 throw new WPRProtectRuleError_V683( 322 322 $this->addExState("splitString: Separator cannot be empty") 323 323 ); … … 325 325 326 326 if (!is_int($limit)) { 327 throw new WPRProtectRuleError_V68 1(327 throw new WPRProtectRuleError_V683( 328 328 $this->addExState("splitString: Limit should be an integer") 329 329 ); … … 344 344 345 345 if (!is_bool($recursive)) { 346 throw new WPRProtectRuleError_V68 1(346 throw new WPRProtectRuleError_V683( 347 347 $this->addExState("urlDecode: Recursive flag should be a boolean") 348 348 ); … … 363 363 364 364 if (!is_bool($recursive)) { 365 throw new WPRProtectRuleError_V68 1(365 throw new WPRProtectRuleError_V683( 366 366 $this->addExState("rawUrlDecode: Recursive flag should be a boolean") 367 367 ); … … 382 382 383 383 if (!is_bool($recursive)) { 384 throw new WPRProtectRuleError_V68 1(384 throw new WPRProtectRuleError_V683( 385 385 $this->addExState("htmlEntityDecode: Recursive flag should be a boolean") 386 386 ); … … 401 401 402 402 if (!is_bool($recursive)) { 403 throw new WPRProtectRuleError_V68 1(403 throw new WPRProtectRuleError_V683( 404 404 $this->addExState("stripSlashes: Recursive flag should be a boolean") 405 405 ); … … 410 410 411 411 private function normalizeStringValue($value, $operation, $recursive, $depth = 1) { 412 if ($depth > WPRProtectFWRuleEngine_V68 1::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {412 if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) { 413 413 return null; 414 414 } … … 442 442 } 443 443 444 throw new WPRProtectRuleError_V68 1(444 throw new WPRProtectRuleError_V683( 445 445 $this->addExState("normalizeStringValue: Invalid normalization operation") 446 446 ); -
wpremote/trunk/protect/fw/rule/functions/wp.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!trait_exists('WPRProtectFWRuleWPFunc_V68 1')) :6 trait WPRProtectFWRuleWPFunc_V68 1{5 if (!trait_exists('WPRProtectFWRuleWPFunc_V683')) : 6 trait WPRProtectFWRuleWPFunc_V683 { 7 7 private function _rf_sanitizeUser() { 8 8 $args = $this->processRuleFunctionParams( … … 16 16 $strict = $args[1]; 17 17 18 if (!function_exists('sanitize_user') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {19 throw new WPRProtectRuleError_V68 1(18 if (!function_exists('sanitize_user') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 19 throw new WPRProtectRuleError_V683( 20 20 $this->addExState("sanitizeUser: Func sanitize_user doesn't exist.") 21 21 ); … … 34 34 $data = $args[0]; 35 35 36 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {37 throw new WPRProtectRuleError_V68 1(36 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 37 throw new WPRProtectRuleError_V683( 38 38 $this->addExState("maybeSerialize: Func maybe_serialize doesn't exist.") 39 39 ); … … 50 50 ); 51 51 52 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {53 throw new WPRProtectRuleError_V68 1(52 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V683::havePluginsLoaded()) { 53 throw new WPRProtectRuleError_V683( 54 54 $this->addExState("isUserLoggedIn: Func is_user_logged_in doesn't exist.") 55 55 ); … … 66 66 ); 67 67 68 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {69 throw new WPRProtectRuleError_V68 1(68 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V683::havePluginsLoaded()) { 69 throw new WPRProtectRuleError_V683( 70 70 $this->addExState("getCurrentWPUser: Func wp_get_current_user doesn't exist.") 71 71 ); 72 72 } 73 73 74 return WPRProtectFWRuleEngine_V68 1::toAllowedType(wp_get_current_user());74 return WPRProtectFWRuleEngine_V683::toAllowedType(wp_get_current_user()); 75 75 } 76 76 … … 87 87 $arg2 = isset($args[2]) ? $args[2] : null; 88 88 89 if (!function_exists('current_user_can') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {90 throw new WPRProtectRuleError_V68 1(89 if (!function_exists('current_user_can') || !WPRProtectUtils_V683::havePluginsLoaded()) { 90 throw new WPRProtectRuleError_V683( 91 91 $this->addExState("currentUserCan: Required funcs doesn't exist.") 92 92 ); … … 115 115 $value = $args[1]; 116 116 117 if (!function_exists('get_user_by') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {118 throw new WPRProtectRuleError_V68 1(117 if (!function_exists('get_user_by') || !WPRProtectUtils_V683::havePluginsLoaded()) { 118 throw new WPRProtectRuleError_V683( 119 119 $this->addExState("getUserBy: Func get_user_by doesn't exist") 120 120 ); … … 123 123 if ($field === 'ID' || $field === 'id') { 124 124 if (!is_string($value) && !is_int($value)) { 125 throw new WPRProtectRuleError_V68 1(125 throw new WPRProtectRuleError_V683( 126 126 $this->addExState("getUserBy: Value must be a valid string or an integer") 127 127 ); 128 128 } 129 129 } elseif (!is_string($value)) { 130 throw new WPRProtectRuleError_V68 1(130 throw new WPRProtectRuleError_V683( 131 131 $this->addExState("getUserBy: Value must be a valid string") 132 132 ); … … 138 138 } 139 139 140 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user);140 return WPRProtectFWRuleEngine_V683::toAllowedType($user); 141 141 } 142 142 … … 151 151 152 152 if (!array_key_exists("allcaps", $user)) { 153 throw new WPRProtectRuleError_V68 1(153 throw new WPRProtectRuleError_V683( 154 154 $this->addExState("getCurrentWPUserCapabilities: allcaps doesn't exist in user.") 155 155 ); 156 156 } 157 157 158 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user["allcaps"]);158 return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]); 159 159 } 160 160 … … 174 174 175 175 if (!array_key_exists("allcaps", $user)) { 176 throw new WPRProtectRuleError_V68 1(176 throw new WPRProtectRuleError_V683( 177 177 $this->addExState("getUserCapabilities: allcaps doesn't exist in user.") 178 178 ); 179 179 } 180 180 181 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user["allcaps"]);181 return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]); 182 182 } 183 183 … … 203 203 $default_value = isset($args[1]) ? $args[1] : false; 204 204 205 if (!function_exists('get_option') || !WPRProtectUtils_V68 1::haveMupluginsLoaded()) {206 throw new WPRProtectRuleError_V68 1(205 if (!function_exists('get_option') || !WPRProtectUtils_V683::haveMupluginsLoaded()) { 206 throw new WPRProtectRuleError_V683( 207 207 $this->addExState("getOption: Func get_option doesn't exist.") 208 208 ); 209 209 } 210 210 211 return WPRProtectFWRuleEngine_V68 1::toAllowedType(get_option($option, $default_value));211 return WPRProtectFWRuleEngine_V683::toAllowedType(get_option($option, $default_value)); 212 212 } 213 213 … … 223 223 $login = $args[1]; 224 224 225 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V68 1::havePluginsLoaded()) {226 throw new WPRProtectRuleError_V68 1(225 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V683::havePluginsLoaded()) { 226 throw new WPRProtectRuleError_V683( 227 227 $this->addExState("checkPasswordResetKey: Func check_password_reset_key doesn't exist.") 228 228 ); … … 232 232 233 233 if (is_a($user, "WP_User")) { 234 return WPRProtectFWRuleEngine_V68 1::toAllowedType($user);234 return WPRProtectFWRuleEngine_V683::toAllowedType($user); 235 235 } 236 236 … … 287 287 $value = $args[0]; 288 288 289 if (!function_exists('wp_unslash') || !WPRProtectUtils_V68 1::haveMuPluginsLoaded()) {290 throw new WPRProtectRuleError_V68 1(289 if (!function_exists('wp_unslash') || !WPRProtectUtils_V683::haveMuPluginsLoaded()) { 290 throw new WPRProtectRuleError_V683( 291 291 $this->addExState("wpUnslash: Func wp_unslash doesn't exist.") 292 292 ); … … 294 294 295 295 if (!is_string($value) && !is_array($value)) { 296 throw new WPRProtectRuleError_V68 1(296 throw new WPRProtectRuleError_V683( 297 297 $this->addExState("wpUnslash: Value must be a valid string or an array") 298 298 ); … … 310 310 311 311 if (!defined('COOKIEHASH')) { 312 throw new WPRProtectRuleError_V68 1(312 throw new WPRProtectRuleError_V683( 313 313 $this->addExState("parseResetPassCookie: COOKIEHASH is not defined.") 314 314 ); -
wpremote/trunk/protect/ipstore.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstore_V68 1')) :4 if (!class_exists('WPRProtectIpstore_V683')) : 5 5 require_once dirname( __FILE__ ) . '/request.php'; 6 6 require_once dirname( __FILE__ ) . '/ipstore/fs.php'; 7 7 require_once dirname( __FILE__ ) . '/ipstore/db.php'; 8 8 9 class WPRProtectIpstore_V68 1{9 class WPRProtectIpstore_V683 { 10 10 private $storage; 11 11 private $storage_type; … … 14 14 const STORAGE_TYPE_DB = 1; 15 15 16 function __construct($storage_type = WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {16 function __construct($storage_type = WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 17 17 $this->storage_type = $storage_type; 18 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_FS) {19 $this->storage = new WPRProtectIpstoreFS_V68 1();18 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_FS) { 19 $this->storage = new WPRProtectIpstoreFS_V683(); 20 20 } else { 21 $this->storage = new WPRProtectIpstoreDB_V68 1();21 $this->storage = new WPRProtectIpstoreDB_V683(); 22 22 } 23 23 } 24 24 25 25 public static function uninstall() { 26 WPRProtectIpstoreDB_V68 1::uninstall();26 WPRProtectIpstoreDB_V683::uninstall(); 27 27 } 28 28 29 29 public function isLPIPBlacklisted($ip) { 30 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {30 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 31 31 return $this->storage->isLPIPBlacklisted($ip); 32 32 } … … 34 34 35 35 public function isLPIPWhitelisted($ip) { 36 if ($this->storage_type == WPRProtectIpstore_V68 1::STORAGE_TYPE_DB) {36 if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) { 37 37 return $this->storage->isLPIPWhitelisted($ip); 38 38 } -
wpremote/trunk/protect/ipstore/db.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstoreDB_V68 1')) :5 class WPRProtectIpstoreDB_V68 1{4 if (!class_exists('WPRProtectIpstoreDB_V683')) : 5 class WPRProtectIpstoreDB_V683 { 6 6 const TABLE_NAME = 'ip_store'; 7 7 … … 11 11 #XNOTE: check this. 12 12 public static function blacklistedTypes() { 13 return WPRProtectRequest_V68 1::blacklistedCategories();13 return WPRProtectRequest_V683::blacklistedCategories(); 14 14 } 15 15 16 16 public static function whitelistedTypes() { 17 return WPRProtectRequest_V68 1::whitelistedCategories();17 return WPRProtectRequest_V683::whitelistedCategories(); 18 18 } 19 19 20 20 public static function uninstall() { 21 WPRProtect_V68 1::$db->dropBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);21 WPRProtect_V683::$db->dropBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME); 22 22 } 23 23 24 24 public function isLPIPBlacklisted($ip) { 25 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_LP);25 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 26 26 } 27 27 28 28 public function isLPIPWhitelisted($ip) { 29 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_LP);29 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP); 30 30 } 31 31 32 32 public function getTypeIfBlacklistedIP($ip) { 33 return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);33 return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 34 34 } 35 35 36 36 public function isFWIPBlacklisted($ip) { 37 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);37 return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 38 38 } 39 39 40 40 public function isFWIPWhitelisted($ip) { 41 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V68 1::CATEGORY_FW);41 return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW); 42 42 } 43 43 … … 50 50 #XNOTE: getIPCategory or getIPType? 51 51 private function getIPType($ip, $types, $category) { 52 $table = WPRProtect_V68 1::$db->getBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);52 $table = WPRProtect_V683::$db->getBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME); 53 53 54 if (WPRProtect_V68 1::$db->isTablePresent($table)) {55 $binIP = WPRProtectUtils_V68 1::bvInetPton($ip);56 $is_v6 = WPRProtectUtils_V68 1::isIPv6($ip);54 if (WPRProtect_V683::$db->isTablePresent($table)) { 55 $binIP = WPRProtectUtils_V683::bvInetPton($ip); 56 $is_v6 = WPRProtectUtils_V683::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_V68 1::CATEGORY_FW) {60 if ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) { 61 61 $query_str .= "`is_fw` = true"; 62 62 } else { … … 65 65 $query_str .= " && `type` in (" . implode(',', $types) . ") && `is_v6` = %d LIMIT 1;"; 66 66 67 $query = WPRProtect_V68 1::$db->prepare($query_str, array($binIP, $binIP, $is_v6));67 $query = WPRProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6)); 68 68 69 return WPRProtect_V68 1::$db->getVar($query, 5);69 return WPRProtect_V683::$db->getVar($query, 5); 70 70 } 71 71 } -
wpremote/trunk/protect/ipstore/fs.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectIpstoreFS_V68 1')) :5 class WPRProtectIpstoreFS_V68 1{4 if (!class_exists('WPRProtectIpstoreFS_V683')) : 5 class WPRProtectIpstoreFS_V683 { 6 6 private $whitelisted_ips; 7 7 private $blacklisted_ips; … … 12 12 function __construct() { 13 13 $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf'; 14 $ips = WPRProtectUtils_V68 1::parseFile($ip_store_file);14 $ips = WPRProtectUtils_V683::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(); … … 18 18 19 19 public function getTypeIfBlacklistedIP($ip) { 20 return $this->getIPType($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED);20 return $this->getIPType($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED); 21 21 } 22 22 23 23 public function isFWIPBlacklisted($ip) { 24 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED);24 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED); 25 25 } 26 26 27 27 public function isFWIPWhitelisted($ip) { 28 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V68 1::IP_TYPE_WHITELISTED);28 return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED); 29 29 } 30 30 … … 37 37 private function getIPType($ip, $type) { 38 38 switch ($type) { 39 case WPRProtectIpstoreFS_V68 1::IP_TYPE_BLACKLISTED:39 case WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED: 40 40 return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null; 41 case WPRProtectIpstoreFS_V68 1::IP_TYPE_WHITELISTED:41 case WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED: 42 42 return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null; 43 43 } -
wpremote/trunk/protect/lib/utils.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectUtils_V68 1')) :5 class WPRProtectUtils_V68 1{4 if (!class_exists('WPRProtectUtils_V683')) : 5 class WPRProtectUtils_V683 { 6 6 public static function getIP($ip_header) { 7 7 $ip = null; … … 131 131 if (is_array($val)) { 132 132 foreach ($val as $e) { 133 $length += WPRProtectUtils_V68 1::getLength($e);133 $length += WPRProtectUtils_V683::getLength($e); 134 134 } 135 135 -
wpremote/trunk/protect/logger.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLogger_V68 1')) :4 if (!class_exists('WPRProtectLogger_V683')) : 5 5 require_once dirname( __FILE__ ) . '/logger/fs.php'; 6 6 require_once dirname( __FILE__ ) . '/logger/db.php'; 7 7 8 class WPRProtectLogger_V68 1{8 class WPRProtectLogger_V683 { 9 9 private $log_destination; 10 10 … … 12 12 const TYPE_DB = 1; 13 13 14 function __construct($name, $type = WPRProtectLogger_V68 1::TYPE_DB) {15 if ($type == WPRProtectLogger_V68 1::TYPE_FS) {16 $this->log_destination = new WPRProtectLoggerFS_V68 1($name);14 function __construct($name, $type = WPRProtectLogger_V683::TYPE_DB) { 15 if ($type == WPRProtectLogger_V683::TYPE_FS) { 16 $this->log_destination = new WPRProtectLoggerFS_V683($name); 17 17 } else { 18 $this->log_destination = new WPRProtectLoggerDB_V68 1($name);18 $this->log_destination = new WPRProtectLoggerDB_V683($name); 19 19 } 20 20 } -
wpremote/trunk/protect/logger/db.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLoggerDB_V68 1')) :5 class WPRProtectLoggerDB_V68 1{4 if (!class_exists('WPRProtectLoggerDB_V683')) : 5 class WPRProtectLoggerDB_V683 { 6 6 private $tablename; 7 7 private $bv_tablename; … … 11 11 function __construct($tablename) { 12 12 $this->tablename = $tablename; 13 $this->bv_tablename = WPRProtect_V68 1::$db->getBVTable($tablename);13 $this->bv_tablename = WPRProtect_V683::$db->getBVTable($tablename); 14 14 } 15 15 16 16 public function log($data) { 17 17 if (is_array($data)) { 18 if (WPRProtect_V68 1::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V681::MAXROWCOUNT) {19 WPRProtect_V68 1::$db->deleteRowsFromtable($this->tablename, 1);18 if (WPRProtect_V683::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V683::MAXROWCOUNT) { 19 WPRProtect_V683::$db->deleteRowsFromtable($this->tablename, 1); 20 20 } 21 21 22 WPRProtect_V68 1::$db->replaceIntoBVTable($this->tablename, $data);22 WPRProtect_V683::$db->replaceIntoBVTable($this->tablename, $data); 23 23 } 24 24 } -
wpremote/trunk/protect/logger/fs.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLoggerFS_V68 1')) :5 class WPRProtectLoggerFS_V68 1{4 if (!class_exists('WPRProtectLoggerFS_V683')) : 5 class WPRProtectLoggerFS_V683 { 6 6 public $logFile; 7 7 -
wpremote/trunk/protect/lp.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectLP_V68 1')) :5 class WPRProtectLP_V68 1{4 if (!class_exists('WPRProtectLP_V683')) : 5 class WPRProtectLP_V683 { 6 6 private $ip; 7 7 private $time; … … 10 10 private $brand_name; 11 11 12 private $mode = WPRProtectLP_V68 1::MODE_DISABLED;12 private $mode = WPRProtectLP_V683::MODE_DISABLED; 13 13 private $captcha_limit = 3; 14 14 private $temp_block_limit = 10; … … 18 18 private $all_blocked_gap = 1800; 19 19 20 private $category = WPRProtectLP_V68 1::CATEGORY_ALLOWED;20 private $category = WPRProtectLP_V683::CATEGORY_ALLOWED; 21 21 private $username = ''; 22 22 private $message = ''; … … 47 47 $this->ip = $request->getIP(); 48 48 $this->brand_name = $brand_name; 49 $this->ipstore = new WPRProtectIpstore_V68 1();50 $this->logger = new WPRProtectLogger_V68 1(WPRProtectLP_V681::TABLE_NAME);49 $this->ipstore = new WPRProtectIpstore_V683(); 50 $this->logger = new WPRProtectLogger_V683(WPRProtectLP_V683::TABLE_NAME); 51 51 $this->time = strtotime(gmdate("Y-m-d H:i:s")); 52 52 … … 91 91 92 92 public static function uninstall() { 93 WPRProtect_V68 1::$db->dropBVTable(WPRProtectLP_V681::TABLE_NAME);93 WPRProtect_V683::$db->dropBVTable(WPRProtectLP_V683::TABLE_NAME); 94 94 } 95 95 … … 103 103 104 104 private function getCaptchaLink() { 105 $account = WPRAccount::apiPublicAccount(WPRProtect_V68 1::$settings);105 $account = WPRAccount::apiPublicAccount(WPRProtect_V683::$settings); 106 106 107 107 $url = $account->authenticatedUrl('/captcha/solve'); … … 112 112 113 113 private function getAllowLoginsTransient() { 114 return WPRProtect_V68 1::$settings->getTransient('bvlp_allow_logins');114 return WPRProtect_V683::$settings->getTransient('bvlp_allow_logins'); 115 115 } 116 116 117 117 private function getBlockLoginsTransient() { 118 return WPRProtect_V68 1::$settings->getTransient('bvlp_block_logins');118 return WPRProtect_V683::$settings->getTransient('bvlp_block_logins'); 119 119 } 120 120 … … 142 142 143 143 private function isProtecting() { 144 return $this->mode === WPRProtectLP_V68 1::MODE_PROTECT;144 return $this->mode === WPRProtectLP_V683::MODE_PROTECT; 145 145 } 146 146 147 147 private function isActive() { 148 return $this->mode !== WPRProtectLP_V68 1::MODE_DISABLED;148 return $this->mode !== WPRProtectLP_V683::MODE_DISABLED; 149 149 } 150 150 … … 158 158 159 159 private function isUnBlockedIP() { 160 $transient_name = WPRProtectLP_V68 1::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;161 $attempts = WPRProtect_V68 1::$settings->getTransient($transient_name);160 $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip; 161 $attempts = WPRProtect_V683::$settings->getTransient($transient_name); 162 162 163 163 if ($attempts && $attempts > 0) { 164 WPRProtect_V68 1::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);164 WPRProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts); 165 165 return true; 166 166 } … … 171 171 private function isLoginBlocked() { 172 172 if ($this->getAllowLoginsTransient() || 173 ($this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) {173 ($this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) { 174 174 return false; 175 175 } … … 194 194 private function terminateLogin() { 195 195 $this->message = 'Login Blocked'; 196 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_BLOCKED);196 $this->log(WPRProtectLP_V683::LOGIN_STATUS_BLOCKED); 197 197 if ($this->isProtecting()) { 198 198 header("Cache-Control: no-cache, no-store, must-revalidate"); … … 208 208 public function loginInit($user, $username = '', $password = '') { 209 209 if ($this->isUnBlockedIP()) { 210 $this->category = WPRProtectLP_V68 1::CATEGORY_UNBLOCKED;210 $this->category = WPRProtectLP_V683::CATEGORY_UNBLOCKED; 211 211 } else { 212 $failed_attempts = $this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE,212 $failed_attempts = $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE, 213 213 $this->ip, $this->failed_login_gap); 214 214 215 215 if ($this->isWhitelistedIP()) { 216 $this->category = WPRProtectLP_V68 1::CATEGORY_BYPASSED;217 } elseif (WPRProtectUtils_V68 1::isPrivateIP($this->ip)) {218 $this->category = WPRProtectLP_V68 1::CATEGORY_PRIVATEIP;216 $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED; 217 } elseif (WPRProtectUtils_V683::isPrivateIP($this->ip)) { 218 $this->category = WPRProtectLP_V683::CATEGORY_PRIVATEIP; 219 219 } elseif ($this->isBlacklistedIP()) { 220 $this->category = WPRProtectLP_V68 1::CATEGORY_BLACKLISTED;220 $this->category = WPRProtectLP_V683::CATEGORY_BLACKLISTED; 221 221 $this->terminateLogin(); 222 222 } elseif ($this->isKnownLogin()) { 223 $this->category = WPRProtectLP_V68 1::CATEGORY_BYPASSED;223 $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED; 224 224 } elseif ($this->isLoginBlocked()) { 225 $this->category = WPRProtectLP_V68 1::CATEGORY_ALL_BLOCKED;225 $this->category = WPRProtectLP_V683::CATEGORY_ALL_BLOCKED; 226 226 $this->terminateLogin(); 227 227 } elseif ($failed_attempts >= $this->temp_block_limit) { 228 $this->category = WPRProtectLP_V68 1::CATEGORY_TEMP_BLOCK;228 $this->category = WPRProtectLP_V683::CATEGORY_TEMP_BLOCK; 229 229 $this->terminateLogin(); 230 230 } elseif ($failed_attempts >= $this->captcha_limit) { 231 $this->category = WPRProtectLP_V68 1::CATEGORY_CAPTCHA_BLOCK;231 $this->category = WPRProtectLP_V683::CATEGORY_CAPTCHA_BLOCK; 232 232 $this->terminateLogin(); 233 233 } … … 243 243 public function loginFailed($username) { 244 244 $this->username = $username; 245 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_FAILURE);245 $this->log(WPRProtectLP_V683::LOGIN_STATUS_FAILURE); 246 246 } 247 247 … … 249 249 $this->username = $username; 250 250 $this->message = 'Login Success'; 251 $this->log(WPRProtectLP_V68 1::LOGIN_STATUS_SUCCESS);251 $this->log(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS); 252 252 } 253 253 254 254 private function isKnownLogin() { 255 return $this->getLoginCount(WPRProtectLP_V68 1::LOGIN_STATUS_SUCCESS,255 return $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS, 256 256 $this->ip, $this->success_login_gap) > 0; 257 257 } 258 258 259 259 private function getLoginCount($status, $ip, $gap) { 260 $table = WPRProtect_V68 1::$db->getBVTable(WPRProtectLP_V681::TABLE_NAME);260 $table = WPRProtect_V683::$db->getBVTable(WPRProtectLP_V683::TABLE_NAME); 261 261 $query_str = "SELECT COUNT(*) as count from `$table` WHERE status=%d && time > %d"; 262 262 $query_args = array($status, ($this->time - $gap)); 263 263 264 $query = WPRProtect_V68 1::$db->prepare($query_str, $query_args);264 $query = WPRProtect_V683::$db->prepare($query_str, $query_args); 265 265 if ($ip) { 266 $query .= WPRProtect_V68 1::$db->prepare(" && ip=%s", $ip);267 } 268 269 $rows = WPRProtect_V68 1::$db->getResult($query);266 $query .= WPRProtect_V683::$db->prepare(" && ip=%s", $ip); 267 } 268 269 $rows = WPRProtect_V683::$db->getResult($query); 270 270 if (!$rows) { 271 271 return 0; -
wpremote/trunk/protect/prepend/ignitor.php
r3775063 r3795707 5 5 require_once dirname( __FILE__ ) . '/../protect.php'; 6 6 7 WPRProtect_V68 1::init(WPRProtect_V681::MODE_PREPEND);7 WPRProtect_V683::init(WPRProtect_V683::MODE_PREPEND); 8 8 } -
wpremote/trunk/protect/protect.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtect_V68 1')) :4 if (!class_exists('WPRProtect_V683')) : 5 5 require_once dirname( __FILE__ ) . '/logger.php'; 6 6 require_once dirname( __FILE__ ) . '/ipstore.php'; … … 12 12 require_once dirname( __FILE__ ) . '/../helper.php'; 13 13 14 class WPRProtect_V68 1{14 class WPRProtect_V683 { 15 15 public static $settings; 16 16 public static $db; … … 27 27 } 28 28 29 if ($mode == WPRProtect_V68 1::MODE_PREPEND) {29 if ($mode == WPRProtect_V683::MODE_PREPEND) { 30 30 $config_file = MCDATAPATH . MCCONFKEY . '-' . 'mc.conf'; 31 $config = WPRProtectUtils_V68 1::parseFile($config_file);31 $config = WPRProtectUtils_V683::parseFile($config_file); 32 32 33 33 if (empty($config['time']) || !($config['time'] > time() - (48*3600)) || 34 34 !isset($config['mc_conf_version']) || 35 (WPRProtect_V68 1::CONF_VERSION !== $config['mc_conf_version'])) {35 (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) { 36 36 return false; 37 37 … … 41 41 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null; 42 42 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array(); 43 $request = new WPRProtectRequest_V68 1($request_ip_header, $req_config);43 $request = new WPRProtectRequest_V683($request_ip_header, $req_config); 44 44 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array(); 45 45 46 WPRProtectFW_V68 1::getInstance($mode, $request, $fw_config, $brand_name)->init();46 WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init(); 47 47 } else { 48 48 $plug_config = self::$settings->getOption(self::$info->services_option_name); 49 49 $config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array(); 50 50 if (!is_array($config) || !array_key_exists('mc_conf_version', $config) || 51 (WPRProtect_V68 1::CONF_VERSION !== $config['mc_conf_version'])) {51 (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) { 52 52 53 53 return false; … … 57 57 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null; 58 58 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array(); 59 $request = new WPRProtectRequest_V68 1($request_ip_header, $req_config);59 $request = new WPRProtectRequest_V683($request_ip_header, $req_config); 60 60 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array(); 61 61 $lp_config = array_key_exists('lp', $config) ? $config['lp'] : array(); 62 62 63 WPRProtectFW_V68 1::getInstance($mode, $request, $fw_config, $brand_name)->init();64 WPRProtectLP_V68 1::getInstance($request, $lp_config, $brand_name)->init();63 WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init(); 64 WPRProtectLP_V683::getInstance($request, $lp_config, $brand_name)->init(); 65 65 } 66 66 } … … 69 69 self::$settings->deleteOption('bvptconf'); 70 70 self::$settings->deleteOption('bvptplug'); 71 WPRProtectIpstore_V68 1::uninstall();72 WPRProtectFW_V68 1::uninstall();73 WPRProtectLP_V68 1::uninstall();71 WPRProtectIpstore_V683::uninstall(); 72 WPRProtectFW_V683::uninstall(); 73 WPRProtectLP_V683::uninstall(); 74 74 75 WPRProtect_V68 1::removeWPPrepend();76 WPRProtect_V68 1::removePHPPrepend();77 WPRProtect_V68 1::removeMCData();75 WPRProtect_V683::removeWPPrepend(); 76 WPRProtect_V683::removePHPPrepend(); 77 WPRProtect_V683::removeMCData(); 78 78 79 79 return true; … … 96 96 $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';"; 97 97 98 WPRProtectUtils_V68 1::fileRemovePattern($fname, $pattern);98 WPRProtectUtils_V683::fileRemovePattern($fname, $pattern); 99 99 } 100 100 101 101 private static function removePHPPrepend() { 102 WPRProtect_V68 1::removeHtaccessPrepend();103 WPRProtect_V68 1::removeUseriniPrepend();102 WPRProtect_V683::removeHtaccessPrepend(); 103 WPRProtect_V683::removeUseriniPrepend(); 104 104 } 105 105 … … 107 107 $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i"; 108 108 109 WPRProtectUtils_V68 1::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);109 WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true); 110 110 } 111 111 … … 113 113 $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i"; 114 114 115 WPRProtectUtils_V68 1::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);115 WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true); 116 116 } 117 117 … … 120 120 $mc_data_dir = $content_dir . "/mc_data"; 121 121 122 WPRProtectUtils_V68 1::rrmdir($mc_data_dir);122 WPRProtectUtils_V683::rrmdir($mc_data_dir); 123 123 } 124 124 } -
wpremote/trunk/protect/request.php
r3775063 r3795707 3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 4 4 5 if (!class_exists('WPRProtectRequest_V68 1')) :6 class WPRProtectRequest_V68 1{5 if (!class_exists('WPRProtectRequest_V683')) : 6 class WPRProtectRequest_V683 { 7 7 public $ip; 8 8 public $host = ''; … … 20 20 public $files; 21 21 public $respcode; 22 public $status = WPRProtectRequest_V68 1::STATUS_ALLOWED;23 public $category = WPRProtectRequest_V68 1::CATEGORY_NORMAL;22 public $status = WPRProtectRequest_V683::STATUS_ALLOWED; 23 public $category = WPRProtectRequest_V683::CATEGORY_NORMAL; 24 24 25 25 public $wp_user; … … 60 60 61 61 public function __construct($ip_header, $config) { 62 $this->ip = WPRProtectUtils_V68 1::getIP($ip_header);62 $this->ip = WPRProtectUtils_V683::getIP($ip_header); 63 63 $this->timestamp = time(); 64 64 $this->get_params = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended … … 142 142 public static function blacklistedCategories() { 143 143 return array( 144 WPRProtectRequest_V68 1::CATEGORY_BOT_BLOCKED,145 WPRProtectRequest_V68 1::CATEGORY_COUNTRY_BLOCKED,146 WPRProtectRequest_V68 1::CATEGORY_USER_BLACKLISTED,147 WPRProtectRequest_V68 1::CATEGORY_GLOBAL_BOT_BLOCKED144 WPRProtectRequest_V683::CATEGORY_BOT_BLOCKED, 145 WPRProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED, 146 WPRProtectRequest_V683::CATEGORY_USER_BLACKLISTED, 147 WPRProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED 148 148 ); 149 149 } 150 150 151 151 public static function whitelistedCategories() { 152 return array(WPRProtectRequest_V68 1::CATEGORY_WHITELISTED);152 return array(WPRProtectRequest_V683::CATEGORY_WHITELISTED); 153 153 } 154 154 … … 488 488 } 489 489 490 $_json_params = WPRProtectUtils_V68 1::safeDecodeJSON(490 $_json_params = WPRProtectUtils_V683::safeDecodeJSON( 491 491 $this->raw_body, 492 492 true, -
wpremote/trunk/protect/wp_user.php
r3775063 r3795707 2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit; 3 3 4 if (!class_exists('WPRProtectWPUser_V68 1')) :5 class WPRProtectWPUser_V68 1{4 if (!class_exists('WPRProtectWPUser_V683')) : 5 class WPRProtectWPUser_V683 { 6 6 public $id; 7 7 public $role; … … 22 22 public static function defaultUser() { 23 23 $time = (int) floor(time() / 43200); 24 return (new WPRProtectWPUser_V68 1(0, 0, array(), $time));24 return (new WPRProtectWPUser_V683(0, 0, array(), $time)); 25 25 } 26 26 … … 42 42 $capabilities = array_map('intval', explode(',', $capabilities)); 43 43 44 return (new WPRProtectWPUser_V68 1((int) $id, (int) $role_level, $capabilities, (int) $time));44 return (new WPRProtectWPUser_V683((int) $id, (int) $role_level, $capabilities, (int) $time)); 45 45 } 46 46 -
wpremote/trunk/readme.txt
r3775063 r3795707 7 7 Tested up to: 7.1 8 8 Requires PHP: 7.0 9 Stable tag: 6.8 19 Stable tag: 6.83 10 10 License: GPLv2 or later 11 11 License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) … … 47 47 48 48 == CHANGELOG == 49 = 6.83 = 50 * New: Broken Link Checker: checks your links from your own site, and highlights the broken ones on the page when you open it from the dashboard. 51 49 52 = 6.81 = 50 53 * New: Added a must-use plugin loader. -
wpremote/trunk/wp_actions.php
r3775063 r3795707 85 85 } 86 86 87 public function enqueueBrokenLinkHighlight() { 88 // Read-only visual aid: this flag grants no access and executes no callback. 89 if (!in_array('wpr', array('bv', 'mc', 'wpr'), true) || 90 WPRHelper::getRawParam('GET', 'bv-blc') !== '1' || is_admin() || is_feed() || (function_exists('is_embed') && is_embed())) { 91 return; 92 } 93 94 // A cache that drops unknown query parameters from its key must not store this 95 // page and serve the overlay to every visitor. 96 if (!headers_sent()) { 97 header('Cache-Control: no-store, max-age=0'); 98 } 99 // The selection travels in the URL fragment, which browsers never send. This 100 // request carries no input, so there is nothing here to read, decode or echo. 101 // Share handles across plugin families so only one helper is loaded. 102 wp_enqueue_style('blogvault-blc-highlight', plugins_url('broken_link_checker/highlight.css', __FILE__), array(), '1.3.1'); 103 wp_enqueue_script('blogvault-blc-highlight', plugins_url('broken_link_checker/highlight.js', __FILE__), array(), '1.3.1', true); 104 } 105 87 106 private function process_deactivation_feedback(&$info) { 88 107 //phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)