Plugin Directory

Changeset 3813747


Ignore:
Timestamp:
11/20/2026 01:23:58 PM (6 hours ago)
Author:
ritesh.soni36
Message:

Updating and Tagging 6.85 version

Location:
blogvault-real-time-backup
Files:
34 added
46 edited
34 copied

Legend:

Unmodified
Added
Removed
  • blogvault-real-time-backup/tags/6.85/blogvault.php

    r3795700 r3813747  
    66Author: Backup by BlogVault
    77Author URI: https://blogvault.net
    8 Version: 6.83
     8Version: 6.85
    99Network: True
    1010License: GPLv2 or later
    … …  
    187187                        require_once dirname( __FILE__ ) . '/protect/protect.php';
    188188                        //For backward compatibility.
    189                         BVProtect_V683::$settings = new BVWPSettings();
    190                         BVProtect_V683::$db = new BVWPDb();
    191                         BVProtect_V683::$info = new BVInfo(BVProtect_V683::$settings);
    192 
    193                         add_action('bv_clear_pt_config', array('BVProtect_V683', 'uninstall'));
     189                        BVProtect_V685::$settings = new BVWPSettings();
     190                        BVProtect_V685::$db = new BVWPDb();
     191                        BVProtect_V685::$info = new BVInfo(BVProtect_V685::$settings);
     192
     193                        add_action('bv_clear_pt_config', array('BVProtect_V685', 'uninstall'));
    194194
    195195                        if ($bvinfo->isActivePlugin()) {
    196                                 BVProtect_V683::init(BVProtect_V683::MODE_WP);
     196                                BVProtect_V685::init(BVProtect_V685::MODE_WP);
    197197                        }
    198198                }
  • blogvault-real-time-backup/tags/6.85/callback/base.php

    r3795700 r3813747  
    1313                "DB_WING_VERSION" => '1.5',
    1414                "ACCOUNT_WING_VERSION" => '1.2',
    15                 "MISC_WING_VERSION" => '1.4',
     15                "MISC_WING_VERSION" => '1.6',
    1616                "FS_WING_VERSION" => '1.4',
    17                 "INFO_WING_VERSION" => '2.9',
     17                "INFO_WING_VERSION" => '3.0',
    1818                "WATCH_WING_VERSION" => '1.7',
    1919                "FS_WRITE_WING_VERSION" => '1.2',
    … …  
    2323                "SECURITY_WING_VERSION" => '1.4',
    2424                "LINKS_WING_VERSION" => '1.0',
     25                "FORM_TESTING_WING_VERSION" => '1.0',
    2526                "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0',
    2627                );
  • blogvault-real-time-backup/tags/6.85/callback/handler.php

    r3795700 r3813747  
    180180                                $module = new BVLinksCallback($this);
    181181                                break;
     182                        case 'frmtst':
     183                                // Only the BlogVault, MalCare and WP Remote plugins carry this wing; the rest answer Bad Command.
     184                                $form_testing_wing = dirname( __FILE__ ) . '/wings/form_testing.php';
     185                                if (!file_exists($form_testing_wing)) {
     186                                        $module = null;
     187                                        break;
     188                                }
     189                                require_once $form_testing_wing;
     190                                $module = new BVFormTestingCallback($this);
     191                                break;
    182192                        default:
    183193                                require_once dirname( __FILE__ ) . '/wings/misc.php';
  • blogvault-real-time-backup/tags/6.85/callback/wings/info.php

    r3795700 r3813747  
    1111        public $bvapi;
    1212       
    13         const INFO_WING_VERSION = 2.9;
     13        const INFO_WING_VERSION = 3.0;
    1414
    1515        public function __construct($callback_handler) {
    … …  
    221221                        'templatedir' => get_template_directory(),
    222222                        'dbcharset' => defined('DB_CHARSET') ? DB_CHARSET : null,
     223                        'mysql_client_flags' => defined('MYSQL_CLIENT_FLAGS') ? MYSQL_CLIENT_FLAGS : null,
    223224                        'disallow_file_edit' => defined('DISALLOW_FILE_EDIT'),
    224225                        'disallow_file_mods' => defined('DISALLOW_FILE_MODS'),
  • blogvault-real-time-backup/tags/6.85/callback/wings/ipstore.php

    r3795700 r3813747  
    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 == BVProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
     53                $query .= ($category == BVProtectIpstoreDB_V685::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                         BVProtectIpstoreDB_V683::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     67                        BVProtectIpstoreDB_V685::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    6868                $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    69                         BVProtectIpstoreDB_V683::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     69                        BVProtectIpstoreDB_V685::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    7070                $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    71                         BVProtectIpstoreDB_V683::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     71                        BVProtectIpstoreDB_V685::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    7272                $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    73                         BVProtectIpstoreDB_V683::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     73                        BVProtectIpstoreDB_V685::whitelistedTypes(), BVProtectIpstoreDB_V685::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"));
  • blogvault-real-time-backup/tags/6.85/callback/wings/misc.php

    r3158138 r3813747  
    1212        public $db;
    1313
    14         const MISC_WING_VERSION = 1.4;
     14        const MISC_WING_VERSION = 1.6;
    1515
    1616        public function __construct($callback_handler) {
  • blogvault-real-time-backup/tags/6.85/callback/wings/protect.php

    r3795700 r3813747  
    4141
    4242        public function unBlockIP($ip, $attempts, $time) {
    43                 $transient_name = BVProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
     43                $transient_name = BVProtectLP_V685::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
    4444                $this->settings->setTransient($transient_name, $attempts, $time);
    4545                return $this->settings->getTransient($transient_name);
  • blogvault-real-time-backup/tags/6.85/callback/wings/watch.php

    r3795700 r3813747  
    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(BVProtectLP_V683::TABLE_NAME))) {
     147                                if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectLP_V685::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(BVProtectLP_V683::TABLE_NAME);
     151                                        $table = $db->getBVTable(BVProtectLP_V685::TABLE_NAME);
    152152                                        $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table);
    153153                                        if (empty($resp["lplogs"])) {
    154                                                 $db->deleteBVTableContent(BVProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']);
     154                                                $db->deleteBVTableContent(BVProtectLP_V685::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(BVProtectFW_V683::TABLE_NAME))) {
     170                                if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectFW_V685::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(BVProtectFW_V683::TABLE_NAME);
     174                                        $table = $db->getBVTable(BVProtectFW_V685::TABLE_NAME);
    175175                                        $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table);
    176176                                        if (empty($resp["fwlogs"])){
    177                                                 $db->deleteBVTableContent(BVProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']);
     177                                                $db->deleteBVTableContent(BVProtectFW_V685::TABLE_NAME, $fw_params['rmfilter']);
    178178                                                $resp["fwlogs"] = $this->getData($table, $limit, $filter);
    179179                                        }
  • blogvault-real-time-backup/tags/6.85/form_testing/form_testing.php

    r3220024 r3813747  
    22
    33if (!defined('ABSPATH')) exit;
     4
     5require_once dirname(__FILE__) . '/recorder.php';
     6require_once dirname(__FILE__) . '/entries.php';
     7
    48if (!class_exists('BVFormTesting')) :
    59
     10// Form test mode for one signed test submission: the tested form's CAPTCHA, email and anti-spam bypasses, and the recorder.
    611class BVFormTesting {
    712        private $form_type;
    … …  
    914        private $spam_bypass;
    1015        private $bypass_params = array();
     16        private $run_id;
     17        private $capture_mail;
     18        private $block_http;
     19        private $captcha_live;
    1120
    1221        public function __construct($params) {
    … …  
    1524                $this->spam_bypass = isset($params['bv_ignr_spm_plgns']);
    1625
    17                 if (isset($params['bv_ignr_frm_cptch'])) {
     26                $this->captcha_live = isset($params['bv_frm_cptch_live']);
     27                // A live-captcha run tests that the form rejects a wrong token: never bypass the captcha then.
     28                if (isset($params['bv_ignr_frm_cptch']) && !$this->captcha_live) {
    1829                        $this->bypass_params['should_bypass_captcha'] = true;
    1930                }
    … …  
    2233                        $this->bypass_params['should_bypass_email'] = true;
    2334                }
     35
     36                $run_id = isset($params['bv_frm_run']) && is_string($params['bv_frm_run']) ? sanitize_text_field(wp_unslash($params['bv_frm_run'])) : null;
     37                $this->run_id = BVFormTestRecorder::isValidRunId($run_id) ? $run_id : null;
     38                $this->capture_mail = isset($params['bv_frm_cptr_ml']);
     39                $this->block_http = isset($params['bv_frm_blk_http']);
     40        }
     41
     42        /**
     43         * Request fields that only a login, registration, checkout or comment sends: exact names, never a pattern (form fields
     44         * such as "mf-password" must not match). WordPress's login sends "log" and "pwd" together.
     45         */
     46        private static $refused_fields = array('woocommerce-login-nonce', 'woocommerce-register-nonce', 'woocommerce-process-checkout-nonce',
     47                'woocommerce-lost-password-nonce', 'woocommerce-reset-password-nonce', 'woocommerce-edit-account-nonce', 'wc-ajax', 'comment_post_ID');
     48
     49        /**
     50         * Whether this is a request a form test never makes (see the class comment): login, registration, comments,
     51         * XML-RPC, cron, an admin screen other than admin-ajax.php, a WooCommerce login, checkout or account form.
     52         */
     53        public function isRefusedRequest($request) {
     54                $request = (array) $request;
     55                if (defined('XMLRPC_REQUEST') || defined('DOING_CRON') || defined('WP_INSTALLING')) {
     56                        return true;
     57                }
     58                $script = isset($_SERVER['SCRIPT_NAME']) && is_string($_SERVER['SCRIPT_NAME']) ? basename($_SERVER['SCRIPT_NAME']) : '';
     59                if (defined('DOING_AJAX') && DOING_AJAX) {
     60                        if ($script !== 'admin-ajax.php') {
     61                                return true;
     62                        }
     63                } elseif (is_admin() || $script !== 'index.php') {
     64                        return true;
     65                }
     66                if (isset($request['log'], $request['pwd'])) {
     67                        return true;
     68                }
     69                foreach (self::$refused_fields as $field) {
     70                        if (isset($request[$field])) {
     71                                return true;
     72                        }
     73                }
     74                return false;
    2475        }
    2576
    2677        public function init() {
     78                // Refused, not handled as a normal request: a test submission carried on without test mode would be a real one.
     79                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     80                if ($this->isRefusedRequest($_REQUEST)) {
     81                        wp_die(esc_html('Form test refused for this request.'), '', array('response' => 403));
     82                }
     83
    2784                if ($this->spam_bypass === true) {
    2885                        $this->bypassSpamPlugins();
    2986                }
    3087
     88                $recorder = null;
     89                if ($this->run_id !== null) {
     90                        $recorder = new BVFormTestRecorder($this->run_id, $this->capture_mail, $this->block_http, $this->captcha_live,
     91                                array_key_exists('should_bypass_captcha', $this->bypass_params), $this->form_id);
     92                        $recorder->start();
     93                        BVFormTestEntries::watch($recorder);
     94                        $this->watchSubmissionEvents($recorder);
     95                }
     96
     97                // Mail capture can only be decided once wp_mail() exists (after all plugins load), and the
     98                // plugin's own email suppression depends on it, so with capture requested both wait for
     99                // plugins_loaded. That is still before any form plugin handles the submission.
     100                if ($recorder !== null && $this->capture_mail) {
     101                        $this->whenPluginsLoaded(function () use ($recorder) {
     102                                $this->applyBypass($recorder);
     103                        });
     104                } else {
     105                        $this->applyBypass($recorder);
     106                }
     107        }
     108
     109        private function applyBypass($recorder) {
     110                if ($recorder !== null) {
     111                        $recorder->setupMailCapture();
     112                        // Captured mail never leaves the site, so let the plugin send it to wp_mail() and record it.
     113                        if ($recorder->captureMailEnabled()) {
     114                                unset($this->bypass_params['should_bypass_email']);
     115                        }
     116                }
     117
     118                // Always, even with nothing to bypass: besides the CAPTCHA and email bypasses, each handler keeps the test's
     119                // side effects in check (integrations, created posts and users, asynchronous work), which a submission must
     120                // never skip. The wrong-CAPTCHA run (bv_frm_cptch_live) with mail capture has no bypass at all, and is exactly
     121                // the run that goes through as a real submission when the form accepts the wrong token.
    31122                $handler = $this->getHandler($this->form_type);
    32                 if ($handler === null) {
    33                         return;
    34                 }
    35 
    36                 if (empty($this->bypass_params) === false) {
     123                if ($handler !== null) {
    37124                        $handler->bypass();
     125                }
     126        }
     127
     128        /** Form plugins that store no entry id, or whose handler reports what it did: record the submission's events. */
     129        private function watchSubmissionEvents($recorder) {
     130                switch ($this->form_type) {
     131                case 'ElementorProForm':
     132                        require_once dirname(__FILE__) . '/handlers/elementor_pro_form.php';
     133                        BVElementorProFormHandler::watch($recorder);
     134                        break;
     135                case 'DiviForm':
     136                        require_once dirname(__FILE__) . '/handlers/divi_form.php';
     137                        BVDiviFormHandler::watch($recorder);
     138                        break;
     139                case 'SpectraForm':
     140                        require_once dirname(__FILE__) . '/handlers/spectra_form.php';
     141                        BVSpectraFormHandler::watch($recorder);
     142                        break;
     143                case 'KadenceForm':
     144                        require_once dirname(__FILE__) . '/handlers/kadence_form.php';
     145                        BVKadenceFormHandler::watch($recorder);
     146                        break;
     147                case 'BeaverBuilderForm':
     148                        require_once dirname(__FILE__) . '/handlers/beaver_builder_form.php';
     149                        BVBeaverBuilderFormHandler::watch($recorder);
     150                        break;
     151                case 'Mc4wpForm':
     152                        require_once dirname(__FILE__) . '/handlers/mc4wp_form.php';
     153                        BVMc4wpFormHandler::watch($recorder);
     154                        break;
     155                case 'JetEngineForm':
     156                        require_once dirname(__FILE__) . '/handlers/jet_engine_form.php';
     157                        BVJetEngineFormHandler::watch($recorder);
     158                        break;
     159                case 'FluentForm':
     160                        require_once dirname(__FILE__) . '/handlers/fluent_form.php';
     161                        BVFluentFormHandler::watch($recorder);
     162                        break;
     163                }
     164        }
     165
     166        private function whenPluginsLoaded($callback) {
     167                if (did_action('plugins_loaded')) {
     168                        call_user_func($callback);
     169                } else {
     170                        add_action('plugins_loaded', $callback, PHP_INT_MIN);
    38171                }
    39172        }
    … …  
    59192                        require_once dirname(__FILE__) . '/handlers/formidable_form.php';
    60193                        return new BVFormidableFormHandler($this->form_id, $this->bypass_params);
     194                case 'FluentForm':
     195                        require_once dirname(__FILE__) . '/handlers/fluent_form.php';
     196                        return new BVFluentFormHandler($this->form_id, $this->bypass_params);
     197                case 'ElementorProForm':
     198                        require_once dirname(__FILE__) . '/handlers/elementor_pro_form.php';
     199                        return new BVElementorProFormHandler($this->form_id, $this->bypass_params);
     200                case 'DiviForm':
     201                        require_once dirname(__FILE__) . '/handlers/divi_form.php';
     202                        return new BVDiviFormHandler($this->form_id, $this->bypass_params);
     203                case 'MetForm':
     204                        require_once dirname(__FILE__) . '/handlers/met_form.php';
     205                        return new BVMetFormHandler($this->form_id, $this->bypass_params);
     206                case 'JetFormBuilderForm':
     207                        require_once dirname(__FILE__) . '/handlers/jet_form_builder_form.php';
     208                        return new BVJetFormBuilderFormHandler($this->form_id, $this->bypass_params);
     209                case 'SureForm':
     210                        require_once dirname(__FILE__) . '/handlers/sure_form.php';
     211                        return new BVSureFormHandler($this->form_id, $this->bypass_params);
     212                case 'JetpackForm':
     213                        require_once dirname(__FILE__) . '/handlers/jetpack_form.php';
     214                        return new BVJetpackFormHandler($this->form_id, $this->bypass_params);
     215                case 'SpectraForm':
     216                        require_once dirname(__FILE__) . '/handlers/spectra_form.php';
     217                        return new BVSpectraFormHandler($this->form_id, $this->bypass_params);
     218                case 'KadenceForm':
     219                        require_once dirname(__FILE__) . '/handlers/kadence_form.php';
     220                        return new BVKadenceFormHandler($this->form_id, $this->bypass_params);
     221                case 'BeaverBuilderForm':
     222                        require_once dirname(__FILE__) . '/handlers/beaver_builder_form.php';
     223                        return new BVBeaverBuilderFormHandler($this->form_id, $this->bypass_params);
     224                case 'AvadaForm':
     225                        require_once dirname(__FILE__) . '/handlers/avada_form.php';
     226                        return new BVAvadaFormHandler($this->form_id, $this->bypass_params);
     227                case 'MailPoetForm':
     228                        require_once dirname(__FILE__) . '/handlers/mail_poet_form.php';
     229                        return new BVMailPoetFormHandler($this->form_id, $this->bypass_params);
     230                case 'Mc4wpForm':
     231                        require_once dirname(__FILE__) . '/handlers/mc4wp_form.php';
     232                        return new BVMc4wpFormHandler($this->form_id, $this->bypass_params);
     233                case 'JetEngineForm':
     234                        require_once dirname(__FILE__) . '/handlers/jet_engine_form.php';
     235                        return new BVJetEngineFormHandler($this->form_id, $this->bypass_params);
    61236                default:
    62237                        return null;
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/contact_form7.php

    r3220024 r3813747  
    2424
    2525        private function bypassCaptcha() {
     26                // Spam check: reCAPTCHA v3, Turnstile, Akismet, disallowed list.
    2627                add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX);
     28
     29                // Quiz and Really Simple CAPTCHA are validated per field instead. Their answers are tied to a
     30                // random question or a single-use image, so unhook their validators just before they run.
     31                add_filter('wpcf7_validate_quiz', array($this, 'skipQuizValidation'), 9, 1);
     32                add_filter('wpcf7_validate_captchar', array($this, 'skipCaptchaValidation'), 9, 1);
     33        }
     34
     35        public function skipQuizValidation($result) {
     36                remove_filter('wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10);
     37                return $result;
     38        }
     39
     40        public function skipCaptchaValidation($result) {
     41                remove_filter('wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10);
     42                return $result;
    2743        }
    2844
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/formidable_form.php

    r3220024 r3813747  
    1414
    1515        public function bypass() {
     16                // Report spam as an error instead of silently saving a spam entry behind a success message.
     17                add_filter('frm_save_spam_entry', '__return_false', PHP_INT_MAX);
     18
    1619                if (array_key_exists('should_bypass_captcha', $this->bypass_params)) {
    1720                        $this->bypassCaptcha();
    … …  
    2427
    2528        public function bypassCaptcha() {
    26                 add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX);
     29                // Only the captcha field: Formidable Pro also uses this filter for conditional logic on every field.
     30                add_filter('frm_is_field_hidden', array($this, 'hideCaptchaField'), PHP_INT_MAX, 2);
     31                // Anti-spam a direct test POST can't pass: the JavaScript token and the honeypot.
     32                add_filter('frm_run_antispam', '__return_false', PHP_INT_MAX);
     33                add_filter('frm_run_honeypot', '__return_false', PHP_INT_MAX);
     34        }
     35
     36        public function hideCaptchaField($is_hidden, $field) {
     37                $type = is_array($field) ? (isset($field['type']) ? $field['type'] : '') : (isset($field->type) ? $field->type : '');
     38                return ($type === 'captcha') ? true : $is_hidden;
    2739        }
    2840
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/forminator_form.php

    r3220024 r3813747  
    77        private $form_id;
    88        private $bypass_params = array();
     9        private $captcha_endpoints = array();
     10        private $created_posts = array();
     11        private $created_attachments = array();
    912
    1013        public function __construct($form_id, $bypass_params) {
    … …  
    2124                        $this->bypassEmail();
    2225                }
     26
     27                $this->allowPollTestVotes();
     28                $this->discardPostDataPosts();
    2329        }
    2430
     31        private function isTestedModule($module_id) {
     32                return (string) $module_id === (string) $this->form_id;
     33        }
     34
     35        /**
     36         * Forminator verifies reCAPTCHA (v2 checkbox, v2 invisible, v3), hCaptcha and Turnstile tokens with
     37         * Forminator_Captcha_Verification::verify(), a wp_remote_request() to the provider's siteverify URL that
     38         * it passes through the forminator_<provider>_verify_endpoint filter. We note that URL and answer the
     39         * request ourselves with a passing verdict, so only Forminator's own verification is affected.
     40         */
    2541        public function bypassCaptcha() {
     42                foreach (array('recaptcha', 'hcaptcha', 'turnstile') as $provider) {
     43                        add_filter("forminator_{$provider}_verify_endpoint", function ($endpoint) use ($provider) {
     44                                if (is_string($endpoint) && $endpoint !== '') {
     45                                        $this->captcha_endpoints[$endpoint] = $provider;
     46                                }
     47                                return $endpoint;
     48                        }, PHP_INT_MAX);
     49                }
     50                add_filter('pre_http_request', array($this, 'stubCaptchaVerification'), PHP_INT_MAX - 1, 3);
     51
     52                // Forminator before 1.58 skipped its captcha check while a Stripe field was hidden.
     53                // From 1.58 a hidden Stripe field means "verify the payment token", which needs a token we don't have.
     54                $this->whenForminatorLoaded(function () {
     55                        if (defined('FORMINATOR_VERSION') && version_compare(FORMINATOR_VERSION, '1.58.0', '<')) {
     56                                $this->markStripeHidden();
     57                        }
     58                });
     59        }
     60
     61        public function stubCaptchaVerification($preempt, $args, $url) {
     62                if ($preempt !== false || !is_string($url) || !isset($this->captcha_endpoints[$url])) {
     63                        return $preempt;
     64                }
     65
     66                $verdict = array('success' => true, 'hostname' => BVFormTestRecorder::parseUrl(home_url(), PHP_URL_HOST));
     67                // Only reCAPTCHA v3 checks a score, and it wants a high one.
     68                if ($this->captcha_endpoints[$url] === 'recaptcha') {
     69                        $verdict['score'] = 1.0;
     70                }
     71
     72                return array(
     73                        'headers' => array(),
     74                        'body' => BVFormTestRecorder::jsonEncode($verdict),
     75                        'response' => array('code' => 200, 'message' => 'OK'),
     76                        'cookies' => array(),
     77                        'filename' => null
     78                );
     79        }
     80
     81        private function markStripeHidden() {
    2682                if (defined('WP_PLUGIN_DIR')) {
    2783                        $abstract_front_action_file_path = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php';
    … …  
    45101                }
    46102        }
     103
     104        /**
     105         * Polls accept one vote per IP (or browser cookie). A test vote must neither be refused because an
     106         * earlier test voted, nor lock the poll for the monitoring server's IP: we let the test vote through
     107         * and don't store the voter IP with it.
     108         */
     109        private function allowPollTestVotes() {
     110                add_filter('forminator_poll_handle_form_user_can_vote', function ($can_vote, $poll_id) {
     111                        return $this->isTestedModule($poll_id) ? true : $can_vote;
     112                }, PHP_INT_MAX, 2);
     113
     114                // Forminator also blocks the voter's IP for a few seconds after a vote; lift that block for a test vote.
     115                add_action('forminator_polls_submit_before_set_fields', function ($entry, $poll_id) {
     116                        if ($this->isTestedModule($poll_id)) {
     117                                add_action('shutdown', function () use ($poll_id) {
     118                                        $this->clearPollVoteLock($poll_id);
     119                                }, 0);
     120                        }
     121                }, PHP_INT_MAX, 2);
     122
     123                add_filter('forminator_polls_submit_field_data', function ($field_data, $poll_id) {
     124                        if (!$this->isTestedModule($poll_id) || !is_array($field_data)) {
     125                                return $field_data;
     126                        }
     127                        return array_values(array_filter($field_data, function ($item) {
     128                                return !(is_array($item) && isset($item['name']) && $item['name'] === '_forminator_user_ip');
     129                        }));
     130                }, PHP_INT_MAX, 2);
     131        }
     132
     133        private function clearPollVoteLock($poll_id) {
     134                if (!class_exists('Forminator_Geo') || !method_exists('Forminator_Geo', 'get_user_ip')) {
     135                        return;
     136                }
     137                $user_ip = Forminator_Geo::get_user_ip();
     138                delete_transient('forminator_request_from_ip_' . $poll_id . '_' . $user_ip);
     139                delete_option('forminator_poll_ip_lock_' . $poll_id . '_' . md5($user_ip));
     140        }
     141
     142        /**
     143         * A Post Data field creates a post. For a test submission it is created as a draft (never published,
     144         * so no publish notifications or auto-sharing) and deleted, with any featured image uploaded by the
     145         * submission, once the request ends.
     146         */
     147        private function discardPostDataPosts() {
     148                add_filter('forminator_post_data_post_info', function ($post) {
     149                        if ($this->isCurrentForm() && is_array($post)) {
     150                                $post['post_status'] = 'draft';
     151                        }
     152                        return $post;
     153                }, PHP_INT_MAX);
     154
     155                add_action('forminator_post_data_field_post_saved', function ($post_id) {
     156                        if ($this->isCurrentForm()) {
     157                                $this->created_posts[] = absint($post_id);
     158                        }
     159                }, PHP_INT_MAX);
     160
     161                add_action('add_attachment', function ($attachment_id) {
     162                        if ($this->isCurrentForm()) {
     163                                $this->created_attachments[] = absint($attachment_id);
     164                        }
     165                }, PHP_INT_MAX);
     166
     167                add_action('shutdown', array($this, 'deleteCreatedPosts'), 0);
     168        }
     169
     170        private function isCurrentForm() {
     171                return class_exists('Forminator_CForm_Front_Action') && isset(Forminator_CForm_Front_Action::$module_id) &&
     172                                $this->isTestedModule(Forminator_CForm_Front_Action::$module_id);
     173        }
     174
     175        public function deleteCreatedPosts() {
     176                foreach ($this->created_posts as $post_id) {
     177                        $post = get_post($post_id);
     178                        if ($post_id === 0 || !$post || $post->post_status !== 'draft') {
     179                                continue;
     180                        }
     181                        $thumbnail_id = (int) get_post_thumbnail_id($post_id);
     182                        if ($thumbnail_id > 0 && in_array($thumbnail_id, $this->created_attachments, true)) {
     183                                wp_delete_attachment($thumbnail_id, true);
     184                        }
     185                        wp_delete_post($post_id, true);
     186                }
     187                $this->created_posts = array();
     188        }
     189
     190        private function whenForminatorLoaded($callback) {
     191                if (did_action('plugins_loaded')) {
     192                        call_user_func($callback);
     193                } else {
     194                        add_action('plugins_loaded', $callback, PHP_INT_MIN);
     195                }
     196        }
    47197}
    48198
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/gravity_form.php

    r3220024 r3813747  
    2121                        $this->bypassEmail();
    2222                }
     23
     24                $this->bypassContentCreation();
     25                $this->keepSideEffectsInRequest();
     26                $this->bypassTotalValidation();
     27        }
     28
     29        /**
     30         * Gravity Forms 2.10+ sends notifications from a background request by default (and add-ons may
     31         * process feeds in one), where the test's email suppression, mail capture and HTTP blocking are not
     32         * active. Process them within the test request instead.
     33         */
     34        public function keepSideEffectsInRequest() {
     35                if ($this->form_id === null) {
     36                        return;
     37                }
     38
     39                $form_id = absint($this->form_id);
     40                add_filter('gform_is_asynchronous_notifications_enabled_' . $form_id, '__return_false', PHP_INT_MAX);
     41                add_filter('gform_is_feed_asynchronous_' . $form_id, '__return_false', PHP_INT_MAX);
     42        }
     43
     44        /**
     45         * The Total field is filled by the browser from the pricing fields; Gravity Forms recalculates the
     46         * total when it saves the entry, so the submitted value is not compared for a test submission.
     47         */
     48        public function bypassTotalValidation() {
     49                if ($this->form_id === null) {
     50                        return;
     51                }
     52
     53                add_filter('gform_pre_validation_' . absint($this->form_id), function($form) {
     54                        foreach ($form['fields'] as &$field) {
     55                                if ($field->type === 'total') {
     56                                        $field->validateTotal = false;
     57                                }
     58                        }
     59                        return $form;
     60                }, PHP_INT_MAX);
     61        }
     62
     63        /**
     64         * A test submission must not create posts (Post fields) or WordPress users (User Registration add-on)
     65         * on the site. Advanced Post Creation feeds are skipped for the same reason.
     66         */
     67        public function bypassContentCreation() {
     68                if ($this->form_id === null) {
     69                        return;
     70                }
     71
     72                $form_id = absint($this->form_id);
     73                add_filter('gform_disable_post_creation_' . $form_id, '__return_true', PHP_INT_MAX);
     74                add_filter('gform_gravityformsuserregistration_pre_process_feeds_' . $form_id, '__return_empty_array', PHP_INT_MAX);
     75                add_filter('gform_gravityformsadvancedpostcreation_pre_process_feeds_' . $form_id, '__return_empty_array', PHP_INT_MAX);
    2376        }
    2477
    … …  
    3689                        return $form;
    3790                }, PHP_INT_MAX);
     91
     92                // Honeypot and the submission speed check (2.9.21+) mark a scripted submission as spam or abort it.
     93                add_filter('gform_pre_process_' . absint($this->form_id), function($form) {
     94                        if (is_array($form)) {
     95                                $form['enableHoneypot'] = false;
     96                                $form['enableSubmitSpeedCheck'] = false;
     97                        }
     98                        return $form;
     99                }, PHP_INT_MAX);
     100
     101                // Akismet (Gravity Forms' own integration) would mark the test entry as spam.
     102                add_filter('gform_akismet_enabled_' . absint($this->form_id), '__return_false', PHP_INT_MAX);
    38103        }
    39104
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/ninja_form.php

    r3220024 r3813747  
    2424
    2525        public function bypassCaptcha() {
     26                // Field captchas (reCAPTCHA v2, hCaptcha, Turnstile, the spam question): a null type skips the field's validation.
    2627                add_filter('ninja_forms_pre_validate_field_settings', function ($field_settings) {
    27                         if (isset($field_settings['type']) && in_array($field_settings['type'], ['recaptcha', 'spam'], true)) {
     28                        $captcha_types = array('recaptcha', 'recaptcha_v3', 'hcaptcha', 'turnstile', 'spam');
     29                        if (isset($field_settings['type']) && in_array($field_settings['type'], $captcha_types, true)) {
    2830                                $field_settings['type'] = null;
    2931                        }
    … …  
    3133                }, PHP_INT_MAX);
    3234
     35                // reCAPTCHA v3 is a form action (type "recaptcha") that verifies the injected token.
    3336                add_filter('ninja_forms_run_action_type_recaptcha', '__return_false', PHP_INT_MAX);
    3437        }
  • blogvault-real-time-backup/tags/6.85/form_testing/handlers/wp_form.php

    r3220024 r3813747  
    44if (!class_exists('BVWPFormHandler')) :
    55
     6// WPForms (Lite and Pro): CAPTCHA, anti-spam, email and upload handling for the tested form in a signed test request.
    67class BVWPFormHandler {
    78        private $form_id;
    … …  
    2122                        $this->bypassEmail();
    2223                }
     24
     25                $this->sendEmailsInRequest();
     26                $this->acceptModernUploads();
     27                $this->skipMediaLibrary();
    2328        }
    2429
    2530        public function bypassCaptcha() {
    2631                add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX);
     32                add_filter('wpforms_process_antispam', '__return_true', PHP_INT_MAX);
     33                add_filter('wpforms_process_honeypot', '__return_false', PHP_INT_MAX);
     34                add_filter('wpforms_process_anti_spam_honeypot_bypass', '__return_true', PHP_INT_MAX);
     35                add_filter('wpforms_process_anti_spam_direct_post_bypass', '__return_true', PHP_INT_MAX);
     36                $form_id = (string) $this->form_id;
     37                // Custom Captcha addon: validated as field type "captcha" (wpforms_process_validate_captcha).
     38                add_action('wpforms_process_validate_captcha', function ($field_id, $field_submit, $form_data) use ($form_id) {
     39                        if (!is_array($form_data) || !isset($form_data['id']) || (string) $form_data['id'] !== $form_id || !function_exists('wpforms')) {
     40                                return;
     41                        }
     42                        $process = wpforms()->get('process');
     43                        if (is_object($process) && isset($process->errors[$form_data['id']][$field_id])) {
     44                                unset($process->errors[$form_data['id']][$field_id]);
     45                        }
     46                }, PHP_INT_MAX, 3);
    2747        }
    2848
    … …  
    3050                add_filter('wpforms_entry_email', '__return_false', PHP_INT_MAX);
    3151        }
     52
     53        /**
     54         * With "Optimize Email Sending" (setting email-async), WPForms 1.8.5+ queues each notification as an Action
     55         * Scheduler task that a later request sends, outside test mode: a real email that mail capture never sees. Send
     56         * the tested form's notifications in this request instead.
     57         */
     58        public function sendEmailsInRequest() {
     59                $form_id = (string) $this->form_id;
     60                add_filter('wpforms_tasks_entry_emails_trigger_send_same_process', function ($same_process, $fields = array(), $entry = array(), $form_data = array()) use ($form_id) {
     61                        if ($form_id === '' || (is_array($form_data) && isset($form_data['id']) && (string) $form_data['id'] === $form_id)) {
     62                                return true;
     63                        }
     64                        return $same_process;
     65                }, PHP_INT_MAX, 4);
     66        }
     67
     68        public function skipMediaLibrary() {
     69                $form_id = (string) $this->form_id;
     70                add_filter('wpforms_process_before_form_data', function ($form_data) use ($form_id) {
     71                        if (!is_array($form_data) || !isset($form_data['id'], $form_data['fields']) || (string) $form_data['id'] !== $form_id || !is_array($form_data['fields'])) {
     72                                return $form_data;
     73                        }
     74                        foreach ($form_data['fields'] as $key => $field) {
     75                                if (is_array($field) && isset($field['type']) && in_array($field['type'], array('file-upload', 'camera'), true) && !empty($field['media_library'])) {
     76                                        $form_data['fields'][$key]['media_library'] = '0';
     77                                }
     78                        }
     79                        return $form_data;
     80                }, PHP_INT_MAX, 1);
     81        }
     82
     83        public function acceptModernUploads() {
     84                $form_id = (string) $this->form_id;
     85                add_action('wpforms_process_before', function ($entry, $form_data) use ($form_id) {
     86                        if (!is_array($form_data) || !isset($form_data['id'], $form_data['fields']) || (string) $form_data['id'] !== $form_id ||
     87                                        empty($_FILES) || !function_exists('wpforms_upload_dir')) {
     88                                return;
     89                        }
     90                        foreach ((array) $form_data['fields'] as $field) {
     91                                if (is_array($field) && isset($field['type'], $field['id'], $field['style']) && $field['type'] === 'file-upload' && $field['style'] === 'modern') {
     92                                        BVWPFormHandler::storeModernUpload(sprintf('wpforms_%d_%d', absint($form_data['id']), absint($field['id'])), $field);
     93                                }
     94                        }
     95                }, 1, 2);
     96        }
     97
     98        /**
     99         * Extensions WPForms refuses whatever the site allows (WPForms FileMethodsTrait::$denylist, plus the other PHP
     100         * extensions servers may run).
     101         */
     102        private static $denied_extensions = array(
     103                'ade', 'adp', 'app', 'asp', 'bas', 'bat', 'cer', 'cgi', 'chm', 'cmd', 'com', 'cpl', 'crt', 'csh', 'csr', 'dfxp',
     104                'dll', 'drv', 'exe', 'flv', 'fxp', 'hlp', 'hta', 'htaccess', 'htm', 'html', 'htpasswd', 'inf', 'ins', 'isp',
     105                'jar', 'js', 'jse', 'jsp', 'ksh', 'lnk', 'mdb', 'mde', 'mdt', 'mdw', 'msc', 'msi', 'msp', 'mst', 'onetmp', 'ops',
     106                'pcd', 'phar', 'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'pht', 'phtml', 'pif', 'pl', 'prg', 'ps1', 'ps2',
     107                'py', 'rb', 'reg', 'scr', 'sct', 'sh', 'shb', 'shs', 'swf', 'sys', 'tmp', 'torrent', 'url', 'vb', 'vbe', 'vbs',
     108                'vbscript', 'wsc', 'wsf', 'wsh'
     109        );
     110
     111        /**
     112         * The extensions a file upload field accepts, as WPForms works them out: the field's list (all when empty),
     113         * limited to the file types WordPress allows, without the denied extensions.
     114         */
     115        public static function allowedExtensions($field) {
     116                $allowed = array();
     117                foreach (array_keys(get_allowed_mime_types()) as $extensions) {
     118                        foreach (explode('|', $extensions) as $extension) {
     119                                $allowed[] = strtolower($extension);
     120                        }
     121                }
     122                $allowed = array_diff($allowed, self::$denied_extensions);
     123                if (is_array($field) && !empty($field['extensions']) && is_string($field['extensions'])) {
     124                        $listed = array();
     125                        foreach (explode(',', $field['extensions']) as $extension) {
     126                                $listed[] = strtolower(preg_replace('/[^A-Za-z0-9_-]/', '', $extension));
     127                        }
     128                        $allowed = array_intersect($allowed, $listed);
     129                }
     130                return array_values(array_unique($allowed));
     131        }
     132
     133        /**
     134         * Moves one posted file of a modern upload field into the WPForms tmp folder and posts its JSON description.
     135         * A file whose extension or type the field doesn't accept is left out, and stays in PHP's upload folder (deleted
     136         * when the request ends), so WPForms reports the field as empty or required. A file moved into the tmp folder that
     137         * WPForms doesn't take into the form's folder is deleted when the request ends.
     138         */
     139        public static function storeModernUpload($input_name, $field) {
     140                // phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput
     141                if (!empty($_POST[$input_name]) || !isset($_FILES[$input_name]['tmp_name'], $_FILES[$input_name]['name'], $_FILES[$input_name]['error']) ||
     142                                !is_string($_FILES[$input_name]['tmp_name']) || !is_string($_FILES[$input_name]['name']) ||
     143                                (int) $_FILES[$input_name]['error'] !== UPLOAD_ERR_OK || !is_uploaded_file($_FILES[$input_name]['tmp_name'])) {
     144                        return;
     145                }
     146                $file = $_FILES[$input_name];
     147                unset($_FILES[$input_name]);
     148                // phpcs:enable
     149
     150                $name = sanitize_file_name(wp_unslash($file['name']));
     151                $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
     152                if ($name === '' || $extension === '' || !in_array($extension, self::allowedExtensions($field), true)) {
     153                        return;
     154                }
     155                // WordPress's own check of the name against the content (images are sniffed): refused when it finds no
     156                // allowed type, or when it would rename the file.
     157                $filetype = wp_check_filetype_and_ext($file['tmp_name'], $name);
     158                if (empty($filetype['ext']) || empty($filetype['type']) || !empty($filetype['proper_filename']) ||
     159                                strtolower($filetype['ext']) !== $extension) {
     160                        return;
     161                }
     162
     163                $upload_dir = wpforms_upload_dir();
     164                if (!is_array($upload_dir) || empty($upload_dir['path']) || empty($upload_dir['url'])) {
     165                        return;
     166                }
     167                $tmp_dir = $upload_dir['path'] . '/tmp';
     168                if (!wp_mkdir_p($tmp_dir)) {
     169                        return;
     170                }
     171                $tmp_name = wp_hash(wp_rand() . microtime() . $input_name) . '.' . $extension;
     172                $tmp_path = $tmp_dir . '/' . $tmp_name;
     173                if (!move_uploaded_file($file['tmp_name'], $tmp_path)) {
     174                        return;
     175                }
     176                // WPForms moves the file out of the tmp folder when the entry is saved; anything left is a failed submission.
     177                add_action('shutdown', function () use ($tmp_path) {
     178                        if (is_file($tmp_path)) {
     179                                BVFormTestRecorder::deleteFile($tmp_path);
     180                        }
     181                });
     182                if (function_exists('wpforms_sanitize_svg_file') && !wpforms_sanitize_svg_file($tmp_path)) {
     183                        BVFormTestRecorder::deleteFile($tmp_path);
     184                        return;
     185                }
     186
     187                $_POST[$input_name] = wp_slash(BVFormTestRecorder::jsonEncode(array(array(
     188                        'name' => $name,
     189                        'file' => $tmp_name,
     190                        'url' => $upload_dir['url'] . '/tmp/' . $tmp_name,
     191                        'size' => filesize($tmp_path),
     192                        'type' => $filetype['type'],
     193                        'file_user_name' => $name
     194                ))));
     195        }
    32196}
    33197
  • blogvault-real-time-backup/tags/6.85/info.php

    r3795700 r3813747  
    1212                public $brand_option = 'bv_whitelabel_infos';
    1313                public $wp_lp_whitelabel_option = 'bvLpWhitelabelConf';
    14                 public $version = '6.83';
     14                public $version = '6.85';
    1515                public $webpage = 'https://blogvault.net';
    1616                public $appurl = 'https://app.blogvault.net';
  • blogvault-real-time-backup/tags/6.85/protect/fw.php

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

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectFWRule_V683')) :
    5 class BVProtectFWRule_V683 {
     4if (!class_exists('BVProtectFWRule_V685')) :
     5class BVProtectFWRule_V685 {
    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'] > BVProtectFWRuleEngine_V683::VERSION) {
     107                                $attributes['min_rule_engine_ver'] > BVProtectFWRuleEngine_V685::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'] < BVProtectFWRuleEngine_V683::VERSION)) {
     113                                $attributes['max_rule_engine_ver'] < BVProtectFWRuleEngine_V685::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'] = BVProtectFWRule_V683::EXE_ON_BOOT;
     132                                $attributes['execute_on'] = BVProtectFWRule_V685::EXE_ON_BOOT;
    133133                        } else {
    134134                                return false;
    … …  
    136136                }
    137137
    138                 return new BVProtectFWRule_V683($attributes);
     138                return new BVProtectFWRule_V685($attributes);
    139139        }
    140140
    141141        public function isExeOnBoot() {
    142                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_BOOT);
     142                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_BOOT);
    143143        }
    144144
    145145        public function isExeOnPreUpdateOption() {
    146                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_PRE_UPDATE_OPTION);
     146                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_PRE_UPDATE_OPTION);
    147147        }
    148148
    149149        public function isExeOnPreDeletePost() {
    150                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_PRE_DELETE_POST);
     150                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_PRE_DELETE_POST);
    151151        }
    152152
    153153        public function isExeOnWPInsertPostEmptyContent() {
    154                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
     154                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_WP_INSERT_POST_EMPTY_CONTENT);
    155155        }
    156156
    157157        public function isExeOnInsertUserMeta() {
    158                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_INSERT_USER_META);
     158                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_INSERT_USER_META);
    159159        }
    160160
    161161        public function isExeOnDeleteOption() {
    162                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_DELETE_OPTION);
     162                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_DELETE_OPTION);
    163163        }
    164164
    165165        public function isExeOnDeleteUser() {
    166                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_DELETE_USER);
     166                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_DELETE_USER);
    167167        }
    168168
    169169        public function isExeOnPasswordReset() {
    170                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_PASSWORD_RESET);
     170                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_PASSWORD_RESET);
    171171        }
    172172
    173173        public function isExeOnSendAuthCookies() {
    174                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_SEND_AUTH_COOKIES);
     174                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_SEND_AUTH_COOKIES);
    175175        }
    176176
    177177        public function isExeOnSetAuthCookie() {
    178                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_SET_AUTH_COOKIE);
     178                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_SET_AUTH_COOKIE);
    179179        }
    180180
    181181        public function isExeOnInit() {
    182                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_INIT);
     182                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_INIT);
    183183        }
    184184
    185185        public function isExeOnUserRegister() {
    186                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_USER_REGISTER);
     186                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_USER_REGISTER);
    187187        }
    188188
    189189        public function isExeOnAddUserMeta() {
    190                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_ADD_USER_META);
     190                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_ADD_USER_META);
    191191        }
    192192
    193193        public function isExeOnUpdateUserMetadata() {
    194                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_UPDATE_USER_METADATA);
     194                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_UPDATE_USER_METADATA);
    195195        }
    196196
    197197        public function isExeOnUpdateUserMeta() {
    198                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_UPDATE_USER_META);
     198                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_UPDATE_USER_META);
    199199        }
    200200
    201201        public function isExeOnAddOption() {
    202                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_ADD_OPTION);
     202                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_ADD_OPTION);
    203203        }
    204204
    205205        public function isExeOnWpPreInsertUserData() {
    206                 return ($this->execute_on === BVProtectFWRule_V683::EXE_ON_WP_PRE_INSERT_USER_DATA);
     206                return ($this->execute_on === BVProtectFWRule_V685::EXE_ON_WP_PRE_INSERT_USER_DATA);
    207207        }
    208208}
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/engine.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('BVProtectFWRuleEngine_V683')) :
     5if (!class_exists('BVProtectFWRuleEngine_V685')) :
    66require_once dirname( __FILE__ ) . '/functions.php';
    77
    8 class BVProtectFWRuleEngine_V683 {
    9         use BVProtectFWRuleStringFunc_V683;
    10         use BVProtectFWRuleArrayFunc_V683;
    11         use BVProtectFWRuleMiscFunc_V683;
    12         use BVProtectFWRuleRequestFunc_V683;
    13         use BVProtectFWRuleWPFunc_V683;
     8class BVProtectFWRuleEngine_V685 {
     9        use BVProtectFWRuleStringFunc_V685;
     10        use BVProtectFWRuleArrayFunc_V685;
     11        use BVProtectFWRuleMiscFunc_V685;
     12        use BVProtectFWRuleRequestFunc_V685;
     13        use BVProtectFWRuleWPFunc_V685;
    1414
    1515        private $request;
    … …  
    2626        const WILDCARD_KEY = '*';
    2727        const FUNC_NAME_PREFIX = '_rf_';
    28         const CONST_NAME_PREFIX = 'BVProtectFWRule_V683::';
     28        const CONST_NAME_PREFIX = 'BVProtectFWRule_V685::';
    2929        const ALLOWED_EXT_CONSTANTS = [
    3030                'DOING_CRON'
    … …  
    5353                try {
    5454                        return $this->executeStmt($rule->logic);
    55                 } catch (BVProtectRuleError_V683 $e) {
     55                } catch (BVProtectRuleError_V685 $e) {
    5656                        $this->error = $e;
    5757                }
    … …  
    124124        private function getValue($stmt) {
    125125                if (!is_array($stmt) || empty($stmt["type"])) {
    126                         throw new BVProtectRuleError_V683(
     126                        throw new BVProtectRuleError_V685(
    127127                                $this->addExState("InvalidStatementError: Malformed value statement"));
    128128                }
    … …  
    133133                case "NUMBER":
    134134                        if (!isset($stmt["value"]) || !is_int($stmt["value"])) {
    135                                 throw new BVProtectRuleError_V683(
     135                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     143                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     151                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     159                                throw new BVProtectRuleError_V685(
    160160                                        $this->addExState("TypeError: Invalid constant name")
    161161                                );
    … …  
    169169
    170170                        if (!defined($name)) {
    171                                 throw new BVProtectRuleError_V683(
     171                                throw new BVProtectRuleError_V685(
    172172                                        $this->addExState("TypeError: Undefined constant" . $stmt["value"])
    173173                                );
    … …  
    177177                case "ARRAY":
    178178                        if (!isset($stmt["value"]) || !is_array($stmt["value"])) {
    179                                 throw new BVProtectRuleError_V683(
     179                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     210                        throw new BVProtectRuleError_V685(
    211211                                $this->addExState("InvalidStatementError: Malformed logic statement")
    212212                        );
    … …  
    220220                case "AND":
    221221                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    222                                 throw new BVProtectRuleError_V683(
     222                                throw new BVProtectRuleError_V685(
    223223                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    224224                                );
    … …  
    229229                case "OR":
    230230                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    231                                 throw new BVProtectRuleError_V683(
     231                                throw new BVProtectRuleError_V685(
    232232                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    233233                                );
    … …  
    238238                case "NOT":
    239239                        if (empty($stmt["value"])) {
    240                                 throw new BVProtectRuleError_V683(
     240                                throw new BVProtectRuleError_V685(
    241241                                        $this->addExState("InvalidOperandError: Malformed operand")
    242242                                );
    … …  
    247247                case "FUNCTION":
    248248                        if (empty($stmt["name"]) || !is_string($stmt["name"])) {
    249                                 throw new BVProtectRuleError_V683(
     249                                throw new BVProtectRuleError_V685(
    250250                                        $this->addExState("InvalidFunctionName: Malformed name")
    251251                                );
    … …  
    256256
    257257                        if (!is_callable($handler)) {
    258                                 throw new BVProtectRuleError_V683(
     258                                throw new BVProtectRuleError_V685(
    259259                                        $this->addExState("UndefinedFunctionCall: " . $stmt["name"])
    260260                                );
    … …  
    262262
    263263                        if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) {
    264                                 throw new BVProtectRuleError_V683(
     264                                throw new BVProtectRuleError_V685(
    265265                                        $this->addExState("InvalidArguments: Malformed args")
    266266                                );
    … …  
    275275                        break;
    276276                default:
    277                         throw new BVProtectRuleError_V683(
     277                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     288                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     295                                throw new BVProtectRuleError_V685(
    296296                                        $this->addExState("InvalidParamType: " . $pos)
    297297                                );
    … …  
    301301                        case "string":
    302302                                if (!isset($args[$pos]) || !is_string($args[$pos])) {
    303                                         throw new BVProtectRuleError_V683(
     303                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     310                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     317                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     324                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     331                                        throw new BVProtectRuleError_V685(
    332332                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.")
    333333                                        );
    … …  
    337337                                break;
    338338                        default:
    339                                 throw new BVProtectRuleError_V683(
     339                                throw new BVProtectRuleError_V685(
    340340                                        $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name)
    341341                                );
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/errors.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectRuleError_V683')) :
    5 class BVProtectRuleError_V683 extends Exception {
     4if (!class_exists('BVProtectRuleError_V685')) :
     5class BVProtectRuleError_V685 extends Exception {
    66//Root rule error class.
    77}
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/functions/array.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleArrayFunc_V683')) :
    6 trait BVProtectFWRuleArrayFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleArrayFunc_V685')) :
     6trait BVProtectFWRuleArrayFunc_V685 {
    77        private function _rf_inArray() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1717
    1818                if (!is_array($array)) {
    19                         throw new BVProtectRuleError_V683(
     19                        throw new BVProtectRuleError_V685(
    2020                                $this->addExState("inArray: 2nd param is not an array")
    2121                        );
    … …  
    2323
    2424                if (!is_bool($strict)) {
    25                         throw new BVProtectRuleError_V683(
     25                        throw new BVProtectRuleError_V685(
    2626                                $this->addExState("inArray: 3rd param is not a boolean")
    2727                        );
    … …  
    5454                        }
    5555                } else {
    56                         throw new BVProtectRuleError_V683(
     56                        throw new BVProtectRuleError_V685(
    5757                                $this->addExState("recInArray: Expects an array")
    5858                        );
    … …  
    7373
    7474                if (!is_array($array)) {
    75                         throw new BVProtectRuleError_V683(
     75                        throw new BVProtectRuleError_V685(
    7676                                $this->addExState("arrayKeyExists: Array must be of type array")
    7777                        );
    7878                } elseif (!is_string($key) && !is_int($key)) {
    79                         throw new BVProtectRuleError_V683(
     79                        throw new BVProtectRuleError_V685(
    8080                                $this->addExState("arrayKeyExists: Key must be of type string or int")
    8181                        );
    … …  
    110110
    111111                if (!is_bool($recursive)) {
    112                         throw new BVProtectRuleError_V683(
     112                        throw new BVProtectRuleError_V685(
    113113                                $this->addExState("getArrayKeys: 2nd param must be a boolean")
    114114                        );
    … …  
    140140
    141141                if (!is_bool($recursive)) {
    142                         throw new BVProtectRuleError_V683(
     142                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     150                                throw new BVProtectRuleError_V685(
    151151                                        $this->addExState("hasAnyArrayKey: Key must be of type string or int")
    152152                                );
    … …  
    189189
    190190                if (!is_bool($recursive)) {
    191                         throw new BVProtectRuleError_V683(
     191                        throw new BVProtectRuleError_V685(
    192192                                $this->addExState("keyMatches: 3rd param must be a boolean")
    193193                        );
    … …  
    224224
    225225                if ($resp === false) {
    226                         throw new BVProtectRuleError_V683(
     226                        throw new BVProtectRuleError_V685(
    227227                                $this->addExState("keyMatches: Invalid regular expression")
    228228                        );
    … …  
    233233                $resp = BVHelper::safePregMatch($pattern, (string) $key);
    234234                if ($resp === false) {
    235                         throw new BVProtectRuleError_V683(
     235                        throw new BVProtectRuleError_V685(
    236236                                $this->addExState("keyMatches: Regex match failed")
    237237                        );
    … …  
    242242
    243243        private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) {
    244                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     244                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    245245                        return false;
    246246                }
    … …  
    262262
    263263        private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) {
    264                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     264                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    265265                        return;
    266266                }
    … …  
    277277
    278278        private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) {
    279                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     279                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    280280                        return false;
    281281                }
    … …  
    297297
    298298        private function enforceArrayTraversalLimit($func_name, $traversed_keys) {
    299                 if ($traversed_keys > BVProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) {
    300                         throw new BVProtectRuleError_V683(
     299                if ($traversed_keys > BVProtectFWRuleEngine_V685::MAX_ARRAY_KEYS_TO_TRAVERSE) {
     300                        throw new BVProtectRuleError_V685(
    301301                                $this->addExState(
    302302                                        "TraversalLimitError: " . $func_name . " exceeded " .
    303                                         BVProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE .
     303                                        BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     323                                throw new BVProtectRuleError_V685(
    324324                                        $this->addExState("digArray: Keys must be a valid array of string, or integer type")
    325325                                );
    … …  
    342342
    343343                if (empty($keys)) {
    344                         throw new BVProtectRuleError_V683(
     344                        throw new BVProtectRuleError_V685(
    345345                                $this->addExState("digArrayValues: Keys must not be empty")
    346346                        );
    347347                }
    348348
    349                 if (count($keys) > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    350                         throw new BVProtectRuleError_V683(
     349                if (count($keys) > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     350                        throw new BVProtectRuleError_V685(
    351351                                $this->addExState(
    352352                                        "digArrayValues: Keys exceeded " .
    353                                         BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
     353                                        BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     361                                throw new BVProtectRuleError_V685(
    362362                                        $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type")
    363363                                );
    … …  
    376376                                }
    377377
    378                                 if ($key === BVProtectFWRuleEngine_V683::WILDCARD_KEY) {
     378                                if ($key === BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     419                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     440                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     521                                throw new BVProtectRuleError_V685(
    522522                                        $this->addExState("arrayJoin: Array element must be of scalar type")
    523523                                );
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/functions/misc.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleMiscFunc_V683')) :
    6 trait BVProtectFWRuleMiscFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleMiscFunc_V685')) :
     6trait BVProtectFWRuleMiscFunc_V685 {
    77        private function _rf_isTrue() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    7373
    7474                if (!array_key_exists($name, $this->variables)) {
    75                         throw new BVProtectRuleError_V683(
     75                        throw new BVProtectRuleError_V685(
    7676                                $this->addExState("UndefinedVariableError: " . $name . " is not defined.")
    7777                        );
    … …  
    134134                $resp = BVHelper::safePregMatch((string) $pattern, (string) $subject);
    135135                if ($resp === false) {
    136                         throw new BVProtectRuleError_V683(
     136                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     177                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     203                        throw new BVProtectRuleError_V685(
    204204                                $this->addExState("preg_match_all: " . serialize($subject))
    205205                        );
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/functions/request.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleRequestFunc_V683')) :
    6 trait BVProtectFWRuleRequestFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleRequestFunc_V685')) :
     6trait BVProtectFWRuleRequestFunc_V685 {
    77        private function _rf_getAction() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    496496
    497497                if (!array_key_exists('ID', $user)) {
    498                         throw new BVProtectRuleError_V683(
     498                        throw new BVProtectRuleError_V685(
    499499                                $this->addExState("wpUserId: user's id doesn't exist")
    500500                        );
  • blogvault-real-time-backup/tags/6.85/protect/fw/rule/functions/string.php

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

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

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectIpstore_V683')) :
     4if (!class_exists('BVProtectIpstore_V685')) :
    55require_once dirname( __FILE__ ) . '/request.php';
    66require_once dirname( __FILE__ ) . '/ipstore/fs.php';
    77require_once dirname( __FILE__ ) . '/ipstore/db.php';
    88
    9 class BVProtectIpstore_V683 {
     9class BVProtectIpstore_V685 {
    1010        private $storage;
    1111        private $storage_type;
    … …  
    1414        const STORAGE_TYPE_DB = 1;
    1515
    16         function __construct($storage_type = BVProtectIpstore_V683::STORAGE_TYPE_DB) {
     16        function __construct($storage_type = BVProtectIpstore_V685::STORAGE_TYPE_DB) {
    1717                $this->storage_type = $storage_type;
    18                 if ($this->storage_type == BVProtectIpstore_V683::STORAGE_TYPE_FS) {
    19                         $this->storage = new BVProtectIpstoreFS_V683();
     18                if ($this->storage_type == BVProtectIpstore_V685::STORAGE_TYPE_FS) {
     19                        $this->storage = new BVProtectIpstoreFS_V685();
    2020                } else {
    21                         $this->storage = new BVProtectIpstoreDB_V683();
     21                        $this->storage = new BVProtectIpstoreDB_V685();
    2222                }
    2323        }
    2424
    2525        public static function uninstall() {
    26                 BVProtectIpstoreDB_V683::uninstall();
     26                BVProtectIpstoreDB_V685::uninstall();
    2727        }
    2828
    2929        public function isLPIPBlacklisted($ip) {
    30                 if ($this->storage_type == BVProtectIpstore_V683::STORAGE_TYPE_DB) {
     30                if ($this->storage_type == BVProtectIpstore_V685::STORAGE_TYPE_DB) {
    3131                        return $this->storage->isLPIPBlacklisted($ip);
    3232                }
    … …  
    3434
    3535        public function isLPIPWhitelisted($ip) {
    36                 if ($this->storage_type == BVProtectIpstore_V683::STORAGE_TYPE_DB) {
     36                if ($this->storage_type == BVProtectIpstore_V685::STORAGE_TYPE_DB) {
    3737                        return $this->storage->isLPIPWhitelisted($ip);
    3838                }
  • blogvault-real-time-backup/tags/6.85/protect/ipstore/db.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectIpstoreDB_V683')) :
    5 class BVProtectIpstoreDB_V683 {
     4if (!class_exists('BVProtectIpstoreDB_V685')) :
     5class BVProtectIpstoreDB_V685 {
    66                const TABLE_NAME = 'ip_store';
    77
    … …  
    1111                #XNOTE: check this.
    1212                public static function blacklistedTypes() {
    13                         return BVProtectRequest_V683::blacklistedCategories();
     13                        return BVProtectRequest_V685::blacklistedCategories();
    1414                }
    1515
    1616                public static function whitelistedTypes() {
    17                         return BVProtectRequest_V683::whitelistedCategories();
     17                        return BVProtectRequest_V685::whitelistedCategories();
    1818                }
    1919
    2020                public static function uninstall() {
    21                         BVProtect_V683::$db->dropBVTable(BVProtectIpstoreDB_V683::TABLE_NAME);
     21                        BVProtect_V685::$db->dropBVTable(BVProtectIpstoreDB_V685::TABLE_NAME);
    2222                }
    2323
    2424                public function isLPIPBlacklisted($ip) {
    25                         return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     25                        return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    2626                }
    2727
    2828                public function isLPIPWhitelisted($ip) {
    29                         return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     29                        return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    3030                }
    3131
    3232                public function getTypeIfBlacklistedIP($ip) {
    33                         return $this->getIPType($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     33                        return $this->getIPType($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    3434                }
    3535
    3636                public function isFWIPBlacklisted($ip) {
    37                         return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     37                        return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    3838                }
    3939
    4040                public function isFWIPWhitelisted($ip) {
    41                         return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     41                        return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    4242                }
    4343
    … …  
    5050                #XNOTE: getIPCategory or getIPType?
    5151                private function getIPType($ip, $types, $category) {
    52                         $table = BVProtect_V683::$db->getBVTable(BVProtectIpstoreDB_V683::TABLE_NAME);
     52                        $table = BVProtect_V685::$db->getBVTable(BVProtectIpstoreDB_V685::TABLE_NAME);
    5353
    54                         if (BVProtect_V683::$db->isTablePresent($table)) {
    55                                 $binIP = BVProtectUtils_V683::bvInetPton($ip);
    56                                 $is_v6 = BVProtectUtils_V683::isIPv6($ip);
     54                        if (BVProtect_V685::$db->isTablePresent($table)) {
     55                                $binIP = BVProtectUtils_V685::bvInetPton($ip);
     56                                $is_v6 = BVProtectUtils_V685::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 == BVProtectIpstoreDB_V683::CATEGORY_FW) {
     60                                        if ($category == BVProtectIpstoreDB_V685::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 = BVProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
     67                                        $query = BVProtect_V685::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
    6868
    69                                         return BVProtect_V683::$db->getVar($query, 5);
     69                                        return BVProtect_V685::$db->getVar($query, 5);
    7070                                }
    7171                        }
  • blogvault-real-time-backup/tags/6.85/protect/ipstore/fs.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectIpstoreFS_V683')) :
    5         class BVProtectIpstoreFS_V683 {
     4if (!class_exists('BVProtectIpstoreFS_V685')) :
     5        class BVProtectIpstoreFS_V685 {
    66                private $whitelisted_ips;
    77                private $blacklisted_ips;
    … …  
    1212                function __construct() {
    1313                        $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf';
    14                         $ips = BVProtectUtils_V683::parseFile($ip_store_file);
     14                        $ips = BVProtectUtils_V685::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, BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
     20                        return $this->getIPType($ip, BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED);
    2121                }
    2222
    2323                public function isFWIPBlacklisted($ip) {
    24                         return $this->checkIPPresent($ip, BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
     24                        return $this->checkIPPresent($ip, BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED);
    2525                }
    2626
    2727                public function isFWIPWhitelisted($ip) {
    28                         return $this->checkIPPresent($ip, BVProtectIpstoreFS_V683::IP_TYPE_WHITELISTED);
     28                        return $this->checkIPPresent($ip, BVProtectIpstoreFS_V685::IP_TYPE_WHITELISTED);
    2929                }
    3030
    … …  
    3737                private function getIPType($ip, $type) {
    3838                        switch ($type) {
    39                         case BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED:
     39                        case BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED:
    4040                                return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null;
    41                         case BVProtectIpstoreFS_V683::IP_TYPE_WHITELISTED:
     41                        case BVProtectIpstoreFS_V685::IP_TYPE_WHITELISTED:
    4242                                return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null;
    4343                        }
  • blogvault-real-time-backup/tags/6.85/protect/lib/utils.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectUtils_V683')) :
    5 class BVProtectUtils_V683 {
     4if (!class_exists('BVProtectUtils_V685')) :
     5class BVProtectUtils_V685 {
    66        public static function getIP($ip_header) {
    77                $ip = null;
    … …  
    131131                if (is_array($val)) {
    132132                        foreach ($val as $e) {
    133                                 $length += BVProtectUtils_V683::getLength($e);
     133                                $length += BVProtectUtils_V685::getLength($e);
    134134                        }
    135135
  • blogvault-real-time-backup/tags/6.85/protect/logger.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLogger_V683')) :
     4if (!class_exists('BVProtectLogger_V685')) :
    55require_once dirname( __FILE__ ) . '/logger/fs.php';
    66require_once dirname( __FILE__ ) . '/logger/db.php';
    77
    8 class BVProtectLogger_V683 {
     8class BVProtectLogger_V685 {
    99        private $log_destination;
    1010
    … …  
    1212        const TYPE_DB = 1;
    1313
    14         function __construct($name, $type = BVProtectLogger_V683::TYPE_DB) {
    15                 if ($type == BVProtectLogger_V683::TYPE_FS) {
    16                         $this->log_destination = new BVProtectLoggerFS_V683($name);
     14        function __construct($name, $type = BVProtectLogger_V685::TYPE_DB) {
     15                if ($type == BVProtectLogger_V685::TYPE_FS) {
     16                        $this->log_destination = new BVProtectLoggerFS_V685($name);
    1717                } else {
    18                         $this->log_destination = new BVProtectLoggerDB_V683($name);
     18                        $this->log_destination = new BVProtectLoggerDB_V685($name);
    1919                }
    2020        }
  • blogvault-real-time-backup/tags/6.85/protect/logger/db.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLoggerDB_V683')) :
    5 class BVProtectLoggerDB_V683 {
     4if (!class_exists('BVProtectLoggerDB_V685')) :
     5class BVProtectLoggerDB_V685 {
    66        private $tablename;
    77        private $bv_tablename;
    … …  
    1111        function __construct($tablename) {
    1212                $this->tablename = $tablename;
    13                 $this->bv_tablename = BVProtect_V683::$db->getBVTable($tablename);
     13                $this->bv_tablename = BVProtect_V685::$db->getBVTable($tablename);
    1414        }
    1515
    1616        public function log($data) {
    1717                if (is_array($data)) {
    18                         if (BVProtect_V683::$db->rowsCount($this->bv_tablename) > BVProtectLoggerDB_V683::MAXROWCOUNT) {
    19                                 BVProtect_V683::$db->deleteRowsFromtable($this->tablename, 1);
     18                        if (BVProtect_V685::$db->rowsCount($this->bv_tablename) > BVProtectLoggerDB_V685::MAXROWCOUNT) {
     19                                BVProtect_V685::$db->deleteRowsFromtable($this->tablename, 1);
    2020                        }
    2121
    22                         BVProtect_V683::$db->replaceIntoBVTable($this->tablename, $data);
     22                        BVProtect_V685::$db->replaceIntoBVTable($this->tablename, $data);
    2323                }
    2424        }
  • blogvault-real-time-backup/tags/6.85/protect/logger/fs.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLoggerFS_V683')) :
    5 class BVProtectLoggerFS_V683 {
     4if (!class_exists('BVProtectLoggerFS_V685')) :
     5class BVProtectLoggerFS_V685 {
    66        public $logFile;
    77
  • blogvault-real-time-backup/tags/6.85/protect/lp.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLP_V683')) :
    5 class BVProtectLP_V683 {
     4if (!class_exists('BVProtectLP_V685')) :
     5class BVProtectLP_V685 {
    66        private $ip;
    77        private $time;
    … …  
    1010        private $brand_name;
    1111
    12         private $mode              = BVProtectLP_V683::MODE_DISABLED;
     12        private $mode              = BVProtectLP_V685::MODE_DISABLED;
    1313        private $captcha_limit     = 3;
    1414        private $temp_block_limit  = 10;
    … …  
    1818        private $all_blocked_gap   = 1800;
    1919
    20         private $category          = BVProtectLP_V683::CATEGORY_ALLOWED;
     20        private $category          = BVProtectLP_V685::CATEGORY_ALLOWED;
    2121        private $username          = '';
    2222        private $message           = '';
    … …  
    4747                $this->ip = $request->getIP();
    4848                $this->brand_name = $brand_name;
    49                 $this->ipstore = new BVProtectIpstore_V683();
    50                 $this->logger = new BVProtectLogger_V683(BVProtectLP_V683::TABLE_NAME);
     49                $this->ipstore = new BVProtectIpstore_V685();
     50                $this->logger = new BVProtectLogger_V685(BVProtectLP_V685::TABLE_NAME);
    5151                $this->time = strtotime(gmdate("Y-m-d H:i:s"));
    5252
    … …  
    9191
    9292        public static function uninstall() {
    93                 BVProtect_V683::$db->dropBVTable(BVProtectLP_V683::TABLE_NAME);
     93                BVProtect_V685::$db->dropBVTable(BVProtectLP_V685::TABLE_NAME);
    9494        }
    9595
    … …  
    103103
    104104        private function getCaptchaLink() {
    105                 $account = BVAccount::apiPublicAccount(BVProtect_V683::$settings);
     105                $account = BVAccount::apiPublicAccount(BVProtect_V685::$settings);
    106106
    107107                $url = $account->authenticatedUrl('/captcha/solve');
    … …  
    112112
    113113        private function getAllowLoginsTransient() {
    114                 return BVProtect_V683::$settings->getTransient('bvlp_allow_logins');
     114                return BVProtect_V685::$settings->getTransient('bvlp_allow_logins');
    115115        }
    116116
    117117        private function getBlockLoginsTransient() {
    118                 return BVProtect_V683::$settings->getTransient('bvlp_block_logins');
     118                return BVProtect_V685::$settings->getTransient('bvlp_block_logins');
    119119        }
    120120
    … …  
    142142
    143143        private function isProtecting() {
    144                 return $this->mode === BVProtectLP_V683::MODE_PROTECT;
     144                return $this->mode === BVProtectLP_V685::MODE_PROTECT;
    145145        }
    146146
    147147        private function isActive() {
    148                 return $this->mode !== BVProtectLP_V683::MODE_DISABLED;
     148                return $this->mode !== BVProtectLP_V685::MODE_DISABLED;
    149149        }
    150150
    … …  
    158158
    159159        private function isUnBlockedIP() {
    160                 $transient_name = BVProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
    161                 $attempts = BVProtect_V683::$settings->getTransient($transient_name);
     160                $transient_name = BVProtectLP_V685::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
     161                $attempts = BVProtect_V685::$settings->getTransient($transient_name);
    162162
    163163                if ($attempts && $attempts > 0) {
    164                         BVProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
     164                        BVProtect_V685::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
    165165                        return true;
    166166                }
    … …  
    171171        private function isLoginBlocked() {
    172172                if ($this->getAllowLoginsTransient() ||
    173                                 ($this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) {
     173                                ($this->getLoginCount(BVProtectLP_V685::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(BVProtectLP_V683::LOGIN_STATUS_BLOCKED);
     196                $this->log(BVProtectLP_V685::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 = BVProtectLP_V683::CATEGORY_UNBLOCKED;
     210                        $this->category = BVProtectLP_V685::CATEGORY_UNBLOCKED;
    211211                } else {
    212                         $failed_attempts = $this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_FAILURE,
     212                        $failed_attempts = $this->getLoginCount(BVProtectLP_V685::LOGIN_STATUS_FAILURE,
    213213                                                                                                                                                                                        $this->ip, $this->failed_login_gap);
    214214
    215215                        if ($this->isWhitelistedIP()) {
    216                                 $this->category = BVProtectLP_V683::CATEGORY_BYPASSED;
    217                         } elseif (BVProtectUtils_V683::isPrivateIP($this->ip)) {
    218                                 $this->category = BVProtectLP_V683::CATEGORY_PRIVATEIP;
     216                                $this->category = BVProtectLP_V685::CATEGORY_BYPASSED;
     217                        } elseif (BVProtectUtils_V685::isPrivateIP($this->ip)) {
     218                                $this->category = BVProtectLP_V685::CATEGORY_PRIVATEIP;
    219219                        } elseif ($this->isBlacklistedIP()) {
    220                                 $this->category = BVProtectLP_V683::CATEGORY_BLACKLISTED;
     220                                $this->category = BVProtectLP_V685::CATEGORY_BLACKLISTED;
    221221                                $this->terminateLogin();
    222222                        } elseif ($this->isKnownLogin()) {
    223                                 $this->category = BVProtectLP_V683::CATEGORY_BYPASSED;
     223                                $this->category = BVProtectLP_V685::CATEGORY_BYPASSED;
    224224                        } elseif ($this->isLoginBlocked()) {
    225                                 $this->category = BVProtectLP_V683::CATEGORY_ALL_BLOCKED;
     225                                $this->category = BVProtectLP_V685::CATEGORY_ALL_BLOCKED;
    226226                                $this->terminateLogin();
    227227                        } elseif ($failed_attempts >= $this->temp_block_limit) {
    228                                 $this->category = BVProtectLP_V683::CATEGORY_TEMP_BLOCK;
     228                                $this->category = BVProtectLP_V685::CATEGORY_TEMP_BLOCK;
    229229                                $this->terminateLogin();
    230230                        } elseif ($failed_attempts >= $this->captcha_limit) {
    231                                 $this->category = BVProtectLP_V683::CATEGORY_CAPTCHA_BLOCK;
     231                                $this->category = BVProtectLP_V685::CATEGORY_CAPTCHA_BLOCK;
    232232                                $this->terminateLogin();
    233233                        }
    … …  
    243243        public function loginFailed($username) {
    244244                $this->username = $username;
    245                 $this->log(BVProtectLP_V683::LOGIN_STATUS_FAILURE);
     245                $this->log(BVProtectLP_V685::LOGIN_STATUS_FAILURE);
    246246        }
    247247
    … …  
    249249                $this->username = $username;
    250250                $this->message = 'Login Success';
    251                 $this->log(BVProtectLP_V683::LOGIN_STATUS_SUCCESS);
     251                $this->log(BVProtectLP_V685::LOGIN_STATUS_SUCCESS);
    252252        }
    253253
    254254        private function isKnownLogin() {
    255                 return $this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_SUCCESS,
     255                return $this->getLoginCount(BVProtectLP_V685::LOGIN_STATUS_SUCCESS,
    256256                                                                                                                                $this->ip, $this->success_login_gap) > 0;
    257257        }
    258258
    259259        private function getLoginCount($status, $ip, $gap) {
    260                 $table = BVProtect_V683::$db->getBVTable(BVProtectLP_V683::TABLE_NAME);
     260                $table = BVProtect_V685::$db->getBVTable(BVProtectLP_V685::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 = BVProtect_V683::$db->prepare($query_str, $query_args);
     264                $query = BVProtect_V685::$db->prepare($query_str, $query_args);
    265265                if ($ip) {
    266                         $query .= BVProtect_V683::$db->prepare(" && ip=%s", $ip);
    267                 }
    268 
    269                 $rows = BVProtect_V683::$db->getResult($query);
     266                        $query .= BVProtect_V685::$db->prepare(" && ip=%s", $ip);
     267                }
     268
     269                $rows = BVProtect_V685::$db->getResult($query);
    270270                if (!$rows) {
    271271                        return 0;
  • blogvault-real-time-backup/tags/6.85/protect/prepend/ignitor.php

    r3795700 r3813747  
    55        require_once dirname( __FILE__ ) . '/../protect.php';
    66
    7         BVProtect_V683::init(BVProtect_V683::MODE_PREPEND);
     7        BVProtect_V685::init(BVProtect_V685::MODE_PREPEND);
    88}
  • blogvault-real-time-backup/tags/6.85/protect/protect.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtect_V683')) :
     4if (!class_exists('BVProtect_V685')) :
    55require_once dirname( __FILE__ ) . '/logger.php';
    66require_once dirname( __FILE__ ) . '/ipstore.php';
    … …  
    1212require_once dirname( __FILE__ ) . '/../helper.php';
    1313
    14 class BVProtect_V683 {
     14class BVProtect_V685 {
    1515        public static $settings;
    1616        public static $db;
    … …  
    2727                }
    2828
    29                 if ($mode == BVProtect_V683::MODE_PREPEND) {
     29                if ($mode == BVProtect_V685::MODE_PREPEND) {
    3030                        $config_file = MCDATAPATH .  MCCONFKEY . '-' . 'mc.conf';
    31                         $config = BVProtectUtils_V683::parseFile($config_file);
     31                        $config = BVProtectUtils_V685::parseFile($config_file);
    3232
    3333                        if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
    3434                                        !isset($config['mc_conf_version']) ||
    35                                         (BVProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
     35                                        (BVProtect_V685::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 BVProtectRequest_V683($request_ip_header, $req_config);
     43                        $request = new BVProtectRequest_V685($request_ip_header, $req_config);
    4444                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    4545
    46                         BVProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
     46                        BVProtectFW_V685::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                                         (BVProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
     51                                        (BVProtect_V685::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 BVProtectRequest_V683($request_ip_header, $req_config);
     59                        $request = new BVProtectRequest_V685($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                         BVProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
    64                         BVProtectLP_V683::getInstance($request, $lp_config, $brand_name)->init();
     63                        BVProtectFW_V685::getInstance($mode, $request, $fw_config, $brand_name)->init();
     64                        BVProtectLP_V685::getInstance($request, $lp_config, $brand_name)->init();
    6565                }
    6666        }
    … …  
    6969                self::$settings->deleteOption('bvptconf');
    7070                self::$settings->deleteOption('bvptplug');
    71                 BVProtectIpstore_V683::uninstall();
    72                 BVProtectFW_V683::uninstall();
    73                 BVProtectLP_V683::uninstall();
     71                BVProtectIpstore_V685::uninstall();
     72                BVProtectFW_V685::uninstall();
     73                BVProtectLP_V685::uninstall();
    7474
    75                 BVProtect_V683::removeWPPrepend();
    76                 BVProtect_V683::removePHPPrepend();
    77                 BVProtect_V683::removeMCData();
     75                BVProtect_V685::removeWPPrepend();
     76                BVProtect_V685::removePHPPrepend();
     77                BVProtect_V685::removeMCData();
    7878
    7979                return true;
    … …  
    9696                $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';";
    9797               
    98                 BVProtectUtils_V683::fileRemovePattern($fname, $pattern);
     98                BVProtectUtils_V685::fileRemovePattern($fname, $pattern);
    9999        }
    100100
    101101        private static function removePHPPrepend() {
    102                 BVProtect_V683::removeHtaccessPrepend();
    103                 BVProtect_V683::removeUseriniPrepend();
     102                BVProtect_V685::removeHtaccessPrepend();
     103                BVProtect_V685::removeUseriniPrepend();
    104104        }
    105105
    … …  
    107107                $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
    108108
    109                 BVProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
     109                BVProtectUtils_V685::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
    110110        }
    111111
    … …  
    113113                $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
    114114
    115                 BVProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
     115                BVProtectUtils_V685::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
    116116        }
    117117
    … …  
    120120                $mc_data_dir = $content_dir . "/mc_data";
    121121
    122                 BVProtectUtils_V683::rrmdir($mc_data_dir);
     122                BVProtectUtils_V685::rrmdir($mc_data_dir);
    123123        }
    124124}
  • blogvault-real-time-backup/tags/6.85/protect/request.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('BVProtectRequest_V683')) :
    6 class BVProtectRequest_V683 {
     5if (!class_exists('BVProtectRequest_V685')) :
     6class BVProtectRequest_V685 {
    77        public $ip;
    88        public $host = '';
    … …  
    2020        public $files;
    2121        public $respcode;
    22         public $status = BVProtectRequest_V683::STATUS_ALLOWED;
    23         public $category = BVProtectRequest_V683::CATEGORY_NORMAL;
     22        public $status = BVProtectRequest_V685::STATUS_ALLOWED;
     23        public $category = BVProtectRequest_V685::CATEGORY_NORMAL;
    2424
    2525        public $wp_user;
    … …  
    6060
    6161        public function __construct($ip_header, $config) {
    62                 $this->ip = BVProtectUtils_V683::getIP($ip_header);
     62                $this->ip = BVProtectUtils_V685::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                         BVProtectRequest_V683::CATEGORY_BOT_BLOCKED,
    145                         BVProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED,
    146                         BVProtectRequest_V683::CATEGORY_USER_BLACKLISTED,
    147                         BVProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED
     144                        BVProtectRequest_V685::CATEGORY_BOT_BLOCKED,
     145                        BVProtectRequest_V685::CATEGORY_COUNTRY_BLOCKED,
     146                        BVProtectRequest_V685::CATEGORY_USER_BLACKLISTED,
     147                        BVProtectRequest_V685::CATEGORY_GLOBAL_BOT_BLOCKED
    148148                );
    149149        }
    150150
    151151        public static function whitelistedCategories() {
    152                 return array(BVProtectRequest_V683::CATEGORY_WHITELISTED);
     152                return array(BVProtectRequest_V685::CATEGORY_WHITELISTED);
    153153        }
    154154
    … …  
    488488                }
    489489
    490                 $_json_params = BVProtectUtils_V683::safeDecodeJSON(
     490                $_json_params = BVProtectUtils_V685::safeDecodeJSON(
    491491                        $this->raw_body,
    492492                        true,
  • blogvault-real-time-backup/tags/6.85/protect/wp_user.php

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

    r3795700 r3813747  
    77Tested up to: 7.1
    88Requires PHP: 7.0
    9 Stable tag: 6.83
     9Stable tag: 6.85
    1010License: GPLv2 or later
    1111License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
    … …  
    271271
    272272== CHANGELOG ==
     273= 6.85 =
     274* Improvement: Form test cleanup now also removes uploaded files, and checks each item against the test's record before deleting it.
     275* Improvement: Form tests now confirm what a test submission did (entry saved, notification email, integrations) without delivering the email, and remove the test entry afterwards.
     276* Improvement: Form tests support more form plugins, including their CAPTCHA and anti-spam checks.
     277* Improvement: Hardened the handling of form test requests.
     278
    273279= 6.83 =
    274280* 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.
  • blogvault-real-time-backup/trunk/blogvault.php

    r3795700 r3813747  
    66Author: Backup by BlogVault
    77Author URI: https://blogvault.net
    8 Version: 6.83
     8Version: 6.85
    99Network: True
    1010License: GPLv2 or later
    … …  
    187187                        require_once dirname( __FILE__ ) . '/protect/protect.php';
    188188                        //For backward compatibility.
    189                         BVProtect_V683::$settings = new BVWPSettings();
    190                         BVProtect_V683::$db = new BVWPDb();
    191                         BVProtect_V683::$info = new BVInfo(BVProtect_V683::$settings);
    192 
    193                         add_action('bv_clear_pt_config', array('BVProtect_V683', 'uninstall'));
     189                        BVProtect_V685::$settings = new BVWPSettings();
     190                        BVProtect_V685::$db = new BVWPDb();
     191                        BVProtect_V685::$info = new BVInfo(BVProtect_V685::$settings);
     192
     193                        add_action('bv_clear_pt_config', array('BVProtect_V685', 'uninstall'));
    194194
    195195                        if ($bvinfo->isActivePlugin()) {
    196                                 BVProtect_V683::init(BVProtect_V683::MODE_WP);
     196                                BVProtect_V685::init(BVProtect_V685::MODE_WP);
    197197                        }
    198198                }
  • blogvault-real-time-backup/trunk/callback/base.php

    r3795700 r3813747  
    1313                "DB_WING_VERSION" => '1.5',
    1414                "ACCOUNT_WING_VERSION" => '1.2',
    15                 "MISC_WING_VERSION" => '1.4',
     15                "MISC_WING_VERSION" => '1.6',
    1616                "FS_WING_VERSION" => '1.4',
    17                 "INFO_WING_VERSION" => '2.9',
     17                "INFO_WING_VERSION" => '3.0',
    1818                "WATCH_WING_VERSION" => '1.7',
    1919                "FS_WRITE_WING_VERSION" => '1.2',
    … …  
    2323                "SECURITY_WING_VERSION" => '1.4',
    2424                "LINKS_WING_VERSION" => '1.0',
     25                "FORM_TESTING_WING_VERSION" => '1.0',
    2526                "SECURITY_HARDENING_SETTINGS_VERSION" => '1.0',
    2627                );
  • blogvault-real-time-backup/trunk/callback/handler.php

    r3795700 r3813747  
    180180                                $module = new BVLinksCallback($this);
    181181                                break;
     182                        case 'frmtst':
     183                                // Only the BlogVault, MalCare and WP Remote plugins carry this wing; the rest answer Bad Command.
     184                                $form_testing_wing = dirname( __FILE__ ) . '/wings/form_testing.php';
     185                                if (!file_exists($form_testing_wing)) {
     186                                        $module = null;
     187                                        break;
     188                                }
     189                                require_once $form_testing_wing;
     190                                $module = new BVFormTestingCallback($this);
     191                                break;
    182192                        default:
    183193                                require_once dirname( __FILE__ ) . '/wings/misc.php';
  • blogvault-real-time-backup/trunk/callback/wings/info.php

    r3795700 r3813747  
    1111        public $bvapi;
    1212       
    13         const INFO_WING_VERSION = 2.9;
     13        const INFO_WING_VERSION = 3.0;
    1414
    1515        public function __construct($callback_handler) {
    … …  
    221221                        'templatedir' => get_template_directory(),
    222222                        'dbcharset' => defined('DB_CHARSET') ? DB_CHARSET : null,
     223                        'mysql_client_flags' => defined('MYSQL_CLIENT_FLAGS') ? MYSQL_CLIENT_FLAGS : null,
    223224                        'disallow_file_edit' => defined('DISALLOW_FILE_EDIT'),
    224225                        'disallow_file_mods' => defined('DISALLOW_FILE_MODS'),
  • blogvault-real-time-backup/trunk/callback/wings/ipstore.php

    r3795700 r3813747  
    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 == BVProtectIpstoreDB_V683::CATEGORY_FW) ? "`is_fw` = true;" : "`is_lp` = true;";
     53                $query .= ($category == BVProtectIpstoreDB_V685::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                         BVProtectIpstoreDB_V683::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     67                        BVProtectIpstoreDB_V685::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    6868                $info['lp_blacklisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    69                         BVProtectIpstoreDB_V683::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     69                        BVProtectIpstoreDB_V685::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    7070                $info['fw_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    71                         BVProtectIpstoreDB_V683::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     71                        BVProtectIpstoreDB_V685::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    7272                $info['lp_whitelisted_ips'] = $this->getIPs($table, $auto_increment_offset,
    73                         BVProtectIpstoreDB_V683::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     73                        BVProtectIpstoreDB_V685::whitelistedTypes(), BVProtectIpstoreDB_V685::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"));
  • blogvault-real-time-backup/trunk/callback/wings/misc.php

    r3158138 r3813747  
    1212        public $db;
    1313
    14         const MISC_WING_VERSION = 1.4;
     14        const MISC_WING_VERSION = 1.6;
    1515
    1616        public function __construct($callback_handler) {
  • blogvault-real-time-backup/trunk/callback/wings/protect.php

    r3795700 r3813747  
    4141
    4242        public function unBlockIP($ip, $attempts, $time) {
    43                 $transient_name = BVProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
     43                $transient_name = BVProtectLP_V685::UNBLOCK_IP_TRANSIENT_PREFIX . $ip;
    4444                $this->settings->setTransient($transient_name, $attempts, $time);
    4545                return $this->settings->getTransient($transient_name);
  • blogvault-real-time-backup/trunk/callback/wings/watch.php

    r3795700 r3813747  
    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(BVProtectLP_V683::TABLE_NAME))) {
     147                                if (!isset($lp_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectLP_V685::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(BVProtectLP_V683::TABLE_NAME);
     151                                        $table = $db->getBVTable(BVProtectLP_V685::TABLE_NAME);
    152152                                        $resp["lplogs"] = $this->getOffsetResetInfo($lp_params, $offset, $table);
    153153                                        if (empty($resp["lplogs"])) {
    154                                                 $db->deleteBVTableContent(BVProtectLP_V683::TABLE_NAME, $lp_params['rmfilter']);
     154                                                $db->deleteBVTableContent(BVProtectLP_V685::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(BVProtectFW_V683::TABLE_NAME))) {
     170                                if (!isset($fw_params['bv_check_table']) || $db->isTablePresent($db->getBVTable(BVProtectFW_V685::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(BVProtectFW_V683::TABLE_NAME);
     174                                        $table = $db->getBVTable(BVProtectFW_V685::TABLE_NAME);
    175175                                        $resp["fwlogs"] = $this->getOffsetResetInfo($fw_params, $offset, $table);
    176176                                        if (empty($resp["fwlogs"])){
    177                                                 $db->deleteBVTableContent(BVProtectFW_V683::TABLE_NAME, $fw_params['rmfilter']);
     177                                                $db->deleteBVTableContent(BVProtectFW_V685::TABLE_NAME, $fw_params['rmfilter']);
    178178                                                $resp["fwlogs"] = $this->getData($table, $limit, $filter);
    179179                                        }
  • blogvault-real-time-backup/trunk/form_testing/form_testing.php

    r3220024 r3813747  
    22
    33if (!defined('ABSPATH')) exit;
     4
     5require_once dirname(__FILE__) . '/recorder.php';
     6require_once dirname(__FILE__) . '/entries.php';
     7
    48if (!class_exists('BVFormTesting')) :
    59
     10// Form test mode for one signed test submission: the tested form's CAPTCHA, email and anti-spam bypasses, and the recorder.
    611class BVFormTesting {
    712        private $form_type;
    … …  
    914        private $spam_bypass;
    1015        private $bypass_params = array();
     16        private $run_id;
     17        private $capture_mail;
     18        private $block_http;
     19        private $captcha_live;
    1120
    1221        public function __construct($params) {
    … …  
    1524                $this->spam_bypass = isset($params['bv_ignr_spm_plgns']);
    1625
    17                 if (isset($params['bv_ignr_frm_cptch'])) {
     26                $this->captcha_live = isset($params['bv_frm_cptch_live']);
     27                // A live-captcha run tests that the form rejects a wrong token: never bypass the captcha then.
     28                if (isset($params['bv_ignr_frm_cptch']) && !$this->captcha_live) {
    1829                        $this->bypass_params['should_bypass_captcha'] = true;
    1930                }
    … …  
    2233                        $this->bypass_params['should_bypass_email'] = true;
    2334                }
     35
     36                $run_id = isset($params['bv_frm_run']) && is_string($params['bv_frm_run']) ? sanitize_text_field(wp_unslash($params['bv_frm_run'])) : null;
     37                $this->run_id = BVFormTestRecorder::isValidRunId($run_id) ? $run_id : null;
     38                $this->capture_mail = isset($params['bv_frm_cptr_ml']);
     39                $this->block_http = isset($params['bv_frm_blk_http']);
     40        }
     41
     42        /**
     43         * Request fields that only a login, registration, checkout or comment sends: exact names, never a pattern (form fields
     44         * such as "mf-password" must not match). WordPress's login sends "log" and "pwd" together.
     45         */
     46        private static $refused_fields = array('woocommerce-login-nonce', 'woocommerce-register-nonce', 'woocommerce-process-checkout-nonce',
     47                'woocommerce-lost-password-nonce', 'woocommerce-reset-password-nonce', 'woocommerce-edit-account-nonce', 'wc-ajax', 'comment_post_ID');
     48
     49        /**
     50         * Whether this is a request a form test never makes (see the class comment): login, registration, comments,
     51         * XML-RPC, cron, an admin screen other than admin-ajax.php, a WooCommerce login, checkout or account form.
     52         */
     53        public function isRefusedRequest($request) {
     54                $request = (array) $request;
     55                if (defined('XMLRPC_REQUEST') || defined('DOING_CRON') || defined('WP_INSTALLING')) {
     56                        return true;
     57                }
     58                $script = isset($_SERVER['SCRIPT_NAME']) && is_string($_SERVER['SCRIPT_NAME']) ? basename($_SERVER['SCRIPT_NAME']) : '';
     59                if (defined('DOING_AJAX') && DOING_AJAX) {
     60                        if ($script !== 'admin-ajax.php') {
     61                                return true;
     62                        }
     63                } elseif (is_admin() || $script !== 'index.php') {
     64                        return true;
     65                }
     66                if (isset($request['log'], $request['pwd'])) {
     67                        return true;
     68                }
     69                foreach (self::$refused_fields as $field) {
     70                        if (isset($request[$field])) {
     71                                return true;
     72                        }
     73                }
     74                return false;
    2475        }
    2576
    2677        public function init() {
     78                // Refused, not handled as a normal request: a test submission carried on without test mode would be a real one.
     79                // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     80                if ($this->isRefusedRequest($_REQUEST)) {
     81                        wp_die(esc_html('Form test refused for this request.'), '', array('response' => 403));
     82                }
     83
    2784                if ($this->spam_bypass === true) {
    2885                        $this->bypassSpamPlugins();
    2986                }
    3087
     88                $recorder = null;
     89                if ($this->run_id !== null) {
     90                        $recorder = new BVFormTestRecorder($this->run_id, $this->capture_mail, $this->block_http, $this->captcha_live,
     91                                array_key_exists('should_bypass_captcha', $this->bypass_params), $this->form_id);
     92                        $recorder->start();
     93                        BVFormTestEntries::watch($recorder);
     94                        $this->watchSubmissionEvents($recorder);
     95                }
     96
     97                // Mail capture can only be decided once wp_mail() exists (after all plugins load), and the
     98                // plugin's own email suppression depends on it, so with capture requested both wait for
     99                // plugins_loaded. That is still before any form plugin handles the submission.
     100                if ($recorder !== null && $this->capture_mail) {
     101                        $this->whenPluginsLoaded(function () use ($recorder) {
     102                                $this->applyBypass($recorder);
     103                        });
     104                } else {
     105                        $this->applyBypass($recorder);
     106                }
     107        }
     108
     109        private function applyBypass($recorder) {
     110                if ($recorder !== null) {
     111                        $recorder->setupMailCapture();
     112                        // Captured mail never leaves the site, so let the plugin send it to wp_mail() and record it.
     113                        if ($recorder->captureMailEnabled()) {
     114                                unset($this->bypass_params['should_bypass_email']);
     115                        }
     116                }
     117
     118                // Always, even with nothing to bypass: besides the CAPTCHA and email bypasses, each handler keeps the test's
     119                // side effects in check (integrations, created posts and users, asynchronous work), which a submission must
     120                // never skip. The wrong-CAPTCHA run (bv_frm_cptch_live) with mail capture has no bypass at all, and is exactly
     121                // the run that goes through as a real submission when the form accepts the wrong token.
    31122                $handler = $this->getHandler($this->form_type);
    32                 if ($handler === null) {
    33                         return;
    34                 }
    35 
    36                 if (empty($this->bypass_params) === false) {
     123                if ($handler !== null) {
    37124                        $handler->bypass();
     125                }
     126        }
     127
     128        /** Form plugins that store no entry id, or whose handler reports what it did: record the submission's events. */
     129        private function watchSubmissionEvents($recorder) {
     130                switch ($this->form_type) {
     131                case 'ElementorProForm':
     132                        require_once dirname(__FILE__) . '/handlers/elementor_pro_form.php';
     133                        BVElementorProFormHandler::watch($recorder);
     134                        break;
     135                case 'DiviForm':
     136                        require_once dirname(__FILE__) . '/handlers/divi_form.php';
     137                        BVDiviFormHandler::watch($recorder);
     138                        break;
     139                case 'SpectraForm':
     140                        require_once dirname(__FILE__) . '/handlers/spectra_form.php';
     141                        BVSpectraFormHandler::watch($recorder);
     142                        break;
     143                case 'KadenceForm':
     144                        require_once dirname(__FILE__) . '/handlers/kadence_form.php';
     145                        BVKadenceFormHandler::watch($recorder);
     146                        break;
     147                case 'BeaverBuilderForm':
     148                        require_once dirname(__FILE__) . '/handlers/beaver_builder_form.php';
     149                        BVBeaverBuilderFormHandler::watch($recorder);
     150                        break;
     151                case 'Mc4wpForm':
     152                        require_once dirname(__FILE__) . '/handlers/mc4wp_form.php';
     153                        BVMc4wpFormHandler::watch($recorder);
     154                        break;
     155                case 'JetEngineForm':
     156                        require_once dirname(__FILE__) . '/handlers/jet_engine_form.php';
     157                        BVJetEngineFormHandler::watch($recorder);
     158                        break;
     159                case 'FluentForm':
     160                        require_once dirname(__FILE__) . '/handlers/fluent_form.php';
     161                        BVFluentFormHandler::watch($recorder);
     162                        break;
     163                }
     164        }
     165
     166        private function whenPluginsLoaded($callback) {
     167                if (did_action('plugins_loaded')) {
     168                        call_user_func($callback);
     169                } else {
     170                        add_action('plugins_loaded', $callback, PHP_INT_MIN);
    38171                }
    39172        }
    … …  
    59192                        require_once dirname(__FILE__) . '/handlers/formidable_form.php';
    60193                        return new BVFormidableFormHandler($this->form_id, $this->bypass_params);
     194                case 'FluentForm':
     195                        require_once dirname(__FILE__) . '/handlers/fluent_form.php';
     196                        return new BVFluentFormHandler($this->form_id, $this->bypass_params);
     197                case 'ElementorProForm':
     198                        require_once dirname(__FILE__) . '/handlers/elementor_pro_form.php';
     199                        return new BVElementorProFormHandler($this->form_id, $this->bypass_params);
     200                case 'DiviForm':
     201                        require_once dirname(__FILE__) . '/handlers/divi_form.php';
     202                        return new BVDiviFormHandler($this->form_id, $this->bypass_params);
     203                case 'MetForm':
     204                        require_once dirname(__FILE__) . '/handlers/met_form.php';
     205                        return new BVMetFormHandler($this->form_id, $this->bypass_params);
     206                case 'JetFormBuilderForm':
     207                        require_once dirname(__FILE__) . '/handlers/jet_form_builder_form.php';
     208                        return new BVJetFormBuilderFormHandler($this->form_id, $this->bypass_params);
     209                case 'SureForm':
     210                        require_once dirname(__FILE__) . '/handlers/sure_form.php';
     211                        return new BVSureFormHandler($this->form_id, $this->bypass_params);
     212                case 'JetpackForm':
     213                        require_once dirname(__FILE__) . '/handlers/jetpack_form.php';
     214                        return new BVJetpackFormHandler($this->form_id, $this->bypass_params);
     215                case 'SpectraForm':
     216                        require_once dirname(__FILE__) . '/handlers/spectra_form.php';
     217                        return new BVSpectraFormHandler($this->form_id, $this->bypass_params);
     218                case 'KadenceForm':
     219                        require_once dirname(__FILE__) . '/handlers/kadence_form.php';
     220                        return new BVKadenceFormHandler($this->form_id, $this->bypass_params);
     221                case 'BeaverBuilderForm':
     222                        require_once dirname(__FILE__) . '/handlers/beaver_builder_form.php';
     223                        return new BVBeaverBuilderFormHandler($this->form_id, $this->bypass_params);
     224                case 'AvadaForm':
     225                        require_once dirname(__FILE__) . '/handlers/avada_form.php';
     226                        return new BVAvadaFormHandler($this->form_id, $this->bypass_params);
     227                case 'MailPoetForm':
     228                        require_once dirname(__FILE__) . '/handlers/mail_poet_form.php';
     229                        return new BVMailPoetFormHandler($this->form_id, $this->bypass_params);
     230                case 'Mc4wpForm':
     231                        require_once dirname(__FILE__) . '/handlers/mc4wp_form.php';
     232                        return new BVMc4wpFormHandler($this->form_id, $this->bypass_params);
     233                case 'JetEngineForm':
     234                        require_once dirname(__FILE__) . '/handlers/jet_engine_form.php';
     235                        return new BVJetEngineFormHandler($this->form_id, $this->bypass_params);
    61236                default:
    62237                        return null;
  • blogvault-real-time-backup/trunk/form_testing/handlers/contact_form7.php

    r3220024 r3813747  
    2424
    2525        private function bypassCaptcha() {
     26                // Spam check: reCAPTCHA v3, Turnstile, Akismet, disallowed list.
    2627                add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX);
     28
     29                // Quiz and Really Simple CAPTCHA are validated per field instead. Their answers are tied to a
     30                // random question or a single-use image, so unhook their validators just before they run.
     31                add_filter('wpcf7_validate_quiz', array($this, 'skipQuizValidation'), 9, 1);
     32                add_filter('wpcf7_validate_captchar', array($this, 'skipCaptchaValidation'), 9, 1);
     33        }
     34
     35        public function skipQuizValidation($result) {
     36                remove_filter('wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10);
     37                return $result;
     38        }
     39
     40        public function skipCaptchaValidation($result) {
     41                remove_filter('wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10);
     42                return $result;
    2743        }
    2844
  • blogvault-real-time-backup/trunk/form_testing/handlers/formidable_form.php

    r3220024 r3813747  
    1414
    1515        public function bypass() {
     16                // Report spam as an error instead of silently saving a spam entry behind a success message.
     17                add_filter('frm_save_spam_entry', '__return_false', PHP_INT_MAX);
     18
    1619                if (array_key_exists('should_bypass_captcha', $this->bypass_params)) {
    1720                        $this->bypassCaptcha();
    … …  
    2427
    2528        public function bypassCaptcha() {
    26                 add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX);
     29                // Only the captcha field: Formidable Pro also uses this filter for conditional logic on every field.
     30                add_filter('frm_is_field_hidden', array($this, 'hideCaptchaField'), PHP_INT_MAX, 2);
     31                // Anti-spam a direct test POST can't pass: the JavaScript token and the honeypot.
     32                add_filter('frm_run_antispam', '__return_false', PHP_INT_MAX);
     33                add_filter('frm_run_honeypot', '__return_false', PHP_INT_MAX);
     34        }
     35
     36        public function hideCaptchaField($is_hidden, $field) {
     37                $type = is_array($field) ? (isset($field['type']) ? $field['type'] : '') : (isset($field->type) ? $field->type : '');
     38                return ($type === 'captcha') ? true : $is_hidden;
    2739        }
    2840
  • blogvault-real-time-backup/trunk/form_testing/handlers/forminator_form.php

    r3220024 r3813747  
    77        private $form_id;
    88        private $bypass_params = array();
     9        private $captcha_endpoints = array();
     10        private $created_posts = array();
     11        private $created_attachments = array();
    912
    1013        public function __construct($form_id, $bypass_params) {
    … …  
    2124                        $this->bypassEmail();
    2225                }
     26
     27                $this->allowPollTestVotes();
     28                $this->discardPostDataPosts();
    2329        }
    2430
     31        private function isTestedModule($module_id) {
     32                return (string) $module_id === (string) $this->form_id;
     33        }
     34
     35        /**
     36         * Forminator verifies reCAPTCHA (v2 checkbox, v2 invisible, v3), hCaptcha and Turnstile tokens with
     37         * Forminator_Captcha_Verification::verify(), a wp_remote_request() to the provider's siteverify URL that
     38         * it passes through the forminator_<provider>_verify_endpoint filter. We note that URL and answer the
     39         * request ourselves with a passing verdict, so only Forminator's own verification is affected.
     40         */
    2541        public function bypassCaptcha() {
     42                foreach (array('recaptcha', 'hcaptcha', 'turnstile') as $provider) {
     43                        add_filter("forminator_{$provider}_verify_endpoint", function ($endpoint) use ($provider) {
     44                                if (is_string($endpoint) && $endpoint !== '') {
     45                                        $this->captcha_endpoints[$endpoint] = $provider;
     46                                }
     47                                return $endpoint;
     48                        }, PHP_INT_MAX);
     49                }
     50                add_filter('pre_http_request', array($this, 'stubCaptchaVerification'), PHP_INT_MAX - 1, 3);
     51
     52                // Forminator before 1.58 skipped its captcha check while a Stripe field was hidden.
     53                // From 1.58 a hidden Stripe field means "verify the payment token", which needs a token we don't have.
     54                $this->whenForminatorLoaded(function () {
     55                        if (defined('FORMINATOR_VERSION') && version_compare(FORMINATOR_VERSION, '1.58.0', '<')) {
     56                                $this->markStripeHidden();
     57                        }
     58                });
     59        }
     60
     61        public function stubCaptchaVerification($preempt, $args, $url) {
     62                if ($preempt !== false || !is_string($url) || !isset($this->captcha_endpoints[$url])) {
     63                        return $preempt;
     64                }
     65
     66                $verdict = array('success' => true, 'hostname' => BVFormTestRecorder::parseUrl(home_url(), PHP_URL_HOST));
     67                // Only reCAPTCHA v3 checks a score, and it wants a high one.
     68                if ($this->captcha_endpoints[$url] === 'recaptcha') {
     69                        $verdict['score'] = 1.0;
     70                }
     71
     72                return array(
     73                        'headers' => array(),
     74                        'body' => BVFormTestRecorder::jsonEncode($verdict),
     75                        'response' => array('code' => 200, 'message' => 'OK'),
     76                        'cookies' => array(),
     77                        'filename' => null
     78                );
     79        }
     80
     81        private function markStripeHidden() {
    2682                if (defined('WP_PLUGIN_DIR')) {
    2783                        $abstract_front_action_file_path = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php';
    … …  
    45101                }
    46102        }
     103
     104        /**
     105         * Polls accept one vote per IP (or browser cookie). A test vote must neither be refused because an
     106         * earlier test voted, nor lock the poll for the monitoring server's IP: we let the test vote through
     107         * and don't store the voter IP with it.
     108         */
     109        private function allowPollTestVotes() {
     110                add_filter('forminator_poll_handle_form_user_can_vote', function ($can_vote, $poll_id) {
     111                        return $this->isTestedModule($poll_id) ? true : $can_vote;
     112                }, PHP_INT_MAX, 2);
     113
     114                // Forminator also blocks the voter's IP for a few seconds after a vote; lift that block for a test vote.
     115                add_action('forminator_polls_submit_before_set_fields', function ($entry, $poll_id) {
     116                        if ($this->isTestedModule($poll_id)) {
     117                                add_action('shutdown', function () use ($poll_id) {
     118                                        $this->clearPollVoteLock($poll_id);
     119                                }, 0);
     120                        }
     121                }, PHP_INT_MAX, 2);
     122
     123                add_filter('forminator_polls_submit_field_data', function ($field_data, $poll_id) {
     124                        if (!$this->isTestedModule($poll_id) || !is_array($field_data)) {
     125                                return $field_data;
     126                        }
     127                        return array_values(array_filter($field_data, function ($item) {
     128                                return !(is_array($item) && isset($item['name']) && $item['name'] === '_forminator_user_ip');
     129                        }));
     130                }, PHP_INT_MAX, 2);
     131        }
     132
     133        private function clearPollVoteLock($poll_id) {
     134                if (!class_exists('Forminator_Geo') || !method_exists('Forminator_Geo', 'get_user_ip')) {
     135                        return;
     136                }
     137                $user_ip = Forminator_Geo::get_user_ip();
     138                delete_transient('forminator_request_from_ip_' . $poll_id . '_' . $user_ip);
     139                delete_option('forminator_poll_ip_lock_' . $poll_id . '_' . md5($user_ip));
     140        }
     141
     142        /**
     143         * A Post Data field creates a post. For a test submission it is created as a draft (never published,
     144         * so no publish notifications or auto-sharing) and deleted, with any featured image uploaded by the
     145         * submission, once the request ends.
     146         */
     147        private function discardPostDataPosts() {
     148                add_filter('forminator_post_data_post_info', function ($post) {
     149                        if ($this->isCurrentForm() && is_array($post)) {
     150                                $post['post_status'] = 'draft';
     151                        }
     152                        return $post;
     153                }, PHP_INT_MAX);
     154
     155                add_action('forminator_post_data_field_post_saved', function ($post_id) {
     156                        if ($this->isCurrentForm()) {
     157                                $this->created_posts[] = absint($post_id);
     158                        }
     159                }, PHP_INT_MAX);
     160
     161                add_action('add_attachment', function ($attachment_id) {
     162                        if ($this->isCurrentForm()) {
     163                                $this->created_attachments[] = absint($attachment_id);
     164                        }
     165                }, PHP_INT_MAX);
     166
     167                add_action('shutdown', array($this, 'deleteCreatedPosts'), 0);
     168        }
     169
     170        private function isCurrentForm() {
     171                return class_exists('Forminator_CForm_Front_Action') && isset(Forminator_CForm_Front_Action::$module_id) &&
     172                                $this->isTestedModule(Forminator_CForm_Front_Action::$module_id);
     173        }
     174
     175        public function deleteCreatedPosts() {
     176                foreach ($this->created_posts as $post_id) {
     177                        $post = get_post($post_id);
     178                        if ($post_id === 0 || !$post || $post->post_status !== 'draft') {
     179                                continue;
     180                        }
     181                        $thumbnail_id = (int) get_post_thumbnail_id($post_id);
     182                        if ($thumbnail_id > 0 && in_array($thumbnail_id, $this->created_attachments, true)) {
     183                                wp_delete_attachment($thumbnail_id, true);
     184                        }
     185                        wp_delete_post($post_id, true);
     186                }
     187                $this->created_posts = array();
     188        }
     189
     190        private function whenForminatorLoaded($callback) {
     191                if (did_action('plugins_loaded')) {
     192                        call_user_func($callback);
     193                } else {
     194                        add_action('plugins_loaded', $callback, PHP_INT_MIN);
     195                }
     196        }
    47197}
    48198
  • blogvault-real-time-backup/trunk/form_testing/handlers/gravity_form.php

    r3220024 r3813747  
    2121                        $this->bypassEmail();
    2222                }
     23
     24                $this->bypassContentCreation();
     25                $this->keepSideEffectsInRequest();
     26                $this->bypassTotalValidation();
     27        }
     28
     29        /**
     30         * Gravity Forms 2.10+ sends notifications from a background request by default (and add-ons may
     31         * process feeds in one), where the test's email suppression, mail capture and HTTP blocking are not
     32         * active. Process them within the test request instead.
     33         */
     34        public function keepSideEffectsInRequest() {
     35                if ($this->form_id === null) {
     36                        return;
     37                }
     38
     39                $form_id = absint($this->form_id);
     40                add_filter('gform_is_asynchronous_notifications_enabled_' . $form_id, '__return_false', PHP_INT_MAX);
     41                add_filter('gform_is_feed_asynchronous_' . $form_id, '__return_false', PHP_INT_MAX);
     42        }
     43
     44        /**
     45         * The Total field is filled by the browser from the pricing fields; Gravity Forms recalculates the
     46         * total when it saves the entry, so the submitted value is not compared for a test submission.
     47         */
     48        public function bypassTotalValidation() {
     49                if ($this->form_id === null) {
     50                        return;
     51                }
     52
     53                add_filter('gform_pre_validation_' . absint($this->form_id), function($form) {
     54                        foreach ($form['fields'] as &$field) {
     55                                if ($field->type === 'total') {
     56                                        $field->validateTotal = false;
     57                                }
     58                        }
     59                        return $form;
     60                }, PHP_INT_MAX);
     61        }
     62
     63        /**
     64         * A test submission must not create posts (Post fields) or WordPress users (User Registration add-on)
     65         * on the site. Advanced Post Creation feeds are skipped for the same reason.
     66         */
     67        public function bypassContentCreation() {
     68                if ($this->form_id === null) {
     69                        return;
     70                }
     71
     72                $form_id = absint($this->form_id);
     73                add_filter('gform_disable_post_creation_' . $form_id, '__return_true', PHP_INT_MAX);
     74                add_filter('gform_gravityformsuserregistration_pre_process_feeds_' . $form_id, '__return_empty_array', PHP_INT_MAX);
     75                add_filter('gform_gravityformsadvancedpostcreation_pre_process_feeds_' . $form_id, '__return_empty_array', PHP_INT_MAX);
    2376        }
    2477
    … …  
    3689                        return $form;
    3790                }, PHP_INT_MAX);
     91
     92                // Honeypot and the submission speed check (2.9.21+) mark a scripted submission as spam or abort it.
     93                add_filter('gform_pre_process_' . absint($this->form_id), function($form) {
     94                        if (is_array($form)) {
     95                                $form['enableHoneypot'] = false;
     96                                $form['enableSubmitSpeedCheck'] = false;
     97                        }
     98                        return $form;
     99                }, PHP_INT_MAX);
     100
     101                // Akismet (Gravity Forms' own integration) would mark the test entry as spam.
     102                add_filter('gform_akismet_enabled_' . absint($this->form_id), '__return_false', PHP_INT_MAX);
    38103        }
    39104
  • blogvault-real-time-backup/trunk/form_testing/handlers/ninja_form.php

    r3220024 r3813747  
    2424
    2525        public function bypassCaptcha() {
     26                // Field captchas (reCAPTCHA v2, hCaptcha, Turnstile, the spam question): a null type skips the field's validation.
    2627                add_filter('ninja_forms_pre_validate_field_settings', function ($field_settings) {
    27                         if (isset($field_settings['type']) && in_array($field_settings['type'], ['recaptcha', 'spam'], true)) {
     28                        $captcha_types = array('recaptcha', 'recaptcha_v3', 'hcaptcha', 'turnstile', 'spam');
     29                        if (isset($field_settings['type']) && in_array($field_settings['type'], $captcha_types, true)) {
    2830                                $field_settings['type'] = null;
    2931                        }
    … …  
    3133                }, PHP_INT_MAX);
    3234
     35                // reCAPTCHA v3 is a form action (type "recaptcha") that verifies the injected token.
    3336                add_filter('ninja_forms_run_action_type_recaptcha', '__return_false', PHP_INT_MAX);
    3437        }
  • blogvault-real-time-backup/trunk/form_testing/handlers/wp_form.php

    r3220024 r3813747  
    44if (!class_exists('BVWPFormHandler')) :
    55
     6// WPForms (Lite and Pro): CAPTCHA, anti-spam, email and upload handling for the tested form in a signed test request.
    67class BVWPFormHandler {
    78        private $form_id;
    … …  
    2122                        $this->bypassEmail();
    2223                }
     24
     25                $this->sendEmailsInRequest();
     26                $this->acceptModernUploads();
     27                $this->skipMediaLibrary();
    2328        }
    2429
    2530        public function bypassCaptcha() {
    2631                add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX);
     32                add_filter('wpforms_process_antispam', '__return_true', PHP_INT_MAX);
     33                add_filter('wpforms_process_honeypot', '__return_false', PHP_INT_MAX);
     34                add_filter('wpforms_process_anti_spam_honeypot_bypass', '__return_true', PHP_INT_MAX);
     35                add_filter('wpforms_process_anti_spam_direct_post_bypass', '__return_true', PHP_INT_MAX);
     36                $form_id = (string) $this->form_id;
     37                // Custom Captcha addon: validated as field type "captcha" (wpforms_process_validate_captcha).
     38                add_action('wpforms_process_validate_captcha', function ($field_id, $field_submit, $form_data) use ($form_id) {
     39                        if (!is_array($form_data) || !isset($form_data['id']) || (string) $form_data['id'] !== $form_id || !function_exists('wpforms')) {
     40                                return;
     41                        }
     42                        $process = wpforms()->get('process');
     43                        if (is_object($process) && isset($process->errors[$form_data['id']][$field_id])) {
     44                                unset($process->errors[$form_data['id']][$field_id]);
     45                        }
     46                }, PHP_INT_MAX, 3);
    2747        }
    2848
    … …  
    3050                add_filter('wpforms_entry_email', '__return_false', PHP_INT_MAX);
    3151        }
     52
     53        /**
     54         * With "Optimize Email Sending" (setting email-async), WPForms 1.8.5+ queues each notification as an Action
     55         * Scheduler task that a later request sends, outside test mode: a real email that mail capture never sees. Send
     56         * the tested form's notifications in this request instead.
     57         */
     58        public function sendEmailsInRequest() {
     59                $form_id = (string) $this->form_id;
     60                add_filter('wpforms_tasks_entry_emails_trigger_send_same_process', function ($same_process, $fields = array(), $entry = array(), $form_data = array()) use ($form_id) {
     61                        if ($form_id === '' || (is_array($form_data) && isset($form_data['id']) && (string) $form_data['id'] === $form_id)) {
     62                                return true;
     63                        }
     64                        return $same_process;
     65                }, PHP_INT_MAX, 4);
     66        }
     67
     68        public function skipMediaLibrary() {
     69                $form_id = (string) $this->form_id;
     70                add_filter('wpforms_process_before_form_data', function ($form_data) use ($form_id) {
     71                        if (!is_array($form_data) || !isset($form_data['id'], $form_data['fields']) || (string) $form_data['id'] !== $form_id || !is_array($form_data['fields'])) {
     72                                return $form_data;
     73                        }
     74                        foreach ($form_data['fields'] as $key => $field) {
     75                                if (is_array($field) && isset($field['type']) && in_array($field['type'], array('file-upload', 'camera'), true) && !empty($field['media_library'])) {
     76                                        $form_data['fields'][$key]['media_library'] = '0';
     77                                }
     78                        }
     79                        return $form_data;
     80                }, PHP_INT_MAX, 1);
     81        }
     82
     83        public function acceptModernUploads() {
     84                $form_id = (string) $this->form_id;
     85                add_action('wpforms_process_before', function ($entry, $form_data) use ($form_id) {
     86                        if (!is_array($form_data) || !isset($form_data['id'], $form_data['fields']) || (string) $form_data['id'] !== $form_id ||
     87                                        empty($_FILES) || !function_exists('wpforms_upload_dir')) {
     88                                return;
     89                        }
     90                        foreach ((array) $form_data['fields'] as $field) {
     91                                if (is_array($field) && isset($field['type'], $field['id'], $field['style']) && $field['type'] === 'file-upload' && $field['style'] === 'modern') {
     92                                        BVWPFormHandler::storeModernUpload(sprintf('wpforms_%d_%d', absint($form_data['id']), absint($field['id'])), $field);
     93                                }
     94                        }
     95                }, 1, 2);
     96        }
     97
     98        /**
     99         * Extensions WPForms refuses whatever the site allows (WPForms FileMethodsTrait::$denylist, plus the other PHP
     100         * extensions servers may run).
     101         */
     102        private static $denied_extensions = array(
     103                'ade', 'adp', 'app', 'asp', 'bas', 'bat', 'cer', 'cgi', 'chm', 'cmd', 'com', 'cpl', 'crt', 'csh', 'csr', 'dfxp',
     104                'dll', 'drv', 'exe', 'flv', 'fxp', 'hlp', 'hta', 'htaccess', 'htm', 'html', 'htpasswd', 'inf', 'ins', 'isp',
     105                'jar', 'js', 'jse', 'jsp', 'ksh', 'lnk', 'mdb', 'mde', 'mdt', 'mdw', 'msc', 'msi', 'msp', 'mst', 'onetmp', 'ops',
     106                'pcd', 'phar', 'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'pht', 'phtml', 'pif', 'pl', 'prg', 'ps1', 'ps2',
     107                'py', 'rb', 'reg', 'scr', 'sct', 'sh', 'shb', 'shs', 'swf', 'sys', 'tmp', 'torrent', 'url', 'vb', 'vbe', 'vbs',
     108                'vbscript', 'wsc', 'wsf', 'wsh'
     109        );
     110
     111        /**
     112         * The extensions a file upload field accepts, as WPForms works them out: the field's list (all when empty),
     113         * limited to the file types WordPress allows, without the denied extensions.
     114         */
     115        public static function allowedExtensions($field) {
     116                $allowed = array();
     117                foreach (array_keys(get_allowed_mime_types()) as $extensions) {
     118                        foreach (explode('|', $extensions) as $extension) {
     119                                $allowed[] = strtolower($extension);
     120                        }
     121                }
     122                $allowed = array_diff($allowed, self::$denied_extensions);
     123                if (is_array($field) && !empty($field['extensions']) && is_string($field['extensions'])) {
     124                        $listed = array();
     125                        foreach (explode(',', $field['extensions']) as $extension) {
     126                                $listed[] = strtolower(preg_replace('/[^A-Za-z0-9_-]/', '', $extension));
     127                        }
     128                        $allowed = array_intersect($allowed, $listed);
     129                }
     130                return array_values(array_unique($allowed));
     131        }
     132
     133        /**
     134         * Moves one posted file of a modern upload field into the WPForms tmp folder and posts its JSON description.
     135         * A file whose extension or type the field doesn't accept is left out, and stays in PHP's upload folder (deleted
     136         * when the request ends), so WPForms reports the field as empty or required. A file moved into the tmp folder that
     137         * WPForms doesn't take into the form's folder is deleted when the request ends.
     138         */
     139        public static function storeModernUpload($input_name, $field) {
     140                // phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput
     141                if (!empty($_POST[$input_name]) || !isset($_FILES[$input_name]['tmp_name'], $_FILES[$input_name]['name'], $_FILES[$input_name]['error']) ||
     142                                !is_string($_FILES[$input_name]['tmp_name']) || !is_string($_FILES[$input_name]['name']) ||
     143                                (int) $_FILES[$input_name]['error'] !== UPLOAD_ERR_OK || !is_uploaded_file($_FILES[$input_name]['tmp_name'])) {
     144                        return;
     145                }
     146                $file = $_FILES[$input_name];
     147                unset($_FILES[$input_name]);
     148                // phpcs:enable
     149
     150                $name = sanitize_file_name(wp_unslash($file['name']));
     151                $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
     152                if ($name === '' || $extension === '' || !in_array($extension, self::allowedExtensions($field), true)) {
     153                        return;
     154                }
     155                // WordPress's own check of the name against the content (images are sniffed): refused when it finds no
     156                // allowed type, or when it would rename the file.
     157                $filetype = wp_check_filetype_and_ext($file['tmp_name'], $name);
     158                if (empty($filetype['ext']) || empty($filetype['type']) || !empty($filetype['proper_filename']) ||
     159                                strtolower($filetype['ext']) !== $extension) {
     160                        return;
     161                }
     162
     163                $upload_dir = wpforms_upload_dir();
     164                if (!is_array($upload_dir) || empty($upload_dir['path']) || empty($upload_dir['url'])) {
     165                        return;
     166                }
     167                $tmp_dir = $upload_dir['path'] . '/tmp';
     168                if (!wp_mkdir_p($tmp_dir)) {
     169                        return;
     170                }
     171                $tmp_name = wp_hash(wp_rand() . microtime() . $input_name) . '.' . $extension;
     172                $tmp_path = $tmp_dir . '/' . $tmp_name;
     173                if (!move_uploaded_file($file['tmp_name'], $tmp_path)) {
     174                        return;
     175                }
     176                // WPForms moves the file out of the tmp folder when the entry is saved; anything left is a failed submission.
     177                add_action('shutdown', function () use ($tmp_path) {
     178                        if (is_file($tmp_path)) {
     179                                BVFormTestRecorder::deleteFile($tmp_path);
     180                        }
     181                });
     182                if (function_exists('wpforms_sanitize_svg_file') && !wpforms_sanitize_svg_file($tmp_path)) {
     183                        BVFormTestRecorder::deleteFile($tmp_path);
     184                        return;
     185                }
     186
     187                $_POST[$input_name] = wp_slash(BVFormTestRecorder::jsonEncode(array(array(
     188                        'name' => $name,
     189                        'file' => $tmp_name,
     190                        'url' => $upload_dir['url'] . '/tmp/' . $tmp_name,
     191                        'size' => filesize($tmp_path),
     192                        'type' => $filetype['type'],
     193                        'file_user_name' => $name
     194                ))));
     195        }
    32196}
    33197
  • blogvault-real-time-backup/trunk/info.php

    r3795700 r3813747  
    1212                public $brand_option = 'bv_whitelabel_infos';
    1313                public $wp_lp_whitelabel_option = 'bvLpWhitelabelConf';
    14                 public $version = '6.83';
     14                public $version = '6.85';
    1515                public $webpage = 'https://blogvault.net';
    1616                public $appurl = 'https://app.blogvault.net';
  • blogvault-real-time-backup/trunk/protect/fw.php

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

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

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('BVProtectFWRuleEngine_V683')) :
     5if (!class_exists('BVProtectFWRuleEngine_V685')) :
    66require_once dirname( __FILE__ ) . '/functions.php';
    77
    8 class BVProtectFWRuleEngine_V683 {
    9         use BVProtectFWRuleStringFunc_V683;
    10         use BVProtectFWRuleArrayFunc_V683;
    11         use BVProtectFWRuleMiscFunc_V683;
    12         use BVProtectFWRuleRequestFunc_V683;
    13         use BVProtectFWRuleWPFunc_V683;
     8class BVProtectFWRuleEngine_V685 {
     9        use BVProtectFWRuleStringFunc_V685;
     10        use BVProtectFWRuleArrayFunc_V685;
     11        use BVProtectFWRuleMiscFunc_V685;
     12        use BVProtectFWRuleRequestFunc_V685;
     13        use BVProtectFWRuleWPFunc_V685;
    1414
    1515        private $request;
    … …  
    2626        const WILDCARD_KEY = '*';
    2727        const FUNC_NAME_PREFIX = '_rf_';
    28         const CONST_NAME_PREFIX = 'BVProtectFWRule_V683::';
     28        const CONST_NAME_PREFIX = 'BVProtectFWRule_V685::';
    2929        const ALLOWED_EXT_CONSTANTS = [
    3030                'DOING_CRON'
    … …  
    5353                try {
    5454                        return $this->executeStmt($rule->logic);
    55                 } catch (BVProtectRuleError_V683 $e) {
     55                } catch (BVProtectRuleError_V685 $e) {
    5656                        $this->error = $e;
    5757                }
    … …  
    124124        private function getValue($stmt) {
    125125                if (!is_array($stmt) || empty($stmt["type"])) {
    126                         throw new BVProtectRuleError_V683(
     126                        throw new BVProtectRuleError_V685(
    127127                                $this->addExState("InvalidStatementError: Malformed value statement"));
    128128                }
    … …  
    133133                case "NUMBER":
    134134                        if (!isset($stmt["value"]) || !is_int($stmt["value"])) {
    135                                 throw new BVProtectRuleError_V683(
     135                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     143                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     151                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     159                                throw new BVProtectRuleError_V685(
    160160                                        $this->addExState("TypeError: Invalid constant name")
    161161                                );
    … …  
    169169
    170170                        if (!defined($name)) {
    171                                 throw new BVProtectRuleError_V683(
     171                                throw new BVProtectRuleError_V685(
    172172                                        $this->addExState("TypeError: Undefined constant" . $stmt["value"])
    173173                                );
    … …  
    177177                case "ARRAY":
    178178                        if (!isset($stmt["value"]) || !is_array($stmt["value"])) {
    179                                 throw new BVProtectRuleError_V683(
     179                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     210                        throw new BVProtectRuleError_V685(
    211211                                $this->addExState("InvalidStatementError: Malformed logic statement")
    212212                        );
    … …  
    220220                case "AND":
    221221                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    222                                 throw new BVProtectRuleError_V683(
     222                                throw new BVProtectRuleError_V685(
    223223                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    224224                                );
    … …  
    229229                case "OR":
    230230                        if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
    231                                 throw new BVProtectRuleError_V683(
     231                                throw new BVProtectRuleError_V685(
    232232                                        $this->addExState("InvalidOperandError: Malformed operand(s)")
    233233                                );
    … …  
    238238                case "NOT":
    239239                        if (empty($stmt["value"])) {
    240                                 throw new BVProtectRuleError_V683(
     240                                throw new BVProtectRuleError_V685(
    241241                                        $this->addExState("InvalidOperandError: Malformed operand")
    242242                                );
    … …  
    247247                case "FUNCTION":
    248248                        if (empty($stmt["name"]) || !is_string($stmt["name"])) {
    249                                 throw new BVProtectRuleError_V683(
     249                                throw new BVProtectRuleError_V685(
    250250                                        $this->addExState("InvalidFunctionName: Malformed name")
    251251                                );
    … …  
    256256
    257257                        if (!is_callable($handler)) {
    258                                 throw new BVProtectRuleError_V683(
     258                                throw new BVProtectRuleError_V685(
    259259                                        $this->addExState("UndefinedFunctionCall: " . $stmt["name"])
    260260                                );
    … …  
    262262
    263263                        if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) {
    264                                 throw new BVProtectRuleError_V683(
     264                                throw new BVProtectRuleError_V685(
    265265                                        $this->addExState("InvalidArguments: Malformed args")
    266266                                );
    … …  
    275275                        break;
    276276                default:
    277                         throw new BVProtectRuleError_V683(
     277                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     288                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     295                                throw new BVProtectRuleError_V685(
    296296                                        $this->addExState("InvalidParamType: " . $pos)
    297297                                );
    … …  
    301301                        case "string":
    302302                                if (!isset($args[$pos]) || !is_string($args[$pos])) {
    303                                         throw new BVProtectRuleError_V683(
     303                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     310                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     317                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     324                                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     331                                        throw new BVProtectRuleError_V685(
    332332                                                $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.")
    333333                                        );
    … …  
    337337                                break;
    338338                        default:
    339                                 throw new BVProtectRuleError_V683(
     339                                throw new BVProtectRuleError_V685(
    340340                                        $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name)
    341341                                );
  • blogvault-real-time-backup/trunk/protect/fw/rule/errors.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectRuleError_V683')) :
    5 class BVProtectRuleError_V683 extends Exception {
     4if (!class_exists('BVProtectRuleError_V685')) :
     5class BVProtectRuleError_V685 extends Exception {
    66//Root rule error class.
    77}
  • blogvault-real-time-backup/trunk/protect/fw/rule/functions/array.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleArrayFunc_V683')) :
    6 trait BVProtectFWRuleArrayFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleArrayFunc_V685')) :
     6trait BVProtectFWRuleArrayFunc_V685 {
    77        private function _rf_inArray() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    1717
    1818                if (!is_array($array)) {
    19                         throw new BVProtectRuleError_V683(
     19                        throw new BVProtectRuleError_V685(
    2020                                $this->addExState("inArray: 2nd param is not an array")
    2121                        );
    … …  
    2323
    2424                if (!is_bool($strict)) {
    25                         throw new BVProtectRuleError_V683(
     25                        throw new BVProtectRuleError_V685(
    2626                                $this->addExState("inArray: 3rd param is not a boolean")
    2727                        );
    … …  
    5454                        }
    5555                } else {
    56                         throw new BVProtectRuleError_V683(
     56                        throw new BVProtectRuleError_V685(
    5757                                $this->addExState("recInArray: Expects an array")
    5858                        );
    … …  
    7373
    7474                if (!is_array($array)) {
    75                         throw new BVProtectRuleError_V683(
     75                        throw new BVProtectRuleError_V685(
    7676                                $this->addExState("arrayKeyExists: Array must be of type array")
    7777                        );
    7878                } elseif (!is_string($key) && !is_int($key)) {
    79                         throw new BVProtectRuleError_V683(
     79                        throw new BVProtectRuleError_V685(
    8080                                $this->addExState("arrayKeyExists: Key must be of type string or int")
    8181                        );
    … …  
    110110
    111111                if (!is_bool($recursive)) {
    112                         throw new BVProtectRuleError_V683(
     112                        throw new BVProtectRuleError_V685(
    113113                                $this->addExState("getArrayKeys: 2nd param must be a boolean")
    114114                        );
    … …  
    140140
    141141                if (!is_bool($recursive)) {
    142                         throw new BVProtectRuleError_V683(
     142                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     150                                throw new BVProtectRuleError_V685(
    151151                                        $this->addExState("hasAnyArrayKey: Key must be of type string or int")
    152152                                );
    … …  
    189189
    190190                if (!is_bool($recursive)) {
    191                         throw new BVProtectRuleError_V683(
     191                        throw new BVProtectRuleError_V685(
    192192                                $this->addExState("keyMatches: 3rd param must be a boolean")
    193193                        );
    … …  
    224224
    225225                if ($resp === false) {
    226                         throw new BVProtectRuleError_V683(
     226                        throw new BVProtectRuleError_V685(
    227227                                $this->addExState("keyMatches: Invalid regular expression")
    228228                        );
    … …  
    233233                $resp = BVHelper::safePregMatch($pattern, (string) $key);
    234234                if ($resp === false) {
    235                         throw new BVProtectRuleError_V683(
     235                        throw new BVProtectRuleError_V685(
    236236                                $this->addExState("keyMatches: Regex match failed")
    237237                        );
    … …  
    242242
    243243        private function keyMatchesRecursive($array, $pattern, &$traversed_keys, $depth = 1) {
    244                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     244                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    245245                        return false;
    246246                }
    … …  
    262262
    263263        private function getArrayKeysRecursive($array, &$keys, &$traversed_keys, $depth = 1) {
    264                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     264                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    265265                        return;
    266266                }
    … …  
    277277
    278278        private function hasAnyArrayKeyRecursive($array, $key_lookup, &$traversed_keys, $depth = 1) {
    279                 if ($depth > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     279                if ($depth > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    280280                        return false;
    281281                }
    … …  
    297297
    298298        private function enforceArrayTraversalLimit($func_name, $traversed_keys) {
    299                 if ($traversed_keys > BVProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE) {
    300                         throw new BVProtectRuleError_V683(
     299                if ($traversed_keys > BVProtectFWRuleEngine_V685::MAX_ARRAY_KEYS_TO_TRAVERSE) {
     300                        throw new BVProtectRuleError_V685(
    301301                                $this->addExState(
    302302                                        "TraversalLimitError: " . $func_name . " exceeded " .
    303                                         BVProtectFWRuleEngine_V683::MAX_ARRAY_KEYS_TO_TRAVERSE .
     303                                        BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     323                                throw new BVProtectRuleError_V685(
    324324                                        $this->addExState("digArray: Keys must be a valid array of string, or integer type")
    325325                                );
    … …  
    342342
    343343                if (empty($keys)) {
    344                         throw new BVProtectRuleError_V683(
     344                        throw new BVProtectRuleError_V685(
    345345                                $this->addExState("digArrayValues: Keys must not be empty")
    346346                        );
    347347                }
    348348
    349                 if (count($keys) > BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
    350                         throw new BVProtectRuleError_V683(
     349                if (count($keys) > BVProtectFWRuleEngine_V685::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC) {
     350                        throw new BVProtectRuleError_V685(
    351351                                $this->addExState(
    352352                                        "digArrayValues: Keys exceeded " .
    353                                         BVProtectFWRuleEngine_V683::MAX_DEPTH_TO_ALLOWED_TYPE_FUNC .
     353                                        BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     361                                throw new BVProtectRuleError_V685(
    362362                                        $this->addExState("digArrayValues: Keys must be a valid array of string, or integer type")
    363363                                );
    … …  
    376376                                }
    377377
    378                                 if ($key === BVProtectFWRuleEngine_V683::WILDCARD_KEY) {
     378                                if ($key === BVProtectFWRuleEngine_V685::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 BVProtectRuleError_V683(
     419                                throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     440                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     521                                throw new BVProtectRuleError_V685(
    522522                                        $this->addExState("arrayJoin: Array element must be of scalar type")
    523523                                );
  • blogvault-real-time-backup/trunk/protect/fw/rule/functions/misc.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleMiscFunc_V683')) :
    6 trait BVProtectFWRuleMiscFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleMiscFunc_V685')) :
     6trait BVProtectFWRuleMiscFunc_V685 {
    77        private function _rf_isTrue() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    7373
    7474                if (!array_key_exists($name, $this->variables)) {
    75                         throw new BVProtectRuleError_V683(
     75                        throw new BVProtectRuleError_V685(
    7676                                $this->addExState("UndefinedVariableError: " . $name . " is not defined.")
    7777                        );
    … …  
    134134                $resp = BVHelper::safePregMatch((string) $pattern, (string) $subject);
    135135                if ($resp === false) {
    136                         throw new BVProtectRuleError_V683(
     136                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     177                        throw new BVProtectRuleError_V685(
    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 BVProtectRuleError_V683(
     203                        throw new BVProtectRuleError_V685(
    204204                                $this->addExState("preg_match_all: " . serialize($subject))
    205205                        );
  • blogvault-real-time-backup/trunk/protect/fw/rule/functions/request.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!trait_exists('BVProtectFWRuleRequestFunc_V683')) :
    6 trait BVProtectFWRuleRequestFunc_V683 {
     5if (!trait_exists('BVProtectFWRuleRequestFunc_V685')) :
     6trait BVProtectFWRuleRequestFunc_V685 {
    77        private function _rf_getAction() {
    88                $args = $this->processRuleFunctionParams(
    … …  
    496496
    497497                if (!array_key_exists('ID', $user)) {
    498                         throw new BVProtectRuleError_V683(
     498                        throw new BVProtectRuleError_V685(
    499499                                $this->addExState("wpUserId: user's id doesn't exist")
    500500                        );
  • blogvault-real-time-backup/trunk/protect/fw/rule/functions/string.php

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

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

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

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectIpstoreDB_V683')) :
    5 class BVProtectIpstoreDB_V683 {
     4if (!class_exists('BVProtectIpstoreDB_V685')) :
     5class BVProtectIpstoreDB_V685 {
    66                const TABLE_NAME = 'ip_store';
    77
    … …  
    1111                #XNOTE: check this.
    1212                public static function blacklistedTypes() {
    13                         return BVProtectRequest_V683::blacklistedCategories();
     13                        return BVProtectRequest_V685::blacklistedCategories();
    1414                }
    1515
    1616                public static function whitelistedTypes() {
    17                         return BVProtectRequest_V683::whitelistedCategories();
     17                        return BVProtectRequest_V685::whitelistedCategories();
    1818                }
    1919
    2020                public static function uninstall() {
    21                         BVProtect_V683::$db->dropBVTable(BVProtectIpstoreDB_V683::TABLE_NAME);
     21                        BVProtect_V685::$db->dropBVTable(BVProtectIpstoreDB_V685::TABLE_NAME);
    2222                }
    2323
    2424                public function isLPIPBlacklisted($ip) {
    25                         return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     25                        return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    2626                }
    2727
    2828                public function isLPIPWhitelisted($ip) {
    29                         return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_LP);
     29                        return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_LP);
    3030                }
    3131
    3232                public function getTypeIfBlacklistedIP($ip) {
    33                         return $this->getIPType($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     33                        return $this->getIPType($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    3434                }
    3535
    3636                public function isFWIPBlacklisted($ip) {
    37                         return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     37                        return $this->checkIPPresent($ip, self::blacklistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    3838                }
    3939
    4040                public function isFWIPWhitelisted($ip) {
    41                         return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V683::CATEGORY_FW);
     41                        return $this->checkIPPresent($ip, self::whitelistedTypes(), BVProtectIpstoreDB_V685::CATEGORY_FW);
    4242                }
    4343
    … …  
    5050                #XNOTE: getIPCategory or getIPType?
    5151                private function getIPType($ip, $types, $category) {
    52                         $table = BVProtect_V683::$db->getBVTable(BVProtectIpstoreDB_V683::TABLE_NAME);
     52                        $table = BVProtect_V685::$db->getBVTable(BVProtectIpstoreDB_V685::TABLE_NAME);
    5353
    54                         if (BVProtect_V683::$db->isTablePresent($table)) {
    55                                 $binIP = BVProtectUtils_V683::bvInetPton($ip);
    56                                 $is_v6 = BVProtectUtils_V683::isIPv6($ip);
     54                        if (BVProtect_V685::$db->isTablePresent($table)) {
     55                                $binIP = BVProtectUtils_V685::bvInetPton($ip);
     56                                $is_v6 = BVProtectUtils_V685::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 == BVProtectIpstoreDB_V683::CATEGORY_FW) {
     60                                        if ($category == BVProtectIpstoreDB_V685::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 = BVProtect_V683::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
     67                                        $query = BVProtect_V685::$db->prepare($query_str, array($binIP, $binIP, $is_v6));
    6868
    69                                         return BVProtect_V683::$db->getVar($query, 5);
     69                                        return BVProtect_V685::$db->getVar($query, 5);
    7070                                }
    7171                        }
  • blogvault-real-time-backup/trunk/protect/ipstore/fs.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectIpstoreFS_V683')) :
    5         class BVProtectIpstoreFS_V683 {
     4if (!class_exists('BVProtectIpstoreFS_V685')) :
     5        class BVProtectIpstoreFS_V685 {
    66                private $whitelisted_ips;
    77                private $blacklisted_ips;
    … …  
    1212                function __construct() {
    1313                        $ip_store_file = MCDATAPATH . MCCONFKEY . '-' . 'mc_ips.conf';
    14                         $ips = BVProtectUtils_V683::parseFile($ip_store_file);
     14                        $ips = BVProtectUtils_V685::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, BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
     20                        return $this->getIPType($ip, BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED);
    2121                }
    2222
    2323                public function isFWIPBlacklisted($ip) {
    24                         return $this->checkIPPresent($ip, BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED);
     24                        return $this->checkIPPresent($ip, BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED);
    2525                }
    2626
    2727                public function isFWIPWhitelisted($ip) {
    28                         return $this->checkIPPresent($ip, BVProtectIpstoreFS_V683::IP_TYPE_WHITELISTED);
     28                        return $this->checkIPPresent($ip, BVProtectIpstoreFS_V685::IP_TYPE_WHITELISTED);
    2929                }
    3030
    … …  
    3737                private function getIPType($ip, $type) {
    3838                        switch ($type) {
    39                         case BVProtectIpstoreFS_V683::IP_TYPE_BLACKLISTED:
     39                        case BVProtectIpstoreFS_V685::IP_TYPE_BLACKLISTED:
    4040                                return isset($this->blacklisted_ips[$ip]) ? $this->blacklisted_ips[$ip] : null;
    41                         case BVProtectIpstoreFS_V683::IP_TYPE_WHITELISTED:
     41                        case BVProtectIpstoreFS_V685::IP_TYPE_WHITELISTED:
    4242                                return isset($this->whitelisted_ips[$ip]) ? $this->whitelisted_ips[$ip] : null;
    4343                        }
  • blogvault-real-time-backup/trunk/protect/lib/utils.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectUtils_V683')) :
    5 class BVProtectUtils_V683 {
     4if (!class_exists('BVProtectUtils_V685')) :
     5class BVProtectUtils_V685 {
    66        public static function getIP($ip_header) {
    77                $ip = null;
    … …  
    131131                if (is_array($val)) {
    132132                        foreach ($val as $e) {
    133                                 $length += BVProtectUtils_V683::getLength($e);
     133                                $length += BVProtectUtils_V685::getLength($e);
    134134                        }
    135135
  • blogvault-real-time-backup/trunk/protect/logger.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLogger_V683')) :
     4if (!class_exists('BVProtectLogger_V685')) :
    55require_once dirname( __FILE__ ) . '/logger/fs.php';
    66require_once dirname( __FILE__ ) . '/logger/db.php';
    77
    8 class BVProtectLogger_V683 {
     8class BVProtectLogger_V685 {
    99        private $log_destination;
    1010
    … …  
    1212        const TYPE_DB = 1;
    1313
    14         function __construct($name, $type = BVProtectLogger_V683::TYPE_DB) {
    15                 if ($type == BVProtectLogger_V683::TYPE_FS) {
    16                         $this->log_destination = new BVProtectLoggerFS_V683($name);
     14        function __construct($name, $type = BVProtectLogger_V685::TYPE_DB) {
     15                if ($type == BVProtectLogger_V685::TYPE_FS) {
     16                        $this->log_destination = new BVProtectLoggerFS_V685($name);
    1717                } else {
    18                         $this->log_destination = new BVProtectLoggerDB_V683($name);
     18                        $this->log_destination = new BVProtectLoggerDB_V685($name);
    1919                }
    2020        }
  • blogvault-real-time-backup/trunk/protect/logger/db.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLoggerDB_V683')) :
    5 class BVProtectLoggerDB_V683 {
     4if (!class_exists('BVProtectLoggerDB_V685')) :
     5class BVProtectLoggerDB_V685 {
    66        private $tablename;
    77        private $bv_tablename;
    … …  
    1111        function __construct($tablename) {
    1212                $this->tablename = $tablename;
    13                 $this->bv_tablename = BVProtect_V683::$db->getBVTable($tablename);
     13                $this->bv_tablename = BVProtect_V685::$db->getBVTable($tablename);
    1414        }
    1515
    1616        public function log($data) {
    1717                if (is_array($data)) {
    18                         if (BVProtect_V683::$db->rowsCount($this->bv_tablename) > BVProtectLoggerDB_V683::MAXROWCOUNT) {
    19                                 BVProtect_V683::$db->deleteRowsFromtable($this->tablename, 1);
     18                        if (BVProtect_V685::$db->rowsCount($this->bv_tablename) > BVProtectLoggerDB_V685::MAXROWCOUNT) {
     19                                BVProtect_V685::$db->deleteRowsFromtable($this->tablename, 1);
    2020                        }
    2121
    22                         BVProtect_V683::$db->replaceIntoBVTable($this->tablename, $data);
     22                        BVProtect_V685::$db->replaceIntoBVTable($this->tablename, $data);
    2323                }
    2424        }
  • blogvault-real-time-backup/trunk/protect/logger/fs.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLoggerFS_V683')) :
    5 class BVProtectLoggerFS_V683 {
     4if (!class_exists('BVProtectLoggerFS_V685')) :
     5class BVProtectLoggerFS_V685 {
    66        public $logFile;
    77
  • blogvault-real-time-backup/trunk/protect/lp.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtectLP_V683')) :
    5 class BVProtectLP_V683 {
     4if (!class_exists('BVProtectLP_V685')) :
     5class BVProtectLP_V685 {
    66        private $ip;
    77        private $time;
    … …  
    1010        private $brand_name;
    1111
    12         private $mode              = BVProtectLP_V683::MODE_DISABLED;
     12        private $mode              = BVProtectLP_V685::MODE_DISABLED;
    1313        private $captcha_limit     = 3;
    1414        private $temp_block_limit  = 10;
    … …  
    1818        private $all_blocked_gap   = 1800;
    1919
    20         private $category          = BVProtectLP_V683::CATEGORY_ALLOWED;
     20        private $category          = BVProtectLP_V685::CATEGORY_ALLOWED;
    2121        private $username          = '';
    2222        private $message           = '';
    … …  
    4747                $this->ip = $request->getIP();
    4848                $this->brand_name = $brand_name;
    49                 $this->ipstore = new BVProtectIpstore_V683();
    50                 $this->logger = new BVProtectLogger_V683(BVProtectLP_V683::TABLE_NAME);
     49                $this->ipstore = new BVProtectIpstore_V685();
     50                $this->logger = new BVProtectLogger_V685(BVProtectLP_V685::TABLE_NAME);
    5151                $this->time = strtotime(gmdate("Y-m-d H:i:s"));
    5252
    … …  
    9191
    9292        public static function uninstall() {
    93                 BVProtect_V683::$db->dropBVTable(BVProtectLP_V683::TABLE_NAME);
     93                BVProtect_V685::$db->dropBVTable(BVProtectLP_V685::TABLE_NAME);
    9494        }
    9595
    … …  
    103103
    104104        private function getCaptchaLink() {
    105                 $account = BVAccount::apiPublicAccount(BVProtect_V683::$settings);
     105                $account = BVAccount::apiPublicAccount(BVProtect_V685::$settings);
    106106
    107107                $url = $account->authenticatedUrl('/captcha/solve');
    … …  
    112112
    113113        private function getAllowLoginsTransient() {
    114                 return BVProtect_V683::$settings->getTransient('bvlp_allow_logins');
     114                return BVProtect_V685::$settings->getTransient('bvlp_allow_logins');
    115115        }
    116116
    117117        private function getBlockLoginsTransient() {
    118                 return BVProtect_V683::$settings->getTransient('bvlp_block_logins');
     118                return BVProtect_V685::$settings->getTransient('bvlp_block_logins');
    119119        }
    120120
    … …  
    142142
    143143        private function isProtecting() {
    144                 return $this->mode === BVProtectLP_V683::MODE_PROTECT;
     144                return $this->mode === BVProtectLP_V685::MODE_PROTECT;
    145145        }
    146146
    147147        private function isActive() {
    148                 return $this->mode !== BVProtectLP_V683::MODE_DISABLED;
     148                return $this->mode !== BVProtectLP_V685::MODE_DISABLED;
    149149        }
    150150
    … …  
    158158
    159159        private function isUnBlockedIP() {
    160                 $transient_name = BVProtectLP_V683::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
    161                 $attempts = BVProtect_V683::$settings->getTransient($transient_name);
     160                $transient_name = BVProtectLP_V685::UNBLOCK_IP_TRANSIENT_PREFIX . $this->ip;
     161                $attempts = BVProtect_V685::$settings->getTransient($transient_name);
    162162
    163163                if ($attempts && $attempts > 0) {
    164                         BVProtect_V683::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
     164                        BVProtect_V685::$settings->setTransient($transient_name, $attempts - 1, 600 * $attempts);
    165165                        return true;
    166166                }
    … …  
    171171        private function isLoginBlocked() {
    172172                if ($this->getAllowLoginsTransient() ||
    173                                 ($this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_FAILURE, null, $this->all_blocked_gap) < $this->block_all_limit)) {
     173                                ($this->getLoginCount(BVProtectLP_V685::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(BVProtectLP_V683::LOGIN_STATUS_BLOCKED);
     196                $this->log(BVProtectLP_V685::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 = BVProtectLP_V683::CATEGORY_UNBLOCKED;
     210                        $this->category = BVProtectLP_V685::CATEGORY_UNBLOCKED;
    211211                } else {
    212                         $failed_attempts = $this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_FAILURE,
     212                        $failed_attempts = $this->getLoginCount(BVProtectLP_V685::LOGIN_STATUS_FAILURE,
    213213                                                                                                                                                                                        $this->ip, $this->failed_login_gap);
    214214
    215215                        if ($this->isWhitelistedIP()) {
    216                                 $this->category = BVProtectLP_V683::CATEGORY_BYPASSED;
    217                         } elseif (BVProtectUtils_V683::isPrivateIP($this->ip)) {
    218                                 $this->category = BVProtectLP_V683::CATEGORY_PRIVATEIP;
     216                                $this->category = BVProtectLP_V685::CATEGORY_BYPASSED;
     217                        } elseif (BVProtectUtils_V685::isPrivateIP($this->ip)) {
     218                                $this->category = BVProtectLP_V685::CATEGORY_PRIVATEIP;
    219219                        } elseif ($this->isBlacklistedIP()) {
    220                                 $this->category = BVProtectLP_V683::CATEGORY_BLACKLISTED;
     220                                $this->category = BVProtectLP_V685::CATEGORY_BLACKLISTED;
    221221                                $this->terminateLogin();
    222222                        } elseif ($this->isKnownLogin()) {
    223                                 $this->category = BVProtectLP_V683::CATEGORY_BYPASSED;
     223                                $this->category = BVProtectLP_V685::CATEGORY_BYPASSED;
    224224                        } elseif ($this->isLoginBlocked()) {
    225                                 $this->category = BVProtectLP_V683::CATEGORY_ALL_BLOCKED;
     225                                $this->category = BVProtectLP_V685::CATEGORY_ALL_BLOCKED;
    226226                                $this->terminateLogin();
    227227                        } elseif ($failed_attempts >= $this->temp_block_limit) {
    228                                 $this->category = BVProtectLP_V683::CATEGORY_TEMP_BLOCK;
     228                                $this->category = BVProtectLP_V685::CATEGORY_TEMP_BLOCK;
    229229                                $this->terminateLogin();
    230230                        } elseif ($failed_attempts >= $this->captcha_limit) {
    231                                 $this->category = BVProtectLP_V683::CATEGORY_CAPTCHA_BLOCK;
     231                                $this->category = BVProtectLP_V685::CATEGORY_CAPTCHA_BLOCK;
    232232                                $this->terminateLogin();
    233233                        }
    … …  
    243243        public function loginFailed($username) {
    244244                $this->username = $username;
    245                 $this->log(BVProtectLP_V683::LOGIN_STATUS_FAILURE);
     245                $this->log(BVProtectLP_V685::LOGIN_STATUS_FAILURE);
    246246        }
    247247
    … …  
    249249                $this->username = $username;
    250250                $this->message = 'Login Success';
    251                 $this->log(BVProtectLP_V683::LOGIN_STATUS_SUCCESS);
     251                $this->log(BVProtectLP_V685::LOGIN_STATUS_SUCCESS);
    252252        }
    253253
    254254        private function isKnownLogin() {
    255                 return $this->getLoginCount(BVProtectLP_V683::LOGIN_STATUS_SUCCESS,
     255                return $this->getLoginCount(BVProtectLP_V685::LOGIN_STATUS_SUCCESS,
    256256                                                                                                                                $this->ip, $this->success_login_gap) > 0;
    257257        }
    258258
    259259        private function getLoginCount($status, $ip, $gap) {
    260                 $table = BVProtect_V683::$db->getBVTable(BVProtectLP_V683::TABLE_NAME);
     260                $table = BVProtect_V685::$db->getBVTable(BVProtectLP_V685::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 = BVProtect_V683::$db->prepare($query_str, $query_args);
     264                $query = BVProtect_V685::$db->prepare($query_str, $query_args);
    265265                if ($ip) {
    266                         $query .= BVProtect_V683::$db->prepare(" && ip=%s", $ip);
    267                 }
    268 
    269                 $rows = BVProtect_V683::$db->getResult($query);
     266                        $query .= BVProtect_V685::$db->prepare(" && ip=%s", $ip);
     267                }
     268
     269                $rows = BVProtect_V685::$db->getResult($query);
    270270                if (!$rows) {
    271271                        return 0;
  • blogvault-real-time-backup/trunk/protect/prepend/ignitor.php

    r3795700 r3813747  
    55        require_once dirname( __FILE__ ) . '/../protect.php';
    66
    7         BVProtect_V683::init(BVProtect_V683::MODE_PREPEND);
     7        BVProtect_V685::init(BVProtect_V685::MODE_PREPEND);
    88}
  • blogvault-real-time-backup/trunk/protect/protect.php

    r3795700 r3813747  
    22if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    33
    4 if (!class_exists('BVProtect_V683')) :
     4if (!class_exists('BVProtect_V685')) :
    55require_once dirname( __FILE__ ) . '/logger.php';
    66require_once dirname( __FILE__ ) . '/ipstore.php';
    … …  
    1212require_once dirname( __FILE__ ) . '/../helper.php';
    1313
    14 class BVProtect_V683 {
     14class BVProtect_V685 {
    1515        public static $settings;
    1616        public static $db;
    … …  
    2727                }
    2828
    29                 if ($mode == BVProtect_V683::MODE_PREPEND) {
     29                if ($mode == BVProtect_V685::MODE_PREPEND) {
    3030                        $config_file = MCDATAPATH .  MCCONFKEY . '-' . 'mc.conf';
    31                         $config = BVProtectUtils_V683::parseFile($config_file);
     31                        $config = BVProtectUtils_V685::parseFile($config_file);
    3232
    3333                        if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
    3434                                        !isset($config['mc_conf_version']) ||
    35                                         (BVProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
     35                                        (BVProtect_V685::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 BVProtectRequest_V683($request_ip_header, $req_config);
     43                        $request = new BVProtectRequest_V685($request_ip_header, $req_config);
    4444                        $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
    4545
    46                         BVProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
     46                        BVProtectFW_V685::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                                         (BVProtect_V683::CONF_VERSION !== $config['mc_conf_version'])) {
     51                                        (BVProtect_V685::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 BVProtectRequest_V683($request_ip_header, $req_config);
     59                        $request = new BVProtectRequest_V685($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                         BVProtectFW_V683::getInstance($mode, $request, $fw_config, $brand_name)->init();
    64                         BVProtectLP_V683::getInstance($request, $lp_config, $brand_name)->init();
     63                        BVProtectFW_V685::getInstance($mode, $request, $fw_config, $brand_name)->init();
     64                        BVProtectLP_V685::getInstance($request, $lp_config, $brand_name)->init();
    6565                }
    6666        }
    … …  
    6969                self::$settings->deleteOption('bvptconf');
    7070                self::$settings->deleteOption('bvptplug');
    71                 BVProtectIpstore_V683::uninstall();
    72                 BVProtectFW_V683::uninstall();
    73                 BVProtectLP_V683::uninstall();
     71                BVProtectIpstore_V685::uninstall();
     72                BVProtectFW_V685::uninstall();
     73                BVProtectLP_V685::uninstall();
    7474
    75                 BVProtect_V683::removeWPPrepend();
    76                 BVProtect_V683::removePHPPrepend();
    77                 BVProtect_V683::removeMCData();
     75                BVProtect_V685::removeWPPrepend();
     76                BVProtect_V685::removePHPPrepend();
     77                BVProtect_V685::removeMCData();
    7878
    7979                return true;
    … …  
    9696                $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';";
    9797               
    98                 BVProtectUtils_V683::fileRemovePattern($fname, $pattern);
     98                BVProtectUtils_V685::fileRemovePattern($fname, $pattern);
    9999        }
    100100
    101101        private static function removePHPPrepend() {
    102                 BVProtect_V683::removeHtaccessPrepend();
    103                 BVProtect_V683::removeUseriniPrepend();
     102                BVProtect_V685::removeHtaccessPrepend();
     103                BVProtect_V685::removeUseriniPrepend();
    104104        }
    105105
    … …  
    107107                $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
    108108
    109                 BVProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
     109                BVProtectUtils_V685::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
    110110        }
    111111
    … …  
    113113                $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
    114114
    115                 BVProtectUtils_V683::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
     115                BVProtectUtils_V685::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
    116116        }
    117117
    … …  
    120120                $mc_data_dir = $content_dir . "/mc_data";
    121121
    122                 BVProtectUtils_V683::rrmdir($mc_data_dir);
     122                BVProtectUtils_V685::rrmdir($mc_data_dir);
    123123        }
    124124}
  • blogvault-real-time-backup/trunk/protect/request.php

    r3795700 r3813747  
    33if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
    44
    5 if (!class_exists('BVProtectRequest_V683')) :
    6 class BVProtectRequest_V683 {
     5if (!class_exists('BVProtectRequest_V685')) :
     6class BVProtectRequest_V685 {
    77        public $ip;
    88        public $host = '';
    … …  
    2020        public $files;
    2121        public $respcode;
    22         public $status = BVProtectRequest_V683::STATUS_ALLOWED;
    23         public $category = BVProtectRequest_V683::CATEGORY_NORMAL;
     22        public $status = BVProtectRequest_V685::STATUS_ALLOWED;
     23        public $category = BVProtectRequest_V685::CATEGORY_NORMAL;
    2424
    2525        public $wp_user;
    … …  
    6060
    6161        public function __construct($ip_header, $config) {
    62                 $this->ip = BVProtectUtils_V683::getIP($ip_header);
     62                $this->ip = BVProtectUtils_V685::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                         BVProtectRequest_V683::CATEGORY_BOT_BLOCKED,
    145                         BVProtectRequest_V683::CATEGORY_COUNTRY_BLOCKED,
    146                         BVProtectRequest_V683::CATEGORY_USER_BLACKLISTED,
    147                         BVProtectRequest_V683::CATEGORY_GLOBAL_BOT_BLOCKED
     144                        BVProtectRequest_V685::CATEGORY_BOT_BLOCKED,
     145                        BVProtectRequest_V685::CATEGORY_COUNTRY_BLOCKED,
     146                        BVProtectRequest_V685::CATEGORY_USER_BLACKLISTED,
     147                        BVProtectRequest_V685::CATEGORY_GLOBAL_BOT_BLOCKED
    148148                );
    149149        }
    150150
    151151        public static function whitelistedCategories() {
    152                 return array(BVProtectRequest_V683::CATEGORY_WHITELISTED);
     152                return array(BVProtectRequest_V685::CATEGORY_WHITELISTED);
    153153        }
    154154
    … …  
    488488                }
    489489
    490                 $_json_params = BVProtectUtils_V683::safeDecodeJSON(
     490                $_json_params = BVProtectUtils_V685::safeDecodeJSON(
    491491                        $this->raw_body,
    492492                        true,
  • blogvault-real-time-backup/trunk/protect/wp_user.php

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

    r3795700 r3813747  
    77Tested up to: 7.1
    88Requires PHP: 7.0
    9 Stable tag: 6.83
     9Stable tag: 6.85
    1010License: GPLv2 or later
    1111License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
    … …  
    271271
    272272== CHANGELOG ==
     273= 6.85 =
     274* Improvement: Form test cleanup now also removes uploaded files, and checks each item against the test's record before deleting it.
     275* Improvement: Form tests now confirm what a test submission did (entry saved, notification email, integrations) without delivering the email, and remove the test entry afterwards.
     276* Improvement: Form tests support more form plugins, including their CAPTCHA and anti-spam checks.
     277* Improvement: Hardened the handling of form test requests.
     278
    273279= 6.83 =
    274280* 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.
Note: See TracChangeset for help on using the changeset viewer.