| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: WP Remote |
| 4 |
Plugin URI: https://wpremote.com |
| 5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. |
| 6 |
Author: WP Remote |
| 7 |
Author URI: https://wpremote.com |
| 8 |
Version: 6.72 |
| 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) |
| 12 |
*/ |
| 13 |
|
| 14 |
/* Copyright 2017 WP Remote (email : support@wpremote.com) |
| 15 |
|
| 16 |
This program is free software; you can redistribute it and/or modify |
| 17 |
it under the terms of the GNU General Public License, version 2, as |
| 18 |
published by the Free Software Foundation. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
You should have received a copy of the GNU General Public License |
| 26 |
along with this program; if not, write to the Free Software |
| 27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 |
*/ |
| 29 |
|
| 30 |
/* Global response array */ |
| 31 |
|
| 32 |
if (!defined('ABSPATH')) exit; |
| 33 |
##OLDWPR## |
| 34 |
|
| 35 |
require_once dirname( __FILE__ ) . '/wp_settings.php'; |
| 36 |
require_once dirname( __FILE__ ) . '/wp_site_info.php'; |
| 37 |
require_once dirname( __FILE__ ) . '/wp_db.php'; |
| 38 |
require_once dirname( __FILE__ ) . '/wp_api.php'; |
| 39 |
require_once dirname( __FILE__ ) . '/wp_actions.php'; |
| 40 |
require_once dirname( __FILE__ ) . '/info.php'; |
| 41 |
require_once dirname( __FILE__ ) . '/account.php'; |
| 42 |
require_once dirname( __FILE__ ) . '/helper.php'; |
| 43 |
require_once dirname( __FILE__ ) . '/wp_file_system.php'; |
| 44 |
require_once dirname( __FILE__ ) . '/wp_2fa/wp_2fa.php'; |
| 45 |
|
| 46 |
require_once dirname( __FILE__ ) . '/wp_login_whitelabel.php'; |
| 47 |
|
| 48 |
##WPCACHEMODULE## |
| 49 |
|
| 50 |
|
| 51 |
$bvsettings = new WPRWPSettings(); |
| 52 |
$bvsiteinfo = new WPRWPSiteInfo(); |
| 53 |
$bvdb = new WPRWPDb(); |
| 54 |
|
| 55 |
|
| 56 |
$bvapi = new WPRWPAPI($bvsettings); |
| 57 |
$bvinfo = new WPRInfo($bvsettings); |
| 58 |
$wp_action = new WPRWPAction($bvsettings, $bvsiteinfo, $bvapi); |
| 59 |
|
| 60 |
register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall')); |
| 61 |
register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 62 |
register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 63 |
|
| 64 |
|
| 65 |
add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 66 |
add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); |
| 67 |
|
| 68 |
##SOADDUNINSTALLACTION## |
| 69 |
|
| 70 |
##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 71 |
|
| 72 |
##WPCLIMODULE## |
| 73 |
|
| 74 |
if (is_admin()) { |
| 75 |
require_once dirname( __FILE__ ) . '/wp_admin.php'; |
| 76 |
$wpadmin = new WPRWPAdmin($bvsettings, $bvsiteinfo); |
| 77 |
add_action('admin_init', array($wpadmin, 'initHandler')); |
| 78 |
add_filter('all_plugins', array($wpadmin, 'initWhitelabel')); |
| 79 |
add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2); |
| 80 |
add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1); |
| 81 |
if ($bvsiteinfo->isMultisite()) { |
| 82 |
add_action('network_admin_menu', array($wpadmin, 'menu')); |
| 83 |
} else { |
| 84 |
add_action('admin_menu', array($wpadmin, 'menu')); |
| 85 |
} |
| 86 |
add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 87 |
add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 88 |
|
| 89 |
##MG_AJAX_ACTIONS## |
| 90 |
##POPUP_ON_DEACTIVATION## |
| 91 |
add_action('admin_notices', array($wpadmin, 'activateWarning')); |
| 92 |
add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu')); |
| 93 |
} |
| 94 |
|
| 95 |
if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended |
| 96 |
$_REQUEST = array_merge($_GET, $_POST); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended |
| 97 |
} |
| 98 |
|
| 99 |
#Service active check |
| 100 |
if ($bvinfo->config != false) { |
| 101 |
add_action('wpr_remove_bv_preload_include', array($wp_action, 'removeBVPreload')); |
| 102 |
} |
| 103 |
|
| 104 |
require_once dirname( __FILE__ ) . '/php_error_monitoring/monitoring.php'; |
| 105 |
WPRWPPHPErrorMonitoring::init(); |
| 106 |
|
| 107 |
if ($bvinfo->hasValidDBVersion()) { |
| 108 |
if ($bvinfo->isServiceActive('activity_log')) { |
| 109 |
require_once dirname( __FILE__ ) . '/wp_actlog.php'; |
| 110 |
$bvconfig = $bvinfo->config; |
| 111 |
$actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']); |
| 112 |
$actlog->init(); |
| 113 |
} |
| 114 |
|
| 115 |
##MAINTENANCEMODULE## |
| 116 |
} |
| 117 |
|
| 118 |
if (WPRHelper::getRawParam('REQUEST', 'bvplugname') == "wpremote") { |
| 119 |
require_once dirname( __FILE__ ) . '/callback/base.php'; |
| 120 |
require_once dirname( __FILE__ ) . '/callback/response.php'; |
| 121 |
require_once dirname( __FILE__ ) . '/callback/request.php'; |
| 122 |
require_once dirname( __FILE__ ) . '/recover.php'; |
| 123 |
|
| 124 |
$pubkey = WPRHelper::getRawParam('REQUEST', 'pubkey'); |
| 125 |
$pubkey = isset($pubkey) ? WPRAccount::sanitizeKey($pubkey) : ''; |
| 126 |
$rcvracc = WPRHelper::getRawParam('REQUEST', 'rcvracc'); |
| 127 |
|
| 128 |
if (isset($rcvracc)) { |
| 129 |
$bvctag = WPRHelper::getRawParam('REQUEST', 'bvctag'); |
| 130 |
$bvctag = isset($bvctag) ? WPRAccount::sanitizeKey($bvctag) : null; |
| 131 |
$account = WPRRecover::find($bvsettings, $pubkey, $bvctag); |
| 132 |
} else { |
| 133 |
$account = WPRAccount::find($bvsettings, $pubkey); |
| 134 |
} |
| 135 |
|
| 136 |
$request = new WPRCallbackRequest($account, $_REQUEST, $bvsettings); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 137 |
$response = new WPRCallbackResponse($request->bvb64cksize); |
| 138 |
|
| 139 |
if ($request->authenticate() === 1) { |
| 140 |
$bv_frm_tstng = WPRHelper::getRawParam('REQUEST', 'bv_frm_tstng'); |
| 141 |
if (isset($bv_frm_tstng)) { |
| 142 |
require_once dirname(__FILE__) . '/form_testing/form_testing.php'; |
| 143 |
$form_testing = new BVFormTesting($_REQUEST); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 144 |
$form_testing->init(); |
| 145 |
|
| 146 |
} else { |
| 147 |
define('WPRBASEPATH', plugin_dir_path(__FILE__)); |
| 148 |
|
| 149 |
|
| 150 |
require_once dirname( __FILE__ ) . '/callback/handler.php'; |
| 151 |
|
| 152 |
$params = $request->processParams($_REQUEST); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 153 |
if ($params === false) { |
| 154 |
$response->terminate($request->corruptedParamsResp()); |
| 155 |
} |
| 156 |
$request->params = $params; |
| 157 |
$callback_handler = new WPRCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response); |
| 158 |
if ($request->is_aftershutdown) { |
| 159 |
$callback_handler->deferExecutionUntilShutdown(); |
| 160 |
} else if ($request->is_afterload) { |
| 161 |
add_action('wp_loaded', array($callback_handler, 'execute')); |
| 162 |
} else if ($request->is_admin_ajax) { |
| 163 |
add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser')); |
| 164 |
add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser')); |
| 165 |
} else { |
| 166 |
$callback_handler->execute(); |
| 167 |
} |
| 168 |
} |
| 169 |
} else { |
| 170 |
$response->terminate($request->authFailedResp()); |
| 171 |
} |
| 172 |
} else { |
| 173 |
if ($bvinfo->hasValidDBVersion()) { |
| 174 |
if ($bvinfo->isProtectModuleEnabled()) { |
| 175 |
require_once dirname( __FILE__ ) . '/protect/protect.php'; |
| 176 |
//For backward compatibility. |
| 177 |
WPRProtect_V672::$settings = new WPRWPSettings(); |
| 178 |
WPRProtect_V672::$db = new WPRWPDb(); |
| 179 |
WPRProtect_V672::$info = new WPRInfo(WPRProtect_V672::$settings); |
| 180 |
|
| 181 |
add_action('wpr_clear_pt_config', array('WPRProtect_V672', 'uninstall')); |
| 182 |
|
| 183 |
if ($bvinfo->isActivePlugin()) { |
| 184 |
WPRProtect_V672::init(WPRProtect_V672::MODE_WP); |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
if ($bvinfo->isDynSyncModuleEnabled()) { |
| 189 |
require_once dirname( __FILE__ ) . '/wp_dynsync.php'; |
| 190 |
$bvconfig = $bvinfo->config; |
| 191 |
$dynsync = new BVWPDynSync($bvdb, $bvsettings, $bvconfig['dynsync']); |
| 192 |
$dynsync->init(); |
| 193 |
} |
| 194 |
|
| 195 |
} |
| 196 |
$bv_site_settings = $bvsettings->getOption('bv_site_settings'); |
| 197 |
if (is_array($bv_site_settings)) { |
| 198 |
if (isset($bv_site_settings['wp_auto_updates'])) { |
| 199 |
$wp_auto_updates = $bv_site_settings['wp_auto_updates']; |
| 200 |
if (array_key_exists('block_auto_update_core', $wp_auto_updates)) { |
| 201 |
add_filter('auto_update_core', '__return_false' ); |
| 202 |
} |
| 203 |
if (array_key_exists('block_auto_update_theme', $wp_auto_updates)) { |
| 204 |
add_filter('auto_update_theme', '__return_false' ); |
| 205 |
add_filter('themes_auto_update_enabled', '__return_false' ); |
| 206 |
} |
| 207 |
if (array_key_exists('block_auto_update_plugin', $wp_auto_updates)) { |
| 208 |
add_filter('auto_update_plugin', '__return_false' ); |
| 209 |
add_filter('plugins_auto_update_enabled', '__return_false' ); |
| 210 |
} |
| 211 |
if (array_key_exists('block_auto_update_translation', $wp_auto_updates)) { |
| 212 |
add_filter('auto_update_translation', '__return_false' ); |
| 213 |
} |
| 214 |
} |
| 215 |
|
| 216 |
if (isset($bv_site_settings['security_hardening'])) { |
| 217 |
$bv_security_hardening = $bv_site_settings['security_hardening']; |
| 218 |
if (is_array($bv_security_hardening) && |
| 219 |
isset($bv_security_hardening['version']) && |
| 220 |
$bv_security_hardening['version'] === 1) { |
| 221 |
if (isset($bv_security_hardening['disable_file_editor']) && |
| 222 |
$bv_security_hardening['disable_file_editor'] === true && |
| 223 |
!defined('DISALLOW_FILE_EDIT')) { |
| 224 |
define('DISALLOW_FILE_EDIT', true); |
| 225 |
} |
| 226 |
|
| 227 |
if (isset($bv_security_hardening['block_file_modifications']) && |
| 228 |
$bv_security_hardening['block_file_modifications'] === true && |
| 229 |
!defined('DISALLOW_FILE_MODS')) { |
| 230 |
define('DISALLOW_FILE_MODS', true); |
| 231 |
} |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
} |
| 236 |
|
| 237 |
if (is_admin()) { |
| 238 |
add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate')); |
| 239 |
} |
| 240 |
|
| 241 |
##THIRDPARTYCACHINGMODULE## |
| 242 |
} |
| 243 |
|
| 244 |
if (WPRWP2FA::isEnabled($bvsettings)) { |
| 245 |
$wp_2fa = new WPRWP2FA(); |
| 246 |
$wp_2fa->init(); |
| 247 |
} |
| 248 |
|
| 249 |
if (!empty($bvinfo->getLPWhitelabelInfo())) { |
| 250 |
$wp_login_whitelabel = new WPRWPLoginWhitelabel(); |
| 251 |
$wp_login_whitelabel->init(); |
| 252 |
} |
| 253 |
|
| 254 |
add_action('wpr_clear_wp_2fa_config', array($wp_action, 'clear_wp_2fa_config')); |
| 255 |
##PLUGIN_LOADED_MODULE## |
| 256 |
|