| @@ -4,9 +4,9 @@ | ||
| 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.81 | |
| 9 | 9 | Network: True |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | /* Copyright 2017 WP Remote (email : support@wpremote.com) |
| @@ -36,8 +36,13 @@ | ||
| 36 | 36 | require_once dirname( __FILE__ ) . '/wp_api.php'; |
| 37 | 37 | require_once dirname( __FILE__ ) . '/wp_actions.php'; |
| 38 | 38 | require_once dirname( __FILE__ ) . '/info.php'; |
| 39 | 39 | require_once dirname( __FILE__ ) . '/account.php'; |
| 40 | +require_once dirname( __FILE__ ) . '/helper.php'; | |
| 41 | +require_once dirname( __FILE__ ) . '/wp_2fa/wp_2fa.php'; | |
| 42 | + | |
| 43 | +require_once dirname( __FILE__ ) . '/wp_login_whitelabel.php'; | |
| 44 | + | |
| 40 | 45 | ##WPCACHEMODULE## |
| 41 | 46 | |
| 42 | 47 | |
| 43 | 48 | $bvsettings = new WPRWPSettings(); |
| @@ -52,10 +57,12 @@ | ||
| 52 | 57 | register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall')); |
| 53 | 58 | register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 54 | 59 | register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 55 | 60 | |
| 61 | + | |
| 56 | 62 | add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 57 | -add_action('clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); | |
| 63 | +add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); | |
| 64 | + | |
| 58 | 65 | ##SOADDUNINSTALLACTION## |
| 59 | 66 | |
| 60 | 67 | ##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 61 | 68 | |
| @@ -63,9 +70,9 @@ | ||
| 63 | 70 | if (is_admin()) { |
| 64 | 71 | require_once dirname( __FILE__ ) . '/wp_admin.php'; |
| 65 | 72 | $wpadmin = new WPRWPAdmin($bvsettings, $bvsiteinfo); |
| 66 | 73 | add_action('admin_init', array($wpadmin, 'initHandler')); |
| 67 | - add_filter('all_plugins', array($wpadmin, 'initBranding')); | |
| 74 | + add_filter('all_plugins', array($wpadmin, 'initWhitelabel')); | |
| 68 | 75 | add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2); |
| 69 | 76 | add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1); |
| 70 | 77 | if ($bvsiteinfo->isMultisite()) { |
| 71 | 78 | add_action('network_admin_menu', array($wpadmin, 'menu')); |
| @@ -73,8 +80,9 @@ | ||
| 73 | 80 | add_action('admin_menu', array($wpadmin, 'menu')); |
| 74 | 81 | } |
| 75 | 82 | add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 76 | 83 | add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 84 | + ##POPUP_ON_DEACTIVATION## | |
| 77 | 85 | add_action('admin_notices', array($wpadmin, 'activateWarning')); |
| 78 | 86 | add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu')); |
| 79 | 87 | ##ALPURGECACHEFUNCTION## |
| 80 | 88 | ##ALADMINMENU## |
| @@ -83,8 +91,16 @@ | ||
| 83 | 91 | if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { |
| 84 | 92 | $_REQUEST = array_merge($_GET, $_POST); |
| 85 | 93 | } |
| 86 | 94 | |
| 95 | +#Service active check | |
| 96 | +if ($bvinfo->config != false) { | |
| 97 | + add_action('wpr_remove_bv_preload_include', array($wp_action, 'removeBVPreload')); | |
| 98 | +} | |
| 99 | + | |
| 100 | +require_once dirname( __FILE__ ) . '/php_error_monitoring/monitoring.php'; | |
| 101 | +WPRWPPHPErrorMonitoring::init(); | |
| 102 | + | |
| 87 | 103 | if ($bvinfo->hasValidDBVersion()) { |
| 88 | 104 | if ($bvinfo->isServiceActive('activity_log')) { |
| 89 | 105 | require_once dirname( __FILE__ ) . '/wp_actlog.php'; |
| 90 | 106 | $bvconfig = $bvinfo->config; |
| @@ -91,8 +107,15 @@ | ||
| 91 | 107 | $actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']); |
| 92 | 108 | $actlog->init(); |
| 93 | 109 | } |
| 94 | 110 | |
| 111 | + if ($bvinfo->isServiceActive('maintenance_mode')) { | |
| 112 | + require_once dirname( __FILE__ ). '/maintenance/wp_maintenance.php'; | |
| 113 | + $bvconfig = $bvinfo->config; | |
| 114 | + $maintenance = new BVWPMaintenance($bvconfig['maintenance_mode']); | |
| 115 | + $maintenance->init(); | |
| 116 | + } | |
| 117 | + | |
| 95 | 118 | } |
| 96 | 119 | |
| 97 | 120 | if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "wpremote")) { |
| 98 | 121 | require_once dirname( __FILE__ ) . '/callback/base.php'; |
| @@ -107,58 +130,91 @@ | ||
| 107 | 130 | } else { |
| 108 | 131 | $account = WPRAccount::find($bvsettings, $pubkey); |
| 109 | 132 | } |
| 110 | 133 | |
| 111 | - $request = new BVCallbackRequest($account, $_REQUEST); | |
| 134 | + $request = new BVCallbackRequest($account, $_REQUEST, $bvsettings); | |
| 112 | 135 | $response = new BVCallbackResponse($request->bvb64cksize); |
| 113 | 136 | |
| 114 | - if ($account && (1 === $account->authenticate($request))) { | |
| 115 | - define('WPRBASEPATH', plugin_dir_path(__FILE__)); | |
| 137 | + if ($request->authenticate() === 1) { | |
| 138 | + if (array_key_exists('bv_ignr_frm_cptch', $_REQUEST)) { | |
| 139 | + #handling of Contact Forms 7 | |
| 140 | + add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX, 2); | |
| 116 | 141 | |
| 142 | + #handling of Formidable plugin | |
| 143 | + add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX, 3); | |
| 117 | 144 | |
| 118 | - require_once dirname( __FILE__ ) . '/callback/handler.php'; | |
| 145 | + #handling of WP Forms plugin | |
| 146 | + add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX, 3); | |
| 119 | 147 | |
| 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); | |
| 129 | - } | |
| 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')); | |
| 148 | + #handling of Forminator plugin | |
| 149 | + if (defined('WP_PLUGIN_DIR')) { | |
| 150 | + $abstractFrontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php'; | |
| 151 | + $frontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/modules/custom-forms/front/front-action.php'; | |
| 152 | + | |
| 153 | + if (file_exists($abstractFrontActionFilePath) && file_exists($frontActionFilePath)) { | |
| 154 | + require_once $abstractFrontActionFilePath; | |
| 155 | + require_once $frontActionFilePath; | |
| 156 | + if (class_exists('Forminator_CForm_Front_Action')) { | |
| 157 | + Forminator_CForm_Front_Action::$hidden_fields[] = "bv-stripe-"; | |
| 158 | + } | |
| 159 | + } | |
| 160 | + } | |
| 161 | + | |
| 162 | + #handling of CleanTalk Antispam plugin | |
| 163 | + add_action('init', function() { | |
| 164 | + global $apbct; | |
| 165 | + if (isset($apbct) && is_object($apbct)) { | |
| 166 | + $apbct->settings['forms__contact_forms_test'] = 0; | |
| 167 | + } | |
| 168 | + }); | |
| 169 | + | |
| 170 | + #handling of Akismet plugin | |
| 171 | + add_filter('akismet_get_api_key', function($api_key) { return null; }, PHP_INT_MAX); | |
| 172 | + | |
| 173 | + #handling of Formidable Antispam | |
| 174 | + add_filter('frm_validate_entry', function($errors, $values, $args) { | |
| 175 | + unset($errors['spam']); | |
| 176 | + return $errors; | |
| 177 | + }, PHP_INT_MAX, 3); | |
| 137 | 178 | } else { |
| 138 | - $callback_handler->execute(); | |
| 179 | + define('WPRBASEPATH', plugin_dir_path(__FILE__)); | |
| 180 | + | |
| 181 | + | |
| 182 | + require_once dirname( __FILE__ ) . '/callback/handler.php'; | |
| 183 | + | |
| 184 | + $params = $request->processParams($_REQUEST); | |
| 185 | + if ($params === false) { | |
| 186 | + $response->terminate($request->corruptedParamsResp()); | |
| 187 | + } | |
| 188 | + $request->params = $params; | |
| 189 | + $callback_handler = new BVCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response); | |
| 190 | + if ($request->is_afterload) { | |
| 191 | + add_action('wp_loaded', array($callback_handler, 'execute')); | |
| 192 | + } else if ($request->is_admin_ajax) { | |
| 193 | + add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser')); | |
| 194 | + add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser')); | |
| 195 | + } else { | |
| 196 | + $callback_handler->execute(); | |
| 197 | + } | |
| 139 | 198 | } |
| 140 | 199 | } 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); | |
| 200 | + $response->terminate($request->authFailedResp()); | |
| 150 | 201 | } |
| 151 | 202 | } else { |
| 152 | 203 | if ($bvinfo->hasValidDBVersion()) { |
| 153 | 204 | 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(); | |
| 205 | + require_once dirname( __FILE__ ) . '/protect/protect.php'; | |
| 206 | + //For backward compatibility. | |
| 207 | + WPRProtect_V581::$settings = new WPRWPSettings(); | |
| 208 | + WPRProtect_V581::$db = new WPRWPDb(); | |
| 209 | + WPRProtect_V581::$info = new WPRInfo(WPRProtect_V581::$settings); | |
| 210 | + | |
| 211 | + add_action('wpr_clear_pt_config', array('WPRProtect_V581', 'uninstall')); | |
| 212 | + | |
| 213 | + if ($bvinfo->isActivePlugin()) { | |
| 214 | + WPRProtect_V581::init(WPRProtect_V581::MODE_WP); | |
| 215 | + } | |
| 159 | 216 | } |
| 160 | - } | |
| 161 | 217 | |
| 162 | 218 | if ($bvinfo->isDynSyncModuleEnabled()) { |
| 163 | 219 | require_once dirname( __FILE__ ) . '/wp_dynsync.php'; |
| 164 | 220 | $bvconfig = $bvinfo->config; |
| @@ -191,5 +247,18 @@ | ||
| 191 | 247 | if (is_admin()) { |
| 192 | 248 | add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate')); |
| 193 | 249 | } |
| 194 | 250 | |
| 195 | -} | |
| 251 | + ##THIRDPARTYCACHINGMODULE## | |
| 252 | +} | |
| 253 | + | |
| 254 | +if (WPRWP2FA::isEnabled($bvsettings)) { | |
| 255 | + $wp_2fa = new WPRWP2FA(); | |
| 256 | + $wp_2fa->init(); | |
| 257 | +} | |
| 258 | + | |
| 259 | +if (!empty($bvinfo->getLPWhitelabelInfo())) { | |
| 260 | + $wp_login_whitelabel = new WPRWPLoginWhitelabel(); | |
| 261 | + $wp_login_whitelabel->init(); | |
| 262 | +} | |
| 263 | + | |
| 264 | +add_action('wpr_clear_wp_2fa_config', array($wp_action, 'clear_wp_2fa_config')); | |