Plugin Directory

Changeset 3795707


Ignore:
Timestamp:
11/11/2026 05:46:47 AM (10 hours ago)
Author:
ritesh.soni36
Message:

Updating and Tagging version 6.83

Location:
wpremote
Files:
8 added
62 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wpremote/tags/6.83/callback/base.php

    r3775063 r3795707  
    1515                "MISC_WING_VERSION" => '1.4',
    1616                "FS_WING_VERSION" => '1.4',
    17                 "INFO_WING_VERSION" => '2.8',
     17                "INFO_WING_VERSION" => '2.9',
    1818                "WATCH_WING_VERSION" => '1.7',
    1919                "FS_WRITE_WING_VERSION" => '1.2',
    … …  
    2222                "PROTECT_WING_VERSION" => '1.3',
    2323                "SECURITY_WING_VERSION" => '1.4',
     24                "LINKS_WING_VERSION" => '1.0',
    2425                "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0',
    2526                );
  • wpremote/tags/6.83/callback/handler.php

    r3648236 r3795707  
    170170                                $module = new WPRSecurityCallback($this);
    171171                                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;
    172182                        default:
    173183                                require_once dirname( __FILE__ ) . '/wings/misc.php';
    … …  
    175185                                break;
    176186                        }
    177                         $resp = $module->process($this->request);
     187                        $resp = $module ? $module->process($this->request) : false;
    178188                        if ($resp === false) {
    179189                                $resp = array(
  • wpremote/tags/6.83/callback/wings/info.php

    r3775063 r3795707  
    1111        public $bvapi;
    1212       
    13         const INFO_WING_VERSION = 2.8;
     13        const INFO_WING_VERSION = 2.9;
    1414
    1515        public function __construct($callback_handler) {
    … …  
    150150                        $sys_info['webgid'] = posix_getgid();
    151151                }
     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();
    152157                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;
    153192        }
    154193
  • wpremote/tags/6.83/callback/wings/ipstore.php

    r3775063 r3795707  
    5151        public function getIPs($table, $auto_increment_offset, $type, $category) {
    5252                $query = "SELECT `start_ip_range` FROM $table WHERE id < $auto_increment_offset AND `type` in (" . implode(',', $type) . ") AND ";
    53                 $query .= ($category == WPRProtectIpstoreDB_V681::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
     53                $query .= ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
    5454                return $this->db->getCol($query);
    5555        }
    … …  
    6565
    6666                $info['fw_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    67                         WPRProtectIpstoreDB_V681::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     67                        WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    6868                $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    69                         WPRProtectIpstoreDB_V681::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     69                        WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    7070                $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    71                         WPRProtectIpstoreDB_V681::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     71                        WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    7272                $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    73                         WPRProtectIpstoreDB_V681::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     73                        WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    7474                $info['ip_store_offset'] = $this->getIPStoreOffset($table, $auto_increment_offset);
    7575                $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  
    4141
    4242        public function unBlockIP($ip, $attempts, $time) {
    43                 $transient_name = WPRProtectLP_V681::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
     43                $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
    4444                $this->settings->setTransient($transient_name, $attempts, $time);
    4545                return $this->settings->getTransient($transient_name);
  • wpremote/tags/6.83/callback/wings/watch.php

    r3775063 r3795707  
    145145                                require_once dirname( __FILE__ ) . '/../../protect/lp.php';
    146146                                $lp_params = $params['lp'];
    147                                 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V681::TABLE_NAME))) {
     147                                if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V683::TABLE_NAME))) {
    148148                                        $limit = intval($lp_params['limit']);
    149149                                        $filter = $lp_params['filter'];
    150150                                        $offset = isset($lp_params['offset']) ? intval($lp_params['offset']) : 0;
    151                                         $table = $db->getBVTable(WPRProtectLP_V681::TABLE_NAME);
     151                                        $table = $db->getBVTable(WPRProtectLP_V683::TABLE_NAME);
    152152                                        $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table);
    153153                                        if (empty($resp["lplogs"])) {
    154                                                 $db->deleteBVTableContent(WPRProtectLP_V681::TABLE_NAME, $lp_params['rmfilter']);
     154                                                $db->deleteBVTableContent(WPRProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']);
    155155                                                $resp["lplogs"] = $this->getData($table, $limit, $filter);
    156156                                        }
    … …  
    168168                                require_once dirname( __FILE__ ) . '/../../protect/fw.php';
    169169                                $fw_params = $params['fw'];
    170                                 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V681::TABLE_NAME))) {
     170                                if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V683::TABLE_NAME))) {
    171171                                        $limit = intval($fw_params['limit']);
    172172                                        $filter = $fw_params['filter'];
    173173                                        $offset = isset($fw_params['offset']) ? intval($fw_params['offset']) : 0;
    174                                         $table = $db->getBVTable(WPRProtectFW_V681::TABLE_NAME);
     174                                        $table = $db->getBVTable(WPRProtectFW_V683::TABLE_NAME);
    175175                                        $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table);
    176176                                        if (empty($resp["fwlogs"])){
    177                                                 $db->deleteBVTableContent(WPRProtectFW_V681::TABLE_NAME, $fw_params['rmfilter']);
     177                                                $db->deleteBVTableContent(WPRProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']);
    178178                                                $resp["fwlogs"] = $this->getData($table, $limit, $filter);
    179179                                        }
  • wpremote/tags/6.83/info.php

    r3775063 r3795707  
    1212                public $brand_option = 'bv_whitelabel_infos';
    1313                public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf';
    14                 public $version = '6.81';
     14                public $version = '6.83';
    1515                public $webpage = 'https://wpremote.com';
    1616                public $appurl = 'https://app.wpremote.com';
  • wpremote/tags/6.83/plugin.php

    r3775063 r3795707  
    66Author: WP Remote
    77Author URI: https://wpremote.com
    8 Version: 6.81
     8Version: 6.83
    99Network: True
    1010License: GPLv2 or later
    … …  
    6464
    6565add_action('wp_footer', array($wp_action, 'footerHandler'), 100);
     66add_action('wp_enqueue_scripts', array($wp_action, 'enqueueBrokenLinkHighlight'));
    6667add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config'));
    6768add_action('wpr_clear_mu_plugin', array($wp_action, 'clear_mu_plugin'));
    … …  
    186187                        require_once dirname( __FILE__ ) . '/protect/protect.php';
    187188                        //For backward compatibility.
    188                         WPRProtect_V681::$settings = new WPRWPSettings();
    189                         WPRProtect_V681::$db = new WPRWPDb();
    190                         WPRProtect_V681::$info = new WPRInfo(WPRProtect_V681::$settings);
    191 
    192                         add_action('wpr_clear_pt_config', array('WPRProtect_V681', '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'));
    193194
    194195                        if ($bvinfo->isActivePlugin()) {
    195                                 WPRProtect_V681::init(WPRProtect_V681::MODE_WP);
     196                                WPRProtect_V683::init(WPRProtect_V683::MODE_WP);
    196197                        }
    197198                }
  • wpremote/tags/6.83/protect/fw.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectFW_V681')) :
     4if (!class_exists('WPRProtectFW_V683')) :
    55require_once dirname( __FILE__ ) . '/fw/rule/errors.php';
    66require_once dirname( __FILE__ ) . '/fw/rule/engine.php';
    77require_once dirname( __FILE__ ) . '/fw/rule.php';
    88
    9 class WPRProtectFW_V681 {
     9class WPRProtectFW_V683 {
    1010        private $brand_name;
    1111        private $protect_mode;
    … …  
    2424        private $has_valid_bypass_cookie;
    2525
    26         private $mode = WPRProtectFW_V681::MODE_DISABLED;
    27         private $ip_cookie_mode = WPRProtectFW_V681::IP_COOKIE_MODE_DISABLED;
    28         private $admin_cookie_mode = WPRProtectFW_V681::ADMIN_COOKIE_MODE_DISABLED;
    29         private $bypass_level = WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CONTRIBUTOR;
    30         private $wpf_rule_init_mode = WPRProtectFW_V681::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;
    3131        private $custom_roles = array();
    3232        private $cookie_key = "";
    … …  
    3535        private $cookie_validity = 2592000;
    3636        private $can_set_cache_prevention_cookie = false;
    37         private $rules_mode = WPRProtectFW_V681::RULES_MODE_DISABLED;
     37        private $rules_mode = WPRProtectFW_V683::RULES_MODE_DISABLED;
    3838        private $is_geo_blocking = false;
    3939        private $is_wp_user_cookie_enabled = false;
    4040        private $log_config = array();
    41         private $request_profiling_mode = WPRProtectFW_V681::REQ_PROFILING_MODE_DISABLED;
    42         private $logging_mode = WPRProtectFW_V681::LOGGING_MODE_VISITOR;
     41        private $request_profiling_mode = WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED;
     42        private $logging_mode = WPRProtectFW_V683::LOGGING_MODE_VISITOR;
    4343        private $skip_log_config = array();
    4444        private $skip_log_cookies = array();
    … …  
    5555        private $break_rule_matching = false;
    5656        private $can_log_raw_body = false;
    57         private $log_slice_size = WPRProtectFW_V681::LOG_SLICE_SIZE;
     57        private $log_slice_size = WPRProtectFW_V683::LOG_SLICE_SIZE;
    5858
    5959        private static $instance = null;
    … …  
    101101
    102102        const DEFAULT_WP_USER_ROLE_LEVELS = array(
    103                 'administrator' => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_ADMIN,
    104                 'editor'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_EDITOR,
    105                 'author'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_AUTHOR,
    106                 'contributor'   => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CONTRIBUTOR,
    107                 'subscriber'    => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_SUBSCRIBER
     103                '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
    108108        );
    109109
    110110        const EXTRA_WP_USER_ROLE_LEVELS = array(
    111                 'custom'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CUSTOM,
    112                 'unknown'       => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_UNKNOWN
     111                'custom'        => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM,
     112                'unknown'       => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_UNKNOWN
    113113        );
    114114
    … …  
    249249                if ($this->isPrependMode()) {
    250250                        $log_file = MCDATAPATH . MCCONFKEY . '-mc.log';
    251                         $this->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_FS);
    252                         $this->logger = new WPRProtectLogger_V681($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);
    253253                } else {
    254                         $this->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_DB);
    255                         $this->logger = new WPRProtectLogger_V681(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);
    256256                }
    257257
    … …  
    266266                if (!isset(self::$instance)) {
    267267                        self::$instance = new self($protect_mode, $request, $config, $brand_name);
    268                 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V681::MODE_WP) {
     268                } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V683::MODE_WP) {
    269269                        self::$instance->protect_mode = $protect_mode;
    270270                        self::$instance->brand_name = $brand_name;
    271                         self::$instance->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_DB);
     271                        self::$instance->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB);
    272272                        self::$instance->initRules();
    273273                }
    … …  
    277277
    278278        public static function uninstall() {
    279                 WPRProtect_V681::$db->dropBVTable(WPRProtectFW_V681::TABLE_NAME);
     279                WPRProtect_V683::$db->dropBVTable(WPRProtectFW_V683::TABLE_NAME);
    280280        }
    281281
    … …  
    297297
    298298        private function isPrependMode() {
    299                 return ($this->protect_mode === WPRProtect_V681::MODE_PREPEND);
     299                return ($this->protect_mode === WPRProtect_V683::MODE_PREPEND);
    300300        }
    301301
    302302        private function isWPMode() {
    303                 return ($this->protect_mode === WPRProtect_V681::MODE_WP);
     303                return ($this->protect_mode === WPRProtect_V683::MODE_WP);
    304304        }
    305305
    306306        private function isModeDisabled() {
    307                 return ($this->mode === WPRProtectFW_V681::MODE_DISABLED);
     307                return ($this->mode === WPRProtectFW_V683::MODE_DISABLED);
    308308        }
    309309
    310310        private function isModeProtect() {
    311                 return ($this->mode === WPRProtectFW_V681::MODE_PROTECT);
     311                return ($this->mode === WPRProtectFW_V683::MODE_PROTECT);
    312312        }
    313313
    314314        private function isAdminCookieEnabled() {
    315                 return ($this->admin_cookie_mode === WPRProtectFW_V681::ADMIN_COOKIE_MODE_ENABLED);
     315                return ($this->admin_cookie_mode === WPRProtectFW_V683::ADMIN_COOKIE_MODE_ENABLED);
    316316        }
    317317
    318318        private function isIPCookieEnabled() {
    319                 return ($this->ip_cookie_mode === WPRProtectFW_V681::IP_COOKIE_MODE_ENABLED);
     319                return ($this->ip_cookie_mode === WPRProtectFW_V683::IP_COOKIE_MODE_ENABLED);
    320320        }
    321321
    322322        private function isRequestProfilingDisabled() {
    323                 return ($this->request_profiling_mode === WPRProtectFW_V681::REQ_PROFILING_MODE_DISABLED);
     323                return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED);
    324324        }
    325325
    326326        private function isRequestProfilingModeDebug() {
    327                 return ($this->request_profiling_mode === WPRProtectFW_V681::REQ_PROFILING_MODE_DEBUG);
     327                return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DEBUG);
    328328        }
    329329
    330330        private function isRequestHasValidBypassCookie() {
    331331                if (!isset($this->has_valid_bypass_cookie)) {
    332                         $cookie = (string) $this->request->getCookies(WPRProtectFW_V681::BYPASS_COOKIE_NAME);
     332                        $cookie = (string) $this->request->getCookies(WPRProtectFW_V683::BYPASS_COOKIE_NAME);
    333333                        $new_cookie = $this->generateBypassCookie();
    334334                        $is_valid = ($this->isAdminCookieEnabled() && $new_cookie && ($cookie === $new_cookie));
    … …  
    340340
    341341        private function isRulesModeProtect() {
    342                 return ($this->rules_mode === WPRProtectFW_V681::RULES_MODE_PROTECT);
     342                return ($this->rules_mode === WPRProtectFW_V683::RULES_MODE_PROTECT);
    343343        }
    344344
    345345        public function isLoggingModeComplete() {
    346                 return ($this->logging_mode === WPRProtectFW_V681::LOGGING_MODE_COMPLETE);
     346                return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_COMPLETE);
    347347        }
    348348
    349349        public function isLoggingModeVisitor() {
    350                 return ($this->logging_mode === WPRProtectFW_V681::LOGGING_MODE_VISITOR);
     350                return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_VISITOR);
    351351        }
    352352
    … …  
    356356
    357357        private function isWPFRuleInitModePrepend() {
    358                 return ($this->wpf_rule_init_mode === WPRProtectFW_V681::WPF_RULE_INIT_MODE_PREPEND);
     358                return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_PREPEND);
    359359        }
    360360
    361361        private function isWPFRuleInitModeWP() {
    362                 return ($this->wpf_rule_init_mode === WPRProtectFW_V681::WPF_RULE_INIT_MODE_WP);
     362                return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP);
    363363        }
    364364
    … …  
    389389
    390390                        if (!$current_wp_user->isIdentical($this->request->wp_user)) {
    391                                 $serialized_wp_user = WPRProtectWPUser_V681::_serialize($current_wp_user);
     391                                $serialized_wp_user = WPRProtectWPUser_V683::_serialize($current_wp_user);
    392392                                $cookie_val = $serialized_wp_user . '_' .
    393                                         WPRProtectUtils_V681::signMessage($serialized_wp_user, $this->cookie_key);
     393                                        WPRProtectUtils_V683::signMessage($serialized_wp_user, $this->cookie_key);
    394394                                $cookie_val = base64_encode($cookie_val);
    395395
    396                                 $this->setCookie(WPRProtectWPUser_V681::COOKIE_NAME, $cookie_val);
     396                                $this->setCookie(WPRProtectWPUser_V683::COOKIE_NAME, $cookie_val);
    397397                        }
    398398                } elseif ($this->request->wp_user->isLoggedIn()) {
    399                         $this->request->wp_user = WPRProtectWPUser_V681::defaultUser();
    400                         $this->unsetCookie(WPRProtectWPUser_V681::COOKIE_NAME);
     399                        $this->request->wp_user = WPRProtectWPUser_V683::defaultUser();
     400                        $this->unsetCookie(WPRProtectWPUser_V683::COOKIE_NAME);
    401401                }
    402402        }
    … …  
    415415                }
    416416
    417                 return (new WPRProtectWPUser_V681($id, $role_level, $capabilities, $time));
     417                return (new WPRProtectWPUser_V683($id, $role_level, $capabilities, $time));
    418418        }
    419419
    … …  
    434434
    435435        private function loadWPUser() {
    436                 $this->request->wp_user = WPRProtectWPUser_V681::defaultUser();
    437 
    438                 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V681::COOKIE_NAME);
     436                $this->request->wp_user = WPRProtectWPUser_V683::defaultUser();
     437
     438                $cookie_val = $this->request->getCookies(WPRProtectWPUser_V683::COOKIE_NAME);
    439439                if (!is_string($cookie_val)) {
    440440                        return;
    … …  
    452452                list($serialized_user, $signature) = $cookie_val_array;
    453453
    454                 if (WPRProtectUtils_V681::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {
    455                         $wp_user = WPRProtectWPUser_V681::_unserialize($serialized_user);
     454                if (WPRProtectUtils_V683::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {
     455                        $wp_user = WPRProtectWPUser_V683::_unserialize($serialized_user);
    456456
    457457                        if (!isset($wp_user) || $wp_user->time !== (int) floor(time() / $this->cookie_validity)) {
    … …  
    468468                        }
    469469
    470                         $role_by_level = array_flip(array_merge(WPRProtectFW_V681::DEFAULT_WP_USER_ROLE_LEVELS,
    471                                         WPRProtectFW_V681::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));
    472472                        $this->request->wp_user->role = $role_by_level[$this->request->wp_user->role_level];
    473473                }
    … …  
    493493                if ($this->isPrependMode()) {
    494494                        $rules_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_rules.json';
    495                         $rule_arrays = WPRProtectUtils_V681::parseFile($rules_file);
     495                        $rule_arrays = WPRProtectUtils_V683::parseFile($rules_file);
    496496                } else {
    497                         $rule_arrays = WPRProtect_V681::$settings->getOption('bvruleset');
     497                        $rule_arrays = WPRProtect_V683::$settings->getOption('bvruleset');
    498498                        if(!is_array($rule_arrays)) {
    499499                                $rule_arrays = array();
    … …  
    507507
    508508                foreach($rule_arrays as $rule_array) {
    509                         $rule = WPRProtectFWRule_V681::init($rule_array);
     509                        $rule = WPRProtectFWRule_V683::init($rule_array);
    510510
    511511                        if ($rule) {
    … …  
    532532        private function initWPFRule($rule) {
    533533                switch ($rule->execute_on) {
    534                 case WPRProtectFWRule_V681::EXE_ON_PRE_UPDATE_OPTION:
     534                case WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION:
    535535                        $this->addWPHook($rule, 'pre_update_option', 'handleRequestOnPreUpdateOption', 3);
    536536                        break;
    537                 case WPRProtectFWRule_V681::EXE_ON_PRE_DELETE_POST:
     537                case WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST:
    538538                        $this->addWPHook($rule, 'pre_delete_post', 'handleRequestOnPreDeletePost', 3);
    539539                        break;
    540                 case WPRProtectFWRule_V681::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:
     540                case WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:
    541541                        $this->addWPHook($rule, 'wp_insert_post_empty_content',
    542542                                'handleRequestOnWPInsertPostEmptyContent', 2);
    543543                        break;
    544                 case WPRProtectFWRule_V681::EXE_ON_INSERT_USER_META:
     544                case WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META:
    545545                        $this->addWPHook($rule, 'insert_user_meta', 'handleRequestOnInsertUserMeta', 4);
    546546                        break;
    547                 case WPRProtectFWRule_V681::EXE_ON_DELETE_OPTION:
     547                case WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION:
    548548                        $this->addWPHook($rule, 'delete_option', 'handleRequestOnDeleteOption', 1, 'action');
    549549                        break;
    550                 case WPRProtectFWRule_V681::EXE_ON_DELETE_USER:
     550                case WPRProtectFWRule_V683::EXE_ON_DELETE_USER:
    551551                        $this->addWPHook($rule, 'delete_user', 'handleRequestOnDeleteUser', 3, 'action');
    552552                        break;
    553                 case WPRProtectFWRule_V681::EXE_ON_PASSWORD_RESET:
     553                case WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET:
    554554                        $this->addWPHook($rule, 'password_reset', 'handleRequestOnPasswordReset', 2, 'action');
    555555                        break;
    556                 case WPRProtectFWRule_V681::EXE_ON_SEND_AUTH_COOKIES:
     556                case WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES:
    557557                        $this->addWPHook($rule, 'send_auth_cookies', 'handleRequestOnSendAuthCookies', 6);
    558558                        break;
    559                 case WPRProtectFWRule_V681::EXE_ON_SET_AUTH_COOKIE:
     559                case WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE:
    560560                        $this->addWPHook($rule, 'set_auth_cookie', 'handleRequestOnSetAuthCookie', 6, 'action');
    561561                        break;
    562                 case WPRProtectFWRule_V681::EXE_ON_INIT:
     562                case WPRProtectFWRule_V683::EXE_ON_INIT:
    563563                        $this->addWPHook($rule, 'init', 'handleRequestOnInit', 0, 'action');
    564564                        break;
    565                 case WPRProtectFWRule_V681::EXE_ON_USER_REGISTER:
     565                case WPRProtectFWRule_V683::EXE_ON_USER_REGISTER:
    566566                        $this->addWPHook($rule, 'user_register', 'handleRequestOnUserRegister', 2, 'action');
    567567                        break;
    568                 case WPRProtectFWRule_V681::EXE_ON_ADD_USER_META:
     568                case WPRProtectFWRule_V683::EXE_ON_ADD_USER_META:
    569569                        $this->addWPHook($rule, 'add_user_meta', 'handleRequestOnAddUserMeta', 3, 'action');
    570570                        break;
    571                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_METADATA:
     571                case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA:
    572572                        $this->addWPHook($rule, 'update_user_metadata', 'handleRequestOnUpdateUserMetadata', 5);
    573573                        break;
    574                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_META:
     574                case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META:
    575575                        $this->addWPHook($rule, 'update_user_meta', 'handleRequestOnUpdateUserMeta', 4, 'action');
    576576                        break;
    577                 case WPRProtectFWRule_V681::EXE_ON_ADD_OPTION:
     577                case WPRProtectFWRule_V683::EXE_ON_ADD_OPTION:
    578578                        $this->addWPHook($rule, 'add_option', 'handleRequestOnAddOption', 2, 'action');
    579579                        break;
    580                 case WPRProtectFWRule_V681::EXE_ON_WP_PRE_INSERT_USER_DATA:
     580                case WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA:
    581581                        $this->addWPHook($rule, 'wp_pre_insert_user_data', 'handleRequestOnWPPreInsertUserData', 4);
    582582                        break;
    583                 case WPRProtectFWRule_V681::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:
     583                case WPRProtectFWRule_V683::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:
    584584                        $this->addWPHook($rule, 'rest_request_before_callbacks',
    585585                                'handleRequestOnRestRequestBeforeCallbacks', 3);
    586586                        break;
    587                 case WPRProtectFWRule_V681::EXE_ON_ADMIN_INIT:
     587                case WPRProtectFWRule_V683::EXE_ON_ADMIN_INIT:
    588588                        $this->addWPHook($rule, 'admin_init', 'handleRequestOnAdminInit', 0, 'action');
    589589                        break;
    590                 case WPRProtectFWRule_V681::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:
     590                case WPRProtectFWRule_V683::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:
    591591                        $this->addWPHook($rule, 'wp_handle_upload_prefilter',
    592592                                'handleRequestOnWPHandleUploadPrefilter', 1);
    593593                        break;
    594                 case WPRProtectFWRule_V681::EXE_ON_TEMPLATE_REDIRECT:
     594                case WPRProtectFWRule_V683::EXE_ON_TEMPLATE_REDIRECT:
    595595                        $this->addWPHook($rule, 'template_redirect', 'handleRequestOnTemplateRedirect', 0, 'action');
    596596                        break;
    597                 case WPRProtectFWRule_V681::EXE_ON_WP_LOADED:
     597                case WPRProtectFWRule_V683::EXE_ON_WP_LOADED:
    598598                        $this->addWPHook($rule, 'wp_loaded', 'handleRequestOnWPLoaded', 0, 'action');
    599599                        break;
    600                 case WPRProtectFWRule_V681::EXE_ON_ADD_POST_METADATA:
     600                case WPRProtectFWRule_V683::EXE_ON_ADD_POST_METADATA:
    601601                        $this->addWPHook($rule, 'add_post_metadata', 'handleRequestOnAddPostMetadata', 5);
    602602                        break;
    603                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_POST_METADATA:
     603                case WPRProtectFWRule_V683::EXE_ON_UPDATE_POST_METADATA:
    604604                        $this->addWPHook($rule, 'update_post_metadata', 'handleRequestOnUpdatePostMetadata', 5);
    605605                        break;
    606                 case WPRProtectFWRule_V681::EXE_ON_DELETE_POST_METADATA:
     606                case WPRProtectFWRule_V683::EXE_ON_DELETE_POST_METADATA:
    607607                        $this->addWPHook($rule, 'delete_post_metadata', 'handleRequestOnDeletePostMetadata', 5);
    608608                        break;
    609                 case WPRProtectFWRule_V681::EXE_ON_ADD_TERM_METADATA:
     609                case WPRProtectFWRule_V683::EXE_ON_ADD_TERM_METADATA:
    610610                        $this->addWPHook($rule, 'add_term_metadata', 'handleRequestOnAddTermMetadata', 5);
    611611                        break;
    612                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_TERM_METADATA:
     612                case WPRProtectFWRule_V683::EXE_ON_UPDATE_TERM_METADATA:
    613613                        $this->addWPHook($rule, 'update_term_metadata', 'handleRequestOnUpdateTermMetadata', 5);
    614614                        break;
    615                 case WPRProtectFWRule_V681::EXE_ON_DELETE_TERM_METADATA:
     615                case WPRProtectFWRule_V683::EXE_ON_DELETE_TERM_METADATA:
    616616                        $this->addWPHook($rule, 'delete_term_metadata', 'handleRequestOnDeleteTermMetadata', 5);
    617617                        break;
    618                 case WPRProtectFWRule_V681::EXE_ON_ADD_COMMENT_METADATA:
     618                case WPRProtectFWRule_V683::EXE_ON_ADD_COMMENT_METADATA:
    619619                        $this->addWPHook($rule, 'add_comment_metadata', 'handleRequestOnAddCommentMetadata', 5);
    620620                        break;
    621                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_COMMENT_METADATA:
     621                case WPRProtectFWRule_V683::EXE_ON_UPDATE_COMMENT_METADATA:
    622622                        $this->addWPHook($rule, 'update_comment_metadata', 'handleRequestOnUpdateCommentMetadata', 5);
    623623                        break;
    624                 case WPRProtectFWRule_V681::EXE_ON_DELETE_COMMENT_METADATA:
     624                case WPRProtectFWRule_V683::EXE_ON_DELETE_COMMENT_METADATA:
    625625                        $this->addWPHook($rule, 'delete_comment_metadata', 'handleRequestOnDeleteCommentMetadata', 5);
    626626                        break;
    627                 case WPRProtectFWRule_V681::EXE_ON_ADD_USER_METADATA:
     627                case WPRProtectFWRule_V683::EXE_ON_ADD_USER_METADATA:
    628628                        $this->addWPHook($rule, 'add_user_metadata', 'handleRequestOnAddUserMetadata', 5);
    629629                        break;
    630                 case WPRProtectFWRule_V681::EXE_ON_DELETE_USER_METADATA:
     630                case WPRProtectFWRule_V683::EXE_ON_DELETE_USER_METADATA:
    631631                        $this->addWPHook($rule, 'delete_user_metadata', 'handleRequestOnDeleteUserMetadata', 5);
    632632                        break;
    … …  
    646646                                }
    647647                        } else {
    648                                 WPRProtectUtils_V681::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);
     648                                WPRProtectUtils_V683::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);
    649649                        }
    650650                }
    … …  
    12041204        private function setIPCookie() {
    12051205                if (!$this->is_ip_cookie_set && $this->isIPCookieEnabled() &&
    1206                                 !$this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME)) {
     1206                                !$this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME)) {
    12071207
    12081208                        $time = floor(time() / 86400);
    12091209                        $cookie = hash('sha256', $this->request->ip . $time . $this->cookie_key);
    12101210                        if ($cookie) {
    1211                                 $this->setCookie(WPRProtectFW_V681::IP_COOKIE_NAME, $cookie, time() + 86400);
     1211                                $this->setCookie(WPRProtectFW_V683::IP_COOKIE_NAME, $cookie, time() + 86400);
    12121212                        }
    12131213                }
    … …  
    12171217                if (function_exists('current_user_can')) {
    12181218                        if (function_exists('is_super_admin') &&  is_super_admin()) {
    1219                                 return WPRProtectFW_V681::WP_USER_ROLE_LEVEL_ADMIN;
     1219                                return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN;
    12201220                        }
    12211221
    12221222                        foreach ($this->custom_roles as $role) {
    12231223                                if (current_user_can($role)) {
    1224                                         return WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CUSTOM;
     1224                                        return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM;
    12251225                                }
    12261226                        }
    12271227
    1228                         foreach (WPRProtectFW_V681::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {
     1228                        foreach (WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {
    12291229                                if (current_user_can($role)) {
    12301230                                        return $level;
    … …  
    13341334                $cookies = array();
    13351335
    1336                 if ($this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME) !== NULL) {
    1337                         $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME);
    1338                         $cookies[WPRProtectFW_V681::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;
    13391339                }
    13401340
    … …  
    15001500
    15011501        private function getUserBy($attribute, $value) {
    1502                 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V681::havePluginsLoaded()) {
     1502                if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V683::havePluginsLoaded()) {
    15031503                        return get_user_by($attribute, $value);
    15041504                }
    … …  
    16041604                                        }
    16051605
    1606                                         if ($this->matchCount(WPRProtectFWRule_V681::SQLIREGEX, $value) > 2) {
     1606                                        if ($this->matchCount(WPRProtectFWRule_V683::SQLIREGEX, $value) > 2) {
    16071607                                                $profiled_data[$key]["sql"] = true;
    16081608                                        }
    … …  
    16931693        private function canRequestBypassFirewall() {
    16941694                if ($this->isRequestIPWhitelisted() || $this->isRequestHasValidBypassCookie()) {
    1695                         $this->request->category = WPRProtectRequest_V681::CATEGORY_WHITELISTED;
    1696                         $this->request->status = WPRProtectRequest_V681::STATUS_BYPASSED;
     1695                        $this->request->category = WPRProtectRequest_V683::CATEGORY_WHITELISTED;
     1696                        $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED;
    16971697
    16981698                        return true;
    1699                 } elseif (WPRProtectUtils_V681::isPrivateIP($this->request->ip)) {
    1700                         $this->request->category = WPRProtectRequest_V681::CATEGORY_PRIVATEIP;
    1701                         $this->request->status = WPRProtectRequest_V681::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;
    17021702
    17031703                        return true;
    … …  
    17231723
    17241724        private function handleRequestOnRuleMatch($rules, $engine_vars = array(), $log_data = array()) {
    1725                 $normalized_engine_vars = WPRProtectFWRuleEngine_V681::normalizeVariables($engine_vars);
     1725                $normalized_engine_vars = WPRProtectFWRuleEngine_V683::normalizeVariables($engine_vars);
    17261726
    17271727                foreach ($rules as $rule) {
    … …  
    17331733                        if (array_key_exists('variables', $rule->opts)) {
    17341734                                $_engine_vars = array_merge($_engine_vars,
    1735                                         WPRProtectFWRuleEngine_V681::normalizeVariables($rule->opts['variables']));
    1736                         }
    1737 
    1738                         $rule_engine = new WPRProtectFWRuleEngine_V681($this->request, $_engine_vars);
     1735                                        WPRProtectFWRuleEngine_V683::normalizeVariables($rule->opts['variables']));
     1736                        }
     1737
     1738                        $rule_engine = new WPRProtectFWRuleEngine_V683($this->request, $_engine_vars);
    17391739
    17401740                        if ($rule_engine->evaluate($rule) && !$rule_engine->hasError()) {
    … …  
    17491749                                        case "ALLOW":
    17501750                                                $this->break_rule_matching = true;
    1751                                                 $this->request->category = WPRProtectRequest_V681::CATEGORY_RULE_ALLOWED;
     1751                                                $this->request->category = WPRProtectRequest_V683::CATEGORY_RULE_ALLOWED;
    17521752                                                return;
    17531753                                        case "BLOCK":
    17541754                                                if ($this->isModeProtect()) {
    1755                                                         $this->terminateRequest(WPRProtectRequest_V681::CATEGORY_RULE_BLOCKED);
     1755                                                        $this->terminateRequest(WPRProtectRequest_V683::CATEGORY_RULE_BLOCKED);
    17561756                                                }
    17571757                                                return;
    … …  
    17691769        private function terminateRequest($category) {
    17701770                $this->request->category = $category;
    1771                 $this->request->status = WPRProtectRequest_V681::STATUS_BLOCKED;
     1771                $this->request->status = WPRProtectRequest_V683::STATUS_BLOCKED;
    17721772                $this->request->setRespCode(403);
    17731773
    17741774                if ($this->can_set_cache_prevention_cookie &&
    1775                         !$this->request->getCookies(WPRProtectFW_V681::PREVENT_CACHE_COOKIE_NAME)) {
     1775                        !$this->request->getCookies(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME)) {
    17761776                        $value = "Prevent Caching Response.";
    1777                         $this->setCookie(WPRProtectFW_V681::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);
     1777                        $this->setCookie(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);
    17781778                }
    17791779
    … …  
    18031803                                $cookie = $this->generateBypassCookie();
    18041804                                if ($cookie) {
    1805                                         $this->setCookie(WPRProtectFW_V681::BYPASS_COOKIE_NAME, $cookie);
     1805                                        $this->setCookie(WPRProtectFW_V683::BYPASS_COOKIE_NAME, $cookie);
    18061806                                }
    18071807                        }
  • wpremote/tags/6.83/protect/fw/rule.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectFWRule_V681')) :
    5 class WPRProtectFWRule_V681 {
     4if (!class_exists('WPRProtectFWRule_V683')) :
     5class WPRProtectFWRule_V683 {
    66        public $id;
    77        public $logic;
    … …  
    105105
    106106                if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) ||
    107                                 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V681::VERSION) {
     107                                $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V683::VERSION) {
    108108
    109109                        return false;
    … …  
    111111
    112112                if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) ||
    113                                 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V681::VERSION)) {
     113                                $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V683::VERSION)) {
    114114
    115115                        return false;
    … …  
    130130                if (!array_key_exists('execute_on', $attributes)) {
    131131                        if (array_key_exists('level', $attributes) && $attributes['level'] === 1) {
    132                                 $attributes['execute_on'] = WPRProtectFWRule_V681::EXE_ON_BOOT;
     132                                $attributes['execute_on'] = WPRProtectFWRule_V683::EXE_ON_BOOT;
    133133                        } else {
    134134                                return false;
    … …  
    136136                }
    137137
    138                 return new WPRProtectFWRule_V681($attributes);
     138                return new WPRProtectFWRule_V683($attributes);
    139139        }
    140140
    141141        public function isExeOnBoot() {
    142                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_BOOT);
     142                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_BOOT);
    143143        }
    144144
    145145        public function isExeOnPreUpdateOption() {
    146                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PRE_UPDATE_OPTION);
     146                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION);
    147147        }
    148148
    149149        public function isExeOnPreDeletePost() {
    150                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PRE_DELETE_POST);
     150                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST);
    151151        }
    152152
    153153        public function isExeOnWPInsertPostEmptyContent() {
    154                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
     154                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
    155155        }
    156156
    157157        public function isExeOnInsertUserMeta() {
    158                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_INSERT_USER_META);
     158                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META);
    159159        }
    160160
    161161        public function isExeOnDeleteOption() {
    162                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_DELETE_OPTION);
     162                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION);
    163163        }
    164164
    165165        public function isExeOnDeleteUser() {
    166                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_DELETE_USER);
     166                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_USER);
    167167        }
    168168
    169169        public function isExeOnPasswordReset() {
    170                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PASSWORD_RESET);
     170                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET);
    171171        }
    172172
    173173        public function isExeOnSendAuthCookies() {
    174                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_SEND_AUTH_COOKIES);
     174                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES);
    175175        }
    176176
    177177        public function isExeOnSetAuthCookie() {
    178                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_SET_AUTH_COOKIE);
     178                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE);
    179179        }
    180180
    181181        public function isExeOnInit() {
    182                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_INIT);
     182                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INIT);
    183183        }
    184184
    185185        public function isExeOnUserRegister() {
    186                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_USER_REGISTER);
     186                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_USER_REGISTER);
    187187        }
    188188
    189189        public function isExeOnAddUserMeta() {
    190                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_ADD_USER_META);
     190                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_USER_META);
    191191        }
    192192
    193193        public function isExeOnUpdateUserMetadata() {
    194                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_METADATA);
     194                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA);
    195195        }
    196196
    197197        public function isExeOnUpdateUserMeta() {
    198                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_META);
     198                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META);
    199199        }
    200200
    201201        public function isExeOnAddOption() {
    202                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_ADD_OPTION);
     202                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_OPTION);
    203203        }
    204204
    205205        public function isExeOnWpPreInsertUserData() {
    206                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_WP_PRE_INSERT_USER_DATA);
     206                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA);
    207207        }
    208208}
  • wpremote/tags/6.83/protect/fw/rule/engine.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('WPRProtectFWRuleEngine_V681')) :
     5if (!class_exists('WPRProtectFWRuleEngine_V683')) :
    66require_once dirname( __FILE__ ) . '/functions.php';
    77
    8 class WPRProtectFWRuleEngine_V681 {
    9         use WPRProtectFWRuleStringFunc_V681;
    10         use WPRProtectFWRuleArrayFunc_V681;
    11         use WPRProtectFWRuleMiscFunc_V681;
    12         use WPRProtectFWRuleRequestFunc_V681;
    13         use WPRProtectFWRuleWPFunc_V681;
     8class WPRProtectFWRuleEngine_V683 {
     9        use WPRProtectFWRuleStringFunc_V683;
     10        use WPRProtectFWRuleArrayFunc_V683;
     11        use WPRProtectFWRuleMiscFunc_V683;
     12        use WPRProtectFWRuleRequestFunc_V683;
     13        use WPRProtectFWRuleWPFunc_V683;
    1414
    1515        private $request;
    … …  
    2626        const WILDCARD_KEY = '*';
    2727        const FUNC_NAME_PREFIX = '_rf_';
    28         const CONST_NAME_PREFIX = 'WPRProtectFWRule_V681::';
     28        const CONST_NAME_PREFIX = 'WPRProtectFWRule_V683::';
    2929        const ALLOWED_EXT_CONSTANTS = [
    3030                'DOING_CRON'
    … …  
    5353                try {
    5454                        return $this->executeStmt($rule->logic);
    55                 } catch (WPRProtectRuleError_V681 $e) {
     55                } catch (WPRProtectRuleError_V683 $e) {
    5656                        $this->error = $e;
    5757                }
    … …  
    124124        private function getValue($stmt) {
    125125                if (!is_array($stmt) || empty($stmt["type"])) {
    126                         throw new WPRProtectRuleError_V681(
     126                        throw new WPRProtectRuleError_V683(
    127127                                $this->addExState("InvalidStatementError: Malformed value statement"));
    128128                }
    … …  
    133133                case "NUMBER":
    134134                        if (!isset($stmt["value"]) || !is_int($stmt["value"])) {
    135                                 throw new WPRProtectRuleError_V681(
     135                                throw new WPRProtectRuleError_V683(
    136136                                        $this->addExState("TypeError: Value is not a number")
    137137                                );
    … …  
    141141                case "STRING":
    142142                        if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
    143                                 throw new WPRProtectRuleError_V681(
     143                                throw new WPRProtectRuleError_V683(
    144144                                        $this->addExState("TypeError: Value is not a string")
    145145                                );
    … …  
    149149                case "BOOL":
    150150                        if (!isset($stmt["value"]) || !is_bool($stmt["value"])) {
    151                                 throw new WPRProtectRuleError_V681(
     151                                throw new WPRProtectRuleError_V683(
    152152                                        $this->addExState("TypeError: Value is not a boolean")
    153153                                );
    … …  
    157157                case "CONST":
    158158                        if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
    159                                 throw new WPRProtectRuleError_V681(
     159                                throw new WPRProtectRuleError_V683(
    160160                                        $this->addExState("TypeError: Invalid constant name")
    161161                                );
    … …  
    169169
    170170                        if (!defined($name)) {
    171                                 throw new WPRProtectRuleError_V681(
     171                                throw new WPRProtectRuleError_V683(
    172172                                        $this->addExState("TypeError: Undefined constant" . $stmt["value"])
    173173                                );
    … …  
    177177                case "ARRAY":
    178178                        if (!isset($stmt["value"]) || !is_array($stmt["value"])) {
    179                                 throw new WPRProtectRuleError_V681(
     179                                throw new WPRProtectRuleError_V683(
    180180                                        $this->addExState("TypeError: Value is not a array")
    181181                                );
    … …  
    208208        private function executeStmt($stmt) {
    209209                if (!is_array($stmt) || empty($stmt["type"])) {
    210                         throw new WPRProtectRuleError_V681(
     210                        throw new WPRProtectRuleError_V683(
    211211                                $this->addExState("InvalidStatementError: Malformed logic statement")
    212212                        );
    … …  
    220220                case "AND":
    221221                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    222                                 throw new WPRProtectRuleError_V681(
     222                                throw new WPRProtectRuleError_V683(
    223223                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    224224                                );
    … …  
    229229                case "OR":
    230230                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    231                                 throw new WPRProtectRuleError_V681(
     231                                throw new WPRProtectRuleError_V683(
    232232                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    233233                                );
    … …  
    238238                case "NOT":
    239239                        if (empty($stmt["value"])) {
    240                                 throw new WPRProtectRuleError_V681(
     240                                throw new WPRProtectRuleError_V683(
    241241                                        $this->addExState("InvalidOperandError: Malformed operand")
    242242                                );
    … …  
    247247                case "FUNCTION":
    248248                        if (empty($stmt["name"]) || !is_string($stmt["name"])) {
    249                                 throw new WPRProtectRuleError_V681(
     249                                throw new WPRProtectRuleError_V683(
    250250                                        $this->addExState("InvalidFunctionName: Malformed name")
    251251                                );
    … …  
    256256
    257257                        if (!is_callable($handler)) {
    258                                 throw new WPRProtectRuleError_V681(
     258                                throw new WPRProtectRuleError_V683(
    259259                                        $this->addExState("UndefinedFunctionCall: " . $stmt["name"])
    260260                                );
    … …  
    262262
    263263                        if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) {
    264                                 throw new WPRProtectRuleError_V681(
     264                                throw new WPRProtectRuleError_V683(
    265265                                        $this->addExState("InvalidArguments: Malformed args")
    266266                                );
    … …  
    275275                        break;
    276276                default:
    277                         throw new WPRProtectRuleError_V681(
     277                        throw new WPRProtectRuleError_V683(
    278278                                $this->addExState("UnknownOperation: -")
    279279                        );
    … …  
    286286        private function processRuleFunctionParams($func_name, $args_cnt, $args, $required_params = 0, $param_types = array()) {
    287287                if (($args_cnt < $required_params)) {
    288                         throw new WPRProtectRuleError_V681(
     288                        throw new WPRProtectRuleError_V683(
    289289                                $this->addExState("ArgumentCountError: Too few arguments for " . $func_name)
    290290                        );
    … …  
    293293                foreach ($param_types as $pos => $type) {
    294294                        if (!is_int($pos)) {
    295                                 throw new WPRProtectRuleError_V681(
     295                                throw new WPRProtectRuleError_V683(
    296296                                        $this->addExState("InvalidParamType: " . $pos)
    297297                                );
    … …  
    301301                        case "string":
    302302                                if (!isset($args[$pos]) || !is_string($args[$pos])) {
    303                                         throw new WPRProtectRuleError_V681(
     303                                        throw new WPRProtectRuleError_V683(
    304304                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a string.")
    305305                                        );
    … …  
    308308                        case 'integer':
    309309                                if (!isset($args[$pos]) || !is_int($args[$pos])) {
    310                                         throw new WPRProtectRuleError_V681(
     310                                        throw new WPRProtectRuleError_V683(
    311311                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a integer.")
    312312                                        );
    … …  
    315315                        case 'double':
    316316                                if (!isset($args[$pos]) || !is_double($args[$pos])) {
    317                                         throw new WPRProtectRuleError_V681(
     317                                        throw new WPRProtectRuleError_V683(
    318318                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a double.")
    319319                                        );
    … …  
    322322                        case 'boolean':
    323323                                if (!isset($args[$pos]) || !is_bool($args[$pos])) {
    324                                         throw new WPRProtectRuleError_V681(
     324                                        throw new WPRProtectRuleError_V683(
    325325                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a boolean.")
    326326                                        );
    … …  
    329329                        case 'array':
    330330                                if (!isset($args[$pos]) || !is_array($args[$pos])) {
    331                                         throw new WPRProtectRuleError_V681(
     331                                        throw new WPRProtectRuleError_V683(
    332332                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.")
    333333                                        );
    … …  
    337337                                break;
    338338                        default:
    339                                 throw new WPRProtectRuleError_V681(
     339                                throw new WPRProtectRuleError_V683(
    340340                                        $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name)
    341341                                );
  • wpremote/tags/6.83/protect/fw/rule/errors.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectRuleError_V681')) :
    5 class WPRProtectRuleError_V681 extends Exception {
     4if (!class_exists('WPRProtectRuleError_V683')) :
     5class WPRProtectRuleError_V683 extends Exception {
    66//Root rule error class.
    77}
  • wpremote/tags/6.83/protect/fw/rule/functions/array.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V681')) :
    6 trait WPRProtectFWRuleArrayFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleArrayFunc_V683')) :
     6trait WPRProtectFWRuleArrayFunc_V683 {
    77        private function _rf_inArray() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1717
    1818                if (!is_array($array)) {
    19                         throw new WPRProtectRuleError_V681(
     19                        throw new WPRProtectRuleError_V683(
    2020                                $this->addExState("inArray: 2nd param is not an array")
    2121                        );
    … …  
    2323
    2424                if (!is_bool($strict)) {
    25                         throw new WPRProtectRuleError_V681(
     25                        throw new WPRProtectRuleError_V683(
    2626                                $this->addExState("inArray: 3rd param is not a boolean")
    2727                        );
    … …  
    5454                        }
    5555                } else {
    56                         throw new WPRProtectRuleError_V681(
     56                        throw new WPRProtectRuleError_V683(
    5757                                $this->addExState("recInArray: Expects an array")
    5858                        );
    … …  
    7373
    7474                if (!is_array($array)) {
    75                         throw new WPRProtectRuleError_V681(
     75                        throw new WPRProtectRuleError_V683(
    7676                                $this->addExState("arrayKeyExists: Array must be of type array")
    7777                        );
    7878                } elseif (!is_string($key) && !is_int($key)) {
    79                         throw new WPRProtectRuleError_V681(
     79                        throw new WPRProtectRuleError_V683(
    8080                                $this->addExState("arrayKeyExists: Key must be of type string or int")
    8181                        );
    … …  
    110110
    111111                if (!is_bool($recursive)) {
    112                         throw new WPRProtectRuleError_V681(
     112                        throw new WPRProtectRuleError_V683(
    113113                                $this->addExState("getArrayKeys: 2nd param must be a boolean")
    114114                        );
    … …  
    140140
    141141                if (!is_bool($recursive)) {
    142                         throw new WPRProtectRuleError_V681(
     142                        throw new WPRProtectRuleError_V683(
    143143                                $this->addExState("hasAnyArrayKey: 3rd param must be a boolean")
    144144                        );
    … …  
    148148                foreach ($keys as $key) {
    149149                        if (!is_int($key) && !is_string($key)) {
    150                                 throw new WPRProtectRuleError_V681(
     150                                throw new WPRProtectRuleError_V683(
    151151                                        $this->addExState("hasAnyArrayKey: Key must be of type string or int")
    152152                                );
    … …  
    189189
    190190                if (!is_bool($recursive)) {
    191                         throw new WPRProtectRuleError_V681(
     191                        throw new WPRProtectRuleError_V683(
    192192                                $this->addExState("keyMatches: 3rd param must be a boolean")
    193193                        );
    … …  
    224224
    225225                if ($resp === false) {
    226                         throw new WPRProtectRuleError_V681(
     226                        throw new WPRProtectRuleError_V683(
    227227                                $this->addExState("keyMatches: Invalid regular expression")
    228228                        );
    … …  
    233233                $resp = WPRHelper::safePregMatch($pattern, (string) $key);
    234234                if ($resp === false) {
    235                         throw new WPRProtectRuleError_V681(
     235                        throw new WPRProtectRuleError_V683(
    236236                                $this->addExState("keyMatches: Regex match failed")
    237237                        );
    … …  
    242242
    243243        private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) {
    244                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     244                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    245245                        return false;
    246246                }
    … …  
    262262
    263263        private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) {
    264                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     264                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    265265                        return;
    266266                }
    … …  
    277277
    278278        private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) {
    279                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     279                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    280280                        return false;
    281281                }
    … …  
    297297
    298298        private function enforceArrayTraversalLimit($func_name, $traversed_keys) {
    299                 if ($traversed_keys > WPRProtectFWRuleEngine_V681::MAX_ARRAY_KEYS_TO_TRAVERSE) {
    300                         throw new WPRProtectRuleError_V681(
     299                if ($traversed_keys > WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) {
     300                        throw new WPRProtectRuleError_V683(
    301301                                $this->addExState(
    302302                                        "TraversalLimitError: " . $func_name . " exceeded " .
    303                                         WPRProtectFWRuleEngine_V681::MAX_ARRAY_KEYS_TO_TRAVERSE .
     303                                        WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE .
    304304                                        " array keys"
    305305                                )
    … …  
    321321                foreach ($keys as $key) {
    322322                        if (!is_int($key) && !is_string($key)) {
    323                                 throw new WPRProtectRuleError_V681(
     323                                throw new WPRProtectRuleError_V683(
    324324                                        $this->addExState("digArray: Keys must be a valid array of string, or integer type")
    325325                                );
    … …  
    342342
    343343                if (empty($keys)) {
    344                         throw new WPRProtectRuleError_V681(
     344                        throw new WPRProtectRuleError_V683(
    345345                                $this->addExState("digArrayValues: Keys must not be empty")
    346346                        );
    347347                }
    348348
    349                 if (count($keys) > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    350                         throw new WPRProtectRuleError_V681(
     349                if (count($keys) > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     350                        throw new WPRProtectRuleError_V683(
    351351                                $this->addExState(
    352352                                        "digArrayValues: Keys exceeded " .
    353                                         WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
     353                                        WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
    354354                                        " levels of traversal"
    355355                                )
    … …  
    359359                foreach ($keys as $key) {
    360360                        if (!is_int($key) && !is_string($key)) {
    361                                 throw new WPRProtectRuleError_V681(
     361                                throw new WPRProtectRuleError_V683(
    362362                                        $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type")
    363363                                );
    … …  
    376376                                }
    377377
    378                                 if ($key === WPRProtectFWRuleEngine_V681::WILDCARD_KEY) {
     378                                if ($key === WPRProtectFWRuleEngine_V683::WILDCARD_KEY) {
    379379                                        foreach ($node as $value) {
    380380                                                $traversed_keys += 1;
    … …  
    417417                foreach ($keys as $key) {
    418418                        if (!is_int($key) && !is_string($key)) {
    419                                 throw new WPRProtectRuleError_V681(
     419                                throw new WPRProtectRuleError_V683(
    420420                                        $this->addExState("filterArray: Keys must be a valid array of string, or integer type")
    421421                                );
    … …  
    438438
    439439                if (!is_string($key) && !is_int($key)) {
    440                         throw new WPRProtectRuleError_V681(
     440                        throw new WPRProtectRuleError_V683(
    441441                                $this->addExState("getArrayVal: Key must be a valid string or integer")
    442442                        );
    … …  
    519519                foreach ($array as $element) {
    520520                        if (!is_scalar($element)) {
    521                                 throw new WPRProtectRuleError_V681(
     521                                throw new WPRProtectRuleError_V683(
    522522                                        $this->addExState("arrayJoin: Array element must be of scalar type")
    523523                                );
  • wpremote/tags/6.83/protect/fw/rule/functions/misc.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V681')) :
    6 trait WPRProtectFWRuleMiscFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleMiscFunc_V683')) :
     6trait WPRProtectFWRuleMiscFunc_V683 {
    77        private function _rf_isTrue() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    7373
    7474                if (!array_key_exists($name, $this->variables)) {
    75                         throw new WPRProtectRuleError_V681(
     75                        throw new WPRProtectRuleError_V683(
    7676                                $this->addExState("UndefinedVariableError: " . $name . " is not defined.")
    7777                        );
    … …  
    134134                $resp = WPRHelper::safePregMatch((string) $pattern, (string) $subject);
    135135                if ($resp === false) {
    136                         throw new WPRProtectRuleError_V681(
     136                        throw new WPRProtectRuleError_V683(
    137137                                $this->addExState('BVHelper::safePregMatch' . serialize($subject))
    138138                        );
    … …  
    175175                $count = preg_match_all((string) $pattern, (string) $subject, $matches);
    176176                if ($count === false) {
    177                         throw new WPRProtectRuleError_V681(
     177                        throw new WPRProtectRuleError_V683(
    178178                                $this->addExState("preg_match_all: " . serialize($subject))
    179179                        );
    … …  
    201201                $count = preg_match_all((string) $pattern, (string) $subject, $matches);
    202202                if ($count === false) {
    203                         throw new WPRProtectRuleError_V681(
     203                        throw new WPRProtectRuleError_V683(
    204204                                $this->addExState("preg_match_all: " . serialize($subject))
    205205                        );
  • wpremote/tags/6.83/protect/fw/rule/functions/request.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V681')) :
    6 trait WPRProtectFWRuleRequestFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleRequestFunc_V683')) :
     6trait WPRProtectFWRuleRequestFunc_V683 {
    77        private function _rf_getAction() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    496496
    497497                if (!array_key_exists('ID', $user)) {
    498                         throw new WPRProtectRuleError_V681(
     498                        throw new WPRProtectRuleError_V683(
    499499                                $this->addExState("wpUserId: user's id doesn't exist")
    500500                        );
  • wpremote/tags/6.83/protect/fw/rule/functions/string.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleStringFunc_V681')) :
    6 trait WPRProtectFWRuleStringFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleStringFunc_V683')) :
     6trait WPRProtectFWRuleStringFunc_V683 {
    77        private function _rf_isNumeric() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    239239                        }
    240240                } else {
    241                         throw new WPRProtectRuleError_V681(
     241                        throw new WPRProtectRuleError_V683(
    242242                                $this->addExState("containsAnySubstring: Expects an array of substrings.")
    243243                        );
    … …  
    274274
    275275                if (!is_int($offset)) {
    276                         throw new WPRProtectRuleError_V681(
     276                        throw new WPRProtectRuleError_V683(
    277277                                $this->addExState("strPos: Offset should be an integer")
    278278                        );
    … …  
    319319
    320320                if (empty($separator)) {
    321                         throw new WPRProtectRuleError_V681(
     321                        throw new WPRProtectRuleError_V683(
    322322                                $this->addExState("splitString: Separator cannot be empty")
    323323                        );
    … …  
    325325
    326326                if (!is_int($limit)) {
    327                         throw new WPRProtectRuleError_V681(
     327                        throw new WPRProtectRuleError_V683(
    328328                                $this->addExState("splitString: Limit should be an integer")
    329329                        );
    … …  
    344344
    345345                if (!is_bool($recursive)) {
    346                         throw new WPRProtectRuleError_V681(
     346                        throw new WPRProtectRuleError_V683(
    347347                                $this->addExState("urlDecode: Recursive flag should be a boolean")
    348348                        );
    … …  
    363363
    364364                if (!is_bool($recursive)) {
    365                         throw new WPRProtectRuleError_V681(
     365                        throw new WPRProtectRuleError_V683(
    366366                                $this->addExState("rawUrlDecode: Recursive flag should be a boolean")
    367367                        );
    … …  
    382382
    383383                if (!is_bool($recursive)) {
    384                         throw new WPRProtectRuleError_V681(
     384                        throw new WPRProtectRuleError_V683(
    385385                                $this->addExState("htmlEntityDecode: Recursive flag should be a boolean")
    386386                        );
    … …  
    401401
    402402                if (!is_bool($recursive)) {
    403                         throw new WPRProtectRuleError_V681(
     403                        throw new WPRProtectRuleError_V683(
    404404                                $this->addExState("stripSlashes: Recursive flag should be a boolean")
    405405                        );
    … …  
    410410
    411411        private function normalizeStringValue($value, $operation, $recursive, $depth = 1) {
    412                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     412                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    413413                        return null;
    414414                }
    … …  
    442442                }
    443443
    444                 throw new WPRProtectRuleError_V681(
     444                throw new WPRProtectRuleError_V683(
    445445                        $this->addExState("normalizeStringValue: Invalid normalization operation")
    446446                );
  • wpremote/tags/6.83/protect/fw/rule/functions/wp.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleWPFunc_V681')) :
    6 trait WPRProtectFWRuleWPFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleWPFunc_V683')) :
     6trait WPRProtectFWRuleWPFunc_V683 {
    77        private function _rf_sanitizeUser() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1616                $strict = $args[1];
    1717
    18                 if (!function_exists('sanitize_user') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    19                         throw new WPRProtectRuleError_V681(
     18                if (!function_exists('sanitize_user') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     19                        throw new WPRProtectRuleError_V683(
    2020                                $this->addExState("sanitizeUser: Func sanitize_user doesn't exist.")
    2121                        );
    … …  
    3434                $data = $args[0];
    3535
    36                 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    37                         throw new WPRProtectRuleError_V681(
     36                if (!function_exists('maybe_serialize') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     37                        throw new WPRProtectRuleError_V683(
    3838                                $this->addExState("maybeSerialize: Func maybe_serialize doesn't exist.")
    3939                        );
    … …  
    5050                );
    5151
    52                 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    53                         throw new WPRProtectRuleError_V681(
     52                if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     53                        throw new WPRProtectRuleError_V683(
    5454                                $this->addExState("isUserLoggedIn: Func is_user_logged_in doesn't exist.")
    5555                        );
    … …  
    6666                );
    6767
    68                 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    69                         throw new WPRProtectRuleError_V681(
     68                if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     69                        throw new WPRProtectRuleError_V683(
    7070                                $this->addExState("getCurrentWPUser: Func wp_get_current_user doesn't exist.")
    7171                        );
    7272                }
    7373
    74                 return WPRProtectFWRuleEngine_V681::toAllowedType(wp_get_current_user());
     74                return WPRProtectFWRuleEngine_V683::toAllowedType(wp_get_current_user());
    7575        }
    7676
    … …  
    8787                $arg2 = isset($args[2]) ? $args[2] : null;
    8888
    89                 if (!function_exists('current_user_can') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    90                         throw new WPRProtectRuleError_V681(
     89                if (!function_exists('current_user_can') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     90                        throw new WPRProtectRuleError_V683(
    9191                                $this->addExState("currentUserCan: Required funcs doesn't exist.")
    9292                        );
    … …  
    115115                $value = $args[1];
    116116
    117                 if (!function_exists('get_user_by') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    118                         throw new WPRProtectRuleError_V681(
     117                if (!function_exists('get_user_by') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     118                        throw new WPRProtectRuleError_V683(
    119119                                $this->addExState("getUserBy: Func get_user_by doesn't exist")
    120120                        );
    … …  
    123123                if ($field === 'ID' || $field === 'id') {
    124124                        if (!is_string($value) && !is_int($value)) {
    125                                 throw new WPRProtectRuleError_V681(
     125                                throw new WPRProtectRuleError_V683(
    126126                                        $this->addExState("getUserBy: Value must be a valid string or an integer")
    127127                                );
    128128                        }
    129129                } elseif (!is_string($value)) {
    130                         throw new WPRProtectRuleError_V681(
     130                        throw new WPRProtectRuleError_V683(
    131131                                $this->addExState("getUserBy: Value must be a valid string")
    132132                        );
    … …  
    138138                }
    139139
    140                 return WPRProtectFWRuleEngine_V681::toAllowedType($user);
     140                return WPRProtectFWRuleEngine_V683::toAllowedType($user);
    141141        }
    142142
    … …  
    151151
    152152                if (!array_key_exists("allcaps", $user)) {
    153                         throw new WPRProtectRuleError_V681(
     153                        throw new WPRProtectRuleError_V683(
    154154                                $this->addExState("getCurrentWPUserCapabilities: allcaps doesn't exist in user.")
    155155                        );
    156156                }
    157157
    158                 return WPRProtectFWRuleEngine_V681::toAllowedType($user["allcaps"]);
     158                return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]);
    159159        }
    160160
    … …  
    174174
    175175                if (!array_key_exists("allcaps", $user)) {
    176                         throw new WPRProtectRuleError_V681(
     176                        throw new WPRProtectRuleError_V683(
    177177                                $this->addExState("getUserCapabilities: allcaps doesn't exist in user.")
    178178                        );
    179179                }
    180180
    181                 return WPRProtectFWRuleEngine_V681::toAllowedType($user["allcaps"]);
     181                return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]);
    182182        }
    183183
    … …  
    203203                $default_value = isset($args[1]) ? $args[1] : false;
    204204
    205                 if (!function_exists('get_option') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    206                         throw new WPRProtectRuleError_V681(
     205                if (!function_exists('get_option') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     206                        throw new WPRProtectRuleError_V683(
    207207                                $this->addExState("getOption: Func get_option doesn't exist.")
    208208                        );
    209209                }
    210210
    211                 return WPRProtectFWRuleEngine_V681::toAllowedType(get_option($option, $default_value));
     211                return WPRProtectFWRuleEngine_V683::toAllowedType(get_option($option, $default_value));
    212212        }
    213213
    … …  
    223223                $login = $args[1];
    224224
    225                 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    226                         throw new WPRProtectRuleError_V681(
     225                if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     226                        throw new WPRProtectRuleError_V683(
    227227                                $this->addExState("checkPasswordResetKey: Func check_password_reset_key doesn't exist.")
    228228                        );
    … …  
    232232
    233233                if (is_a($user, "WP_User")) {
    234                         return WPRProtectFWRuleEngine_V681::toAllowedType($user);
     234                        return WPRProtectFWRuleEngine_V683::toAllowedType($user);
    235235                }
    236236
    … …  
    287287                $value = $args[0];
    288288
    289                 if (!function_exists('wp_unslash') || !WPRProtectUtils_V681::haveMuPluginsLoaded()) {
    290                         throw new WPRProtectRuleError_V681(
     289                if (!function_exists('wp_unslash') || !WPRProtectUtils_V683::haveMuPluginsLoaded()) {
     290                        throw new WPRProtectRuleError_V683(
    291291                                $this->addExState("wpUnslash: Func wp_unslash doesn't exist.")
    292292                        );
    … …  
    294294
    295295                if (!is_string($value) && !is_array($value)) {
    296                         throw new WPRProtectRuleError_V681(
     296                        throw new WPRProtectRuleError_V683(
    297297                                $this->addExState("wpUnslash: Value must be a valid string or an array")
    298298                        );
    … …  
    310310
    311311                if (!defined('COOKIEHASH')) {
    312                         throw new WPRProtectRuleError_V681(
     312                        throw new WPRProtectRuleError_V683(
    313313                                $this->addExState("parseResetPassCookie: COOKIEHASH is not defined.")
    314314                        );
  • wpremote/tags/6.83/protect/ipstore.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstore_V681')) :
     4if (!class_exists('WPRProtectIpstore_V683')) :
    55require_once dirname( __FILE__ ) . '/request.php';
    66require_once dirname( __FILE__ ) . '/ipstore/fs.php';
    77require_once dirname( __FILE__ ) . '/ipstore/db.php';
    88
    9 class WPRProtectIpstore_V681 {
     9class WPRProtectIpstore_V683 {
    1010        private $storage;
    1111        private $storage_type;
    … …  
    1414        const STORAGE_TYPE_DB = 1;
    1515
    16         function __construct($storage_type = WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     16        function __construct($storage_type = WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    1717                $this->storage_type = $storage_type;
    18                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_FS) {
    19                         $this->storage = new WPRProtectIpstoreFS_V681();
     18                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_FS) {
     19                        $this->storage = new WPRProtectIpstoreFS_V683();
    2020                } else {
    21                         $this->storage = new WPRProtectIpstoreDB_V681();
     21                        $this->storage = new WPRProtectIpstoreDB_V683();
    2222                }
    2323        }
    2424
    2525        public static function uninstall() {
    26                 WPRProtectIpstoreDB_V681::uninstall();
     26                WPRProtectIpstoreDB_V683::uninstall();
    2727        }
    2828
    2929        public function isLPIPBlacklisted($ip) {
    30                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     30                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    3131                        return $this->storage->isLPIPBlacklisted($ip);
    3232                }
    … …  
    3434
    3535        public function isLPIPWhitelisted($ip) {
    36                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     36                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    3737                        return $this->storage->isLPIPWhitelisted($ip);
    3838                }
  • wpremote/tags/6.83/protect/ipstore/db.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstoreDB_V681')) :
    5 class WPRProtectIpstoreDB_V681 {
     4if (!class_exists('WPRProtectIpstoreDB_V683')) :
     5class WPRProtectIpstoreDB_V683 {
    66                const TABLE_NAME = 'ip_store';
    77
    … …  
    1111                #XNOTE: check this.
    1212                public static function blacklistedTypes() {
    13                         return WPRProtectRequest_V681::blacklistedCategories();
     13                        return WPRProtectRequest_V683::blacklistedCategories();
    1414                }
    1515
    1616                public static function whitelistedTypes() {
    17                         return WPRProtectRequest_V681::whitelistedCategories();
     17                        return WPRProtectRequest_V683::whitelistedCategories();
    1818                }
    1919
    2020                public static function uninstall() {
    21                         WPRProtect_V681::$db->dropBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);
     21                        WPRProtect_V683::$db->dropBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME);
    2222                }
    2323
    2424                public function isLPIPBlacklisted($ip) {
    25                         return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     25                        return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    2626                }
    2727
    2828                public function isLPIPWhitelisted($ip) {
    29                         return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     29                        return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    3030                }
    3131
    3232                public function getTypeIfBlacklistedIP($ip) {
    33                         return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     33                        return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    3434                }
    3535
    3636                public function isFWIPBlacklisted($ip) {
    37                         return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     37                        return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    3838                }
    3939
    4040                public function isFWIPWhitelisted($ip) {
    41                         return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     41                        return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    4242                }
    4343
    … …  
    5050                #XNOTE: getIPCategory or getIPType?
    5151                private function getIPType($ip, $types, $category) {
    52                         $table = WPRProtect_V681::$db->getBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);
     52                        $table = WPRProtect_V683::$db->getBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME);
    5353
    54                         if (WPRProtect_V681::$db->isTablePresent($table)) {
    55                                 $binIP = WPRProtectUtils_V681::bvInetPton($ip);
    56                                 $is_v6 = WPRProtectUtils_V681::isIPv6($ip);
     54                        if (WPRProtect_V683::$db->isTablePresent($table)) {
     55                                $binIP = WPRProtectUtils_V683::bvInetPton($ip);
     56                                $is_v6 = WPRProtectUtils_V683::isIPv6($ip);
    5757
    5858                                if ($binIP !== false) {
    5959                                        $query_str = "SELECT * FROM $table WHERE %s >= `start_ip_range` && %s <= `end_ip_range` && ";
    60                                         if ($category == WPRProtectIpstoreDB_V681::CATEGORY_FW) {
     60                                        if ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) {
    6161                                                $query_str .= "`is_fw` = true";
    6262                                        } else {
    … …  
    6565                                        $query_str .= " && `type` in (" . implode(',', $types) . ") && `is_v6` = %d LIMIT 1;";
    6666
    67                                         $query = WPRProtect_V681::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
     67                                        $query = WPRProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
    6868
    69                                         return WPRProtect_V681::$db->getVar($query, 5);
     69                                        return WPRProtect_V683::$db->getVar($query, 5);
    7070                                }
    7171                        }
  • wpremote/tags/6.83/protect/ipstore/fs.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstoreFS_V681')) :
    5         class WPRProtectIpstoreFS_V681 {
     4if (!class_exists('WPRProtectIpstoreFS_V683')) :
     5        class WPRProtectIpstoreFS_V683 {
    66                private $whitelisted_ips;
    77                private $blacklisted_ips;
    … …  
    1212                function __construct() {
    1313                        $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf';
    14                         $ips = WPRProtectUtils_V681::parseFile($ip_store_file);
     14                        $ips = WPRProtectUtils_V683::parseFile($ip_store_file);
    1515                        $this->whitelisted_ips = array_key_exists('whitelisted', $ips) ? $ips['whitelisted'] : array();
    1616                        $this->blacklisted_ips = array_key_exists('blacklisted', $ips) ? $ips['blacklisted'] : array();
    … …  
    1818
    1919                public function getTypeIfBlacklistedIP($ip) {
    20                         return $this->getIPType($ip, WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED);
     20                        return $this->getIPType($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
    2121                }
    2222
    2323                public function isFWIPBlacklisted($ip) {
    24                         return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED);
     24                        return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
    2525                }
    2626
    2727                public function isFWIPWhitelisted($ip) {
    28                         return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V681::IP_TYPE_WHITELISTED);
     28                        return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED);
    2929                }
    3030
    … …  
    3737                private function getIPType($ip, $type) {
    3838                        switch ($type) {
    39                         case WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED:
     39                        case WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED:
    4040                                return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null;
    41                         case WPRProtectIpstoreFS_V681::IP_TYPE_WHITELISTED:
     41                        case WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED:
    4242                                return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null;
    4343                        }
  • wpremote/tags/6.83/protect/lib/utils.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectUtils_V681')) :
    5 class WPRProtectUtils_V681 {
     4if (!class_exists('WPRProtectUtils_V683')) :
     5class WPRProtectUtils_V683 {
    66        public static function getIP($ip_header) {
    77                $ip = null;
    … …  
    131131                if (is_array($val)) {
    132132                        foreach ($val as $e) {
    133                                 $length += WPRProtectUtils_V681::getLength($e);
     133                                $length += WPRProtectUtils_V683::getLength($e);
    134134                        }
    135135
  • wpremote/tags/6.83/protect/logger.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLogger_V681')) :
     4if (!class_exists('WPRProtectLogger_V683')) :
    55require_once dirname( __FILE__ ) . '/logger/fs.php';
    66require_once dirname( __FILE__ ) . '/logger/db.php';
    77
    8 class WPRProtectLogger_V681 {
     8class WPRProtectLogger_V683 {
    99        private $log_destination;
    1010
    … …  
    1212        const TYPE_DB = 1;
    1313
    14         function __construct($name, $type = WPRProtectLogger_V681::TYPE_DB) {
    15                 if ($type == WPRProtectLogger_V681::TYPE_FS) {
    16                         $this->log_destination = new WPRProtectLoggerFS_V681($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);
    1717                } else {
    18                         $this->log_destination = new WPRProtectLoggerDB_V681($name);
     18                        $this->log_destination = new WPRProtectLoggerDB_V683($name);
    1919                }
    2020        }
  • wpremote/tags/6.83/protect/logger/db.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLoggerDB_V681')) :
    5 class WPRProtectLoggerDB_V681 {
     4if (!class_exists('WPRProtectLoggerDB_V683')) :
     5class WPRProtectLoggerDB_V683 {
    66        private $tablename;
    77        private $bv_tablename;
    … …  
    1111        function __construct($tablename) {
    1212                $this->tablename = $tablename;
    13                 $this->bv_tablename = WPRProtect_V681::$db->getBVTable($tablename);
     13                $this->bv_tablename = WPRProtect_V683::$db->getBVTable($tablename);
    1414        }
    1515
    1616        public function log($data) {
    1717                if (is_array($data)) {
    18                         if (WPRProtect_V681::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V681::MAXROWCOUNT) {
    19                                 WPRProtect_V681::$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);
    2020                        }
    2121
    22                         WPRProtect_V681::$db->replaceIntoBVTable($this->tablename, $data);
     22                        WPRProtect_V683::$db->replaceIntoBVTable($this->tablename, $data);
    2323                }
    2424        }
  • wpremote/tags/6.83/protect/logger/fs.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLoggerFS_V681')) :
    5 class WPRProtectLoggerFS_V681 {
     4if (!class_exists('WPRProtectLoggerFS_V683')) :
     5class WPRProtectLoggerFS_V683 {
    66        public $logFile;
    77
  • wpremote/tags/6.83/protect/lp.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLP_V681')) :
    5 class WPRProtectLP_V681 {
     4if (!class_exists('WPRProtectLP_V683')) :
     5class WPRProtectLP_V683 {
    66        private $ip;
    77        private $time;
    … …  
    1010        private $brand_name;
    1111
    12         private $mode              = WPRProtectLP_V681::MODE_DISABLED;
     12        private $mode              = WPRProtectLP_V683::MODE_DISABLED;
    1313        private $captcha_limit     = 3;
    1414        private $temp_block_limit  = 10;
    … …  
    1818        private $all_blocked_gap   = 1800;
    1919
    20         private $category          = WPRProtectLP_V681::CATEGORY_ALLOWED;
     20        private $category          = WPRProtectLP_V683::CATEGORY_ALLOWED;
    2121        private $username          = '';
    2222        private $message           = '';
    … …  
    4747                $this->ip = $request->getIP();
    4848                $this->brand_name = $brand_name;
    49                 $this->ipstore = new WPRProtectIpstore_V681();
    50                 $this->logger = new WPRProtectLogger_V681(WPRProtectLP_V681::TABLE_NAME);
     49                $this->ipstore = new WPRProtectIpstore_V683();
     50                $this->logger = new WPRProtectLogger_V683(WPRProtectLP_V683::TABLE_NAME);
    5151                $this->time = strtotime(gmdate("Y-m-d H:i:s"));
    5252
    … …  
    9191
    9292        public static function uninstall() {
    93                 WPRProtect_V681::$db->dropBVTable(WPRProtectLP_V681::TABLE_NAME);
     93                WPRProtect_V683::$db->dropBVTable(WPRProtectLP_V683::TABLE_NAME);
    9494        }
    9595
    … …  
    103103
    104104        private function getCaptchaLink() {
    105                 $account = WPRAccount::apiPublicAccount(WPRProtect_V681::$settings);
     105                $account = WPRAccount::apiPublicAccount(WPRProtect_V683::$settings);
    106106
    107107                $url = $account->authenticatedUrl('/captcha/solve');
    … …  
    112112
    113113        private function getAllowLoginsTransient() {
    114                 return WPRProtect_V681::$settings->getTransient('bvlp_allow_logins');
     114                return WPRProtect_V683::$settings->getTransient('bvlp_allow_logins');
    115115        }
    116116
    117117        private function getBlockLoginsTransient() {
    118                 return WPRProtect_V681::$settings->getTransient('bvlp_block_logins');
     118                return WPRProtect_V683::$settings->getTransient('bvlp_block_logins');
    119119        }
    120120
    … …  
    142142
    143143        private function isProtecting() {
    144                 return $this->mode === WPRProtectLP_V681::MODE_PROTECT;
     144                return $this->mode === WPRProtectLP_V683::MODE_PROTECT;
    145145        }
    146146
    147147        private function isActive() {
    148                 return $this->mode !== WPRProtectLP_V681::MODE_DISABLED;
     148                return $this->mode !== WPRProtectLP_V683::MODE_DISABLED;
    149149        }
    150150
    … …  
    158158
    159159        private function isUnBlockedIP() {
    160                 $transient_name = WPRProtectLP_V681::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
    161                 $attempts = WPRProtect_V681::$settings->getTransient($transient_name);
     160                $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
     161                $attempts = WPRProtect_V683::$settings->getTransient($transient_name);
    162162
    163163                if ($attempts && $attempts > 0) {
    164                         WPRProtect_V681::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
     164                        WPRProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
    165165                        return true;
    166166                }
    … …  
    171171        private function isLoginBlocked() {
    172172                if ($this->getAllowLoginsTransient() ||
    173                                 ($this->getLoginCount(WPRProtectLP_V681::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)) {
    174174                        return false;
    175175                }
    … …  
    194194        private function terminateLogin() {
    195195                $this->message = 'Login Blocked';
    196                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_BLOCKED);
     196                $this->log(WPRProtectLP_V683::LOGIN_STATUS_BLOCKED);
    197197                if ($this->isProtecting()) {
    198198                        header("Cache-Control: no-cache, no-store, must-revalidate");
    … …  
    208208        public function loginInit($user, $username = '', $password = '') {
    209209                if ($this->isUnBlockedIP()) {
    210                         $this->category = WPRProtectLP_V681::CATEGORY_UNBLOCKED;
     210                        $this->category = WPRProtectLP_V683::CATEGORY_UNBLOCKED;
    211211                } else {
    212                         $failed_attempts = $this->getLoginCount(WPRProtectLP_V681::LOGIN_STATUS_FAILURE,
     212                        $failed_attempts = $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE,
    213213                                                                                                                                                                                        $this->ip, $this->failed_login_gap);
    214214
    215215                        if ($this->isWhitelistedIP()) {
    216                                 $this->category = WPRProtectLP_V681::CATEGORY_BYPASSED;
    217                         } elseif (WPRProtectUtils_V681::isPrivateIP($this->ip)) {
    218                                 $this->category = WPRProtectLP_V681::CATEGORY_PRIVATEIP;
     216                                $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED;
     217                        } elseif (WPRProtectUtils_V683::isPrivateIP($this->ip)) {
     218                                $this->category = WPRProtectLP_V683::CATEGORY_PRIVATEIP;
    219219                        } elseif ($this->isBlacklistedIP()) {
    220                                 $this->category = WPRProtectLP_V681::CATEGORY_BLACKLISTED;
     220                                $this->category = WPRProtectLP_V683::CATEGORY_BLACKLISTED;
    221221                                $this->terminateLogin();
    222222                        } elseif ($this->isKnownLogin()) {
    223                                 $this->category = WPRProtectLP_V681::CATEGORY_BYPASSED;
     223                                $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED;
    224224                        } elseif ($this->isLoginBlocked()) {
    225                                 $this->category = WPRProtectLP_V681::CATEGORY_ALL_BLOCKED;
     225                                $this->category = WPRProtectLP_V683::CATEGORY_ALL_BLOCKED;
    226226                                $this->terminateLogin();
    227227                        } elseif ($failed_attempts >= $this->temp_block_limit) {
    228                                 $this->category = WPRProtectLP_V681::CATEGORY_TEMP_BLOCK;
     228                                $this->category = WPRProtectLP_V683::CATEGORY_TEMP_BLOCK;
    229229                                $this->terminateLogin();
    230230                        } elseif ($failed_attempts >= $this->captcha_limit) {
    231                                 $this->category = WPRProtectLP_V681::CATEGORY_CAPTCHA_BLOCK;
     231                                $this->category = WPRProtectLP_V683::CATEGORY_CAPTCHA_BLOCK;
    232232                                $this->terminateLogin();
    233233                        }
    … …  
    243243        public function loginFailed($username) {
    244244                $this->username = $username;
    245                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_FAILURE);
     245                $this->log(WPRProtectLP_V683::LOGIN_STATUS_FAILURE);
    246246        }
    247247
    … …  
    249249                $this->username = $username;
    250250                $this->message = 'Login Success';
    251                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_SUCCESS);
     251                $this->log(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS);
    252252        }
    253253
    254254        private function isKnownLogin() {
    255                 return $this->getLoginCount(WPRProtectLP_V681::LOGIN_STATUS_SUCCESS,
     255                return $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS,
    256256                                                                                                                                $this->ip, $this->success_login_gap) > 0;
    257257        }
    258258
    259259        private function getLoginCount($status, $ip, $gap) {
    260                 $table = WPRProtect_V681::$db->getBVTable(WPRProtectLP_V681::TABLE_NAME);
     260                $table = WPRProtect_V683::$db->getBVTable(WPRProtectLP_V683::TABLE_NAME);
    261261                $query_str = "SELECT COUNT(*) as count from `$table` WHERE status=%d && time > %d";
    262262                $query_args = array($status, ($this->time - $gap));
    263263
    264                 $query = WPRProtect_V681::$db->prepare($query_str, $query_args);
     264                $query = WPRProtect_V683::$db->prepare($query_str, $query_args);
    265265                if ($ip) {
    266                         $query .= WPRProtect_V681::$db->prepare(" && ip=%s", $ip);
    267                 }
    268 
    269                 $rows = WPRProtect_V681::$db->getResult($query);
     266                        $query .= WPRProtect_V683::$db->prepare(" && ip=%s", $ip);
     267                }
     268
     269                $rows = WPRProtect_V683::$db->getResult($query);
    270270                if (!$rows) {
    271271                        return 0;
  • wpremote/tags/6.83/protect/prepend/ignitor.php

    r3775063 r3795707  
    55        require_once dirname( __FILE__ ) . '/../protect.php';
    66
    7         WPRProtect_V681::init(WPRProtect_V681::MODE_PREPEND);
     7        WPRProtect_V683::init(WPRProtect_V683::MODE_PREPEND);
    88}
  • wpremote/tags/6.83/protect/protect.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtect_V681')) :
     4if (!class_exists('WPRProtect_V683')) :
    55require_once dirname( __FILE__ ) . '/logger.php';
    66require_once dirname( __FILE__ ) . '/ipstore.php';
    … …  
    1212require_once dirname( __FILE__ ) . '/../helper.php';
    1313
    14 class WPRProtect_V681 {
     14class WPRProtect_V683 {
    1515        public static $settings;
    1616        public static $db;
    … …  
    2727                }
    2828
    29                 if ($mode == WPRProtect_V681::MODE_PREPEND) {
     29                if ($mode == WPRProtect_V683::MODE_PREPEND) {
    3030                        $config_file = MCDATAPATH .  MCCONFKEY . '-' . 'mc.conf';
    31                         $config = WPRProtectUtils_V681::parseFile($config_file);
     31                        $config = WPRProtectUtils_V683::parseFile($config_file);
    3232
    3333                        if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
    3434                                        !isset($config['mc_conf_version']) ||
    35                                         (WPRProtect_V681::CONF_VERSION !== $config['mc_conf_version'])) {
     35                                        (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
    3636                                return false;
    3737
    … …  
    4141                        $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
    4242                        $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
    43                         $request = new WPRProtectRequest_V681($request_ip_header, $req_config);
     43                        $request = new WPRProtectRequest_V683($request_ip_header, $req_config);
    4444                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    4545
    46                         WPRProtectFW_V681::getInstance($mode, $request, $fw_config, $brand_name)->init();
     46                        WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
    4747                } else {
    4848                        $plug_config = self::$settings->getOption(self::$info->services_option_name);
    4949                        $config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array();
    5050                        if (!is_array($config) || !array_key_exists('mc_conf_version', $config) ||
    51                                         (WPRProtect_V681::CONF_VERSION !== $config['mc_conf_version'])) {
     51                                        (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
    5252
    5353                                return false;
    … …  
    5757                        $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
    5858                        $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
    59                         $request = new WPRProtectRequest_V681($request_ip_header, $req_config);
     59                        $request = new WPRProtectRequest_V683($request_ip_header, $req_config);
    6060                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    6161                        $lp_config = array_key_exists('lp', $config) ? $config['lp'] : array();
    6262
    63                         WPRProtectFW_V681::getInstance($mode, $request, $fw_config, $brand_name)->init();
    64                         WPRProtectLP_V681::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();
    6565                }
    6666        }
    … …  
    6969                self::$settings->deleteOption('bvptconf');
    7070                self::$settings->deleteOption('bvptplug');
    71                 WPRProtectIpstore_V681::uninstall();
    72                 WPRProtectFW_V681::uninstall();
    73                 WPRProtectLP_V681::uninstall();
     71                WPRProtectIpstore_V683::uninstall();
     72                WPRProtectFW_V683::uninstall();
     73                WPRProtectLP_V683::uninstall();
    7474
    75                 WPRProtect_V681::removeWPPrepend();
    76                 WPRProtect_V681::removePHPPrepend();
    77                 WPRProtect_V681::removeMCData();
     75                WPRProtect_V683::removeWPPrepend();
     76                WPRProtect_V683::removePHPPrepend();
     77                WPRProtect_V683::removeMCData();
    7878
    7979                return true;
    … …  
    9696                $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';";
    9797               
    98                 WPRProtectUtils_V681::fileRemovePattern($fname, $pattern);
     98                WPRProtectUtils_V683::fileRemovePattern($fname, $pattern);
    9999        }
    100100
    101101        private static function removePHPPrepend() {
    102                 WPRProtect_V681::removeHtaccessPrepend();
    103                 WPRProtect_V681::removeUseriniPrepend();
     102                WPRProtect_V683::removeHtaccessPrepend();
     103                WPRProtect_V683::removeUseriniPrepend();
    104104        }
    105105
    … …  
    107107                $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
    108108
    109                 WPRProtectUtils_V681::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
     109                WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
    110110        }
    111111
    … …  
    113113                $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
    114114
    115                 WPRProtectUtils_V681::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
     115                WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
    116116        }
    117117
    … …  
    120120                $mc_data_dir = $content_dir . "/mc_data";
    121121
    122                 WPRProtectUtils_V681::rrmdir($mc_data_dir);
     122                WPRProtectUtils_V683::rrmdir($mc_data_dir);
    123123        }
    124124}
  • wpremote/tags/6.83/protect/request.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('WPRProtectRequest_V681')) :
    6 class WPRProtectRequest_V681 {
     5if (!class_exists('WPRProtectRequest_V683')) :
     6class WPRProtectRequest_V683 {
    77        public $ip;
    88        public $host = '';
    … …  
    2020        public $files;
    2121        public $respcode;
    22         public $status = WPRProtectRequest_V681::STATUS_ALLOWED;
    23         public $category = WPRProtectRequest_V681::CATEGORY_NORMAL;
     22        public $status = WPRProtectRequest_V683::STATUS_ALLOWED;
     23        public $category = WPRProtectRequest_V683::CATEGORY_NORMAL;
    2424
    2525        public $wp_user;
    … …  
    6060
    6161        public function __construct($ip_header, $config) {
    62                 $this->ip = WPRProtectUtils_V681::getIP($ip_header);
     62                $this->ip = WPRProtectUtils_V683::getIP($ip_header);
    6363                $this->timestamp = time();
    6464                $this->get_params = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    … …  
    142142        public static function blacklistedCategories() {
    143143                return array(
    144                         WPRProtectRequest_V681::CATEGORY_BOT_BLOCKED,
    145                         WPRProtectRequest_V681::CATEGORY_COUNTRY_BLOCKED,
    146                         WPRProtectRequest_V681::CATEGORY_USER_BLACKLISTED,
    147                         WPRProtectRequest_V681::CATEGORY_GLOBAL_BOT_BLOCKED
     144                        WPRProtectRequest_V683::CATEGORY_BOT_BLOCKED,
     145                        WPRProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED,
     146                        WPRProtectRequest_V683::CATEGORY_USER_BLACKLISTED,
     147                        WPRProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED
    148148                );
    149149        }
    150150
    151151        public static function whitelistedCategories() {
    152                 return array(WPRProtectRequest_V681::CATEGORY_WHITELISTED);
     152                return array(WPRProtectRequest_V683::CATEGORY_WHITELISTED);
    153153        }
    154154
    … …  
    488488                }
    489489
    490                 $_json_params = WPRProtectUtils_V681::safeDecodeJSON(
     490                $_json_params = WPRProtectUtils_V683::safeDecodeJSON(
    491491                        $this->raw_body,
    492492                        true,
  • wpremote/tags/6.83/protect/wp_user.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectWPUser_V681')) :
    5 class WPRProtectWPUser_V681 {
     4if (!class_exists('WPRProtectWPUser_V683')) :
     5class WPRProtectWPUser_V683 {
    66        public $id;
    77        public $role;
    … …  
    2222        public static function defaultUser() {
    2323                $time = (int) floor(time() / 43200);
    24                 return (new WPRProtectWPUser_V681(0, 0, array(), $time));
     24                return (new WPRProtectWPUser_V683(0, 0, array(), $time));
    2525        }
    2626
    … …  
    4242                $capabilities = array_map('intval', explode(',', $capabilities));
    4343
    44                 return (new WPRProtectWPUser_V681((int) $id, (int) $role_level, $capabilities, (int) $time));
     44                return (new WPRProtectWPUser_V683((int) $id, (int) $role_level, $capabilities, (int) $time));
    4545        }
    4646
  • wpremote/tags/6.83/readme.txt

    r3775063 r3795707  
    77Tested up to: 7.1
    88Requires PHP: 7.0
    9 Stable tag: 6.81
     9Stable tag: 6.83
    1010License: GPLv2 or later
    1111License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
    … …  
    4747
    4848== 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
    4952= 6.81 =
    5053* New: Added a must-use plugin loader.
  • wpremote/tags/6.83/wp_actions.php

    r3775063 r3795707  
    8585                }
    8686
     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
    87106                private function process_deactivation_feedback(&$info) {
    88107                        //phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
  • wpremote/trunk/callback/base.php

    r3775063 r3795707  
    1515                "MISC_WING_VERSION" => '1.4',
    1616                "FS_WING_VERSION" => '1.4',
    17                 "INFO_WING_VERSION" => '2.8',
     17                "INFO_WING_VERSION" => '2.9',
    1818                "WATCH_WING_VERSION" => '1.7',
    1919                "FS_WRITE_WING_VERSION" => '1.2',
    … …  
    2222                "PROTECT_WING_VERSION" => '1.3',
    2323                "SECURITY_WING_VERSION" => '1.4',
     24                "LINKS_WING_VERSION" => '1.0',
    2425                "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0',
    2526                );
  • wpremote/trunk/callback/handler.php

    r3648236 r3795707  
    170170                                $module = new WPRSecurityCallback($this);
    171171                                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;
    172182                        default:
    173183                                require_once dirname( __FILE__ ) . '/wings/misc.php';
    … …  
    175185                                break;
    176186                        }
    177                         $resp = $module->process($this->request);
     187                        $resp = $module ? $module->process($this->request) : false;
    178188                        if ($resp === false) {
    179189                                $resp = array(
  • wpremote/trunk/callback/wings/info.php

    r3775063 r3795707  
    1111        public $bvapi;
    1212       
    13         const INFO_WING_VERSION = 2.8;
     13        const INFO_WING_VERSION = 2.9;
    1414
    1515        public function __construct($callback_handler) {
    … …  
    150150                        $sys_info['webgid'] = posix_getgid();
    151151                }
     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();
    152157                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;
    153192        }
    154193
  • wpremote/trunk/callback/wings/ipstore.php

    r3775063 r3795707  
    5151        public function getIPs($table, $auto_increment_offset, $type, $category) {
    5252                $query = "SELECT `start_ip_range` FROM $table WHERE id < $auto_increment_offset AND `type` in (" . implode(',', $type) . ") AND ";
    53                 $query .= ($category == WPRProtectIpstoreDB_V681::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
     53                $query .= ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
    5454                return $this->db->getCol($query);
    5555        }
    … …  
    6565
    6666                $info['fw_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    67                         WPRProtectIpstoreDB_V681::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     67                        WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    6868                $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    69                         WPRProtectIpstoreDB_V681::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     69                        WPRProtectIpstoreDB_V683::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    7070                $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    71                         WPRProtectIpstoreDB_V681::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     71                        WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    7272                $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    73                         WPRProtectIpstoreDB_V681::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     73                        WPRProtectIpstoreDB_V683::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    7474                $info['ip_store_offset'] = $this->getIPStoreOffset($table, $auto_increment_offset);
    7575                $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  
    4141
    4242        public function unBlockIP($ip, $attempts, $time) {
    43                 $transient_name = WPRProtectLP_V681::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
     43                $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
    4444                $this->settings->setTransient($transient_name, $attempts, $time);
    4545                return $this->settings->getTransient($transient_name);
  • wpremote/trunk/callback/wings/watch.php

    r3775063 r3795707  
    145145                                require_once dirname( __FILE__ ) . '/../../protect/lp.php';
    146146                                $lp_params = $params['lp'];
    147                                 if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V681::TABLE_NAME))) {
     147                                if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectLP_V683::TABLE_NAME))) {
    148148                                        $limit = intval($lp_params['limit']);
    149149                                        $filter = $lp_params['filter'];
    150150                                        $offset = isset($lp_params['offset']) ? intval($lp_params['offset']) : 0;
    151                                         $table = $db->getBVTable(WPRProtectLP_V681::TABLE_NAME);
     151                                        $table = $db->getBVTable(WPRProtectLP_V683::TABLE_NAME);
    152152                                        $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table);
    153153                                        if (empty($resp["lplogs"])) {
    154                                                 $db->deleteBVTableContent(WPRProtectLP_V681::TABLE_NAME, $lp_params['rmfilter']);
     154                                                $db->deleteBVTableContent(WPRProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']);
    155155                                                $resp["lplogs"] = $this->getData($table, $limit, $filter);
    156156                                        }
    … …  
    168168                                require_once dirname( __FILE__ ) . '/../../protect/fw.php';
    169169                                $fw_params = $params['fw'];
    170                                 if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V681::TABLE_NAME))) {
     170                                if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(WPRProtectFW_V683::TABLE_NAME))) {
    171171                                        $limit = intval($fw_params['limit']);
    172172                                        $filter = $fw_params['filter'];
    173173                                        $offset = isset($fw_params['offset']) ? intval($fw_params['offset']) : 0;
    174                                         $table = $db->getBVTable(WPRProtectFW_V681::TABLE_NAME);
     174                                        $table = $db->getBVTable(WPRProtectFW_V683::TABLE_NAME);
    175175                                        $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table);
    176176                                        if (empty($resp["fwlogs"])){
    177                                                 $db->deleteBVTableContent(WPRProtectFW_V681::TABLE_NAME, $fw_params['rmfilter']);
     177                                                $db->deleteBVTableContent(WPRProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']);
    178178                                                $resp["fwlogs"] = $this->getData($table, $limit, $filter);
    179179                                        }
  • wpremote/trunk/info.php

    r3775063 r3795707  
    1212                public $brand_option = 'bv_whitelabel_infos';
    1313                public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf';
    14                 public $version = '6.81';
     14                public $version = '6.83';
    1515                public $webpage = 'https://wpremote.com';
    1616                public $appurl = 'https://app.wpremote.com';
  • wpremote/trunk/plugin.php

    r3775063 r3795707  
    66Author: WP Remote
    77Author URI: https://wpremote.com
    8 Version: 6.81
     8Version: 6.83
    99Network: True
    1010License: GPLv2 or later
    … …  
    6464
    6565add_action('wp_footer', array($wp_action, 'footerHandler'), 100);
     66add_action('wp_enqueue_scripts', array($wp_action, 'enqueueBrokenLinkHighlight'));
    6667add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config'));
    6768add_action('wpr_clear_mu_plugin', array($wp_action, 'clear_mu_plugin'));
    … …  
    186187                        require_once dirname( __FILE__ ) . '/protect/protect.php';
    187188                        //For backward compatibility.
    188                         WPRProtect_V681::$settings = new WPRWPSettings();
    189                         WPRProtect_V681::$db = new WPRWPDb();
    190                         WPRProtect_V681::$info = new WPRInfo(WPRProtect_V681::$settings);
    191 
    192                         add_action('wpr_clear_pt_config', array('WPRProtect_V681', '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'));
    193194
    194195                        if ($bvinfo->isActivePlugin()) {
    195                                 WPRProtect_V681::init(WPRProtect_V681::MODE_WP);
     196                                WPRProtect_V683::init(WPRProtect_V683::MODE_WP);
    196197                        }
    197198                }
  • wpremote/trunk/protect/fw.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectFW_V681')) :
     4if (!class_exists('WPRProtectFW_V683')) :
    55require_once dirname( __FILE__ ) . '/fw/rule/errors.php';
    66require_once dirname( __FILE__ ) . '/fw/rule/engine.php';
    77require_once dirname( __FILE__ ) . '/fw/rule.php';
    88
    9 class WPRProtectFW_V681 {
     9class WPRProtectFW_V683 {
    1010        private $brand_name;
    1111        private $protect_mode;
    … …  
    2424        private $has_valid_bypass_cookie;
    2525
    26         private $mode = WPRProtectFW_V681::MODE_DISABLED;
    27         private $ip_cookie_mode = WPRProtectFW_V681::IP_COOKIE_MODE_DISABLED;
    28         private $admin_cookie_mode = WPRProtectFW_V681::ADMIN_COOKIE_MODE_DISABLED;
    29         private $bypass_level = WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CONTRIBUTOR;
    30         private $wpf_rule_init_mode = WPRProtectFW_V681::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;
    3131        private $custom_roles = array();
    3232        private $cookie_key = "";
    … …  
    3535        private $cookie_validity = 2592000;
    3636        private $can_set_cache_prevention_cookie = false;
    37         private $rules_mode = WPRProtectFW_V681::RULES_MODE_DISABLED;
     37        private $rules_mode = WPRProtectFW_V683::RULES_MODE_DISABLED;
    3838        private $is_geo_blocking = false;
    3939        private $is_wp_user_cookie_enabled = false;
    4040        private $log_config = array();
    41         private $request_profiling_mode = WPRProtectFW_V681::REQ_PROFILING_MODE_DISABLED;
    42         private $logging_mode = WPRProtectFW_V681::LOGGING_MODE_VISITOR;
     41        private $request_profiling_mode = WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED;
     42        private $logging_mode = WPRProtectFW_V683::LOGGING_MODE_VISITOR;
    4343        private $skip_log_config = array();
    4444        private $skip_log_cookies = array();
    … …  
    5555        private $break_rule_matching = false;
    5656        private $can_log_raw_body = false;
    57         private $log_slice_size = WPRProtectFW_V681::LOG_SLICE_SIZE;
     57        private $log_slice_size = WPRProtectFW_V683::LOG_SLICE_SIZE;
    5858
    5959        private static $instance = null;
    … …  
    101101
    102102        const DEFAULT_WP_USER_ROLE_LEVELS = array(
    103                 'administrator' => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_ADMIN,
    104                 'editor'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_EDITOR,
    105                 'author'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_AUTHOR,
    106                 'contributor'   => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CONTRIBUTOR,
    107                 'subscriber'    => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_SUBSCRIBER
     103                '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
    108108        );
    109109
    110110        const EXTRA_WP_USER_ROLE_LEVELS = array(
    111                 'custom'        => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CUSTOM,
    112                 'unknown'       => WPRProtectFW_V681::WP_USER_ROLE_LEVEL_UNKNOWN
     111                'custom'        => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM,
     112                'unknown'       => WPRProtectFW_V683::WP_USER_ROLE_LEVEL_UNKNOWN
    113113        );
    114114
    … …  
    249249                if ($this->isPrependMode()) {
    250250                        $log_file = MCDATAPATH . MCCONFKEY . '-mc.log';
    251                         $this->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_FS);
    252                         $this->logger = new WPRProtectLogger_V681($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);
    253253                } else {
    254                         $this->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_DB);
    255                         $this->logger = new WPRProtectLogger_V681(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);
    256256                }
    257257
    … …  
    266266                if (!isset(self::$instance)) {
    267267                        self::$instance = new self($protect_mode, $request, $config, $brand_name);
    268                 } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V681::MODE_WP) {
     268                } elseif (self::$instance->protect_mode != $protect_mode && $protect_mode == WPRProtect_V683::MODE_WP) {
    269269                        self::$instance->protect_mode = $protect_mode;
    270270                        self::$instance->brand_name = $brand_name;
    271                         self::$instance->ipstore = new WPRProtectIpstore_V681(WPRProtectIpstore_V681::STORAGE_TYPE_DB);
     271                        self::$instance->ipstore = new WPRProtectIpstore_V683(WPRProtectIpstore_V683::STORAGE_TYPE_DB);
    272272                        self::$instance->initRules();
    273273                }
    … …  
    277277
    278278        public static function uninstall() {
    279                 WPRProtect_V681::$db->dropBVTable(WPRProtectFW_V681::TABLE_NAME);
     279                WPRProtect_V683::$db->dropBVTable(WPRProtectFW_V683::TABLE_NAME);
    280280        }
    281281
    … …  
    297297
    298298        private function isPrependMode() {
    299                 return ($this->protect_mode === WPRProtect_V681::MODE_PREPEND);
     299                return ($this->protect_mode === WPRProtect_V683::MODE_PREPEND);
    300300        }
    301301
    302302        private function isWPMode() {
    303                 return ($this->protect_mode === WPRProtect_V681::MODE_WP);
     303                return ($this->protect_mode === WPRProtect_V683::MODE_WP);
    304304        }
    305305
    306306        private function isModeDisabled() {
    307                 return ($this->mode === WPRProtectFW_V681::MODE_DISABLED);
     307                return ($this->mode === WPRProtectFW_V683::MODE_DISABLED);
    308308        }
    309309
    310310        private function isModeProtect() {
    311                 return ($this->mode === WPRProtectFW_V681::MODE_PROTECT);
     311                return ($this->mode === WPRProtectFW_V683::MODE_PROTECT);
    312312        }
    313313
    314314        private function isAdminCookieEnabled() {
    315                 return ($this->admin_cookie_mode === WPRProtectFW_V681::ADMIN_COOKIE_MODE_ENABLED);
     315                return ($this->admin_cookie_mode === WPRProtectFW_V683::ADMIN_COOKIE_MODE_ENABLED);
    316316        }
    317317
    318318        private function isIPCookieEnabled() {
    319                 return ($this->ip_cookie_mode === WPRProtectFW_V681::IP_COOKIE_MODE_ENABLED);
     319                return ($this->ip_cookie_mode === WPRProtectFW_V683::IP_COOKIE_MODE_ENABLED);
    320320        }
    321321
    322322        private function isRequestProfilingDisabled() {
    323                 return ($this->request_profiling_mode === WPRProtectFW_V681::REQ_PROFILING_MODE_DISABLED);
     323                return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DISABLED);
    324324        }
    325325
    326326        private function isRequestProfilingModeDebug() {
    327                 return ($this->request_profiling_mode === WPRProtectFW_V681::REQ_PROFILING_MODE_DEBUG);
     327                return ($this->request_profiling_mode === WPRProtectFW_V683::REQ_PROFILING_MODE_DEBUG);
    328328        }
    329329
    330330        private function isRequestHasValidBypassCookie() {
    331331                if (!isset($this->has_valid_bypass_cookie)) {
    332                         $cookie = (string) $this->request->getCookies(WPRProtectFW_V681::BYPASS_COOKIE_NAME);
     332                        $cookie = (string) $this->request->getCookies(WPRProtectFW_V683::BYPASS_COOKIE_NAME);
    333333                        $new_cookie = $this->generateBypassCookie();
    334334                        $is_valid = ($this->isAdminCookieEnabled() && $new_cookie && ($cookie === $new_cookie));
    … …  
    340340
    341341        private function isRulesModeProtect() {
    342                 return ($this->rules_mode === WPRProtectFW_V681::RULES_MODE_PROTECT);
     342                return ($this->rules_mode === WPRProtectFW_V683::RULES_MODE_PROTECT);
    343343        }
    344344
    345345        public function isLoggingModeComplete() {
    346                 return ($this->logging_mode === WPRProtectFW_V681::LOGGING_MODE_COMPLETE);
     346                return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_COMPLETE);
    347347        }
    348348
    349349        public function isLoggingModeVisitor() {
    350                 return ($this->logging_mode === WPRProtectFW_V681::LOGGING_MODE_VISITOR);
     350                return ($this->logging_mode === WPRProtectFW_V683::LOGGING_MODE_VISITOR);
    351351        }
    352352
    … …  
    356356
    357357        private function isWPFRuleInitModePrepend() {
    358                 return ($this->wpf_rule_init_mode === WPRProtectFW_V681::WPF_RULE_INIT_MODE_PREPEND);
     358                return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_PREPEND);
    359359        }
    360360
    361361        private function isWPFRuleInitModeWP() {
    362                 return ($this->wpf_rule_init_mode === WPRProtectFW_V681::WPF_RULE_INIT_MODE_WP);
     362                return ($this->wpf_rule_init_mode === WPRProtectFW_V683::WPF_RULE_INIT_MODE_WP);
    363363        }
    364364
    … …  
    389389
    390390                        if (!$current_wp_user->isIdentical($this->request->wp_user)) {
    391                                 $serialized_wp_user = WPRProtectWPUser_V681::_serialize($current_wp_user);
     391                                $serialized_wp_user = WPRProtectWPUser_V683::_serialize($current_wp_user);
    392392                                $cookie_val = $serialized_wp_user . '_' .
    393                                         WPRProtectUtils_V681::signMessage($serialized_wp_user, $this->cookie_key);
     393                                        WPRProtectUtils_V683::signMessage($serialized_wp_user, $this->cookie_key);
    394394                                $cookie_val = base64_encode($cookie_val);
    395395
    396                                 $this->setCookie(WPRProtectWPUser_V681::COOKIE_NAME, $cookie_val);
     396                                $this->setCookie(WPRProtectWPUser_V683::COOKIE_NAME, $cookie_val);
    397397                        }
    398398                } elseif ($this->request->wp_user->isLoggedIn()) {
    399                         $this->request->wp_user = WPRProtectWPUser_V681::defaultUser();
    400                         $this->unsetCookie(WPRProtectWPUser_V681::COOKIE_NAME);
     399                        $this->request->wp_user = WPRProtectWPUser_V683::defaultUser();
     400                        $this->unsetCookie(WPRProtectWPUser_V683::COOKIE_NAME);
    401401                }
    402402        }
    … …  
    415415                }
    416416
    417                 return (new WPRProtectWPUser_V681($id, $role_level, $capabilities, $time));
     417                return (new WPRProtectWPUser_V683($id, $role_level, $capabilities, $time));
    418418        }
    419419
    … …  
    434434
    435435        private function loadWPUser() {
    436                 $this->request->wp_user = WPRProtectWPUser_V681::defaultUser();
    437 
    438                 $cookie_val = $this->request->getCookies(WPRProtectWPUser_V681::COOKIE_NAME);
     436                $this->request->wp_user = WPRProtectWPUser_V683::defaultUser();
     437
     438                $cookie_val = $this->request->getCookies(WPRProtectWPUser_V683::COOKIE_NAME);
    439439                if (!is_string($cookie_val)) {
    440440                        return;
    … …  
    452452                list($serialized_user, $signature) = $cookie_val_array;
    453453
    454                 if (WPRProtectUtils_V681::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {
    455                         $wp_user = WPRProtectWPUser_V681::_unserialize($serialized_user);
     454                if (WPRProtectUtils_V683::verifyMessage($serialized_user, $signature, $this->cookie_key) === true) {
     455                        $wp_user = WPRProtectWPUser_V683::_unserialize($serialized_user);
    456456
    457457                        if (!isset($wp_user) || $wp_user->time !== (int) floor(time() / $this->cookie_validity)) {
    … …  
    468468                        }
    469469
    470                         $role_by_level = array_flip(array_merge(WPRProtectFW_V681::DEFAULT_WP_USER_ROLE_LEVELS,
    471                                         WPRProtectFW_V681::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));
    472472                        $this->request->wp_user->role = $role_by_level[$this->request->wp_user->role_level];
    473473                }
    … …  
    493493                if ($this->isPrependMode()) {
    494494                        $rules_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_rules.json';
    495                         $rule_arrays = WPRProtectUtils_V681::parseFile($rules_file);
     495                        $rule_arrays = WPRProtectUtils_V683::parseFile($rules_file);
    496496                } else {
    497                         $rule_arrays = WPRProtect_V681::$settings->getOption('bvruleset');
     497                        $rule_arrays = WPRProtect_V683::$settings->getOption('bvruleset');
    498498                        if(!is_array($rule_arrays)) {
    499499                                $rule_arrays = array();
    … …  
    507507
    508508                foreach($rule_arrays as $rule_array) {
    509                         $rule = WPRProtectFWRule_V681::init($rule_array);
     509                        $rule = WPRProtectFWRule_V683::init($rule_array);
    510510
    511511                        if ($rule) {
    … …  
    532532        private function initWPFRule($rule) {
    533533                switch ($rule->execute_on) {
    534                 case WPRProtectFWRule_V681::EXE_ON_PRE_UPDATE_OPTION:
     534                case WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION:
    535535                        $this->addWPHook($rule, 'pre_update_option', 'handleRequestOnPreUpdateOption', 3);
    536536                        break;
    537                 case WPRProtectFWRule_V681::EXE_ON_PRE_DELETE_POST:
     537                case WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST:
    538538                        $this->addWPHook($rule, 'pre_delete_post', 'handleRequestOnPreDeletePost', 3);
    539539                        break;
    540                 case WPRProtectFWRule_V681::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:
     540                case WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT:
    541541                        $this->addWPHook($rule, 'wp_insert_post_empty_content',
    542542                                'handleRequestOnWPInsertPostEmptyContent', 2);
    543543                        break;
    544                 case WPRProtectFWRule_V681::EXE_ON_INSERT_USER_META:
     544                case WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META:
    545545                        $this->addWPHook($rule, 'insert_user_meta', 'handleRequestOnInsertUserMeta', 4);
    546546                        break;
    547                 case WPRProtectFWRule_V681::EXE_ON_DELETE_OPTION:
     547                case WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION:
    548548                        $this->addWPHook($rule, 'delete_option', 'handleRequestOnDeleteOption', 1, 'action');
    549549                        break;
    550                 case WPRProtectFWRule_V681::EXE_ON_DELETE_USER:
     550                case WPRProtectFWRule_V683::EXE_ON_DELETE_USER:
    551551                        $this->addWPHook($rule, 'delete_user', 'handleRequestOnDeleteUser', 3, 'action');
    552552                        break;
    553                 case WPRProtectFWRule_V681::EXE_ON_PASSWORD_RESET:
     553                case WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET:
    554554                        $this->addWPHook($rule, 'password_reset', 'handleRequestOnPasswordReset', 2, 'action');
    555555                        break;
    556                 case WPRProtectFWRule_V681::EXE_ON_SEND_AUTH_COOKIES:
     556                case WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES:
    557557                        $this->addWPHook($rule, 'send_auth_cookies', 'handleRequestOnSendAuthCookies', 6);
    558558                        break;
    559                 case WPRProtectFWRule_V681::EXE_ON_SET_AUTH_COOKIE:
     559                case WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE:
    560560                        $this->addWPHook($rule, 'set_auth_cookie', 'handleRequestOnSetAuthCookie', 6, 'action');
    561561                        break;
    562                 case WPRProtectFWRule_V681::EXE_ON_INIT:
     562                case WPRProtectFWRule_V683::EXE_ON_INIT:
    563563                        $this->addWPHook($rule, 'init', 'handleRequestOnInit', 0, 'action');
    564564                        break;
    565                 case WPRProtectFWRule_V681::EXE_ON_USER_REGISTER:
     565                case WPRProtectFWRule_V683::EXE_ON_USER_REGISTER:
    566566                        $this->addWPHook($rule, 'user_register', 'handleRequestOnUserRegister', 2, 'action');
    567567                        break;
    568                 case WPRProtectFWRule_V681::EXE_ON_ADD_USER_META:
     568                case WPRProtectFWRule_V683::EXE_ON_ADD_USER_META:
    569569                        $this->addWPHook($rule, 'add_user_meta', 'handleRequestOnAddUserMeta', 3, 'action');
    570570                        break;
    571                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_METADATA:
     571                case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA:
    572572                        $this->addWPHook($rule, 'update_user_metadata', 'handleRequestOnUpdateUserMetadata', 5);
    573573                        break;
    574                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_META:
     574                case WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META:
    575575                        $this->addWPHook($rule, 'update_user_meta', 'handleRequestOnUpdateUserMeta', 4, 'action');
    576576                        break;
    577                 case WPRProtectFWRule_V681::EXE_ON_ADD_OPTION:
     577                case WPRProtectFWRule_V683::EXE_ON_ADD_OPTION:
    578578                        $this->addWPHook($rule, 'add_option', 'handleRequestOnAddOption', 2, 'action');
    579579                        break;
    580                 case WPRProtectFWRule_V681::EXE_ON_WP_PRE_INSERT_USER_DATA:
     580                case WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA:
    581581                        $this->addWPHook($rule, 'wp_pre_insert_user_data', 'handleRequestOnWPPreInsertUserData', 4);
    582582                        break;
    583                 case WPRProtectFWRule_V681::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:
     583                case WPRProtectFWRule_V683::EXE_ON_REST_REQUEST_BEFORE_CALLBACKS:
    584584                        $this->addWPHook($rule, 'rest_request_before_callbacks',
    585585                                'handleRequestOnRestRequestBeforeCallbacks', 3);
    586586                        break;
    587                 case WPRProtectFWRule_V681::EXE_ON_ADMIN_INIT:
     587                case WPRProtectFWRule_V683::EXE_ON_ADMIN_INIT:
    588588                        $this->addWPHook($rule, 'admin_init', 'handleRequestOnAdminInit', 0, 'action');
    589589                        break;
    590                 case WPRProtectFWRule_V681::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:
     590                case WPRProtectFWRule_V683::EXE_ON_WP_HANDLE_UPLOAD_PREFILTER:
    591591                        $this->addWPHook($rule, 'wp_handle_upload_prefilter',
    592592                                'handleRequestOnWPHandleUploadPrefilter', 1);
    593593                        break;
    594                 case WPRProtectFWRule_V681::EXE_ON_TEMPLATE_REDIRECT:
     594                case WPRProtectFWRule_V683::EXE_ON_TEMPLATE_REDIRECT:
    595595                        $this->addWPHook($rule, 'template_redirect', 'handleRequestOnTemplateRedirect', 0, 'action');
    596596                        break;
    597                 case WPRProtectFWRule_V681::EXE_ON_WP_LOADED:
     597                case WPRProtectFWRule_V683::EXE_ON_WP_LOADED:
    598598                        $this->addWPHook($rule, 'wp_loaded', 'handleRequestOnWPLoaded', 0, 'action');
    599599                        break;
    600                 case WPRProtectFWRule_V681::EXE_ON_ADD_POST_METADATA:
     600                case WPRProtectFWRule_V683::EXE_ON_ADD_POST_METADATA:
    601601                        $this->addWPHook($rule, 'add_post_metadata', 'handleRequestOnAddPostMetadata', 5);
    602602                        break;
    603                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_POST_METADATA:
     603                case WPRProtectFWRule_V683::EXE_ON_UPDATE_POST_METADATA:
    604604                        $this->addWPHook($rule, 'update_post_metadata', 'handleRequestOnUpdatePostMetadata', 5);
    605605                        break;
    606                 case WPRProtectFWRule_V681::EXE_ON_DELETE_POST_METADATA:
     606                case WPRProtectFWRule_V683::EXE_ON_DELETE_POST_METADATA:
    607607                        $this->addWPHook($rule, 'delete_post_metadata', 'handleRequestOnDeletePostMetadata', 5);
    608608                        break;
    609                 case WPRProtectFWRule_V681::EXE_ON_ADD_TERM_METADATA:
     609                case WPRProtectFWRule_V683::EXE_ON_ADD_TERM_METADATA:
    610610                        $this->addWPHook($rule, 'add_term_metadata', 'handleRequestOnAddTermMetadata', 5);
    611611                        break;
    612                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_TERM_METADATA:
     612                case WPRProtectFWRule_V683::EXE_ON_UPDATE_TERM_METADATA:
    613613                        $this->addWPHook($rule, 'update_term_metadata', 'handleRequestOnUpdateTermMetadata', 5);
    614614                        break;
    615                 case WPRProtectFWRule_V681::EXE_ON_DELETE_TERM_METADATA:
     615                case WPRProtectFWRule_V683::EXE_ON_DELETE_TERM_METADATA:
    616616                        $this->addWPHook($rule, 'delete_term_metadata', 'handleRequestOnDeleteTermMetadata', 5);
    617617                        break;
    618                 case WPRProtectFWRule_V681::EXE_ON_ADD_COMMENT_METADATA:
     618                case WPRProtectFWRule_V683::EXE_ON_ADD_COMMENT_METADATA:
    619619                        $this->addWPHook($rule, 'add_comment_metadata', 'handleRequestOnAddCommentMetadata', 5);
    620620                        break;
    621                 case WPRProtectFWRule_V681::EXE_ON_UPDATE_COMMENT_METADATA:
     621                case WPRProtectFWRule_V683::EXE_ON_UPDATE_COMMENT_METADATA:
    622622                        $this->addWPHook($rule, 'update_comment_metadata', 'handleRequestOnUpdateCommentMetadata', 5);
    623623                        break;
    624                 case WPRProtectFWRule_V681::EXE_ON_DELETE_COMMENT_METADATA:
     624                case WPRProtectFWRule_V683::EXE_ON_DELETE_COMMENT_METADATA:
    625625                        $this->addWPHook($rule, 'delete_comment_metadata', 'handleRequestOnDeleteCommentMetadata', 5);
    626626                        break;
    627                 case WPRProtectFWRule_V681::EXE_ON_ADD_USER_METADATA:
     627                case WPRProtectFWRule_V683::EXE_ON_ADD_USER_METADATA:
    628628                        $this->addWPHook($rule, 'add_user_metadata', 'handleRequestOnAddUserMetadata', 5);
    629629                        break;
    630                 case WPRProtectFWRule_V681::EXE_ON_DELETE_USER_METADATA:
     630                case WPRProtectFWRule_V683::EXE_ON_DELETE_USER_METADATA:
    631631                        $this->addWPHook($rule, 'delete_user_metadata', 'handleRequestOnDeleteUserMetadata', 5);
    632632                        break;
    … …  
    646646                                }
    647647                        } else {
    648                                 WPRProtectUtils_V681::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);
     648                                WPRProtectUtils_V683::preInitWPHook($hook_name, $callback, -9999999, $accepted_args);
    649649                        }
    650650                }
    … …  
    12041204        private function setIPCookie() {
    12051205                if (!$this->is_ip_cookie_set && $this->isIPCookieEnabled() &&
    1206                                 !$this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME)) {
     1206                                !$this->request->getCookies(WPRProtectFW_V683::IP_COOKIE_NAME)) {
    12071207
    12081208                        $time = floor(time() / 86400);
    12091209                        $cookie = hash('sha256', $this->request->ip . $time . $this->cookie_key);
    12101210                        if ($cookie) {
    1211                                 $this->setCookie(WPRProtectFW_V681::IP_COOKIE_NAME, $cookie, time() + 86400);
     1211                                $this->setCookie(WPRProtectFW_V683::IP_COOKIE_NAME, $cookie, time() + 86400);
    12121212                        }
    12131213                }
    … …  
    12171217                if (function_exists('current_user_can')) {
    12181218                        if (function_exists('is_super_admin') &&  is_super_admin()) {
    1219                                 return WPRProtectFW_V681::WP_USER_ROLE_LEVEL_ADMIN;
     1219                                return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_ADMIN;
    12201220                        }
    12211221
    12221222                        foreach ($this->custom_roles as $role) {
    12231223                                if (current_user_can($role)) {
    1224                                         return WPRProtectFW_V681::WP_USER_ROLE_LEVEL_CUSTOM;
     1224                                        return WPRProtectFW_V683::WP_USER_ROLE_LEVEL_CUSTOM;
    12251225                                }
    12261226                        }
    12271227
    1228                         foreach (WPRProtectFW_V681::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {
     1228                        foreach (WPRProtectFW_V683::DEFAULT_WP_USER_ROLE_LEVELS as $role => $level) {
    12291229                                if (current_user_can($role)) {
    12301230                                        return $level;
    … …  
    13341334                $cookies = array();
    13351335
    1336                 if ($this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME) !== NULL) {
    1337                         $cookie_val = (string) $this->request->getCookies(WPRProtectFW_V681::IP_COOKIE_NAME);
    1338                         $cookies[WPRProtectFW_V681::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;
    13391339                }
    13401340
    … …  
    15001500
    15011501        private function getUserBy($attribute, $value) {
    1502                 if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V681::havePluginsLoaded()) {
     1502                if (isset($value) && function_exists('get_user_by') && WPRProtectUtils_V683::havePluginsLoaded()) {
    15031503                        return get_user_by($attribute, $value);
    15041504                }
    … …  
    16041604                                        }
    16051605
    1606                                         if ($this->matchCount(WPRProtectFWRule_V681::SQLIREGEX, $value) > 2) {
     1606                                        if ($this->matchCount(WPRProtectFWRule_V683::SQLIREGEX, $value) > 2) {
    16071607                                                $profiled_data[$key]["sql"] = true;
    16081608                                        }
    … …  
    16931693        private function canRequestBypassFirewall() {
    16941694                if ($this->isRequestIPWhitelisted() || $this->isRequestHasValidBypassCookie()) {
    1695                         $this->request->category = WPRProtectRequest_V681::CATEGORY_WHITELISTED;
    1696                         $this->request->status = WPRProtectRequest_V681::STATUS_BYPASSED;
     1695                        $this->request->category = WPRProtectRequest_V683::CATEGORY_WHITELISTED;
     1696                        $this->request->status = WPRProtectRequest_V683::STATUS_BYPASSED;
    16971697
    16981698                        return true;
    1699                 } elseif (WPRProtectUtils_V681::isPrivateIP($this->request->ip)) {
    1700                         $this->request->category = WPRProtectRequest_V681::CATEGORY_PRIVATEIP;
    1701                         $this->request->status = WPRProtectRequest_V681::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;
    17021702
    17031703                        return true;
    … …  
    17231723
    17241724        private function handleRequestOnRuleMatch($rules, $engine_vars = array(), $log_data = array()) {
    1725                 $normalized_engine_vars = WPRProtectFWRuleEngine_V681::normalizeVariables($engine_vars);
     1725                $normalized_engine_vars = WPRProtectFWRuleEngine_V683::normalizeVariables($engine_vars);
    17261726
    17271727                foreach ($rules as $rule) {
    … …  
    17331733                        if (array_key_exists('variables', $rule->opts)) {
    17341734                                $_engine_vars = array_merge($_engine_vars,
    1735                                         WPRProtectFWRuleEngine_V681::normalizeVariables($rule->opts['variables']));
    1736                         }
    1737 
    1738                         $rule_engine = new WPRProtectFWRuleEngine_V681($this->request, $_engine_vars);
     1735                                        WPRProtectFWRuleEngine_V683::normalizeVariables($rule->opts['variables']));
     1736                        }
     1737
     1738                        $rule_engine = new WPRProtectFWRuleEngine_V683($this->request, $_engine_vars);
    17391739
    17401740                        if ($rule_engine->evaluate($rule) && !$rule_engine->hasError()) {
    … …  
    17491749                                        case "ALLOW":
    17501750                                                $this->break_rule_matching = true;
    1751                                                 $this->request->category = WPRProtectRequest_V681::CATEGORY_RULE_ALLOWED;
     1751                                                $this->request->category = WPRProtectRequest_V683::CATEGORY_RULE_ALLOWED;
    17521752                                                return;
    17531753                                        case "BLOCK":
    17541754                                                if ($this->isModeProtect()) {
    1755                                                         $this->terminateRequest(WPRProtectRequest_V681::CATEGORY_RULE_BLOCKED);
     1755                                                        $this->terminateRequest(WPRProtectRequest_V683::CATEGORY_RULE_BLOCKED);
    17561756                                                }
    17571757                                                return;
    … …  
    17691769        private function terminateRequest($category) {
    17701770                $this->request->category = $category;
    1771                 $this->request->status = WPRProtectRequest_V681::STATUS_BLOCKED;
     1771                $this->request->status = WPRProtectRequest_V683::STATUS_BLOCKED;
    17721772                $this->request->setRespCode(403);
    17731773
    17741774                if ($this->can_set_cache_prevention_cookie &&
    1775                         !$this->request->getCookies(WPRProtectFW_V681::PREVENT_CACHE_COOKIE_NAME)) {
     1775                        !$this->request->getCookies(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME)) {
    17761776                        $value = "Prevent Caching Response.";
    1777                         $this->setCookie(WPRProtectFW_V681::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);
     1777                        $this->setCookie(WPRProtectFW_V683::PREVENT_CACHE_COOKIE_NAME, $value, time() + 43200);
    17781778                }
    17791779
    … …  
    18031803                                $cookie = $this->generateBypassCookie();
    18041804                                if ($cookie) {
    1805                                         $this->setCookie(WPRProtectFW_V681::BYPASS_COOKIE_NAME, $cookie);
     1805                                        $this->setCookie(WPRProtectFW_V683::BYPASS_COOKIE_NAME, $cookie);
    18061806                                }
    18071807                        }
  • wpremote/trunk/protect/fw/rule.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectFWRule_V681')) :
    5 class WPRProtectFWRule_V681 {
     4if (!class_exists('WPRProtectFWRule_V683')) :
     5class WPRProtectFWRule_V683 {
    66        public $id;
    77        public $logic;
    … …  
    105105
    106106                if (!array_key_exists('min_rule_engine_ver', $attributes) || !is_float($attributes['min_rule_engine_ver']) ||
    107                                 $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V681::VERSION) {
     107                                $attributes['min_rule_engine_ver'] > WPRProtectFWRuleEngine_V683::VERSION) {
    108108
    109109                        return false;
    … …  
    111111
    112112                if (array_key_exists('max_rule_engine_ver', $attributes) && (!is_float($attributes['max_rule_engine_ver']) ||
    113                                 $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V681::VERSION)) {
     113                                $attributes['max_rule_engine_ver'] < WPRProtectFWRuleEngine_V683::VERSION)) {
    114114
    115115                        return false;
    … …  
    130130                if (!array_key_exists('execute_on', $attributes)) {
    131131                        if (array_key_exists('level', $attributes) && $attributes['level'] === 1) {
    132                                 $attributes['execute_on'] = WPRProtectFWRule_V681::EXE_ON_BOOT;
     132                                $attributes['execute_on'] = WPRProtectFWRule_V683::EXE_ON_BOOT;
    133133                        } else {
    134134                                return false;
    … …  
    136136                }
    137137
    138                 return new WPRProtectFWRule_V681($attributes);
     138                return new WPRProtectFWRule_V683($attributes);
    139139        }
    140140
    141141        public function isExeOnBoot() {
    142                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_BOOT);
     142                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_BOOT);
    143143        }
    144144
    145145        public function isExeOnPreUpdateOption() {
    146                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PRE_UPDATE_OPTION);
     146                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION);
    147147        }
    148148
    149149        public function isExeOnPreDeletePost() {
    150                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PRE_DELETE_POST);
     150                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PRE_DELETE_POST);
    151151        }
    152152
    153153        public function isExeOnWPInsertPostEmptyContent() {
    154                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
     154                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
    155155        }
    156156
    157157        public function isExeOnInsertUserMeta() {
    158                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_INSERT_USER_META);
     158                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INSERT_USER_META);
    159159        }
    160160
    161161        public function isExeOnDeleteOption() {
    162                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_DELETE_OPTION);
     162                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_OPTION);
    163163        }
    164164
    165165        public function isExeOnDeleteUser() {
    166                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_DELETE_USER);
     166                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_DELETE_USER);
    167167        }
    168168
    169169        public function isExeOnPasswordReset() {
    170                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_PASSWORD_RESET);
     170                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_PASSWORD_RESET);
    171171        }
    172172
    173173        public function isExeOnSendAuthCookies() {
    174                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_SEND_AUTH_COOKIES);
     174                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES);
    175175        }
    176176
    177177        public function isExeOnSetAuthCookie() {
    178                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_SET_AUTH_COOKIE);
     178                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE);
    179179        }
    180180
    181181        public function isExeOnInit() {
    182                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_INIT);
     182                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_INIT);
    183183        }
    184184
    185185        public function isExeOnUserRegister() {
    186                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_USER_REGISTER);
     186                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_USER_REGISTER);
    187187        }
    188188
    189189        public function isExeOnAddUserMeta() {
    190                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_ADD_USER_META);
     190                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_USER_META);
    191191        }
    192192
    193193        public function isExeOnUpdateUserMetadata() {
    194                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_METADATA);
     194                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA);
    195195        }
    196196
    197197        public function isExeOnUpdateUserMeta() {
    198                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_UPDATE_USER_META);
     198                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_UPDATE_USER_META);
    199199        }
    200200
    201201        public function isExeOnAddOption() {
    202                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_ADD_OPTION);
     202                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_ADD_OPTION);
    203203        }
    204204
    205205        public function isExeOnWpPreInsertUserData() {
    206                 return ($this->execute_on === WPRProtectFWRule_V681::EXE_ON_WP_PRE_INSERT_USER_DATA);
     206                return ($this->execute_on === WPRProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA);
    207207        }
    208208}
  • wpremote/trunk/protect/fw/rule/engine.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('WPRProtectFWRuleEngine_V681')) :
     5if (!class_exists('WPRProtectFWRuleEngine_V683')) :
    66require_once dirname( __FILE__ ) . '/functions.php';
    77
    8 class WPRProtectFWRuleEngine_V681 {
    9         use WPRProtectFWRuleStringFunc_V681;
    10         use WPRProtectFWRuleArrayFunc_V681;
    11         use WPRProtectFWRuleMiscFunc_V681;
    12         use WPRProtectFWRuleRequestFunc_V681;
    13         use WPRProtectFWRuleWPFunc_V681;
     8class WPRProtectFWRuleEngine_V683 {
     9        use WPRProtectFWRuleStringFunc_V683;
     10        use WPRProtectFWRuleArrayFunc_V683;
     11        use WPRProtectFWRuleMiscFunc_V683;
     12        use WPRProtectFWRuleRequestFunc_V683;
     13        use WPRProtectFWRuleWPFunc_V683;
    1414
    1515        private $request;
    … …  
    2626        const WILDCARD_KEY = '*';
    2727        const FUNC_NAME_PREFIX = '_rf_';
    28         const CONST_NAME_PREFIX = 'WPRProtectFWRule_V681::';
     28        const CONST_NAME_PREFIX = 'WPRProtectFWRule_V683::';
    2929        const ALLOWED_EXT_CONSTANTS = [
    3030                'DOING_CRON'
    … …  
    5353                try {
    5454                        return $this->executeStmt($rule->logic);
    55                 } catch (WPRProtectRuleError_V681 $e) {
     55                } catch (WPRProtectRuleError_V683 $e) {
    5656                        $this->error = $e;
    5757                }
    … …  
    124124        private function getValue($stmt) {
    125125                if (!is_array($stmt) || empty($stmt["type"])) {
    126                         throw new WPRProtectRuleError_V681(
     126                        throw new WPRProtectRuleError_V683(
    127127                                $this->addExState("InvalidStatementError: Malformed value statement"));
    128128                }
    … …  
    133133                case "NUMBER":
    134134                        if (!isset($stmt["value"]) || !is_int($stmt["value"])) {
    135                                 throw new WPRProtectRuleError_V681(
     135                                throw new WPRProtectRuleError_V683(
    136136                                        $this->addExState("TypeError: Value is not a number")
    137137                                );
    … …  
    141141                case "STRING":
    142142                        if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
    143                                 throw new WPRProtectRuleError_V681(
     143                                throw new WPRProtectRuleError_V683(
    144144                                        $this->addExState("TypeError: Value is not a string")
    145145                                );
    … …  
    149149                case "BOOL":
    150150                        if (!isset($stmt["value"]) || !is_bool($stmt["value"])) {
    151                                 throw new WPRProtectRuleError_V681(
     151                                throw new WPRProtectRuleError_V683(
    152152                                        $this->addExState("TypeError: Value is not a boolean")
    153153                                );
    … …  
    157157                case "CONST":
    158158                        if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
    159                                 throw new WPRProtectRuleError_V681(
     159                                throw new WPRProtectRuleError_V683(
    160160                                        $this->addExState("TypeError: Invalid constant name")
    161161                                );
    … …  
    169169
    170170                        if (!defined($name)) {
    171                                 throw new WPRProtectRuleError_V681(
     171                                throw new WPRProtectRuleError_V683(
    172172                                        $this->addExState("TypeError: Undefined constant" . $stmt["value"])
    173173                                );
    … …  
    177177                case "ARRAY":
    178178                        if (!isset($stmt["value"]) || !is_array($stmt["value"])) {
    179                                 throw new WPRProtectRuleError_V681(
     179                                throw new WPRProtectRuleError_V683(
    180180                                        $this->addExState("TypeError: Value is not a array")
    181181                                );
    … …  
    208208        private function executeStmt($stmt) {
    209209                if (!is_array($stmt) || empty($stmt["type"])) {
    210                         throw new WPRProtectRuleError_V681(
     210                        throw new WPRProtectRuleError_V683(
    211211                                $this->addExState("InvalidStatementError: Malformed logic statement")
    212212                        );
    … …  
    220220                case "AND":
    221221                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    222                                 throw new WPRProtectRuleError_V681(
     222                                throw new WPRProtectRuleError_V683(
    223223                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    224224                                );
    … …  
    229229                case "OR":
    230230                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    231                                 throw new WPRProtectRuleError_V681(
     231                                throw new WPRProtectRuleError_V683(
    232232                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    233233                                );
    … …  
    238238                case "NOT":
    239239                        if (empty($stmt["value"])) {
    240                                 throw new WPRProtectRuleError_V681(
     240                                throw new WPRProtectRuleError_V683(
    241241                                        $this->addExState("InvalidOperandError: Malformed operand")
    242242                                );
    … …  
    247247                case "FUNCTION":
    248248                        if (empty($stmt["name"]) || !is_string($stmt["name"])) {
    249                                 throw new WPRProtectRuleError_V681(
     249                                throw new WPRProtectRuleError_V683(
    250250                                        $this->addExState("InvalidFunctionName: Malformed name")
    251251                                );
    … …  
    256256
    257257                        if (!is_callable($handler)) {
    258                                 throw new WPRProtectRuleError_V681(
     258                                throw new WPRProtectRuleError_V683(
    259259                                        $this->addExState("UndefinedFunctionCall: " . $stmt["name"])
    260260                                );
    … …  
    262262
    263263                        if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) {
    264                                 throw new WPRProtectRuleError_V681(
     264                                throw new WPRProtectRuleError_V683(
    265265                                        $this->addExState("InvalidArguments: Malformed args")
    266266                                );
    … …  
    275275                        break;
    276276                default:
    277                         throw new WPRProtectRuleError_V681(
     277                        throw new WPRProtectRuleError_V683(
    278278                                $this->addExState("UnknownOperation: -")
    279279                        );
    … …  
    286286        private function processRuleFunctionParams($func_name, $args_cnt, $args, $required_params = 0, $param_types = array()) {
    287287                if (($args_cnt < $required_params)) {
    288                         throw new WPRProtectRuleError_V681(
     288                        throw new WPRProtectRuleError_V683(
    289289                                $this->addExState("ArgumentCountError: Too few arguments for " . $func_name)
    290290                        );
    … …  
    293293                foreach ($param_types as $pos => $type) {
    294294                        if (!is_int($pos)) {
    295                                 throw new WPRProtectRuleError_V681(
     295                                throw new WPRProtectRuleError_V683(
    296296                                        $this->addExState("InvalidParamType: " . $pos)
    297297                                );
    … …  
    301301                        case "string":
    302302                                if (!isset($args[$pos]) || !is_string($args[$pos])) {
    303                                         throw new WPRProtectRuleError_V681(
     303                                        throw new WPRProtectRuleError_V683(
    304304                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a string.")
    305305                                        );
    … …  
    308308                        case 'integer':
    309309                                if (!isset($args[$pos]) || !is_int($args[$pos])) {
    310                                         throw new WPRProtectRuleError_V681(
     310                                        throw new WPRProtectRuleError_V683(
    311311                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a integer.")
    312312                                        );
    … …  
    315315                        case 'double':
    316316                                if (!isset($args[$pos]) || !is_double($args[$pos])) {
    317                                         throw new WPRProtectRuleError_V681(
     317                                        throw new WPRProtectRuleError_V683(
    318318                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a double.")
    319319                                        );
    … …  
    322322                        case 'boolean':
    323323                                if (!isset($args[$pos]) || !is_bool($args[$pos])) {
    324                                         throw new WPRProtectRuleError_V681(
     324                                        throw new WPRProtectRuleError_V683(
    325325                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a boolean.")
    326326                                        );
    … …  
    329329                        case 'array':
    330330                                if (!isset($args[$pos]) || !is_array($args[$pos])) {
    331                                         throw new WPRProtectRuleError_V681(
     331                                        throw new WPRProtectRuleError_V683(
    332332                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.")
    333333                                        );
    … …  
    337337                                break;
    338338                        default:
    339                                 throw new WPRProtectRuleError_V681(
     339                                throw new WPRProtectRuleError_V683(
    340340                                        $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name)
    341341                                );
  • wpremote/trunk/protect/fw/rule/errors.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectRuleError_V681')) :
    5 class WPRProtectRuleError_V681 extends Exception {
     4if (!class_exists('WPRProtectRuleError_V683')) :
     5class WPRProtectRuleError_V683 extends Exception {
    66//Root rule error class.
    77}
  • wpremote/trunk/protect/fw/rule/functions/array.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleArrayFunc_V681')) :
    6 trait WPRProtectFWRuleArrayFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleArrayFunc_V683')) :
     6trait WPRProtectFWRuleArrayFunc_V683 {
    77        private function _rf_inArray() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1717
    1818                if (!is_array($array)) {
    19                         throw new WPRProtectRuleError_V681(
     19                        throw new WPRProtectRuleError_V683(
    2020                                $this->addExState("inArray: 2nd param is not an array")
    2121                        );
    … …  
    2323
    2424                if (!is_bool($strict)) {
    25                         throw new WPRProtectRuleError_V681(
     25                        throw new WPRProtectRuleError_V683(
    2626                                $this->addExState("inArray: 3rd param is not a boolean")
    2727                        );
    … …  
    5454                        }
    5555                } else {
    56                         throw new WPRProtectRuleError_V681(
     56                        throw new WPRProtectRuleError_V683(
    5757                                $this->addExState("recInArray: Expects an array")
    5858                        );
    … …  
    7373
    7474                if (!is_array($array)) {
    75                         throw new WPRProtectRuleError_V681(
     75                        throw new WPRProtectRuleError_V683(
    7676                                $this->addExState("arrayKeyExists: Array must be of type array")
    7777                        );
    7878                } elseif (!is_string($key) && !is_int($key)) {
    79                         throw new WPRProtectRuleError_V681(
     79                        throw new WPRProtectRuleError_V683(
    8080                                $this->addExState("arrayKeyExists: Key must be of type string or int")
    8181                        );
    … …  
    110110
    111111                if (!is_bool($recursive)) {
    112                         throw new WPRProtectRuleError_V681(
     112                        throw new WPRProtectRuleError_V683(
    113113                                $this->addExState("getArrayKeys: 2nd param must be a boolean")
    114114                        );
    … …  
    140140
    141141                if (!is_bool($recursive)) {
    142                         throw new WPRProtectRuleError_V681(
     142                        throw new WPRProtectRuleError_V683(
    143143                                $this->addExState("hasAnyArrayKey: 3rd param must be a boolean")
    144144                        );
    … …  
    148148                foreach ($keys as $key) {
    149149                        if (!is_int($key) && !is_string($key)) {
    150                                 throw new WPRProtectRuleError_V681(
     150                                throw new WPRProtectRuleError_V683(
    151151                                        $this->addExState("hasAnyArrayKey: Key must be of type string or int")
    152152                                );
    … …  
    189189
    190190                if (!is_bool($recursive)) {
    191                         throw new WPRProtectRuleError_V681(
     191                        throw new WPRProtectRuleError_V683(
    192192                                $this->addExState("keyMatches: 3rd param must be a boolean")
    193193                        );
    … …  
    224224
    225225                if ($resp === false) {
    226                         throw new WPRProtectRuleError_V681(
     226                        throw new WPRProtectRuleError_V683(
    227227                                $this->addExState("keyMatches: Invalid regular expression")
    228228                        );
    … …  
    233233                $resp = WPRHelper::safePregMatch($pattern, (string) $key);
    234234                if ($resp === false) {
    235                         throw new WPRProtectRuleError_V681(
     235                        throw new WPRProtectRuleError_V683(
    236236                                $this->addExState("keyMatches: Regex match failed")
    237237                        );
    … …  
    242242
    243243        private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) {
    244                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     244                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    245245                        return false;
    246246                }
    … …  
    262262
    263263        private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) {
    264                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     264                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    265265                        return;
    266266                }
    … …  
    277277
    278278        private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) {
    279                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     279                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    280280                        return false;
    281281                }
    … …  
    297297
    298298        private function enforceArrayTraversalLimit($func_name, $traversed_keys) {
    299                 if ($traversed_keys > WPRProtectFWRuleEngine_V681::MAX_ARRAY_KEYS_TO_TRAVERSE) {
    300                         throw new WPRProtectRuleError_V681(
     299                if ($traversed_keys > WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) {
     300                        throw new WPRProtectRuleError_V683(
    301301                                $this->addExState(
    302302                                        "TraversalLimitError: " . $func_name . " exceeded " .
    303                                         WPRProtectFWRuleEngine_V681::MAX_ARRAY_KEYS_TO_TRAVERSE .
     303                                        WPRProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE .
    304304                                        " array keys"
    305305                                )
    … …  
    321321                foreach ($keys as $key) {
    322322                        if (!is_int($key) && !is_string($key)) {
    323                                 throw new WPRProtectRuleError_V681(
     323                                throw new WPRProtectRuleError_V683(
    324324                                        $this->addExState("digArray: Keys must be a valid array of string, or integer type")
    325325                                );
    … …  
    342342
    343343                if (empty($keys)) {
    344                         throw new WPRProtectRuleError_V681(
     344                        throw new WPRProtectRuleError_V683(
    345345                                $this->addExState("digArrayValues: Keys must not be empty")
    346346                        );
    347347                }
    348348
    349                 if (count($keys) > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    350                         throw new WPRProtectRuleError_V681(
     349                if (count($keys) > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     350                        throw new WPRProtectRuleError_V683(
    351351                                $this->addExState(
    352352                                        "digArrayValues: Keys exceeded " .
    353                                         WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
     353                                        WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
    354354                                        " levels of traversal"
    355355                                )
    … …  
    359359                foreach ($keys as $key) {
    360360                        if (!is_int($key) && !is_string($key)) {
    361                                 throw new WPRProtectRuleError_V681(
     361                                throw new WPRProtectRuleError_V683(
    362362                                        $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type")
    363363                                );
    … …  
    376376                                }
    377377
    378                                 if ($key === WPRProtectFWRuleEngine_V681::WILDCARD_KEY) {
     378                                if ($key === WPRProtectFWRuleEngine_V683::WILDCARD_KEY) {
    379379                                        foreach ($node as $value) {
    380380                                                $traversed_keys += 1;
    … …  
    417417                foreach ($keys as $key) {
    418418                        if (!is_int($key) && !is_string($key)) {
    419                                 throw new WPRProtectRuleError_V681(
     419                                throw new WPRProtectRuleError_V683(
    420420                                        $this->addExState("filterArray: Keys must be a valid array of string, or integer type")
    421421                                );
    … …  
    438438
    439439                if (!is_string($key) && !is_int($key)) {
    440                         throw new WPRProtectRuleError_V681(
     440                        throw new WPRProtectRuleError_V683(
    441441                                $this->addExState("getArrayVal: Key must be a valid string or integer")
    442442                        );
    … …  
    519519                foreach ($array as $element) {
    520520                        if (!is_scalar($element)) {
    521                                 throw new WPRProtectRuleError_V681(
     521                                throw new WPRProtectRuleError_V683(
    522522                                        $this->addExState("arrayJoin: Array element must be of scalar type")
    523523                                );
  • wpremote/trunk/protect/fw/rule/functions/misc.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleMiscFunc_V681')) :
    6 trait WPRProtectFWRuleMiscFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleMiscFunc_V683')) :
     6trait WPRProtectFWRuleMiscFunc_V683 {
    77        private function _rf_isTrue() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    7373
    7474                if (!array_key_exists($name, $this->variables)) {
    75                         throw new WPRProtectRuleError_V681(
     75                        throw new WPRProtectRuleError_V683(
    7676                                $this->addExState("UndefinedVariableError: " . $name . " is not defined.")
    7777                        );
    … …  
    134134                $resp = WPRHelper::safePregMatch((string) $pattern, (string) $subject);
    135135                if ($resp === false) {
    136                         throw new WPRProtectRuleError_V681(
     136                        throw new WPRProtectRuleError_V683(
    137137                                $this->addExState('BVHelper::safePregMatch' . serialize($subject))
    138138                        );
    … …  
    175175                $count = preg_match_all((string) $pattern, (string) $subject, $matches);
    176176                if ($count === false) {
    177                         throw new WPRProtectRuleError_V681(
     177                        throw new WPRProtectRuleError_V683(
    178178                                $this->addExState("preg_match_all: " . serialize($subject))
    179179                        );
    … …  
    201201                $count = preg_match_all((string) $pattern, (string) $subject, $matches);
    202202                if ($count === false) {
    203                         throw new WPRProtectRuleError_V681(
     203                        throw new WPRProtectRuleError_V683(
    204204                                $this->addExState("preg_match_all: " . serialize($subject))
    205205                        );
  • wpremote/trunk/protect/fw/rule/functions/request.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V681')) :
    6 trait WPRProtectFWRuleRequestFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleRequestFunc_V683')) :
     6trait WPRProtectFWRuleRequestFunc_V683 {
    77        private function _rf_getAction() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    496496
    497497                if (!array_key_exists('ID', $user)) {
    498                         throw new WPRProtectRuleError_V681(
     498                        throw new WPRProtectRuleError_V683(
    499499                                $this->addExState("wpUserId: user's id doesn't exist")
    500500                        );
  • wpremote/trunk/protect/fw/rule/functions/string.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleStringFunc_V681')) :
    6 trait WPRProtectFWRuleStringFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleStringFunc_V683')) :
     6trait WPRProtectFWRuleStringFunc_V683 {
    77        private function _rf_isNumeric() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    239239                        }
    240240                } else {
    241                         throw new WPRProtectRuleError_V681(
     241                        throw new WPRProtectRuleError_V683(
    242242                                $this->addExState("containsAnySubstring: Expects an array of substrings.")
    243243                        );
    … …  
    274274
    275275                if (!is_int($offset)) {
    276                         throw new WPRProtectRuleError_V681(
     276                        throw new WPRProtectRuleError_V683(
    277277                                $this->addExState("strPos: Offset should be an integer")
    278278                        );
    … …  
    319319
    320320                if (empty($separator)) {
    321                         throw new WPRProtectRuleError_V681(
     321                        throw new WPRProtectRuleError_V683(
    322322                                $this->addExState("splitString: Separator cannot be empty")
    323323                        );
    … …  
    325325
    326326                if (!is_int($limit)) {
    327                         throw new WPRProtectRuleError_V681(
     327                        throw new WPRProtectRuleError_V683(
    328328                                $this->addExState("splitString: Limit should be an integer")
    329329                        );
    … …  
    344344
    345345                if (!is_bool($recursive)) {
    346                         throw new WPRProtectRuleError_V681(
     346                        throw new WPRProtectRuleError_V683(
    347347                                $this->addExState("urlDecode: Recursive flag should be a boolean")
    348348                        );
    … …  
    363363
    364364                if (!is_bool($recursive)) {
    365                         throw new WPRProtectRuleError_V681(
     365                        throw new WPRProtectRuleError_V683(
    366366                                $this->addExState("rawUrlDecode: Recursive flag should be a boolean")
    367367                        );
    … …  
    382382
    383383                if (!is_bool($recursive)) {
    384                         throw new WPRProtectRuleError_V681(
     384                        throw new WPRProtectRuleError_V683(
    385385                                $this->addExState("htmlEntityDecode: Recursive flag should be a boolean")
    386386                        );
    … …  
    401401
    402402                if (!is_bool($recursive)) {
    403                         throw new WPRProtectRuleError_V681(
     403                        throw new WPRProtectRuleError_V683(
    404404                                $this->addExState("stripSlashes: Recursive flag should be a boolean")
    405405                        );
    … …  
    410410
    411411        private function normalizeStringValue($value, $operation, $recursive, $depth = 1) {
    412                 if ($depth > WPRProtectFWRuleEngine_V681::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     412                if ($depth > WPRProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    413413                        return null;
    414414                }
    … …  
    442442                }
    443443
    444                 throw new WPRProtectRuleError_V681(
     444                throw new WPRProtectRuleError_V683(
    445445                        $this->addExState("normalizeStringValue: Invalid normalization operation")
    446446                );
  • wpremote/trunk/protect/fw/rule/functions/wp.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('WPRProtectFWRuleWPFunc_V681')) :
    6 trait WPRProtectFWRuleWPFunc_V681 {
     5if (!trait_exists('WPRProtectFWRuleWPFunc_V683')) :
     6trait WPRProtectFWRuleWPFunc_V683 {
    77        private function _rf_sanitizeUser() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1616                $strict = $args[1];
    1717
    18                 if (!function_exists('sanitize_user') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    19                         throw new WPRProtectRuleError_V681(
     18                if (!function_exists('sanitize_user') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     19                        throw new WPRProtectRuleError_V683(
    2020                                $this->addExState("sanitizeUser: Func sanitize_user doesn't exist.")
    2121                        );
    … …  
    3434                $data = $args[0];
    3535
    36                 if (!function_exists('maybe_serialize') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    37                         throw new WPRProtectRuleError_V681(
     36                if (!function_exists('maybe_serialize') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     37                        throw new WPRProtectRuleError_V683(
    3838                                $this->addExState("maybeSerialize: Func maybe_serialize doesn't exist.")
    3939                        );
    … …  
    5050                );
    5151
    52                 if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    53                         throw new WPRProtectRuleError_V681(
     52                if (!function_exists('is_user_logged_in') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     53                        throw new WPRProtectRuleError_V683(
    5454                                $this->addExState("isUserLoggedIn: Func is_user_logged_in doesn't exist.")
    5555                        );
    … …  
    6666                );
    6767
    68                 if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    69                         throw new WPRProtectRuleError_V681(
     68                if (!function_exists('wp_get_current_user') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     69                        throw new WPRProtectRuleError_V683(
    7070                                $this->addExState("getCurrentWPUser: Func wp_get_current_user doesn't exist.")
    7171                        );
    7272                }
    7373
    74                 return WPRProtectFWRuleEngine_V681::toAllowedType(wp_get_current_user());
     74                return WPRProtectFWRuleEngine_V683::toAllowedType(wp_get_current_user());
    7575        }
    7676
    … …  
    8787                $arg2 = isset($args[2]) ? $args[2] : null;
    8888
    89                 if (!function_exists('current_user_can') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    90                         throw new WPRProtectRuleError_V681(
     89                if (!function_exists('current_user_can') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     90                        throw new WPRProtectRuleError_V683(
    9191                                $this->addExState("currentUserCan: Required funcs doesn't exist.")
    9292                        );
    … …  
    115115                $value = $args[1];
    116116
    117                 if (!function_exists('get_user_by') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    118                         throw new WPRProtectRuleError_V681(
     117                if (!function_exists('get_user_by') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     118                        throw new WPRProtectRuleError_V683(
    119119                                $this->addExState("getUserBy: Func get_user_by doesn't exist")
    120120                        );
    … …  
    123123                if ($field === 'ID' || $field === 'id') {
    124124                        if (!is_string($value) && !is_int($value)) {
    125                                 throw new WPRProtectRuleError_V681(
     125                                throw new WPRProtectRuleError_V683(
    126126                                        $this->addExState("getUserBy: Value must be a valid string or an integer")
    127127                                );
    128128                        }
    129129                } elseif (!is_string($value)) {
    130                         throw new WPRProtectRuleError_V681(
     130                        throw new WPRProtectRuleError_V683(
    131131                                $this->addExState("getUserBy: Value must be a valid string")
    132132                        );
    … …  
    138138                }
    139139
    140                 return WPRProtectFWRuleEngine_V681::toAllowedType($user);
     140                return WPRProtectFWRuleEngine_V683::toAllowedType($user);
    141141        }
    142142
    … …  
    151151
    152152                if (!array_key_exists("allcaps", $user)) {
    153                         throw new WPRProtectRuleError_V681(
     153                        throw new WPRProtectRuleError_V683(
    154154                                $this->addExState("getCurrentWPUserCapabilities: allcaps doesn't exist in user.")
    155155                        );
    156156                }
    157157
    158                 return WPRProtectFWRuleEngine_V681::toAllowedType($user["allcaps"]);
     158                return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]);
    159159        }
    160160
    … …  
    174174
    175175                if (!array_key_exists("allcaps", $user)) {
    176                         throw new WPRProtectRuleError_V681(
     176                        throw new WPRProtectRuleError_V683(
    177177                                $this->addExState("getUserCapabilities: allcaps doesn't exist in user.")
    178178                        );
    179179                }
    180180
    181                 return WPRProtectFWRuleEngine_V681::toAllowedType($user["allcaps"]);
     181                return WPRProtectFWRuleEngine_V683::toAllowedType($user["allcaps"]);
    182182        }
    183183
    … …  
    203203                $default_value = isset($args[1]) ? $args[1] : false;
    204204
    205                 if (!function_exists('get_option') || !WPRProtectUtils_V681::haveMupluginsLoaded()) {
    206                         throw new WPRProtectRuleError_V681(
     205                if (!function_exists('get_option') || !WPRProtectUtils_V683::haveMupluginsLoaded()) {
     206                        throw new WPRProtectRuleError_V683(
    207207                                $this->addExState("getOption: Func get_option doesn't exist.")
    208208                        );
    209209                }
    210210
    211                 return WPRProtectFWRuleEngine_V681::toAllowedType(get_option($option, $default_value));
     211                return WPRProtectFWRuleEngine_V683::toAllowedType(get_option($option, $default_value));
    212212        }
    213213
    … …  
    223223                $login = $args[1];
    224224
    225                 if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V681::havePluginsLoaded()) {
    226                         throw new WPRProtectRuleError_V681(
     225                if (!function_exists('check_password_reset_key') || !WPRProtectUtils_V683::havePluginsLoaded()) {
     226                        throw new WPRProtectRuleError_V683(
    227227                                $this->addExState("checkPasswordResetKey: Func check_password_reset_key doesn't exist.")
    228228                        );
    … …  
    232232
    233233                if (is_a($user, "WP_User")) {
    234                         return WPRProtectFWRuleEngine_V681::toAllowedType($user);
     234                        return WPRProtectFWRuleEngine_V683::toAllowedType($user);
    235235                }
    236236
    … …  
    287287                $value = $args[0];
    288288
    289                 if (!function_exists('wp_unslash') || !WPRProtectUtils_V681::haveMuPluginsLoaded()) {
    290                         throw new WPRProtectRuleError_V681(
     289                if (!function_exists('wp_unslash') || !WPRProtectUtils_V683::haveMuPluginsLoaded()) {
     290                        throw new WPRProtectRuleError_V683(
    291291                                $this->addExState("wpUnslash: Func wp_unslash doesn't exist.")
    292292                        );
    … …  
    294294
    295295                if (!is_string($value) && !is_array($value)) {
    296                         throw new WPRProtectRuleError_V681(
     296                        throw new WPRProtectRuleError_V683(
    297297                                $this->addExState("wpUnslash: Value must be a valid string or an array")
    298298                        );
    … …  
    310310
    311311                if (!defined('COOKIEHASH')) {
    312                         throw new WPRProtectRuleError_V681(
     312                        throw new WPRProtectRuleError_V683(
    313313                                $this->addExState("parseResetPassCookie: COOKIEHASH is not defined.")
    314314                        );
  • wpremote/trunk/protect/ipstore.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstore_V681')) :
     4if (!class_exists('WPRProtectIpstore_V683')) :
    55require_once dirname( __FILE__ ) . '/request.php';
    66require_once dirname( __FILE__ ) . '/ipstore/fs.php';
    77require_once dirname( __FILE__ ) . '/ipstore/db.php';
    88
    9 class WPRProtectIpstore_V681 {
     9class WPRProtectIpstore_V683 {
    1010        private $storage;
    1111        private $storage_type;
    … …  
    1414        const STORAGE_TYPE_DB = 1;
    1515
    16         function __construct($storage_type = WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     16        function __construct($storage_type = WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    1717                $this->storage_type = $storage_type;
    18                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_FS) {
    19                         $this->storage = new WPRProtectIpstoreFS_V681();
     18                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_FS) {
     19                        $this->storage = new WPRProtectIpstoreFS_V683();
    2020                } else {
    21                         $this->storage = new WPRProtectIpstoreDB_V681();
     21                        $this->storage = new WPRProtectIpstoreDB_V683();
    2222                }
    2323        }
    2424
    2525        public static function uninstall() {
    26                 WPRProtectIpstoreDB_V681::uninstall();
     26                WPRProtectIpstoreDB_V683::uninstall();
    2727        }
    2828
    2929        public function isLPIPBlacklisted($ip) {
    30                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     30                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    3131                        return $this->storage->isLPIPBlacklisted($ip);
    3232                }
    … …  
    3434
    3535        public function isLPIPWhitelisted($ip) {
    36                 if ($this->storage_type == WPRProtectIpstore_V681::STORAGE_TYPE_DB) {
     36                if ($this->storage_type == WPRProtectIpstore_V683::STORAGE_TYPE_DB) {
    3737                        return $this->storage->isLPIPWhitelisted($ip);
    3838                }
  • wpremote/trunk/protect/ipstore/db.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstoreDB_V681')) :
    5 class WPRProtectIpstoreDB_V681 {
     4if (!class_exists('WPRProtectIpstoreDB_V683')) :
     5class WPRProtectIpstoreDB_V683 {
    66                const TABLE_NAME = 'ip_store';
    77
    … …  
    1111                #XNOTE: check this.
    1212                public static function blacklistedTypes() {
    13                         return WPRProtectRequest_V681::blacklistedCategories();
     13                        return WPRProtectRequest_V683::blacklistedCategories();
    1414                }
    1515
    1616                public static function whitelistedTypes() {
    17                         return WPRProtectRequest_V681::whitelistedCategories();
     17                        return WPRProtectRequest_V683::whitelistedCategories();
    1818                }
    1919
    2020                public static function uninstall() {
    21                         WPRProtect_V681::$db->dropBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);
     21                        WPRProtect_V683::$db->dropBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME);
    2222                }
    2323
    2424                public function isLPIPBlacklisted($ip) {
    25                         return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     25                        return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    2626                }
    2727
    2828                public function isLPIPWhitelisted($ip) {
    29                         return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_LP);
     29                        return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_LP);
    3030                }
    3131
    3232                public function getTypeIfBlacklistedIP($ip) {
    33                         return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     33                        return $this->getIPType($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    3434                }
    3535
    3636                public function isFWIPBlacklisted($ip) {
    37                         return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     37                        return $this->checkIPPresent($ip, self::blacklistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    3838                }
    3939
    4040                public function isFWIPWhitelisted($ip) {
    41                         return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V681::CATEGORY_FW);
     41                        return $this->checkIPPresent($ip, self::whitelistedTypes(), WPRProtectIpstoreDB_V683::CATEGORY_FW);
    4242                }
    4343
    … …  
    5050                #XNOTE: getIPCategory or getIPType?
    5151                private function getIPType($ip, $types, $category) {
    52                         $table = WPRProtect_V681::$db->getBVTable(WPRProtectIpstoreDB_V681::TABLE_NAME);
     52                        $table = WPRProtect_V683::$db->getBVTable(WPRProtectIpstoreDB_V683::TABLE_NAME);
    5353
    54                         if (WPRProtect_V681::$db->isTablePresent($table)) {
    55                                 $binIP = WPRProtectUtils_V681::bvInetPton($ip);
    56                                 $is_v6 = WPRProtectUtils_V681::isIPv6($ip);
     54                        if (WPRProtect_V683::$db->isTablePresent($table)) {
     55                                $binIP = WPRProtectUtils_V683::bvInetPton($ip);
     56                                $is_v6 = WPRProtectUtils_V683::isIPv6($ip);
    5757
    5858                                if ($binIP !== false) {
    5959                                        $query_str = "SELECT * FROM $table WHERE %s >= `start_ip_range` && %s <= `end_ip_range` && ";
    60                                         if ($category == WPRProtectIpstoreDB_V681::CATEGORY_FW) {
     60                                        if ($category == WPRProtectIpstoreDB_V683::CATEGORY_FW) {
    6161                                                $query_str .= "`is_fw` = true";
    6262                                        } else {
    … …  
    6565                                        $query_str .= " && `type` in (" . implode(',', $types) . ") && `is_v6` = %d LIMIT 1;";
    6666
    67                                         $query = WPRProtect_V681::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
     67                                        $query = WPRProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
    6868
    69                                         return WPRProtect_V681::$db->getVar($query, 5);
     69                                        return WPRProtect_V683::$db->getVar($query, 5);
    7070                                }
    7171                        }
  • wpremote/trunk/protect/ipstore/fs.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectIpstoreFS_V681')) :
    5         class WPRProtectIpstoreFS_V681 {
     4if (!class_exists('WPRProtectIpstoreFS_V683')) :
     5        class WPRProtectIpstoreFS_V683 {
    66                private $whitelisted_ips;
    77                private $blacklisted_ips;
    … …  
    1212                function __construct() {
    1313                        $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf';
    14                         $ips = WPRProtectUtils_V681::parseFile($ip_store_file);
     14                        $ips = WPRProtectUtils_V683::parseFile($ip_store_file);
    1515                        $this->whitelisted_ips = array_key_exists('whitelisted', $ips) ? $ips['whitelisted'] : array();
    1616                        $this->blacklisted_ips = array_key_exists('blacklisted', $ips) ? $ips['blacklisted'] : array();
    … …  
    1818
    1919                public function getTypeIfBlacklistedIP($ip) {
    20                         return $this->getIPType($ip, WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED);
     20                        return $this->getIPType($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
    2121                }
    2222
    2323                public function isFWIPBlacklisted($ip) {
    24                         return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED);
     24                        return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
    2525                }
    2626
    2727                public function isFWIPWhitelisted($ip) {
    28                         return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V681::IP_TYPE_WHITELISTED);
     28                        return $this->checkIPPresent($ip, WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED);
    2929                }
    3030
    … …  
    3737                private function getIPType($ip, $type) {
    3838                        switch ($type) {
    39                         case WPRProtectIpstoreFS_V681::IP_TYPE_BLACKLISTED:
     39                        case WPRProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED:
    4040                                return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null;
    41                         case WPRProtectIpstoreFS_V681::IP_TYPE_WHITELISTED:
     41                        case WPRProtectIpstoreFS_V683::IP_TYPE_WHITELISTED:
    4242                                return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null;
    4343                        }
  • wpremote/trunk/protect/lib/utils.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectUtils_V681')) :
    5 class WPRProtectUtils_V681 {
     4if (!class_exists('WPRProtectUtils_V683')) :
     5class WPRProtectUtils_V683 {
    66        public static function getIP($ip_header) {
    77                $ip = null;
    … …  
    131131                if (is_array($val)) {
    132132                        foreach ($val as $e) {
    133                                 $length += WPRProtectUtils_V681::getLength($e);
     133                                $length += WPRProtectUtils_V683::getLength($e);
    134134                        }
    135135
  • wpremote/trunk/protect/logger.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLogger_V681')) :
     4if (!class_exists('WPRProtectLogger_V683')) :
    55require_once dirname( __FILE__ ) . '/logger/fs.php';
    66require_once dirname( __FILE__ ) . '/logger/db.php';
    77
    8 class WPRProtectLogger_V681 {
     8class WPRProtectLogger_V683 {
    99        private $log_destination;
    1010
    … …  
    1212        const TYPE_DB = 1;
    1313
    14         function __construct($name, $type = WPRProtectLogger_V681::TYPE_DB) {
    15                 if ($type == WPRProtectLogger_V681::TYPE_FS) {
    16                         $this->log_destination = new WPRProtectLoggerFS_V681($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);
    1717                } else {
    18                         $this->log_destination = new WPRProtectLoggerDB_V681($name);
     18                        $this->log_destination = new WPRProtectLoggerDB_V683($name);
    1919                }
    2020        }
  • wpremote/trunk/protect/logger/db.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLoggerDB_V681')) :
    5 class WPRProtectLoggerDB_V681 {
     4if (!class_exists('WPRProtectLoggerDB_V683')) :
     5class WPRProtectLoggerDB_V683 {
    66        private $tablename;
    77        private $bv_tablename;
    … …  
    1111        function __construct($tablename) {
    1212                $this->tablename = $tablename;
    13                 $this->bv_tablename = WPRProtect_V681::$db->getBVTable($tablename);
     13                $this->bv_tablename = WPRProtect_V683::$db->getBVTable($tablename);
    1414        }
    1515
    1616        public function log($data) {
    1717                if (is_array($data)) {
    18                         if (WPRProtect_V681::$db->rowsCount($this->bv_tablename) > WPRProtectLoggerDB_V681::MAXROWCOUNT) {
    19                                 WPRProtect_V681::$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);
    2020                        }
    2121
    22                         WPRProtect_V681::$db->replaceIntoBVTable($this->tablename, $data);
     22                        WPRProtect_V683::$db->replaceIntoBVTable($this->tablename, $data);
    2323                }
    2424        }
  • wpremote/trunk/protect/logger/fs.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLoggerFS_V681')) :
    5 class WPRProtectLoggerFS_V681 {
     4if (!class_exists('WPRProtectLoggerFS_V683')) :
     5class WPRProtectLoggerFS_V683 {
    66        public $logFile;
    77
  • wpremote/trunk/protect/lp.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectLP_V681')) :
    5 class WPRProtectLP_V681 {
     4if (!class_exists('WPRProtectLP_V683')) :
     5class WPRProtectLP_V683 {
    66        private $ip;
    77        private $time;
    … …  
    1010        private $brand_name;
    1111
    12         private $mode              = WPRProtectLP_V681::MODE_DISABLED;
     12        private $mode              = WPRProtectLP_V683::MODE_DISABLED;
    1313        private $captcha_limit     = 3;
    1414        private $temp_block_limit  = 10;
    … …  
    1818        private $all_blocked_gap   = 1800;
    1919
    20         private $category          = WPRProtectLP_V681::CATEGORY_ALLOWED;
     20        private $category          = WPRProtectLP_V683::CATEGORY_ALLOWED;
    2121        private $username          = '';
    2222        private $message           = '';
    … …  
    4747                $this->ip = $request->getIP();
    4848                $this->brand_name = $brand_name;
    49                 $this->ipstore = new WPRProtectIpstore_V681();
    50                 $this->logger = new WPRProtectLogger_V681(WPRProtectLP_V681::TABLE_NAME);
     49                $this->ipstore = new WPRProtectIpstore_V683();
     50                $this->logger = new WPRProtectLogger_V683(WPRProtectLP_V683::TABLE_NAME);
    5151                $this->time = strtotime(gmdate("Y-m-d H:i:s"));
    5252
    … …  
    9191
    9292        public static function uninstall() {
    93                 WPRProtect_V681::$db->dropBVTable(WPRProtectLP_V681::TABLE_NAME);
     93                WPRProtect_V683::$db->dropBVTable(WPRProtectLP_V683::TABLE_NAME);
    9494        }
    9595
    … …  
    103103
    104104        private function getCaptchaLink() {
    105                 $account = WPRAccount::apiPublicAccount(WPRProtect_V681::$settings);
     105                $account = WPRAccount::apiPublicAccount(WPRProtect_V683::$settings);
    106106
    107107                $url = $account->authenticatedUrl('/captcha/solve');
    … …  
    112112
    113113        private function getAllowLoginsTransient() {
    114                 return WPRProtect_V681::$settings->getTransient('bvlp_allow_logins');
     114                return WPRProtect_V683::$settings->getTransient('bvlp_allow_logins');
    115115        }
    116116
    117117        private function getBlockLoginsTransient() {
    118                 return WPRProtect_V681::$settings->getTransient('bvlp_block_logins');
     118                return WPRProtect_V683::$settings->getTransient('bvlp_block_logins');
    119119        }
    120120
    … …  
    142142
    143143        private function isProtecting() {
    144                 return $this->mode === WPRProtectLP_V681::MODE_PROTECT;
     144                return $this->mode === WPRProtectLP_V683::MODE_PROTECT;
    145145        }
    146146
    147147        private function isActive() {
    148                 return $this->mode !== WPRProtectLP_V681::MODE_DISABLED;
     148                return $this->mode !== WPRProtectLP_V683::MODE_DISABLED;
    149149        }
    150150
    … …  
    158158
    159159        private function isUnBlockedIP() {
    160                 $transient_name = WPRProtectLP_V681::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
    161                 $attempts = WPRProtect_V681::$settings->getTransient($transient_name);
     160                $transient_name = WPRProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
     161                $attempts = WPRProtect_V683::$settings->getTransient($transient_name);
    162162
    163163                if ($attempts && $attempts > 0) {
    164                         WPRProtect_V681::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
     164                        WPRProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
    165165                        return true;
    166166                }
    … …  
    171171        private function isLoginBlocked() {
    172172                if ($this->getAllowLoginsTransient() ||
    173                                 ($this->getLoginCount(WPRProtectLP_V681::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)) {
    174174                        return false;
    175175                }
    … …  
    194194        private function terminateLogin() {
    195195                $this->message = 'Login Blocked';
    196                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_BLOCKED);
     196                $this->log(WPRProtectLP_V683::LOGIN_STATUS_BLOCKED);
    197197                if ($this->isProtecting()) {
    198198                        header("Cache-Control: no-cache, no-store, must-revalidate");
    … …  
    208208        public function loginInit($user, $username = '', $password = '') {
    209209                if ($this->isUnBlockedIP()) {
    210                         $this->category = WPRProtectLP_V681::CATEGORY_UNBLOCKED;
     210                        $this->category = WPRProtectLP_V683::CATEGORY_UNBLOCKED;
    211211                } else {
    212                         $failed_attempts = $this->getLoginCount(WPRProtectLP_V681::LOGIN_STATUS_FAILURE,
     212                        $failed_attempts = $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_FAILURE,
    213213                                                                                                                                                                                        $this->ip, $this->failed_login_gap);
    214214
    215215                        if ($this->isWhitelistedIP()) {
    216                                 $this->category = WPRProtectLP_V681::CATEGORY_BYPASSED;
    217                         } elseif (WPRProtectUtils_V681::isPrivateIP($this->ip)) {
    218                                 $this->category = WPRProtectLP_V681::CATEGORY_PRIVATEIP;
     216                                $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED;
     217                        } elseif (WPRProtectUtils_V683::isPrivateIP($this->ip)) {
     218                                $this->category = WPRProtectLP_V683::CATEGORY_PRIVATEIP;
    219219                        } elseif ($this->isBlacklistedIP()) {
    220                                 $this->category = WPRProtectLP_V681::CATEGORY_BLACKLISTED;
     220                                $this->category = WPRProtectLP_V683::CATEGORY_BLACKLISTED;
    221221                                $this->terminateLogin();
    222222                        } elseif ($this->isKnownLogin()) {
    223                                 $this->category = WPRProtectLP_V681::CATEGORY_BYPASSED;
     223                                $this->category = WPRProtectLP_V683::CATEGORY_BYPASSED;
    224224                        } elseif ($this->isLoginBlocked()) {
    225                                 $this->category = WPRProtectLP_V681::CATEGORY_ALL_BLOCKED;
     225                                $this->category = WPRProtectLP_V683::CATEGORY_ALL_BLOCKED;
    226226                                $this->terminateLogin();
    227227                        } elseif ($failed_attempts >= $this->temp_block_limit) {
    228                                 $this->category = WPRProtectLP_V681::CATEGORY_TEMP_BLOCK;
     228                                $this->category = WPRProtectLP_V683::CATEGORY_TEMP_BLOCK;
    229229                                $this->terminateLogin();
    230230                        } elseif ($failed_attempts >= $this->captcha_limit) {
    231                                 $this->category = WPRProtectLP_V681::CATEGORY_CAPTCHA_BLOCK;
     231                                $this->category = WPRProtectLP_V683::CATEGORY_CAPTCHA_BLOCK;
    232232                                $this->terminateLogin();
    233233                        }
    … …  
    243243        public function loginFailed($username) {
    244244                $this->username = $username;
    245                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_FAILURE);
     245                $this->log(WPRProtectLP_V683::LOGIN_STATUS_FAILURE);
    246246        }
    247247
    … …  
    249249                $this->username = $username;
    250250                $this->message = 'Login Success';
    251                 $this->log(WPRProtectLP_V681::LOGIN_STATUS_SUCCESS);
     251                $this->log(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS);
    252252        }
    253253
    254254        private function isKnownLogin() {
    255                 return $this->getLoginCount(WPRProtectLP_V681::LOGIN_STATUS_SUCCESS,
     255                return $this->getLoginCount(WPRProtectLP_V683::LOGIN_STATUS_SUCCESS,
    256256                                                                                                                                $this->ip, $this->success_login_gap) > 0;
    257257        }
    258258
    259259        private function getLoginCount($status, $ip, $gap) {
    260                 $table = WPRProtect_V681::$db->getBVTable(WPRProtectLP_V681::TABLE_NAME);
     260                $table = WPRProtect_V683::$db->getBVTable(WPRProtectLP_V683::TABLE_NAME);
    261261                $query_str = "SELECT COUNT(*) as count from `$table` WHERE status=%d && time > %d";
    262262                $query_args = array($status, ($this->time - $gap));
    263263
    264                 $query = WPRProtect_V681::$db->prepare($query_str, $query_args);
     264                $query = WPRProtect_V683::$db->prepare($query_str, $query_args);
    265265                if ($ip) {
    266                         $query .= WPRProtect_V681::$db->prepare(" && ip=%s", $ip);
    267                 }
    268 
    269                 $rows = WPRProtect_V681::$db->getResult($query);
     266                        $query .= WPRProtect_V683::$db->prepare(" && ip=%s", $ip);
     267                }
     268
     269                $rows = WPRProtect_V683::$db->getResult($query);
    270270                if (!$rows) {
    271271                        return 0;
  • wpremote/trunk/protect/prepend/ignitor.php

    r3775063 r3795707  
    55        require_once dirname( __FILE__ ) . '/../protect.php';
    66
    7         WPRProtect_V681::init(WPRProtect_V681::MODE_PREPEND);
     7        WPRProtect_V683::init(WPRProtect_V683::MODE_PREPEND);
    88}
  • wpremote/trunk/protect/protect.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtect_V681')) :
     4if (!class_exists('WPRProtect_V683')) :
    55require_once dirname( __FILE__ ) . '/logger.php';
    66require_once dirname( __FILE__ ) . '/ipstore.php';
    … …  
    1212require_once dirname( __FILE__ ) . '/../helper.php';
    1313
    14 class WPRProtect_V681 {
     14class WPRProtect_V683 {
    1515        public static $settings;
    1616        public static $db;
    … …  
    2727                }
    2828
    29                 if ($mode == WPRProtect_V681::MODE_PREPEND) {
     29                if ($mode == WPRProtect_V683::MODE_PREPEND) {
    3030                        $config_file = MCDATAPATH .  MCCONFKEY . '-' . 'mc.conf';
    31                         $config = WPRProtectUtils_V681::parseFile($config_file);
     31                        $config = WPRProtectUtils_V683::parseFile($config_file);
    3232
    3333                        if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
    3434                                        !isset($config['mc_conf_version']) ||
    35                                         (WPRProtect_V681::CONF_VERSION !== $config['mc_conf_version'])) {
     35                                        (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
    3636                                return false;
    3737
    … …  
    4141                        $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
    4242                        $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
    43                         $request = new WPRProtectRequest_V681($request_ip_header, $req_config);
     43                        $request = new WPRProtectRequest_V683($request_ip_header, $req_config);
    4444                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    4545
    46                         WPRProtectFW_V681::getInstance($mode, $request, $fw_config, $brand_name)->init();
     46                        WPRProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
    4747                } else {
    4848                        $plug_config = self::$settings->getOption(self::$info->services_option_name);
    4949                        $config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array();
    5050                        if (!is_array($config) || !array_key_exists('mc_conf_version', $config) ||
    51                                         (WPRProtect_V681::CONF_VERSION !== $config['mc_conf_version'])) {
     51                                        (WPRProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
    5252
    5353                                return false;
    … …  
    5757                        $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
    5858                        $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
    59                         $request = new WPRProtectRequest_V681($request_ip_header, $req_config);
     59                        $request = new WPRProtectRequest_V683($request_ip_header, $req_config);
    6060                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    6161                        $lp_config = array_key_exists('lp', $config) ? $config['lp'] : array();
    6262
    63                         WPRProtectFW_V681::getInstance($mode, $request, $fw_config, $brand_name)->init();
    64                         WPRProtectLP_V681::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();
    6565                }
    6666        }
    … …  
    6969                self::$settings->deleteOption('bvptconf');
    7070                self::$settings->deleteOption('bvptplug');
    71                 WPRProtectIpstore_V681::uninstall();
    72                 WPRProtectFW_V681::uninstall();
    73                 WPRProtectLP_V681::uninstall();
     71                WPRProtectIpstore_V683::uninstall();
     72                WPRProtectFW_V683::uninstall();
     73                WPRProtectLP_V683::uninstall();
    7474
    75                 WPRProtect_V681::removeWPPrepend();
    76                 WPRProtect_V681::removePHPPrepend();
    77                 WPRProtect_V681::removeMCData();
     75                WPRProtect_V683::removeWPPrepend();
     76                WPRProtect_V683::removePHPPrepend();
     77                WPRProtect_V683::removeMCData();
    7878
    7979                return true;
    … …  
    9696                $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';";
    9797               
    98                 WPRProtectUtils_V681::fileRemovePattern($fname, $pattern);
     98                WPRProtectUtils_V683::fileRemovePattern($fname, $pattern);
    9999        }
    100100
    101101        private static function removePHPPrepend() {
    102                 WPRProtect_V681::removeHtaccessPrepend();
    103                 WPRProtect_V681::removeUseriniPrepend();
     102                WPRProtect_V683::removeHtaccessPrepend();
     103                WPRProtect_V683::removeUseriniPrepend();
    104104        }
    105105
    … …  
    107107                $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
    108108
    109                 WPRProtectUtils_V681::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
     109                WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
    110110        }
    111111
    … …  
    113113                $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
    114114
    115                 WPRProtectUtils_V681::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
     115                WPRProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
    116116        }
    117117
    … …  
    120120                $mc_data_dir = $content_dir . "/mc_data";
    121121
    122                 WPRProtectUtils_V681::rrmdir($mc_data_dir);
     122                WPRProtectUtils_V683::rrmdir($mc_data_dir);
    123123        }
    124124}
  • wpremote/trunk/protect/request.php

    r3775063 r3795707  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('WPRProtectRequest_V681')) :
    6 class WPRProtectRequest_V681 {
     5if (!class_exists('WPRProtectRequest_V683')) :
     6class WPRProtectRequest_V683 {
    77        public $ip;
    88        public $host = '';
    … …  
    2020        public $files;
    2121        public $respcode;
    22         public $status = WPRProtectRequest_V681::STATUS_ALLOWED;
    23         public $category = WPRProtectRequest_V681::CATEGORY_NORMAL;
     22        public $status = WPRProtectRequest_V683::STATUS_ALLOWED;
     23        public $category = WPRProtectRequest_V683::CATEGORY_NORMAL;
    2424
    2525        public $wp_user;
    … …  
    6060
    6161        public function __construct($ip_header, $config) {
    62                 $this->ip = WPRProtectUtils_V681::getIP($ip_header);
     62                $this->ip = WPRProtectUtils_V683::getIP($ip_header);
    6363                $this->timestamp = time();
    6464                $this->get_params = $_GET; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    … …  
    142142        public static function blacklistedCategories() {
    143143                return array(
    144                         WPRProtectRequest_V681::CATEGORY_BOT_BLOCKED,
    145                         WPRProtectRequest_V681::CATEGORY_COUNTRY_BLOCKED,
    146                         WPRProtectRequest_V681::CATEGORY_USER_BLACKLISTED,
    147                         WPRProtectRequest_V681::CATEGORY_GLOBAL_BOT_BLOCKED
     144                        WPRProtectRequest_V683::CATEGORY_BOT_BLOCKED,
     145                        WPRProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED,
     146                        WPRProtectRequest_V683::CATEGORY_USER_BLACKLISTED,
     147                        WPRProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED
    148148                );
    149149        }
    150150
    151151        public static function whitelistedCategories() {
    152                 return array(WPRProtectRequest_V681::CATEGORY_WHITELISTED);
     152                return array(WPRProtectRequest_V683::CATEGORY_WHITELISTED);
    153153        }
    154154
    … …  
    488488                }
    489489
    490                 $_json_params = WPRProtectUtils_V681::safeDecodeJSON(
     490                $_json_params = WPRProtectUtils_V683::safeDecodeJSON(
    491491                        $this->raw_body,
    492492                        true,
  • wpremote/trunk/protect/wp_user.php

    r3775063 r3795707  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('WPRProtectWPUser_V681')) :
    5 class WPRProtectWPUser_V681 {
     4if (!class_exists('WPRProtectWPUser_V683')) :
     5class WPRProtectWPUser_V683 {
    66        public $id;
    77        public $role;
    … …  
    2222        public static function defaultUser() {
    2323                $time = (int) floor(time() / 43200);
    24                 return (new WPRProtectWPUser_V681(0, 0, array(), $time));
     24                return (new WPRProtectWPUser_V683(0, 0, array(), $time));
    2525        }
    2626
    … …  
    4242                $capabilities = array_map('intval', explode(',', $capabilities));
    4343
    44                 return (new WPRProtectWPUser_V681((int) $id, (int) $role_level, $capabilities, (int) $time));
     44                return (new WPRProtectWPUser_V683((int) $id, (int) $role_level, $capabilities, (int) $time));
    4545        }
    4646
  • wpremote/trunk/readme.txt

    r3775063 r3795707  
    77Tested up to: 7.1
    88Requires PHP: 7.0
    9 Stable tag: 6.81
     9Stable tag: 6.83
    1010License: GPLv2 or later
    1111License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
    … …  
    4747
    4848== 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
    4952= 6.81 =
    5053* New: Added a must-use plugin loader.
  • wpremote/trunk/wp_actions.php

    r3775063 r3795707  
    8585                }
    8686
     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
    87106                private function process_deactivation_feedback(&$info) {
    88107                        //phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
Note: See TracChangeset for help on using the changeset viewer.