| @@ -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: 4.97 | |
| 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 | |
| @@ -36,8 +38,13 @@ | ||
| 36 | 38 | require_once dirname( __FILE__ ) . '/wp_api.php'; |
| 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'; |
| 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 | + | |
| 40 | 47 | ##WPCACHEMODULE## |
| 41 | 48 | |
| 42 | 49 | |
| 43 | 50 | $bvsettings = new WPRWPSettings(); |
| @@ -52,10 +59,12 @@ | ||
| 52 | 59 | register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall')); |
| 53 | 60 | register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 54 | 61 | register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 55 | 62 | |
| 63 | + | |
| 56 | 64 | add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 57 | -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 | + | |
| 58 | 67 | ##SOADDUNINSTALLACTION## |
| 59 | 68 | |
| 60 | 69 | ##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 61 | 70 | |
| @@ -63,9 +72,9 @@ | ||
| 63 | 72 | if (is_admin()) { |
| 64 | 73 | require_once dirname( __FILE__ ) . '/wp_admin.php'; |
| 65 | 74 | $wpadmin = new WPRWPAdmin($bvsettings, $bvsiteinfo); |
| 66 | 75 | add_action('admin_init', array($wpadmin, 'initHandler')); |
| 67 | - add_filter('all_plugins', array($wpadmin, 'initBranding')); | |
| 76 | + add_filter('all_plugins', array($wpadmin, 'initWhitelabel')); | |
| 68 | 77 | add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2); |
| 69 | 78 | add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1); |
| 70 | 79 | if ($bvsiteinfo->isMultisite()) { |
| 71 | 80 | add_action('network_admin_menu', array($wpadmin, 'menu')); |
| @@ -73,8 +82,9 @@ | ||
| 73 | 82 | add_action('admin_menu', array($wpadmin, 'menu')); |
| 74 | 83 | } |
| 75 | 84 | add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 76 | 85 | add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 86 | + ##POPUP_ON_DEACTIVATION## | |
| 77 | 87 | add_action('admin_notices', array($wpadmin, 'activateWarning')); |
| 78 | 88 | add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu')); |
| 79 | 89 | ##ALPURGECACHEFUNCTION## |
| 80 | 90 | ##ALADMINMENU## |
| @@ -79,12 +89,20 @@ | ||
| 79 | 89 | ##ALPURGECACHEFUNCTION## |
| 80 | 90 | ##ALADMINMENU## |
| 81 | 91 | } |
| 82 | 92 | |
| 83 | -if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { | |
| 84 | - $_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 | |
| 85 | 95 | } |
| 86 | 96 | |
| 97 | +#Service active check | |
| 98 | +if ($bvinfo->config != false) { | |
| 99 | + add_action('wpr_remove_bv_preload_include', array($wp_action, 'removeBVPreload')); | |
| 100 | +} | |
| 101 | + | |
| 102 | +require_once dirname( __FILE__ ) . '/php_error_monitoring/monitoring.php'; | |
| 103 | +WPRWPPHPErrorMonitoring::init(); | |
| 104 | + | |
| 87 | 105 | if ($bvinfo->hasValidDBVersion()) { |
| 88 | 106 | if ($bvinfo->isServiceActive('activity_log')) { |
| 89 | 107 | require_once dirname( __FILE__ ) . '/wp_actlog.php'; |
| 90 | 108 | $bvconfig = $bvinfo->config; |
| @@ -91,74 +109,168 @@ | ||
| 91 | 109 | $actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']); |
| 92 | 110 | $actlog->init(); |
| 93 | 111 | } |
| 94 | 112 | |
| 113 | + if ($bvinfo->isServiceActive('maintenance_mode')) { | |
| 114 | + require_once dirname( __FILE__ ). '/maintenance/wp_maintenance.php'; | |
| 115 | + $bvconfig = $bvinfo->config; | |
| 116 | + $maintenance = new BVWPMaintenance($bvconfig['maintenance_mode']); | |
| 117 | + $maintenance->init(); | |
| 118 | + } | |
| 119 | + | |
| 95 | 120 | } |
| 96 | 121 | |
| 97 | -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 | |
| 98 | 123 | require_once dirname( __FILE__ ) . '/callback/base.php'; |
| 99 | 124 | require_once dirname( __FILE__ ) . '/callback/response.php'; |
| 100 | 125 | require_once dirname( __FILE__ ) . '/callback/request.php'; |
| 101 | 126 | require_once dirname( __FILE__ ) . '/recover.php'; |
| 102 | 127 | |
| 103 | - $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'])) : ''; | |
| 104 | 130 | |
| 105 | - if (array_key_exists('rcvracc', $_REQUEST)) { | |
| 131 | + if (array_key_exists('rcvracc', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 106 | 132 | $account = WPRRecover::find($bvsettings, $pubkey); |
| 107 | 133 | } else { |
| 108 | 134 | $account = WPRAccount::find($bvsettings, $pubkey); |
| 109 | 135 | } |
| 110 | 136 | |
| 111 | - $request = new BVCallbackRequest($account, $_REQUEST); | |
| 137 | + $request = new BVCallbackRequest($account, $_REQUEST, $bvsettings); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 112 | 138 | $response = new BVCallbackResponse($request->bvb64cksize); |
| 113 | 139 | |
| 114 | - if ($account && (1 === $account->authenticate($request))) { | |
| 115 | - define('WPRBASEPATH', plugin_dir_path(__FILE__)); | |
| 140 | + if ($request->authenticate() === 1) { | |
| 141 | + if (array_key_exists('bv_ignr_frm_cptch', $_REQUEST)) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 142 | + #handling of Contact Forms 7 | |
| 143 | + add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX, 2); | |
| 116 | 144 | |
| 145 | + #handling of Formidable plugin | |
| 146 | + add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX, 3); | |
| 117 | 147 | |
| 118 | - require_once dirname( __FILE__ ) . '/callback/handler.php'; | |
| 148 | + #handling of WP Forms plugin | |
| 149 | + add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX, 3); | |
| 119 | 150 | |
| 120 | - $params = $request->processParams($_REQUEST); | |
| 121 | - if ($params === false) { | |
| 122 | - $resp = array( | |
| 123 | - "account_info" => $account->info(), | |
| 124 | - "request_info" => $request->info(), | |
| 125 | - "bvinfo" => $bvinfo->info(), | |
| 126 | - "statusmsg" => "BVPRMS_CORRUPTED" | |
| 127 | - ); | |
| 128 | - $response->terminate($resp); | |
| 151 | + #handling of Forminator plugin | |
| 152 | + if (defined('WP_PLUGIN_DIR')) { | |
| 153 | + $abstractFrontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php'; | |
| 154 | + $frontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/modules/custom-forms/front/front-action.php'; | |
| 155 | + | |
| 156 | + if (file_exists($abstractFrontActionFilePath) && file_exists($frontActionFilePath)) { | |
| 157 | + require_once $abstractFrontActionFilePath; | |
| 158 | + require_once $frontActionFilePath; | |
| 159 | + if (class_exists('Forminator_CForm_Front_Action')) { | |
| 160 | + Forminator_CForm_Front_Action::$hidden_fields[] = "bv-stripe-"; | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + #handling of CleanTalk Antispam plugin | |
| 166 | + add_action('init', function() { | |
| 167 | + global $apbct; | |
| 168 | + if (isset($apbct) && is_object($apbct)) { | |
| 169 | + $apbct->settings['forms__contact_forms_test'] = 0; | |
| 170 | + } | |
| 171 | + }); | |
| 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); | |
| 129 | 205 | } |
| 130 | - $request->params = $params; | |
| 131 | - $callback_handler = new BVCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response); | |
| 132 | - if ($request->is_afterload) { | |
| 133 | - add_action('wp_loaded', array($callback_handler, 'execute')); | |
| 134 | - } else if ($request->is_admin_ajax) { | |
| 135 | - add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser')); | |
| 136 | - add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser')); | |
| 137 | - } else { | |
| 138 | - $callback_handler->execute(); | |
| 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 | + } | |
| 139 | 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 | |
| 235 | + define('WPRBASEPATH', plugin_dir_path(__FILE__)); | |
| 236 | + | |
| 237 | + | |
| 238 | + require_once dirname( __FILE__ ) . '/callback/handler.php'; | |
| 239 | + | |
| 240 | + $params = $request->processParams($_REQUEST); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 241 | + if ($params === false) { | |
| 242 | + $response->terminate($request->corruptedParamsResp()); | |
| 243 | + } | |
| 244 | + $request->params = $params; | |
| 245 | + $callback_handler = new BVCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response); | |
| 246 | + if ($request->is_afterload) { | |
| 247 | + add_action('wp_loaded', array($callback_handler, 'execute')); | |
| 248 | + } else if ($request->is_admin_ajax) { | |
| 249 | + add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser')); | |
| 250 | + add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser')); | |
| 251 | + } else { | |
| 252 | + $callback_handler->execute(); | |
| 253 | + } | |
| 254 | + } | |
| 140 | 255 | } else { |
| 141 | - $resp = array( | |
| 142 | - "account_info" => $account ? $account->info() : array("error" => "ACCOUNT_NOT_FOUND"), | |
| 143 | - "request_info" => $request->info(), | |
| 144 | - "bvinfo" => $bvinfo->info(), | |
| 145 | - "statusmsg" => "FAILED_AUTH", | |
| 146 | - "api_pubkey" => substr(WPRAccount::getApiPublicKey($bvsettings), 0, 8), | |
| 147 | - "def_sigmatch" => substr(WPRAccount::getSigMatch($request, WPRRecover::getDefaultSecret($bvsettings)), 0, 8) | |
| 148 | - ); | |
| 149 | - $response->terminate($resp); | |
| 256 | + $response->terminate($request->authFailedResp()); | |
| 150 | 257 | } |
| 151 | 258 | } else { |
| 152 | 259 | if ($bvinfo->hasValidDBVersion()) { |
| 153 | 260 | if ($bvinfo->isProtectModuleEnabled()) { |
| 154 | - require_once dirname( __FILE__ ) . '/protect/wp/protect.php'; | |
| 155 | - $bvprotect = new BVProtect($bvdb, $bvsettings); | |
| 156 | - $bvprotect->init(); | |
| 157 | - if ($bvinfo->isActivePlugin() && !(defined( 'WP_CLI' ) && WP_CLI)) { | |
| 158 | - $bvprotect->run(); | |
| 261 | + require_once dirname( __FILE__ ) . '/protect/protect.php'; | |
| 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 | + | |
| 269 | + if ($bvinfo->isActivePlugin()) { | |
| 270 | + WPRProtect_V588::init(WPRProtect_V588::MODE_WP); | |
| 271 | + } | |
| 159 | 272 | } |
| 160 | - } | |
| 161 | 273 | |
| 162 | 274 | if ($bvinfo->isDynSyncModuleEnabled()) { |
| 163 | 275 | require_once dirname( __FILE__ ) . '/wp_dynsync.php'; |
| 164 | 276 | $bvconfig = $bvinfo->config; |
| @@ -191,5 +303,18 @@ | ||
| 191 | 303 | if (is_admin()) { |
| 192 | 304 | add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate')); |
| 193 | 305 | } |
| 194 | 306 | |
| 195 | -} | |
| 307 | + ##THIRDPARTYCACHINGMODULE## | |
| 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')); | |