PluginProbe
The WP Remote WordPress Plugin / 4.97
The WP Remote WordPress Plugin v4.97
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / plugin.php

plugin.php in The WP Remote WordPress Plugin 4.97, at plugin.php

195 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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: 4.97
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 ##WPCACHEMODULE##
41
42
43 $bvsettings = new WPRWPSettings();
44 $bvsiteinfo = new WPRWPSiteInfo();
45 $bvdb = new WPRWPDb();
46
47
48 $bvapi = new WPRWPAPI($bvsettings);
49 $bvinfo = new WPRInfo($bvsettings);
50 $wp_action = new WPRWPAction($bvsettings, $bvsiteinfo, $bvapi);
51
52 register_uninstall_hook(__FILE__, array('WPRWPAction', 'uninstall'));
53 register_activation_hook(__FILE__, array($wp_action, 'activate'));
54 register_deactivation_hook(__FILE__, array($wp_action, 'deactivate'));
55
56 add_action('wp_footer', array($wp_action, 'footerHandler'), 100);
57 add_action('clear_bv_services_config', array($wp_action, 'clear_bv_services_config'));
58 ##SOADDUNINSTALLACTION##
59
60 ##DISABLE_OTHER_OPTIMIZATION_PLUGINS##
61
62 ##WPCLIMODULE##
63 if (is_admin()) {
64 require_once dirname( __FILE__ ) . '/wp_admin.php';
65 $wpadmin = new WPRWPAdmin($bvsettings, $bvsiteinfo);
66 add_action('admin_init', array($wpadmin, 'initHandler'));
67 add_filter('all_plugins', array($wpadmin, 'initBranding'));
68 add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2);
69 add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1);
70 if ($bvsiteinfo->isMultisite()) {
71 add_action('network_admin_menu', array($wpadmin, 'menu'));
72 } else {
73 add_action('admin_menu', array($wpadmin, 'menu'));
74 }
75 add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2);
76 add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3);
77 add_action('admin_notices', array($wpadmin, 'activateWarning'));
78 add_action('admin_enqueue_scripts', array($wpadmin, 'wprsecAdminMenu'));
79 ##ALPURGECACHEFUNCTION##
80 ##ALADMINMENU##
81 }
82
83 if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) {
84 $_REQUEST = array_merge($_GET, $_POST);
85 }
86
87 if ($bvinfo->hasValidDBVersion()) {
88 if ($bvinfo->isServiceActive('activity_log')) {
89 require_once dirname( __FILE__ ) . '/wp_actlog.php';
90 $bvconfig = $bvinfo->config;
91 $actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']);
92 $actlog->init();
93 }
94
95 }
96
97 if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "wpremote")) {
98 require_once dirname( __FILE__ ) . '/callback/base.php';
99 require_once dirname( __FILE__ ) . '/callback/response.php';
100 require_once dirname( __FILE__ ) . '/callback/request.php';
101 require_once dirname( __FILE__ ) . '/recover.php';
102
103 $pubkey = WPRAccount::sanitizeKey($_REQUEST['pubkey']);
104
105 if (array_key_exists('rcvracc', $_REQUEST)) {
106 $account = WPRRecover::find($bvsettings, $pubkey);
107 } else {
108 $account = WPRAccount::find($bvsettings, $pubkey);
109 }
110
111 $request = new BVCallbackRequest($account, $_REQUEST);
112 $response = new BVCallbackResponse($request->bvb64cksize);
113
114 if ($account && (1 === $account->authenticate($request))) {
115 define('WPRBASEPATH', plugin_dir_path(__FILE__));
116
117
118 require_once dirname( __FILE__ ) . '/callback/handler.php';
119
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'));
137 } else {
138 $callback_handler->execute();
139 }
140 } 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);
150 }
151 } else {
152 if ($bvinfo->hasValidDBVersion()) {
153 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();
159 }
160 }
161
162 if ($bvinfo->isDynSyncModuleEnabled()) {
163 require_once dirname( __FILE__ ) . '/wp_dynsync.php';
164 $bvconfig = $bvinfo->config;
165 $dynsync = new BVWPDynSync($bvdb, $bvsettings, $bvconfig['dynsync']);
166 $dynsync->init();
167 }
168
169 }
170 $bv_site_settings = $bvsettings->getOption('bv_site_settings');
171 if (isset($bv_site_settings)) {
172 if (isset($bv_site_settings['wp_auto_updates'])) {
173 $wp_auto_updates = $bv_site_settings['wp_auto_updates'];
174 if (array_key_exists('block_auto_update_core', $wp_auto_updates)) {
175 add_filter('auto_update_core', '__return_false' );
176 }
177 if (array_key_exists('block_auto_update_theme', $wp_auto_updates)) {
178 add_filter('auto_update_theme', '__return_false' );
179 add_filter('themes_auto_update_enabled', '__return_false' );
180 }
181 if (array_key_exists('block_auto_update_plugin', $wp_auto_updates)) {
182 add_filter('auto_update_plugin', '__return_false' );
183 add_filter('plugins_auto_update_enabled', '__return_false' );
184 }
185 if (array_key_exists('block_auto_update_translation', $wp_auto_updates)) {
186 add_filter('auto_update_translation', '__return_false' );
187 }
188 }
189 }
190
191 if (is_admin()) {
192 add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate'));
193 }
194
195 }