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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib
File: wordfenceClass.php
case 'livetraffic':
[7000] Fix | Delete
$content = self::_menu_tools_livetraffic();
[7001] Fix | Delete
break;
[7002] Fix | Delete
[7003] Fix | Delete
case 'whois':
[7004] Fix | Delete
$content = self::_menu_tools_whois();
[7005] Fix | Delete
break;
[7006] Fix | Delete
[7007] Fix | Delete
case 'diagnostics':
[7008] Fix | Delete
$content = self::_menu_tools_diagnostics();
[7009] Fix | Delete
break;
[7010] Fix | Delete
[7011] Fix | Delete
case 'importexport':
[7012] Fix | Delete
$content = self::_menu_tools_importexport();
[7013] Fix | Delete
break;
[7014] Fix | Delete
[7015] Fix | Delete
// case 'twofactor':
[7016] Fix | Delete
default:
[7017] Fix | Delete
if (wfCredentialsController::allowLegacy2FA()) {
[7018] Fix | Delete
$subpage = 'twofactor';
[7019] Fix | Delete
$content = self::_menu_tools_twofactor();
[7020] Fix | Delete
}
[7021] Fix | Delete
else {
[7022] Fix | Delete
$subpage = 'livetraffic';
[7023] Fix | Delete
$content = self::_menu_tools_livetraffic();
[7024] Fix | Delete
}
[7025] Fix | Delete
}
[7026] Fix | Delete
require(dirname(__FILE__) . '/menu_tools.php');
[7027] Fix | Delete
}
[7028] Fix | Delete
[7029] Fix | Delete
private static function _menu_tools_livetraffic() {
[7030] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.min.css'), array(), WORDFENCE_VERSION);
[7031] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-structure-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.structure.min.css'), array(), WORDFENCE_VERSION);
[7032] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-theme-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.theme.min.css'), array(), WORDFENCE_VERSION);
[7033] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-timepicker-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui-timepicker-addon.css'), array(), WORDFENCE_VERSION);
[7034] Fix | Delete
[7035] Fix | Delete
wp_enqueue_script('wordfence-timepicker-js', wfUtils::getBaseURL() . wfUtils::versionedAsset('js/jquery-ui-timepicker-addon.js'), array('jquery', 'jquery-ui-datepicker', 'jquery-ui-slider'), WORDFENCE_VERSION);
[7036] Fix | Delete
wp_enqueue_script('wordfence-knockout-js', wfUtils::getBaseURL() . wfUtils::versionedAsset('js/knockout-3.5.1.js'), array(), WORDFENCE_VERSION);
[7037] Fix | Delete
wp_enqueue_script('wordfence-live-traffic-js', wfUtils::getBaseURL() . wfUtils::versionedAsset('js/admin.liveTraffic.js'), array('jquery', 'jquery-ui-tooltip'), WORDFENCE_VERSION);
[7038] Fix | Delete
[7039] Fix | Delete
ob_start();
[7040] Fix | Delete
require(dirname(__FILE__) . '/menu_tools_livetraffic.php');
[7041] Fix | Delete
$content = ob_get_clean();
[7042] Fix | Delete
return $content;
[7043] Fix | Delete
}
[7044] Fix | Delete
[7045] Fix | Delete
private static function _menu_tools_whois() {
[7046] Fix | Delete
ob_start();
[7047] Fix | Delete
require(dirname(__FILE__) . '/menu_tools_whois.php');
[7048] Fix | Delete
$content = ob_get_clean();
[7049] Fix | Delete
return $content;
[7050] Fix | Delete
}
[7051] Fix | Delete
[7052] Fix | Delete
private static function _menu_tools_diagnostics() {
[7053] Fix | Delete
$emailForm = true;
[7054] Fix | Delete
$inEmail = false;
[7055] Fix | Delete
ob_start();
[7056] Fix | Delete
require(dirname(__FILE__) . '/menu_tools_diagnostic.php');
[7057] Fix | Delete
$content = ob_get_clean();
[7058] Fix | Delete
return $content;
[7059] Fix | Delete
}
[7060] Fix | Delete
[7061] Fix | Delete
private static function _menu_tools_importexport() {
[7062] Fix | Delete
ob_start();
[7063] Fix | Delete
require(dirname(__FILE__) . '/menu_tools_importExport.php');
[7064] Fix | Delete
$content = ob_get_clean();
[7065] Fix | Delete
return $content;
[7066] Fix | Delete
}
[7067] Fix | Delete
[7068] Fix | Delete
private static function _menu_tools_twofactor() {
[7069] Fix | Delete
ob_start();
[7070] Fix | Delete
require(dirname(__FILE__) . '/menu_tools_twoFactor.php');
[7071] Fix | Delete
$content = ob_get_clean();
[7072] Fix | Delete
return $content;
[7073] Fix | Delete
}
[7074] Fix | Delete
[7075] Fix | Delete
public static function menu_options() {
[7076] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.min.css'), array(), WORDFENCE_VERSION);
[7077] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-structure-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.structure.min.css'), array(), WORDFENCE_VERSION);
[7078] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-theme-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.theme.min.css'), array(), WORDFENCE_VERSION);
[7079] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-timepicker-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui-timepicker-addon.css'), array(), WORDFENCE_VERSION);
[7080] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7081] Fix | Delete
[7082] Fix | Delete
wp_enqueue_script('wordfence-timepicker-js', wfUtils::getBaseURL() . wfUtils::versionedAsset('js/jquery-ui-timepicker-addon.js'), array('jquery', 'jquery-ui-datepicker', 'jquery-ui-slider'), WORDFENCE_VERSION);
[7083] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7084] Fix | Delete
[7085] Fix | Delete
try {
[7086] Fix | Delete
$wafData = self::_getWAFData();
[7087] Fix | Delete
}
[7088] Fix | Delete
catch (wfWAFStorageFileConfigException $e) {
[7089] Fix | Delete
// We don't have anywhere to write files in this scenario. Let's notify the user to update the permissions.
[7090] Fix | Delete
$wafData = array(
[7091] Fix | Delete
'learningMode' => false,
[7092] Fix | Delete
'rules' => array(),
[7093] Fix | Delete
'whitelistedURLParams' => array(),
[7094] Fix | Delete
'disabledRules' => array(),
[7095] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7096] Fix | Delete
);
[7097] Fix | Delete
$logPath = str_replace(ABSPATH, '~/', WFWAF_LOG_PATH);
[7098] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[7099] Fix | Delete
$wafMenuURL = network_admin_url('admin.php?page=WordfenceWAF&wafconfigrebuild=1');
[7100] Fix | Delete
} else {
[7101] Fix | Delete
$wafMenuURL = admin_url('admin.php?page=WordfenceWAF&wafconfigrebuild=1');
[7102] Fix | Delete
}
[7103] Fix | Delete
$wafMenuURL = add_query_arg(array(
[7104] Fix | Delete
'waf-nonce' => wp_create_nonce('wafconfigrebuild'),
[7105] Fix | Delete
), $wafMenuURL);
[7106] Fix | Delete
$storageExceptionMessage = $e->getMessage() . ' ' . sprintf(__('<a href="%s">Click here</a> to rebuild the configuration file.', 'wordfence'), esc_url($wafMenuURL));
[7107] Fix | Delete
} catch (wfWAFStorageFileException $e) {
[7108] Fix | Delete
// We don't have anywhere to write files in this scenario. Let's notify the user to update the permissions.
[7109] Fix | Delete
$wafData = array(
[7110] Fix | Delete
'learningMode' => false,
[7111] Fix | Delete
'rules' => array(),
[7112] Fix | Delete
'whitelistedURLParams' => array(),
[7113] Fix | Delete
'disabledRules' => array(),
[7114] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7115] Fix | Delete
);
[7116] Fix | Delete
$logPath = str_replace(ABSPATH, '~/', WFWAF_LOG_PATH);
[7117] Fix | Delete
$storageExceptionMessage = sprintf(/* translators: File path. */ __('We were unable to write to %s which the WAF uses for storage. Please update permissions on the parent directory so the web server can write to it.', 'wordfence'), $logPath);
[7118] Fix | Delete
} catch (wfWAFStorageEngineMySQLiException $e) {
[7119] Fix | Delete
$wafData = array(
[7120] Fix | Delete
'learningMode' => false,
[7121] Fix | Delete
'rules' => array(),
[7122] Fix | Delete
'whitelistedURLParams' => array(),
[7123] Fix | Delete
'disabledRules' => array(),
[7124] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7125] Fix | Delete
);
[7126] Fix | Delete
$logPath = null;
[7127] Fix | Delete
$storageExceptionMessage = __('An error occured when fetching the WAF configuration from the database.', 'wordfence') . ' <pre>' . esc_html($e->getMessage()) . '</pre>';
[7128] Fix | Delete
}
[7129] Fix | Delete
[7130] Fix | Delete
require(dirname(__FILE__) . '/menu_options.php');
[7131] Fix | Delete
}
[7132] Fix | Delete
[7133] Fix | Delete
public static function menu_blocking() {
[7134] Fix | Delete
// Do nothing -- this action is forwarded in admin_init
[7135] Fix | Delete
}
[7136] Fix | Delete
[7137] Fix | Delete
public static function menu_firewall() {
[7138] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.min.css'), array(), WORDFENCE_VERSION);
[7139] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-structure-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.structure.min.css'), array(), WORDFENCE_VERSION);
[7140] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-theme-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui.theme.min.css'), array(), WORDFENCE_VERSION);
[7141] Fix | Delete
wp_enqueue_style('wordfence-jquery-ui-timepicker-css', wfUtils::getBaseURL() . wfUtils::versionedAsset('css/jquery-ui-timepicker-addon.css'), array(), WORDFENCE_VERSION);
[7142] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7143] Fix | Delete
[7144] Fix | Delete
wp_enqueue_script('wordfence-timepicker-js', wfUtils::getBaseURL() . wfUtils::versionedAsset('js/jquery-ui-timepicker-addon.js'), array('jquery', 'jquery-ui-datepicker', 'jquery-ui-slider'), WORDFENCE_VERSION);
[7145] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7146] Fix | Delete
wp_enqueue_script('chart-js');
[7147] Fix | Delete
[7148] Fix | Delete
try {
[7149] Fix | Delete
$wafData = self::_getWAFData();
[7150] Fix | Delete
} catch (wfWAFStorageFileConfigException $e) {
[7151] Fix | Delete
// We don't have anywhere to write files in this scenario. Let's notify the user to update the permissions.
[7152] Fix | Delete
$wafData = array(
[7153] Fix | Delete
'learningMode' => false,
[7154] Fix | Delete
'rules' => array(),
[7155] Fix | Delete
'whitelistedURLParams' => array(),
[7156] Fix | Delete
'disabledRules' => array(),
[7157] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7158] Fix | Delete
);
[7159] Fix | Delete
[7160] Fix | Delete
$logPath = str_replace(ABSPATH, '~/', WFWAF_LOG_PATH);
[7161] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[7162] Fix | Delete
$wafMenuURL = network_admin_url('admin.php?page=WordfenceWAF&wafconfigrebuild=1');
[7163] Fix | Delete
} else {
[7164] Fix | Delete
$wafMenuURL = admin_url('admin.php?page=WordfenceWAF&wafconfigrebuild=1');
[7165] Fix | Delete
}
[7166] Fix | Delete
$wafMenuURL = add_query_arg(array(
[7167] Fix | Delete
'waf-nonce' => wp_create_nonce('wafconfigrebuild'),
[7168] Fix | Delete
), $wafMenuURL);
[7169] Fix | Delete
$storageExceptionMessage = $e->getMessage() . ' ' . sprintf(/* translators: WordPress admin panel URL. */ __('<a href="%s">Click here</a> to rebuild the configuration file.', 'wordfence'), esc_url($wafMenuURL));
[7170] Fix | Delete
} catch (wfWAFStorageFileException $e) {
[7171] Fix | Delete
// We don't have anywhere to write files in this scenario. Let's notify the user to update the permissions.
[7172] Fix | Delete
$wafData = array(
[7173] Fix | Delete
'learningMode' => false,
[7174] Fix | Delete
'rules' => array(),
[7175] Fix | Delete
'whitelistedURLParams' => array(),
[7176] Fix | Delete
'disabledRules' => array(),
[7177] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7178] Fix | Delete
);
[7179] Fix | Delete
$logPath = str_replace(ABSPATH, '~/', WFWAF_LOG_PATH);
[7180] Fix | Delete
$storageExceptionMessage = sprintf(/* translators: File path. */ __('We were unable to write to %s which the WAF uses for storage. Please update permissions on the parent directory so the web server can write to it.', 'wordfence'), $logPath);
[7181] Fix | Delete
} catch (wfWAFStorageEngineMySQLiException $e) {
[7182] Fix | Delete
$wafData = array(
[7183] Fix | Delete
'learningMode' => false,
[7184] Fix | Delete
'rules' => array(),
[7185] Fix | Delete
'whitelistedURLParams' => array(),
[7186] Fix | Delete
'disabledRules' => array(),
[7187] Fix | Delete
'isPaid' => (bool) wfConfig::get('isPaid', 0),
[7188] Fix | Delete
);
[7189] Fix | Delete
$logPath = null;
[7190] Fix | Delete
$storageExceptionMessage = __('An error occured when fetching the WAF configuration from the database.', 'wordfence') . ' <pre>' . esc_html($e->getMessage()) . '</pre>';
[7191] Fix | Delete
}
[7192] Fix | Delete
[7193] Fix | Delete
if (isset($_GET['subpage']) && $_GET['subpage'] == 'waf_options') {
[7194] Fix | Delete
require(dirname(__FILE__) . '/menu_firewall_waf_options.php');
[7195] Fix | Delete
}
[7196] Fix | Delete
else if (isset($_GET['subpage']) && $_GET['subpage'] == 'blocking_options') {
[7197] Fix | Delete
require(dirname(__FILE__) . '/menu_firewall_blocking_options.php');
[7198] Fix | Delete
}
[7199] Fix | Delete
else {
[7200] Fix | Delete
require(dirname(__FILE__) . '/menu_firewall.php');
[7201] Fix | Delete
}
[7202] Fix | Delete
}
[7203] Fix | Delete
[7204] Fix | Delete
public static function liveTrafficW3TCWarning() {
[7205] Fix | Delete
echo self::cachingWarning("W3 Total Cache");
[7206] Fix | Delete
}
[7207] Fix | Delete
public static function liveTrafficSuperCacheWarning(){
[7208] Fix | Delete
echo self::cachingWarning("WP Super Cache");
[7209] Fix | Delete
}
[7210] Fix | Delete
public static function cachingWarning($plugin){
[7211] Fix | Delete
return '<div id="wordfenceConfigWarning" class="error fade"><p><strong>' .
[7212] Fix | Delete
sprintf(/* translators: Plugin name. */ __('The Wordfence Live Traffic feature has been disabled because you have %s active which is not compatible with Wordfence Live Traffic.', 'wordfence'), $plugin)
[7213] Fix | Delete
. '</strong> ' .
[7214] Fix | Delete
sprintf(/* translators: 1. Plugin name. */ __('If you want to reenable Wordfence Live Traffic, you need to deactivate %1$s and then go to the Wordfence options page and reenable Live Traffic there. Wordfence does work with %1$s, however Live Traffic will be disabled and the Wordfence firewall will also count less hits per visitor because of the %1$s caching function. All other functions should work correctly.', 'wordfence'), $plugin)
[7215] Fix | Delete
. '</p></div>';
[7216] Fix | Delete
}
[7217] Fix | Delete
public static function menu_dashboard() {
[7218] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7219] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7220] Fix | Delete
wp_enqueue_script('chart-js');
[7221] Fix | Delete
[7222] Fix | Delete
if (wfConfig::get('keyType') == wfLicense::KEY_TYPE_PAID_EXPIRED || (wfConfig::get('keyType') == wfLicense::KEY_TYPE_PAID_CURRENT && wfConfig::get('keyExpDays') < 30)) {
[7223] Fix | Delete
$api = new wfAPI(wfConfig::get('apiKey', ''), wfUtils::getWPVersion());
[7224] Fix | Delete
try {
[7225] Fix | Delete
$api->call('check_api_key', array(), array(), false, 2);
[7226] Fix | Delete
}
[7227] Fix | Delete
catch (Exception $e) {
[7228] Fix | Delete
//Do nothing
[7229] Fix | Delete
}
[7230] Fix | Delete
}
[7231] Fix | Delete
[7232] Fix | Delete
if (isset($_GET['subpage']) && $_GET['subpage'] == 'global_options') {
[7233] Fix | Delete
require(dirname(__FILE__) . '/menu_dashboard_options.php');
[7234] Fix | Delete
return;
[7235] Fix | Delete
}
[7236] Fix | Delete
[7237] Fix | Delete
require(dirname(__FILE__) . '/menu_dashboard.php');
[7238] Fix | Delete
}
[7239] Fix | Delete
public static function menu_scan() {
[7240] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7241] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7242] Fix | Delete
[7243] Fix | Delete
if (isset($_GET['subpage']) && $_GET['subpage'] == 'scan_options') {
[7244] Fix | Delete
require(dirname(__FILE__) . '/menu_scanner_options.php');
[7245] Fix | Delete
return;
[7246] Fix | Delete
}
[7247] Fix | Delete
else if (isset($_GET['subpage']) && $_GET['subpage'] == 'scan_credentials') {
[7248] Fix | Delete
require(dirname(__FILE__) . '/menu_scanner_credentials.php');
[7249] Fix | Delete
return;
[7250] Fix | Delete
}
[7251] Fix | Delete
[7252] Fix | Delete
require(dirname(__FILE__) . '/menu_scanner.php');
[7253] Fix | Delete
}
[7254] Fix | Delete
[7255] Fix | Delete
public static function menu_support() {
[7256] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7257] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7258] Fix | Delete
[7259] Fix | Delete
require(dirname(__FILE__) . '/menu_support.php');
[7260] Fix | Delete
}
[7261] Fix | Delete
[7262] Fix | Delete
public static function menu_wordfence_central() {
[7263] Fix | Delete
wfConfig::set('showWfCentralUI', 1);
[7264] Fix | Delete
[7265] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[7266] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[7267] Fix | Delete
[7268] Fix | Delete
require(dirname(__FILE__) . '/menu_wordfence_central.php');
[7269] Fix | Delete
}
[7270] Fix | Delete
[7271] Fix | Delete
public static function menu_install() {
[7272] Fix | Delete
$token = array_key_exists('token', $_GET) ? $_GET['token'] : null;
[7273] Fix | Delete
$payload = array_key_exists('payload', $_GET) ? $_GET['payload'] : null;
[7274] Fix | Delete
$invalidLink = false;
[7275] Fix | Delete
$payloadException = null;
[7276] Fix | Delete
$email = null;
[7277] Fix | Delete
$license = null;
[7278] Fix | Delete
if ($shouldShowOnboarding = wfOnboardingController::shouldShowAnyAttempt()) {
[7279] Fix | Delete
if (!empty($token) && !empty($payload)) {
[7280] Fix | Delete
if (wfLicense::validateRegistrationToken($token)) {
[7281] Fix | Delete
$wfWebsite = wfWebsite::getInstance();
[7282] Fix | Delete
try {
[7283] Fix | Delete
$data = $wfWebsite->retrievePayload($payload, $expiredPayload);
[7284] Fix | Delete
$data = json_decode($data, true);
[7285] Fix | Delete
if (is_array($data) && array_key_exists('email', $data) && array_key_exists('license', $data)) {
[7286] Fix | Delete
$email = (string) $data['email'];
[7287] Fix | Delete
$license = (string) $data['license'];
[7288] Fix | Delete
}
[7289] Fix | Delete
}
[7290] Fix | Delete
catch (wfWebsiteEphemeralPayloadRetrievalException $e) {
[7291] Fix | Delete
$payloadException = $e;
[7292] Fix | Delete
$invalidLink = true;
[7293] Fix | Delete
}
[7294] Fix | Delete
}
[7295] Fix | Delete
else {
[7296] Fix | Delete
$invalidLink = true;
[7297] Fix | Delete
}
[7298] Fix | Delete
}
[7299] Fix | Delete
}
[7300] Fix | Delete
require(__DIR__ . '/menu_install.php');
[7301] Fix | Delete
}
[7302] Fix | Delete
[7303] Fix | Delete
public static function fsActionRestoreFileCallback() {
[7304] Fix | Delete
$issueID = filter_input(INPUT_GET, 'issueID', FILTER_SANITIZE_NUMBER_INT);
[7305] Fix | Delete
$response = self::ajax_restoreFile_callback($issueID);
[7306] Fix | Delete
if (!empty($response['ok'])) {
[7307] Fix | Delete
$result = sprintf('<p>' . /* translators: File path. */ __('The file <code>%s</code> was restored successfully.', 'wordfence') . '</p>',
[7308] Fix | Delete
esc_html(strpos($response['file'], ABSPATH) === 0 ? substr($response['file'], strlen(ABSPATH) + 1) : $response['file']));
[7309] Fix | Delete
} else if (!empty($response['cerrorMessage'])) {
[7310] Fix | Delete
$result = sprintf('<div class="wfSummaryErr">%s</div>', esc_html($response['cerrorMessage']));
[7311] Fix | Delete
} else {
[7312] Fix | Delete
$result = '<div class="wfSummaryErr">' . __('There was an error restoring the file.', 'wordfence') . '</div>';
[7313] Fix | Delete
}
[7314] Fix | Delete
printf(<<<HTML
[7315] Fix | Delete
<br>
[7316] Fix | Delete
%s
[7317] Fix | Delete
<p><a href="%s">%s</a></p>
[7318] Fix | Delete
HTML
[7319] Fix | Delete
,
[7320] Fix | Delete
$result,
[7321] Fix | Delete
esc_url(network_admin_url('admin.php?page=WordfenceScan')),
[7322] Fix | Delete
__('Return to scan results', 'wordfence')
[7323] Fix | Delete
);
[7324] Fix | Delete
wfScanEngine::refreshScanNotification();
[7325] Fix | Delete
}
[7326] Fix | Delete
[7327] Fix | Delete
public static function fsActionDeleteFileCallback() {
[7328] Fix | Delete
$issueID = filter_input(INPUT_GET, 'issueID', FILTER_SANITIZE_NUMBER_INT);
[7329] Fix | Delete
$response = self::ajax_deleteFile_callback($issueID);
[7330] Fix | Delete
if (!empty($response['ok'])) {
[7331] Fix | Delete
$result = sprintf('<p>' . /* translators: File path. */ __('The file <code>%s</code> was deleted successfully.', 'wordfence') . '</p>', esc_html($response['file']));
[7332] Fix | Delete
} else if (!empty($response['errorMessage'])) {
[7333] Fix | Delete
$result = sprintf('<div class="wfSummaryErr">%s</div>', esc_html($response['errorMessage']));
[7334] Fix | Delete
} else {
[7335] Fix | Delete
$result = '<div class="wfSummaryErr">' . __('There was an error deleting the file.', 'wordfence') . '</div>';
[7336] Fix | Delete
}
[7337] Fix | Delete
printf(<<<HTML
[7338] Fix | Delete
<br>
[7339] Fix | Delete
%s
[7340] Fix | Delete
<p><a href="%s">%s</a></p>
[7341] Fix | Delete
HTML
[7342] Fix | Delete
,
[7343] Fix | Delete
$result,
[7344] Fix | Delete
esc_url(network_admin_url('admin.php?page=WordfenceScan')),
[7345] Fix | Delete
__('Return to scan results', 'wordfence')
[7346] Fix | Delete
);
[7347] Fix | Delete
wfScanEngine::refreshScanNotification();
[7348] Fix | Delete
}
[7349] Fix | Delete
[7350] Fix | Delete
public static function status($level /* 1 has highest visibility */, $type /* info|error */, $msg){
[7351] Fix | Delete
if($level > 3 && $level < 10 && (! self::isDebugOn())){ //level 10 and higher is for summary messages
[7352] Fix | Delete
return false;
[7353] Fix | Delete
}
[7354] Fix | Delete
if($type != 'info' && $type != 'error'){ error_log("Invalid status type: $type"); return; }
[7355] Fix | Delete
if(self::$printStatus){
[7356] Fix | Delete
echo "STATUS: $level : $type : ".esc_html($msg)."\n";
[7357] Fix | Delete
} else {
[7358] Fix | Delete
self::getLog()->addStatus($level, $type, $msg);
[7359] Fix | Delete
}
[7360] Fix | Delete
}
[7361] Fix | Delete
public static function profileUpdateAction($userID, $newDat = false){
[7362] Fix | Delete
if(! $newDat){ return; }
[7363] Fix | Delete
if(wfConfig::get('other_pwStrengthOnUpdate')){
[7364] Fix | Delete
$oldDat = get_userdata($userID);
[7365] Fix | Delete
if($newDat->user_pass != $oldDat->user_pass){
[7366] Fix | Delete
$wf = new wfScanEngine();
[7367] Fix | Delete
$wf->scanUserPassword($userID);
[7368] Fix | Delete
$wf->emailNewIssues();
[7369] Fix | Delete
}
[7370] Fix | Delete
}
[7371] Fix | Delete
}
[7372] Fix | Delete
[7373] Fix | Delete
public static function replaceVersion($url) {
[7374] Fix | Delete
if (is_string($url))
[7375] Fix | Delete
return preg_replace_callback("/([&;\?]ver)=(.+?)(&|$)/", "wordfence::replaceVersionCallback", $url);
[7376] Fix | Delete
return $url;
[7377] Fix | Delete
}
[7378] Fix | Delete
[7379] Fix | Delete
public static function replaceVersionCallback($matches) {
[7380] Fix | Delete
global $wp_version;
[7381] Fix | Delete
return $matches[1] . '=' . ($wp_version === $matches[2] ? wp_hash($matches[2]) : $matches[2]) . $matches[3];
[7382] Fix | Delete
}
[7383] Fix | Delete
[7384] Fix | Delete
public static function genFilter($gen, $type){
[7385] Fix | Delete
if(wfConfig::get('other_hideWPVersion')){
[7386] Fix | Delete
return '';
[7387] Fix | Delete
} else {
[7388] Fix | Delete
return $gen;
[7389] Fix | Delete
}
[7390] Fix | Delete
}
[7391] Fix | Delete
public static function getMyHomeURL(){
[7392] Fix | Delete
return wfUtils::wpAdminURL('admin.php?page=Wordfence');
[7393] Fix | Delete
}
[7394] Fix | Delete
public static function getMyOptionsURL(){
[7395] Fix | Delete
return wfUtils::wpAdminURL('admin.php?page=Wordfence&subpage=global_options');
[7396] Fix | Delete
}
[7397] Fix | Delete
[7398] Fix | Delete
public static function alert($subject, $alertMsg, $IP) {
[7399] Fix | Delete
wfConfig::inc('totalAlertsSent');
[7400] Fix | Delete
$emails = wfConfig::getAlertEmails();
[7401] Fix | Delete
if (sizeof($emails) < 1) { return false; }
[7402] Fix | Delete
[7403] Fix | Delete
$IPMsg = "";
[7404] Fix | Delete
if ($IP) {
[7405] Fix | Delete
$IPMsg = sprintf(/* translators: IP address. */ __("User IP: %s\n", 'wordfence'), $IP);
[7406] Fix | Delete
$reverse = wfUtils::reverseLookup($IP);
[7407] Fix | Delete
if ($reverse) {
[7408] Fix | Delete
$IPMsg .= sprintf(/* translators: Domain name. */ __("User hostname: %s\n", 'wordfence'), $reverse);
[7409] Fix | Delete
}
[7410] Fix | Delete
$userLoc = wfUtils::getIPGeo($IP);
[7411] Fix | Delete
if ($userLoc) {
[7412] Fix | Delete
$IPMsg .= __('User location: ', 'wordfence');
[7413] Fix | Delete
if ($userLoc['city']) {
[7414] Fix | Delete
$IPMsg .= $userLoc['city'] . ', ';
[7415] Fix | Delete
}
[7416] Fix | Delete
if ($userLoc['region'] && wfUtils::shouldDisplayRegion($userLoc['countryName'])) {
[7417] Fix | Delete
$IPMsg .= $userLoc['region'] . ', ';
[7418] Fix | Delete
}
[7419] Fix | Delete
$IPMsg .= $userLoc['countryName'] . "\n";
[7420] Fix | Delete
}
[7421] Fix | Delete
}
[7422] Fix | Delete
[7423] Fix | Delete
$content = wfUtils::tmpl('email_genericAlert.php', array(
[7424] Fix | Delete
'isPaid' => wfConfig::get('isPaid'),
[7425] Fix | Delete
'subject' => $subject,
[7426] Fix | Delete
'blogName' => get_bloginfo('name', 'raw'),
[7427] Fix | Delete
'adminURL' => get_admin_url(),
[7428] Fix | Delete
'alertMsg' => $alertMsg,
[7429] Fix | Delete
'IPMsg' => $IPMsg,
[7430] Fix | Delete
'date' => wfUtils::localHumanDate(),
[7431] Fix | Delete
'myHomeURL' => self::getMyHomeURL(),
[7432] Fix | Delete
'myOptionsURL' => self::getMyOptionsURL()
[7433] Fix | Delete
));
[7434] Fix | Delete
$shortSiteURL = preg_replace('/^https?:\/\//i', '', site_url());
[7435] Fix | Delete
$subject = "[Wordfence Alert] $shortSiteURL " . $subject;
[7436] Fix | Delete
[7437] Fix | Delete
$sendMax = wfConfig::get('alert_maxHourly', 0);
[7438] Fix | Delete
if($sendMax > 0){
[7439] Fix | Delete
$sendArr = wfConfig::get_ser('alertFreqTrack', array());
[7440] Fix | Delete
if(! is_array($sendArr)){
[7441] Fix | Delete
$sendArr = array();
[7442] Fix | Delete
}
[7443] Fix | Delete
$minuteTime = floor(time() / 60);
[7444] Fix | Delete
$totalSent = 0;
[7445] Fix | Delete
for($i = $minuteTime; $i > $minuteTime - 60; $i--){
[7446] Fix | Delete
$totalSent += isset($sendArr[$i]) ? $sendArr[$i] : 0;
[7447] Fix | Delete
}
[7448] Fix | Delete
if($totalSent >= $sendMax){
[7449] Fix | Delete
return false;
[7450] Fix | Delete
}
[7451] Fix | Delete
$sendArr[$minuteTime] = isset($sendArr[$minuteTime]) ? $sendArr[$minuteTime] + 1 : 1;
[7452] Fix | Delete
wfConfig::set_ser('alertFreqTrack', $sendArr);
[7453] Fix | Delete
}
[7454] Fix | Delete
//Prevent duplicate emails within 1 hour:
[7455] Fix | Delete
$hash = md5(implode(',', $emails) . ':' . $subject . ':' . $alertMsg . ':' . $IP); //Hex
[7456] Fix | Delete
$lastHash = wfConfig::get('lastEmailHash', false);
[7457] Fix | Delete
if($lastHash){
[7458] Fix | Delete
$lastHashDat = explode(':', $lastHash); //[time, hash]
[7459] Fix | Delete
if(time() - $lastHashDat[0] < 3600){
[7460] Fix | Delete
if($lastHashDat[1] == $hash){
[7461] Fix | Delete
return false; //Don't send because this email is identical to the previous email which was sent within the last hour.
[7462] Fix | Delete
}
[7463] Fix | Delete
}
[7464] Fix | Delete
}
[7465] Fix | Delete
wfConfig::set('lastEmailHash', time() . ':' . $hash);
[7466] Fix | Delete
foreach ($emails as $email) {
[7467] Fix | Delete
$uniqueContent = $content . "\n\n" . sprintf(/* translators: WordPress admin panel URL. */ __('No longer an administrator for this site? Click here to stop receiving security alerts: %s', 'wordfence'), wfUtils::getSiteBaseURL() . '?_wfsf=removeAlertEmail&jwt=' . wfUtils::generateJWT(array('email' => $email)));
[7468] Fix | Delete
wp_mail($email, $subject, $uniqueContent);
[7469] Fix | Delete
}
[7470] Fix | Delete
return true;
[7471] Fix | Delete
}
[7472] Fix | Delete
public static function getLog(){
[7473] Fix | Delete
if(! self::$wfLog){
[7474] Fix | Delete
$wfLog = wfLog::shared();
[7475] Fix | Delete
self::$wfLog = $wfLog;
[7476] Fix | Delete
}
[7477] Fix | Delete
return self::$wfLog;
[7478] Fix | Delete
}
[7479] Fix | Delete
public static function wfSchemaExists(){
[7480] Fix | Delete
global $wpdb;
[7481] Fix | Delete
$exists = $wpdb->get_col($wpdb->prepare(<<<SQL
[7482] Fix | Delete
SELECT TABLE_NAME FROM information_schema.TABLES
[7483] Fix | Delete
WHERE TABLE_SCHEMA=DATABASE()
[7484] Fix | Delete
AND TABLE_NAME=%s
[7485] Fix | Delete
SQL
[7486] Fix | Delete
, wfDB::networkTable('wfConfig')));
[7487] Fix | Delete
return $exists ? true : false;
[7488] Fix | Delete
}
[7489] Fix | Delete
public static function isDebugOn(){
[7490] Fix | Delete
if(is_null(self::$debugOn)){
[7491] Fix | Delete
if(wfConfig::get('debugOn')){
[7492] Fix | Delete
self::$debugOn = true;
[7493] Fix | Delete
} else {
[7494] Fix | Delete
self::$debugOn = false;
[7495] Fix | Delete
}
[7496] Fix | Delete
}
[7497] Fix | Delete
return self::$debugOn;
[7498] Fix | Delete
}
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function