| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Migrate to WordPress.com |
| 4 |
Plugin URI: https://www.wordpress.com |
| 5 |
Description: The easiest way to migrate your site to WordPress.com. |
| 6 |
Author: WordPress.com |
| 7 |
Author URI: https://www.wordpress.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 Migrate to WordPress.com (email : support@blogvault.net) |
| 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 |
##WP_2FA_REQUIRE_FILE## |
| 45 |
##WP_LOGIN_WHITELABEL_REQUIRE_FILE## |
| 46 |
##WPCACHEMODULE## |
| 47 |
|
| 48 |
|
| 49 |
$bvsettings = new WPCOMWPSettings(); |
| 50 |
$bvsiteinfo = new WPCOMWPSiteInfo(); |
| 51 |
$bvdb = new WPCOMWPDb(); |
| 52 |
|
| 53 |
|
| 54 |
$bvapi = new WPCOMWPAPI($bvsettings); |
| 55 |
$bvinfo = new WPCOMInfo($bvsettings); |
| 56 |
$wp_action = new WPCOMWPAction($bvsettings, $bvsiteinfo, $bvapi); |
| 57 |
|
| 58 |
register_uninstall_hook(__FILE__, array('WPCOMWPAction', 'uninstall')); |
| 59 |
register_activation_hook(__FILE__, array($wp_action, 'activate')); |
| 60 |
register_deactivation_hook(__FILE__, array($wp_action, 'deactivate')); |
| 61 |
|
| 62 |
|
| 63 |
add_action('wp_footer', array($wp_action, 'footerHandler'), 100); |
| 64 |
add_action('wpcom_clear_bv_services_config', array($wp_action, 'clear_bv_services_config')); |
| 65 |
|
| 66 |
##SOADDUNINSTALLACTION## |
| 67 |
|
| 68 |
##DISABLE_OTHER_OPTIMIZATION_PLUGINS## |
| 69 |
|
| 70 |
if (defined('WP_CLI') && WP_CLI) { |
| 71 |
require_once dirname( __FILE__ ) . '/wp_cli.php'; |
| 72 |
$wp_cli = new WPCOMWPCli($bvsettings, $bvinfo, $bvsiteinfo, $bvapi); |
| 73 |
WP_CLI::add_command("bvwpcom", $wp_cli); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
if (is_admin()) { |
| 78 |
require_once dirname( __FILE__ ) . '/wp_admin.php'; |
| 79 |
$wpadmin = new WPCOMWPAdmin($bvsettings, $bvsiteinfo); |
| 80 |
add_action('admin_init', array($wpadmin, 'initHandler')); |
| 81 |
add_filter('all_plugins', array($wpadmin, 'initWhitelabel')); |
| 82 |
add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2); |
| 83 |
##HEALTH_INFO_HOOK## |
| 84 |
if ($bvsiteinfo->isMultisite()) { |
| 85 |
add_action('network_admin_menu', array($wpadmin, 'menu')); |
| 86 |
} else { |
| 87 |
add_action('admin_menu', array($wpadmin, 'menu')); |
| 88 |
} |
| 89 |
add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2); |
| 90 |
add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3); |
| 91 |
|
| 92 |
##MG_AJAX_ACTIONS## |
| 93 |
##POPUP_ON_DEACTIVATION## |
| 94 |
##ACTIVATEWARNING## |
| 95 |
add_action('admin_enqueue_scripts', array($wpadmin, 'wpcomsecAdminMenu')); |
| 96 |
} |
| 97 |
|
| 98 |
if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) { // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended |
| 99 |
$_REQUEST = array_merge($_GET, $_POST); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended |
| 100 |
} |
| 101 |
|
| 102 |
##REMOVE_BV_PRELOAD_MODULE## |
| 103 |
##PHP_ERROR_MONITORING_MODULE## |
| 104 |
if ($bvinfo->hasValidDBVersion()) { |
| 105 |
##ACTLOGMODULE## |
| 106 |
##MAINTENANCEMODULE## |
| 107 |
} |
| 108 |
|
| 109 |
if (WPCOMHelper::getRawParam('REQUEST', 'bvplugname') == "wpcom-migration") { |
| 110 |
require_once dirname( __FILE__ ) . '/callback/base.php'; |
| 111 |
require_once dirname( __FILE__ ) . '/callback/response.php'; |
| 112 |
require_once dirname( __FILE__ ) . '/callback/request.php'; |
| 113 |
require_once dirname( __FILE__ ) . '/recover.php'; |
| 114 |
|
| 115 |
$pubkey = WPCOMHelper::getRawParam('REQUEST', 'pubkey'); |
| 116 |
$pubkey = isset($pubkey) ? WPCOMAccount::sanitizeKey($pubkey) : ''; |
| 117 |
$rcvracc = WPCOMHelper::getRawParam('REQUEST', 'rcvracc'); |
| 118 |
|
| 119 |
if (isset($rcvracc)) { |
| 120 |
$bvctag = WPCOMHelper::getRawParam('REQUEST', 'bvctag'); |
| 121 |
$bvctag = isset($bvctag) ? WPCOMAccount::sanitizeKey($bvctag) : null; |
| 122 |
$account = WPCOMRecover::find($bvsettings, $pubkey, $bvctag); |
| 123 |
} else { |
| 124 |
$account = WPCOMAccount::find($bvsettings, $pubkey); |
| 125 |
} |
| 126 |
|
| 127 |
$request = new WPCOMCallbackRequest($account, $_REQUEST, $bvsettings); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 128 |
$response = new WPCOMCallbackResponse($request->bvb64cksize); |
| 129 |
|
| 130 |
if ($request->authenticate() === 1) { |
| 131 |
$bv_frm_tstng = WPCOMHelper::getRawParam('REQUEST', 'bv_frm_tstng'); |
| 132 |
if (isset($bv_frm_tstng)) { |
| 133 |
##FORM_TESTING## |
| 134 |
} else { |
| 135 |
##BVBASEPATH## |
| 136 |
|
| 137 |
require_once dirname( __FILE__ ) . '/callback/handler.php'; |
| 138 |
|
| 139 |
$params = $request->processParams($_REQUEST); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 140 |
if ($params === false) { |
| 141 |
$response->terminate($request->corruptedParamsResp()); |
| 142 |
} |
| 143 |
$request->params = $params; |
| 144 |
$callback_handler = new WPCOMCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response); |
| 145 |
if ($request->is_aftershutdown) { |
| 146 |
$callback_handler->deferExecutionUntilShutdown(); |
| 147 |
} else if ($request->is_afterload) { |
| 148 |
add_action('wp_loaded', array($callback_handler, 'execute')); |
| 149 |
} else if ($request->is_admin_ajax) { |
| 150 |
add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser')); |
| 151 |
add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser')); |
| 152 |
} else { |
| 153 |
$callback_handler->execute(); |
| 154 |
} |
| 155 |
} |
| 156 |
} else { |
| 157 |
$response->terminate($request->authFailedResp()); |
| 158 |
} |
| 159 |
} else { |
| 160 |
if ($bvinfo->hasValidDBVersion()) { |
| 161 |
##PROTECTMODULE## |
| 162 |
##DYNSYNCMODULE## |
| 163 |
} |
| 164 |
|
| 165 |
##HIDEPLUGINUPDATEMODULE## |
| 166 |
##THIRDPARTYCACHINGMODULE## |
| 167 |
} |
| 168 |
|
| 169 |
##WP2FAMODULE## |
| 170 |
##WP_LOGIN_WHITELABEL_MODULE## |
| 171 |
##CLEAR_WP_2FA_CONFIG_ACTION## |
| 172 |
##PLUGIN_LOADED_MODULE## |
| 173 |
|