PluginProbe
MalCare WordPress Security Plugin – Malware Scanner, Cleaner, Security Firewall / 5.77
MalCare WordPress Security Plugin – Malware Scanner, Cleaner, Security Firewall v5.77
6.72 6.69 6.65 6.62 6.48 6.47 5.41 5.42 5.45 5.47 5.53 5.54 5.55 5.56 5.65 5.67 5.68 5.72 5.73 5.77 5.81 5.85 5.88 5.91 5.92 All 88 releases
malcare-security / malcare.php

malcare.php in MalCare WordPress Security Plugin – Malware Scanner, Cleaner, Security Firewall 5.77, at malcare.php

260 lines 9.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: MalCare WordPress Security Plugin - Malware Scanner, Cleaner, Security Firewall
4 Plugin URI: https://www.malcare.com
5 Description: MalCare WordPress Security Plugin - Malware Scanner, Cleaner, Security Firewall
6 Author: MalCare Security
7 Author URI: https://www.malcare.com
8 Version: 5.77
9 Network: True
10 */
11
12 /* Copyright 2017 MalCare (email : support@malcare.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 MCWPSettings();
49 $bvsiteinfo = new MCWPSiteInfo();
50 $bvdb = new MCWPDb();
51
52
53 $bvapi = new MCWPAPI($bvsettings);
54 $bvinfo = new MCInfo($bvsettings);
55 $wp_action = new MCWPAction($bvsettings, $bvsiteinfo, $bvapi);
56
57 register_uninstall_hook(__FILE__, array('MCWPAction', '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('mc_clear_bv_services_config', array($wp_action, 'clear_bv_services_config'));
64
65 ##SOADDUNINSTALLACTION##
66
67 ##DISABLE_OTHER_OPTIMIZATION_PLUGINS##
68
69 if (defined('WP_CLI') && WP_CLI) {
70 require_once dirname( __FILE__ ) . '/wp_cli.php';
71 $wp_cli = new MCWPCli($bvsettings, $bvinfo, $bvsiteinfo, $bvapi);
72 WP_CLI::add_command("malcare", $wp_cli);
73 }
74
75 if (is_admin()) {
76 require_once dirname( __FILE__ ) . '/wp_admin.php';
77 $wpadmin = new MCWPAdmin($bvsettings, $bvsiteinfo);
78 add_action('admin_init', array($wpadmin, 'initHandler'));
79 add_filter('all_plugins', array($wpadmin, 'initWhitelabel'));
80 add_filter('plugin_row_meta', array($wpadmin, 'hidePluginDetails'), 10, 2);
81 add_filter('debug_information', array($wpadmin, 'handlePluginHealthInfo'), 10, 1);
82 if ($bvsiteinfo->isMultisite()) {
83 add_action('network_admin_menu', array($wpadmin, 'menu'));
84 } else {
85 add_action('admin_menu', array($wpadmin, 'menu'));
86 }
87 add_filter('plugin_action_links', array($wpadmin, 'settingsLink'), 10, 2);
88 add_action('admin_head', array($wpadmin, 'removeAdminNotices'), 3);
89 ##POPUP_ON_DEACTIVATION##
90 add_action('admin_notices', array($wpadmin, 'activateWarning'));
91 add_action('admin_enqueue_scripts', array($wpadmin, 'mcsecAdminMenu'));
92 ##ALPURGECACHEFUNCTION##
93 ##ALADMINMENU##
94 }
95
96 if ((array_key_exists('bvreqmerge', $_POST)) || (array_key_exists('bvreqmerge', $_GET))) {
97 $_REQUEST = array_merge($_GET, $_POST);
98 }
99
100 #Service active check
101 if ($bvinfo->config != false) {
102 add_action('mc_remove_bv_preload_include', array($wp_action, 'removeBVPreload'));
103 }
104
105 require_once dirname( __FILE__ ) . '/php_error_monitoring/monitoring.php';
106 MCWPPHPErrorMonitoring::init();
107
108 if ($bvinfo->hasValidDBVersion()) {
109 if ($bvinfo->isServiceActive('activity_log')) {
110 require_once dirname( __FILE__ ) . '/wp_actlog.php';
111 $bvconfig = $bvinfo->config;
112 $actlog = new BVWPActLog($bvdb, $bvsettings, $bvinfo, $bvconfig['activity_log']);
113 $actlog->init();
114 }
115
116 if ($bvinfo->isServiceActive('maintenance_mode')) {
117 require_once dirname( __FILE__ ). '/maintenance/wp_maintenance.php';
118 $bvconfig = $bvinfo->config;
119 $maintenance = new BVWPMaintenance($bvconfig['maintenance_mode']);
120 $maintenance->init();
121 }
122
123 }
124
125 if ((array_key_exists('bvplugname', $_REQUEST)) && ($_REQUEST['bvplugname'] == "malcare")) {
126 require_once dirname( __FILE__ ) . '/callback/base.php';
127 require_once dirname( __FILE__ ) . '/callback/response.php';
128 require_once dirname( __FILE__ ) . '/callback/request.php';
129 require_once dirname( __FILE__ ) . '/recover.php';
130
131 $pubkey = MCAccount::sanitizeKey($_REQUEST['pubkey']);
132
133 if (array_key_exists('rcvracc', $_REQUEST)) {
134 $account = MCRecover::find($bvsettings, $pubkey);
135 } else {
136 $account = MCAccount::find($bvsettings, $pubkey);
137 }
138
139 $request = new BVCallbackRequest($account, $_REQUEST, $bvsettings);
140 $response = new BVCallbackResponse($request->bvb64cksize);
141
142 if ($request->authenticate() === 1) {
143 if (array_key_exists('bv_ignr_frm_cptch', $_REQUEST)) {
144 #handling of Contact Forms 7
145 add_filter('wpcf7_skip_spam_check', '__return_true', PHP_INT_MAX, 2);
146
147 #handling of Formidable plugin
148 add_filter('frm_is_field_hidden', '__return_true', PHP_INT_MAX, 3);
149
150 #handling of WP Forms plugin
151 add_filter('wpforms_process_bypass_captcha', '__return_true', PHP_INT_MAX, 3);
152
153 #handling of Forminator plugin
154 if (defined('WP_PLUGIN_DIR')) {
155 $abstractFrontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php';
156 $frontActionFilePath = WP_PLUGIN_DIR . '/forminator/library/modules/custom-forms/front/front-action.php';
157
158 if (file_exists($abstractFrontActionFilePath) && file_exists($frontActionFilePath)) {
159 require_once $abstractFrontActionFilePath;
160 require_once $frontActionFilePath;
161 if (class_exists('Forminator_CForm_Front_Action')) {
162 Forminator_CForm_Front_Action::$hidden_fields[] = "bv-stripe-";
163 }
164 }
165 }
166
167 #handling of CleanTalk Antispam plugin
168 add_action('init', function() {
169 global $apbct;
170 if (isset($apbct) && is_object($apbct)) {
171 $apbct->settings['forms__contact_forms_test'] = 0;
172 }
173 });
174 } else {
175 define('MCBASEPATH', plugin_dir_path(__FILE__));
176
177
178 require_once dirname( __FILE__ ) . '/callback/handler.php';
179
180 $params = $request->processParams($_REQUEST);
181 if ($params === false) {
182 $response->terminate($request->corruptedParamsResp());
183 }
184 $request->params = $params;
185 $callback_handler = new BVCallbackHandler($bvdb, $bvsettings, $bvsiteinfo, $request, $account, $response);
186 if ($request->is_afterload) {
187 add_action('wp_loaded', array($callback_handler, 'execute'));
188 } else if ($request->is_admin_ajax) {
189 add_action('wp_ajax_bvadm', array($callback_handler, 'bvAdmExecuteWithUser'));
190 add_action('wp_ajax_nopriv_bvadm', array($callback_handler, 'bvAdmExecuteWithoutUser'));
191 } else {
192 $callback_handler->execute();
193 }
194 }
195 } else {
196 $response->terminate($request->authFailedResp());
197 }
198 } else {
199 if ($bvinfo->hasValidDBVersion()) {
200 if ($bvinfo->isProtectModuleEnabled()) {
201 require_once dirname( __FILE__ ) . '/protect/protect.php';
202 //For backward compatibility.
203 MCProtect_V577::$settings = new MCWPSettings();
204 MCProtect_V577::$db = new MCWPDb();
205 MCProtect_V577::$info = new MCInfo(MCProtect_V577::$settings);
206
207 add_action('mc_clear_pt_config', array('MCProtect_V577', 'uninstall'));
208
209 if ($bvinfo->isActivePlugin()) {
210 MCProtect_V577::init(MCProtect_V577::MODE_WP);
211 }
212 }
213
214 if ($bvinfo->isDynSyncModuleEnabled()) {
215 require_once dirname( __FILE__ ) . '/wp_dynsync.php';
216 $bvconfig = $bvinfo->config;
217 $dynsync = new BVWPDynSync($bvdb, $bvsettings, $bvconfig['dynsync']);
218 $dynsync->init();
219 }
220
221 }
222 $bv_site_settings = $bvsettings->getOption('bv_site_settings');
223 if (isset($bv_site_settings)) {
224 if (isset($bv_site_settings['wp_auto_updates'])) {
225 $wp_auto_updates = $bv_site_settings['wp_auto_updates'];
226 if (array_key_exists('block_auto_update_core', $wp_auto_updates)) {
227 add_filter('auto_update_core', '__return_false' );
228 }
229 if (array_key_exists('block_auto_update_theme', $wp_auto_updates)) {
230 add_filter('auto_update_theme', '__return_false' );
231 add_filter('themes_auto_update_enabled', '__return_false' );
232 }
233 if (array_key_exists('block_auto_update_plugin', $wp_auto_updates)) {
234 add_filter('auto_update_plugin', '__return_false' );
235 add_filter('plugins_auto_update_enabled', '__return_false' );
236 }
237 if (array_key_exists('block_auto_update_translation', $wp_auto_updates)) {
238 add_filter('auto_update_translation', '__return_false' );
239 }
240 }
241 }
242
243 if (is_admin()) {
244 add_filter('site_transient_update_plugins', array($wpadmin, 'hidePluginUpdate'));
245 }
246
247 ##THIRDPARTYCACHINGMODULE##
248 }
249
250 if (MCWP2FA::isEnabled($bvsettings)) {
251 $wp_2fa = new MCWP2FA();
252 $wp_2fa->init();
253 }
254
255 if (!empty($bvinfo->getLPWhitelabelInfo())) {
256 $wp_login_whitelabel = new MCWPLoginWhitelabel();
257 $wp_login_whitelabel->init();
258 }
259
260 add_action('mc_clear_wp_2fa_config', array($wp_action, 'clear_wp_2fa_config'));