Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/blogvaul.../protect
File: protect.php
<?php
[0] Fix | Delete
if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
[1] Fix | Delete
[2] Fix | Delete
if (!class_exists('BVProtect_V565')) :
[3] Fix | Delete
require_once dirname( __FILE__ ) . '/logger.php';
[4] Fix | Delete
require_once dirname( __FILE__ ) . '/ipstore.php';
[5] Fix | Delete
require_once dirname( __FILE__ ) . '/request.php';
[6] Fix | Delete
require_once dirname( __FILE__ ) . '/wp_user.php';
[7] Fix | Delete
require_once dirname( __FILE__ ) . '/lib.php';
[8] Fix | Delete
require_once dirname( __FILE__ ) . '/fw.php';
[9] Fix | Delete
require_once dirname( __FILE__ ) . '/lp.php';
[10] Fix | Delete
require_once dirname( __FILE__ ) . '/../helper.php';
[11] Fix | Delete
[12] Fix | Delete
class BVProtect_V565 {
[13] Fix | Delete
public static $settings;
[14] Fix | Delete
public static $db;
[15] Fix | Delete
public static $info;
[16] Fix | Delete
[17] Fix | Delete
const MODE_PREPEND = 0;
[18] Fix | Delete
const MODE_WP = 1;
[19] Fix | Delete
[20] Fix | Delete
const CONF_VERSION = '2';
[21] Fix | Delete
[22] Fix | Delete
public static function init($mode) {
[23] Fix | Delete
if (defined('WP_CLI') && WP_CLI) {
[24] Fix | Delete
return false;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
if ($mode == BVProtect_V565::MODE_PREPEND) {
[28] Fix | Delete
$config_file = MCDATAPATH . MCCONFKEY . '-' . 'mc.conf';
[29] Fix | Delete
$config = BVProtectUtils_V565::parseFile($config_file);
[30] Fix | Delete
[31] Fix | Delete
if (empty($config['time']) || !($config['time'] > time() - (48*3600)) ||
[32] Fix | Delete
!isset($config['mc_conf_version']) ||
[33] Fix | Delete
(BVProtect_V565::CONF_VERSION !== $config['mc_conf_version'])) {
[34] Fix | Delete
return false;
[35] Fix | Delete
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$brand_name = array_key_exists('brandname', $config) ? $config['brandname'] : 'Protect';
[39] Fix | Delete
$request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
[40] Fix | Delete
$req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
[41] Fix | Delete
$request = new BVProtectRequest_V565($request_ip_header, $req_config);
[42] Fix | Delete
$fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
[43] Fix | Delete
[44] Fix | Delete
BVProtectFW_V565::getInstance($mode, $request, $fw_config, $brand_name)->init();
[45] Fix | Delete
} else {
[46] Fix | Delete
//For backward compatibility.
[47] Fix | Delete
self::$settings = new BVWPSettings();
[48] Fix | Delete
self::$db = new BVWPDb();
[49] Fix | Delete
self::$info = new BVInfo(self::$settings);
[50] Fix | Delete
[51] Fix | Delete
$plug_config = self::$settings->getOption(self::$info->services_option_name);
[52] Fix | Delete
$config = array_key_exists('protect', $plug_config) ? $plug_config['protect'] : array();
[53] Fix | Delete
if (!is_array($config) || !array_key_exists('mc_conf_version', $config) ||
[54] Fix | Delete
(BVProtect_V565::CONF_VERSION !== $config['mc_conf_version'])) {
[55] Fix | Delete
[56] Fix | Delete
return false;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
$brand_name = self::$info->getBrandName();
[60] Fix | Delete
$request_ip_header = array_key_exists('ipheader', $config) ? $config['ipheader'] : null;
[61] Fix | Delete
$req_config = array_key_exists('reqconfig', $config) ? $config['reqconfig'] : array();
[62] Fix | Delete
$request = new BVProtectRequest_V565($request_ip_header, $req_config);
[63] Fix | Delete
$fw_config = array_key_exists('fw', $config) ? $config['fw'] : array();
[64] Fix | Delete
$lp_config = array_key_exists('lp', $config) ? $config['lp'] : array();
[65] Fix | Delete
[66] Fix | Delete
BVProtectFW_V565::getInstance($mode, $request, $fw_config, $brand_name)->init();
[67] Fix | Delete
BVProtectLP_V565::getInstance($request, $lp_config, $brand_name)->init();
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
public static function uninstall() {
[72] Fix | Delete
self::$settings->deleteOption('bvptconf');
[73] Fix | Delete
self::$settings->deleteOption('bvptplug');
[74] Fix | Delete
BVProtectIpstore_V565::uninstall();
[75] Fix | Delete
BVProtectFW_V565::uninstall();
[76] Fix | Delete
BVProtectLP_V565::uninstall();
[77] Fix | Delete
[78] Fix | Delete
BVProtect_V565::removeWPPrepend();
[79] Fix | Delete
BVProtect_V565::removePHPPrepend();
[80] Fix | Delete
BVProtect_V565::removeMCData();
[81] Fix | Delete
[82] Fix | Delete
return true;
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
private static function removeWPPrepend() {
[86] Fix | Delete
$wp_conf_paths = array(
[87] Fix | Delete
dirname(ABSPATH) . "/wp-config.php",
[88] Fix | Delete
dirname(ABSPATH) . "/../wp-config.php"
[89] Fix | Delete
);
[90] Fix | Delete
[91] Fix | Delete
if (file_exists($wp_conf_paths[0])) {
[92] Fix | Delete
$fname = $wp_conf_paths[0];
[93] Fix | Delete
} elseif (file_exists($wp_conf_paths[1])) {
[94] Fix | Delete
$fname = $wp_conf_paths[1];
[95] Fix | Delete
} else {
[96] Fix | Delete
return;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
$pattern = "@include '" . dirname(ABSPATH) . "/malcare-waf.php" . "';";
[100] Fix | Delete
[101] Fix | Delete
BVProtectUtils_V565::fileRemovePattern($fname, $pattern);
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
private static function removePHPPrepend() {
[105] Fix | Delete
BVProtect_V565::removeHtaccessPrepend();
[106] Fix | Delete
BVProtect_V565::removeUseriniPrepend();
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
private static function removeHtaccessPrepend() {
[110] Fix | Delete
$pattern = "/# MalCare WAF(.|\n)*# END MalCare WAF/i";
[111] Fix | Delete
[112] Fix | Delete
BVProtectUtils_V565::fileRemovePattern(dirname(ABSPATH) . "/.htaccess", $pattern, true);
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
private static function removeUseriniPrepend() {
[116] Fix | Delete
$pattern = "/; MalCare WAF(.|\n)*; END MalCare WAF/i";
[117] Fix | Delete
[118] Fix | Delete
BVProtectUtils_V565::fileRemovePattern(dirname(ABSPATH) . "/.user.ini", $pattern, true);
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
private static function removeMCData() {
[122] Fix | Delete
$content_dir = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : dirname(ABSPATH) . "/wp-content";
[123] Fix | Delete
$mc_data_dir = $content_dir . "/mc_data";
[124] Fix | Delete
[125] Fix | Delete
BVProtectUtils_V565::rrmdir($mc_data_dir);
[126] Fix | Delete
}
[127] Fix | Delete
}
[128] Fix | Delete
endif;
[129] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function