| @@ -4,10 +4,12 @@ | ||
| 4 | 4 | Plugin URI: https://wpremote.com |
| 5 | 5 | Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. |
| 6 | 6 | Author: WP Remote |
| 7 | 7 | Author URI: https://wpremote.com |
| 8 | -Version: 5.65 | |
| 8 | +Version: 5.88 | |
| 9 | 9 | Network: True |
| 10 | +License: GPLv2 or later | |
| 11 | +License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) | |
| 10 | 12 | */ |
| 11 | 13 | |
| 12 | 14 | /* Copyright 2017 WP Remote (email : support@wpremote.com) |
| 13 | 15 | |
| @@ -37,8 +39,12 @@ | ||
| 37 | 39 | require_once dirname( __FILE__ ) . '/wp_actions.php'; |
| 38 | 40 | require_once dirname( __FILE__ ) . '/info.php'; |
| 39 | 41 | require_once dirname( __FILE__ ) . '/account.php'; |
| 40 | 42 | require_once dirname( __FILE__ ) . '/helper.php'; |
| 43 | +require_once dirname( __FILE__ ) . '/wp_2fa/wp_2fa.php'; | |
| 44 | + | |
| 45 | +require_once dirname( __FILE__ ) . '/wp_login_whitelabel.php'; | |
| 46 | + | |
| 41 | 47 | ##WPCACHEMODULE## |
| 42 | 48 | |
| 43 | 49 | |
| 44 | 50 | $bvsettings = new WPRWPSettings(); |
| @@ -53,10 +59,12 @@ | ||
| 53 | 59 | register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall')); |
| 54 | 60 | register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 55 | 61 | register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 56 | 62 | |
| 63 | + | |
| 57 | 64 | add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 58 | -add_action('clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); | |
| 65 | +add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); | |
| 66 | + | |
| 59 | 67 | ##SOADDUNINSTALLACTION## |
| 60 | 68 | |
| 61 | 69 | ##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 62 | 70 | |
| @@ -74,8 +82,9 @@ | ||
| 74 | 82 | add_action('admin_menu', array($wpadmin, 'menu')); |
| 75 | 83 | } |
| 76 | 84 | add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 77 | 85 | add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 86 | + ##POPUP_ON_DEACTIVATION## | |
| 78 | 87 | add_action('admin_notices', array($wpadmin, 'activateWarning')); |
| 79 | 88 | add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu')); |
| 80 | 89 | ##ALPURGECACHEFUNCTION## |
| 81 | 90 | ##ALADMINMENU## |
| @@ -80,12 +89,17 @@ | ||
| 80 | 89 | ##ALPURGECACHEFUNCTION## |
| 81 | 90 | ##ALADMINMENU## |
| 82 | 91 | } |
| 83 | 92 | |
| 84 | -if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { | |
| 85 | - $_REQUEST = array_merge($_GET, $_POST); | |
| 93 | +if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended | |
| 94 | + $_REQUEST = array_merge($_GET, $_POST); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended | |
| 86 | 95 | } |
| 87 | 96 | |
| 97 | +#Service active check | |
| 98 | +if ($bvinfo->config != false) { | |
| 99 | + add_action('wpr_remove_bv_preload_include', array($wp_action, 'removeBVPreload')); | |
| 100 | +} | |
| 101 | + | |
| 88 | 102 | require_once dirname( __FILE__ ) . '/php_error_monitoring/monitoring.php'; |
| 89 | 103 | WPRWPPHPErrorMonitoring::init(); |
| 90 | 104 | |
| 91 | 105 | if ($bvinfo->hasValidDBVersion()) { |
| @@ -104,27 +118,28 @@ | ||
| 104 | 118 | } |
| 105 | 119 | |
| 106 | 120 | } |
| 107 | 121 | |
| 108 | -if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "wpremote")) { | |
| 122 | +if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "wpremote")) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 109 | 123 | require_once dirname( __FILE__ ) . '/callback/base.php'; |
| 110 | 124 | require_once dirname( __FILE__ ) . '/callback/response.php'; |
| 111 | 125 | require_once dirname( __FILE__ ) . '/callback/request.php'; |
| 112 | 126 | require_once dirname( __FILE__ ) . '/recover.php'; |
| 113 | 127 | |
| 114 | - $pubkey = WPRAccount::sanitizeKey($_REQUEST['pubkey']); | |
| 128 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended | |
| 129 | + $pubkey = isset($_REQUEST['pubkey']) ? WPRAccount::sanitizeKey(wp_unslash($_REQUEST['pubkey'])) : ''; | |
| 115 | 130 | |
| 116 | - if (array_key_exists('rcvracc', $_REQUEST)) { | |
| 131 | + if (array_key_exists('rcvracc', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 117 | 132 | $account = WPRRecover::find($bvsettings, $pubkey); |
| 118 | 133 | } else { |
| 119 | 134 | $account = WPRAccount::find($bvsettings, $pubkey); |
| 120 | 135 | } |
| 121 | 136 | |
| 122 | - $request = new BVCallbackRequest($account, $_REQUEST, $bvsettings); | |
| 137 | + $request = new BVCallbackRequest($account, $_REQUEST, $bvsettings); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 123 | 138 | $response = new BVCallbackResponse($request->bvb64cksize); |
| 124 | 139 | |
| 125 | 140 | if ($request->authenticate() === 1) { |
| 126 | - if (array_key_exists('bv_ignr_frm_cptch', $_REQUEST)) { | |
| 141 | + if (array_key_exists('bv_ignr_frm_cptch', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 127 | 142 | #handling of Contact Forms 7 |
| 128 | 143 | add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX, 2); |
| 129 | 144 | |
| 130 | 145 | #handling of Formidable plugin |
| @@ -153,15 +168,77 @@ | ||
| 153 | 168 | if (isset($apbct) && is_object($apbct)) { |
| 154 | 169 | $apbct->settings['forms__contact_forms_test'] = 0; |
| 155 | 170 | } |
| 156 | 171 | }); |
| 157 | - } else { | |
| 172 | + | |
| 173 | + #handling of Akismet plugin | |
| 174 | + add_filter('akismet_get_api_key', function($api_key) { return null; }, PHP_INT_MAX); | |
| 175 | + | |
| 176 | + #handling of Formidable Antispam | |
| 177 | + add_filter('frm_validate_entry', function($errors, $values, $args) { | |
| 178 | + unset($errors['spam']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 179 | + return $errors; | |
| 180 | + }, PHP_INT_MAX, 3); | |
| 181 | + | |
| 182 | + #handling of Gravity Form plugin | |
| 183 | + if (isset($_REQUEST['form_id'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 184 | + $form_id = sanitize_text_field(wp_unslash($_REQUEST['form_id'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 185 | + add_filter('gform_pre_validation_' . $form_id, function($form) { | |
| 186 | + foreach ($form['fields'] as &$field) { | |
| 187 | + if ($field['type'] === 'captcha') { | |
| 188 | + $field->visibility = 'hidden'; | |
| 189 | + } | |
| 190 | + } | |
| 191 | + return $form; | |
| 192 | + }, PHP_INT_MAX, 1); | |
| 193 | + } | |
| 194 | + | |
| 195 | + #handling of Ninja Form plugin | |
| 196 | + add_filter('ninja_forms_pre_validate_field_settings', function($field_settings) { | |
| 197 | + if (isset($field_settings['type']) && in_array($field_settings['type'], array('recaptcha', 'spam'), true)) { | |
| 198 | + $field_settings['type'] = null; | |
| 199 | + } | |
| 200 | + | |
| 201 | + return $field_settings; | |
| 202 | + }, PHP_INT_MAX, 1); | |
| 203 | + | |
| 204 | + add_filter('ninja_forms_run_action_type_recaptcha', '__return_false', PHP_INT_MAX); | |
| 205 | + } | |
| 206 | + | |
| 207 | + if (array_key_exists('bv_ignr_eml', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 208 | + #handling of Gravity Form's Email | |
| 209 | + add_filter('gform_pre_send_email', function($email_data) { | |
| 210 | + $email_data['abort_email'] = true; | |
| 211 | + return $email_data; | |
| 212 | + }, PHP_INT_MAX, 1); | |
| 213 | + | |
| 214 | + #handling of Ninja Form's Email | |
| 215 | + add_filter('ninja_forms_action_email_send', '__return_true', PHP_INT_MAX); | |
| 216 | + | |
| 217 | + #handling of Contact Form 7's Email | |
| 218 | + add_action('wpcf7_before_send_mail', function($contact_form, &$abort) { $abort = true; }, PHP_INT_MAX, 2); | |
| 219 | + | |
| 220 | + #handling of WP Form's Email | |
| 221 | + add_filter('wpforms_entry_email', '__return_false', PHP_INT_MAX); | |
| 222 | + | |
| 223 | + #handling of Formidable Form's Email | |
| 224 | + add_filter('frm_send_email', '__return_false', PHP_INT_MAX); | |
| 225 | + | |
| 226 | + #handling of Forminator Form's Email | |
| 227 | + foreach (['poll', 'quiz', 'form'] as $type) { | |
| 228 | + add_filter("forminator_{$type}_get_admin_email_recipients", function() { | |
| 229 | + return []; | |
| 230 | + }, PHP_INT_MAX); | |
| 231 | + } | |
| 232 | + } | |
| 233 | + | |
| 234 | + if (!array_key_exists('bv_ignr_frm_cptch', $_REQUEST) && !array_key_exists('bv_ignr_eml', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 158 | 235 | define('WPRBASEPATH', plugin_dir_path(__FILE__)); |
| 159 | 236 | |
| 160 | 237 | |
| 161 | 238 | require_once dirname( __FILE__ ) . '/callback/handler.php'; |
| 162 | 239 | |
| 163 | - $params = $request->processParams($_REQUEST); | |
| 240 | + $params = $request->processParams($_REQUEST); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 164 | 241 | if ($params === false) { |
| 165 | 242 | $response->terminate($request->corruptedParamsResp()); |
| 166 | 243 | } |
| 167 | 244 | $request->params = $params; |
| @@ -181,11 +258,17 @@ | ||
| 181 | 258 | } else { |
| 182 | 259 | if ($bvinfo->hasValidDBVersion()) { |
| 183 | 260 | if ($bvinfo->isProtectModuleEnabled()) { |
| 184 | 261 | require_once dirname( __FILE__ ) . '/protect/protect.php'; |
| 185 | - add_action('clear_pt_config', array('WPRProtect_V565', 'uninstall')); | |
| 262 | + //For backward compatibility. | |
| 263 | + WPRProtect_V588::$settings = new WPRWPSettings(); | |
| 264 | + WPRProtect_V588::$db = new WPRWPDb(); | |
| 265 | + WPRProtect_V588::$info = new WPRInfo(WPRProtect_V588::$settings); | |
| 266 | + | |
| 267 | + add_action('wpr_clear_pt_config', array('WPRProtect_V588', 'uninstall')); | |
| 268 | + | |
| 186 | 269 | if ($bvinfo->isActivePlugin()) { |
| 187 | - WPRProtect_V565::init(WPRProtect_V565::MODE_WP); | |
| 270 | + WPRProtect_V588::init(WPRProtect_V588::MODE_WP); | |
| 188 | 271 | } |
| 189 | 272 | } |
| 190 | 273 | |
| 191 | 274 | if ($bvinfo->isDynSyncModuleEnabled()) { |
| @@ -221,5 +304,17 @@ | ||
| 221 | 304 | add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate')); |
| 222 | 305 | } |
| 223 | 306 | |
| 224 | 307 | ##THIRDPARTYCACHINGMODULE## |
| 225 | -} | |
| 308 | +} | |
| 309 | + | |
| 310 | +if (WPRWP2FA::isEnabled($bvsettings)) { | |
| 311 | + $wp_2fa = new WPRWP2FA(); | |
| 312 | + $wp_2fa->init(); | |
| 313 | +} | |
| 314 | + | |
| 315 | +if (!empty($bvinfo->getLPWhitelabelInfo())) { | |
| 316 | + $wp_login_whitelabel = new WPRWPLoginWhitelabel(); | |
| 317 | + $wp_login_whitelabel->init(); | |
| 318 | +} | |
| 319 | + | |
| 320 | +add_action('wpr_clear_wp_2fa_config', array($wp_action, 'clear_wp_2fa_config')); | |