| 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: 5.81 |
| 9 |
Network: True |
| 10 |
*/ |
| 11 |
|
| 12 |
/* Copyright 2017 WP Remote (email : support@wpremote.com) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License, version 2, as |
| 16 |
published by the Free Software Foundation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
*/ |
| 27 |
|
| 28 |
/* Global response array */ |
| 29 |
|
| 30 |
if (!defined('ABSPATH')) exit; |
| 31 |
##OLDWPR## |
| 32 |
|
| 33 |
require_once dirname( __FILE__ ) . '/wp_settings.php'; |
| 34 |
require_once dirname( __FILE__ ) . '/wp_site_info.php'; |
| 35 |
require_once dirname( __FILE__ ) . '/wp_db.php'; |
| 36 |
require_once dirname( __FILE__ ) . '/wp_api.php'; |
| 37 |
require_once dirname( __FILE__ ) . '/wp_actions.php'; |
| 38 |
require_once dirname( __FILE__ ) . '/info.php'; |
| 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 |
|
| 45 |
##WPCACHEMODULE## |
| 46 |
|
| 47 |
|
| 48 |
$bvsettings = new WPRWPSettings(); |
| 49 |
$bvsiteinfo = new WPRWPSiteInfo(); |
| 50 |
$bvdb = new WPRWPDb(); |
| 51 |
|
| 52 |
|
| 53 |
$bvapi = new WPRWPAPI($bvsettings); |
| 54 |
$bvinfo = new WPRInfo($bvsettings); |
| 55 |
$wp_action = new WPRWPAction($bvsettings, $bvsiteinfo, $bvapi); |
| 56 |
|
| 57 |
register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall')); |
| 58 |
register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 59 |
register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 60 |
|
| 61 |
|
| 62 |
add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 63 |
add_action('wpr_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); |
| 64 |
|
| 65 |
##SOADDUNINSTALLACTION## |
| 66 |
|
| 67 |
##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 68 |
|
| 69 |
##WPCLIMODULE## |
| 70 |
if (is_admin()) { |
| 71 |
require_once dirname( __FILE__ ) . '/wp_admin.php'; |
| 72 |
$wpadmin = new WPRWPAdmin($bvsettings, $bvsiteinfo); |
| 73 |
add_action('admin_init', array($wpadmin, 'initHandler')); |
| 74 |
add_filter('all_plugins', array($wpadmin, 'initWhitelabel')); |
| 75 |
add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2); |
| 76 |
add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1); |
| 77 |
if ($bvsiteinfo->isMultisite()) { |
| 78 |
add_action('network_admin_menu', array($wpadmin, 'menu')); |
| 79 |
} else { |
| 80 |
add_action('admin_menu', array($wpadmin, 'menu')); |
| 81 |
} |
| 82 |
add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 83 |
add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 84 |
##POPUP_ON_DEACTIVATION## |
| 85 |
add_action('admin_notices', array($wpadmin, 'activateWarning')); |
| 86 |
add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu')); |
| 87 |
##ALPURGECACHEFUNCTION## |
| 88 |
##ALADMINMENU## |
| 89 |
} |
| 90 |
|
| 91 |
if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { |
| 92 |
$_REQUEST = array_merge($_GET, $_POST); |
| 93 |
} |
| 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 |
|
| 103 |
if ($bvinfo->hasValidDBVersion()) { |
| 104 |
if ($bvinfo->isServiceActive('activity_log')) { |
| 105 |
require_once dirname( __FILE__ ) . '/wp_actlog.php'; |
| 106 |
$bvconfig = $bvinfo->config; |
| 107 |
$actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']); |
| 108 |
$actlog->init(); |
| 109 |
} |
| 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 |
|
| 118 |
} |
| 119 |
|
| 120 |
if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "wpremote")) { |
| 121 |
require_once dirname( __FILE__ ) . '/callback/base.php'; |
| 122 |
require_once dirname( __FILE__ ) . '/callback/response.php'; |
| 123 |
require_once dirname( __FILE__ ) . '/callback/request.php'; |
| 124 |
require_once dirname( __FILE__ ) . '/recover.php'; |
| 125 |
|
| 126 |
$pubkey = WPRAccount::sanitizeKey($_REQUEST['pubkey']); |
| 127 |
|
| 128 |
if (array_key_exists('rcvracc', $_REQUEST)) { |
| 129 |
$account = WPRRecover::find($bvsettings, $pubkey); |
| 130 |
} else { |
| 131 |
$account = WPRAccount::find($bvsettings, $pubkey); |
| 132 |
} |
| 133 |
|
| 134 |
$request = new BVCallbackRequest($account, $_REQUEST, $bvsettings); |
| 135 |
$response = new BVCallbackResponse($request->bvb64cksize); |
| 136 |
|
| 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); |
| 141 |
|
| 142 |
#handling of Formidable plugin |
| 143 |
add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX, 3); |
| 144 |
|
| 145 |
#handling of WP Forms plugin |
| 146 |
add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX, 3); |
| 147 |
|
| 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); |
| 178 |
} else { |
| 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 |
} |
| 198 |
} |
| 199 |
} else { |
| 200 |
$response->terminate($request->authFailedResp()); |
| 201 |
} |
| 202 |
} else { |
| 203 |
if ($bvinfo->hasValidDBVersion()) { |
| 204 |
if ($bvinfo->isProtectModuleEnabled()) { |
| 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 |
} |
| 216 |
} |
| 217 |
|
| 218 |
if ($bvinfo->isDynSyncModuleEnabled()) { |
| 219 |
require_once dirname( __FILE__ ) . '/wp_dynsync.php'; |
| 220 |
$bvconfig = $bvinfo->config; |
| 221 |
$dynsync = new BVWPDynSync($bvdb, $bvsettings, $bvconfig['dynsync']); |
| 222 |
$dynsync->init(); |
| 223 |
} |
| 224 |
|
| 225 |
} |
| 226 |
$bv_site_settings = $bvsettings->getOption('bv_site_settings'); |
| 227 |
if (isset($bv_site_settings)) { |
| 228 |
if (isset($bv_site_settings['wp_auto_updates'])) { |
| 229 |
$wp_auto_updates = $bv_site_settings['wp_auto_updates']; |
| 230 |
if (array_key_exists('block_auto_update_core', $wp_auto_updates)) { |
| 231 |
add_filter('auto_update_core', '__return_false' ); |
| 232 |
} |
| 233 |
if (array_key_exists('block_auto_update_theme', $wp_auto_updates)) { |
| 234 |
add_filter('auto_update_theme', '__return_false' ); |
| 235 |
add_filter('themes_auto_update_enabled', '__return_false' ); |
| 236 |
} |
| 237 |
if (array_key_exists('block_auto_update_plugin', $wp_auto_updates)) { |
| 238 |
add_filter('auto_update_plugin', '__return_false' ); |
| 239 |
add_filter('plugins_auto_update_enabled', '__return_false' ); |
| 240 |
} |
| 241 |
if (array_key_exists('block_auto_update_translation', $wp_auto_updates)) { |
| 242 |
add_filter('auto_update_translation', '__return_false' ); |
| 243 |
} |
| 244 |
} |
| 245 |
} |
| 246 |
|
| 247 |
if (is_admin()) { |
| 248 |
add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate')); |
| 249 |
} |
| 250 |
|
| 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')); |