PluginProbe
The WP Remote WordPress Plugin / 6.36
The WP Remote WordPress Plugin v6.36
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
← All changes | protect/protect.php +31 -32 5.566.36 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
3 3
4 -if (!class_exists('WPRProtect_V556')) :
4 +if (!class_exists('WPRProtect_V636')) :
5 5 require_once dirname( __FILE__ ) . '/logger.php';
6 6 require_once dirname( __FILE__ ) . '/ipstore.php';
7 7 require_once dirname( __FILE__ ) . '/request.php';
8 8 require_once dirname( __FILE__ ) . '/wp_user.php';
@@ -10,9 +10,9 @@
10 10 require_once dirname( __FILE__ ) . '/fw.php';
11 11 require_once dirname( __FILE__ ) . '/lp.php';
12 12 require_once dirname( __FILE__ ) . '/../helper.php';
13 13
14 -class WPRProtect_V556 {
14 +class WPRProtect_V636 {
15 15 public static $settings;
16 16 public static $db;
17 17 public static $info;
18 18
@@ -21,15 +21,19 @@
21 21
22 22 const CONF_VERSION = '2';
23 23
24 24 public static function init($mode) {
25 - if ($mode == WPRProtect_V556::MODE_PREPEND) {
25 + if (defined('WP_CLI') && WP_CLI) {
26 + return false;
27 + }
28 +
29 + if ($mode == WPRProtect_V636::MODE_PREPEND) {
26 30 $config_file = MCDATAPATH . MCCONFKEY . '-' . 'mc.conf';
27 - $config = WPRProtectUtils_V556::parseFile($config_file);
31 + $config = WPRProtectUtils_V636::parseFile($config_file);
28 32
29 33 if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
30 34 !isset($config['mc_conf_version']) ||
31 - (WPRProtect_V556::CONF_VERSION !== $config['mc_conf_version'])) {
35 + (WPRProtect_V636::CONF_VERSION !== $config['mc_conf_version'])) {
32 36 return false;
33 37
34 38 }
35 39
@@ -35,22 +39,17 @@
35 39
36 40 $brand_name = array_key_exists('brandname', $config) ? $config['brandname'] : 'Protect';
37 41 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
38 42 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
39 - $request = new WPRProtectRequest_V556($request_ip_header, $req_config);
43 + $request = new WPRProtectRequest_V636($request_ip_header, $req_config);
40 44 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
41 45
42 - WPRProtectFW_V556::getInstance($mode, $request, $fw_config, $brand_name)->init();
46 + WPRProtectFW_V636::getInstance($mode, $request, $fw_config, $brand_name)->init();
43 47 } else {
44 - //For backward compatibility.
45 - self::$settings = new WPRWPSettings();
46 - self::$db = new WPRWPDb();
47 - self::$info = new WPRInfo(self::$settings);
48 -
49 48 $plug_config = self::$settings->getOption(self::$info->services_option_name);
50 49 $config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array();
51 50 if (!is_array($config) || !array_key_exists('mc_conf_version', $config) ||
52 - (WPRProtect_V556::CONF_VERSION !== $config['mc_conf_version'])) {
51 + (WPRProtect_V636::CONF_VERSION !== $config['mc_conf_version'])) {
53 52
54 53 return false;
55 54 }
56 55
@@ -56,14 +55,14 @@
56 55
57 56 $brand_name = self::$info->getBrandName();
58 57 $request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
59 58 $req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
60 - $request = new WPRProtectRequest_V556($request_ip_header, $req_config);
59 + $request = new WPRProtectRequest_V636($request_ip_header, $req_config);
61 60 $fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
62 61 $lp_config = array_key_exists('lp', $config) ? $config['lp'] : array();
63 62
64 - WPRProtectFW_V556::getInstance($mode, $request, $fw_config, $brand_name)->init();
65 - WPRProtectLP_V556::getInstance($request, $lp_config, $brand_name)->init();
63 + WPRProtectFW_V636::getInstance($mode, $request, $fw_config, $brand_name)->init();
64 + WPRProtectLP_V636::getInstance($request, $lp_config, $brand_name)->init();
66 65 }
67 66 }
68 67
69 68 public static function uninstall() {
@@ -68,15 +67,15 @@
68 67
69 68 public static function uninstall() {
70 69 self::$settings->deleteOption('bvptconf');
71 70 self::$settings->deleteOption('bvptplug');
72 - WPRProtectIpstore_V556::uninstall();
73 - WPRProtectFW_V556::uninstall();
74 - WPRProtectLP_V556::uninstall();
71 + WPRProtectIpstore_V636::uninstall();
72 + WPRProtectFW_V636::uninstall();
73 + WPRProtectLP_V636::uninstall();
75 74
76 - WPRProtect_V556::removeWPPrepend();
77 - WPRProtect_V556::removePHPPrepend();
78 - WPRProtect_V556::removeMCData();
75 + WPRProtect_V636::removeWPPrepend();
76 + WPRProtect_V636::removePHPPrepend();
77 + WPRProtect_V636::removeMCData();
79 78
80 79 return true;
81 80 }
82 81
@@ -81,10 +80,10 @@
81 80 }
82 81
83 82 private static function removeWPPrepend() {
84 83 $wp_conf_paths = array(
85 - dirname(ABSPATH) . "/wp-config.php",
86 - dirname(ABSPATH) . "/../wp-config.php"
84 + rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/wp-config.php",
85 + rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/../wp-config.php"
87 86 );
88 87
89 88 if (file_exists($wp_conf_paths[0])) {
90 89 $fname = $wp_conf_paths[0];
@@ -93,34 +92,34 @@
93 92 } else {
94 93 return;
95 94 }
96 95
97 - $pattern = "@include '" . dirname(ABSPATH) . "/malcare-waf.php" . "';";
96 + $pattern = "@include '" . rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/malcare-waf.php" . "';";
98 97
99 - WPRProtectUtils_V556::fileRemovePattern($fname, $pattern);
98 + WPRProtectUtils_V636::fileRemovePattern($fname, $pattern);
100 99 }
101 100
102 101 private static function removePHPPrepend() {
103 - WPRProtect_V556::removeHtaccessPrepend();
104 - WPRProtect_V556::removeUseriniPrepend();
102 + WPRProtect_V636::removeHtaccessPrepend();
103 + WPRProtect_V636::removeUseriniPrepend();
105 104 }
106 105
107 106 private static function removeHtaccessPrepend() {
108 107 $pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
109 108
110 - WPRProtectUtils_V556::fileRemovePattern(dirname(ABSPATH) . "/.htaccess", $pattern, true);
109 + WPRProtectUtils_V636::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.htaccess", $pattern, true);
111 110 }
112 111
113 112 private static function removeUseriniPrepend() {
114 113 $pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
115 114
116 - WPRProtectUtils_V556::fileRemovePattern(dirname(ABSPATH) . "/.user.ini", $pattern, true);
115 + WPRProtectUtils_V636::fileRemovePattern(rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/.user.ini", $pattern, true);
117 116 }
118 117
119 118 private static function removeMCData() {
120 - $content_dir = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : dirname(ABSPATH) . "/wp-content";
119 + $content_dir = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : rtrim(ABSPATH, DIRECTORY_SEPARATOR) . "/wp-content";
121 120 $mc_data_dir = $content_dir . "/mc_data";
122 121
123 - WPRProtectUtils_V556::rrmdir($mc_data_dir);
122 + WPRProtectUtils_V636::rrmdir($mc_data_dir);
124 123 }
125 124 }
126 125 endif;