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
}
[4500] Fix | Delete
}
[4501] Fix | Delete
[4502] Fix | Delete
return array(
[4503] Fix | Delete
'error' => __('No license was provided to install.', 'wordfence'),
[4504] Fix | Delete
);
[4505] Fix | Delete
}
[4506] Fix | Delete
public static function ajax_recordTOUPP_callback() {
[4507] Fix | Delete
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
[4508] Fix | Delete
$result = $api->call('record_toupp', array(), array());
[4509] Fix | Delete
wfConfig::set('touppBypassNextCheck', 1); //In case this call kicks off the cron that checks, this avoids the race condition of that setting the prompt as being needed at the same time we've just recorded it as accepted
[4510] Fix | Delete
wfConfig::set('touppPromptNeeded', 0);
[4511] Fix | Delete
return array(
[4512] Fix | Delete
'success' => 1,
[4513] Fix | Delete
);
[4514] Fix | Delete
}
[4515] Fix | Delete
public static function ajax_mailingSignup_callback() {
[4516] Fix | Delete
if (isset($_POST['emails'])) {
[4517] Fix | Delete
$emails = @json_decode(stripslashes($_POST['emails']), true);
[4518] Fix | Delete
if (is_array($emails) && count($emails)) {
[4519] Fix | Delete
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
[4520] Fix | Delete
$result = $api->call('mailing_signup', array(), array('signup' => json_encode(array('emails' => $emails)), 'ip' => wfUtils::getIP()));
[4521] Fix | Delete
}
[4522] Fix | Delete
}
[4523] Fix | Delete
[4524] Fix | Delete
return array(
[4525] Fix | Delete
'success' => 1,
[4526] Fix | Delete
);
[4527] Fix | Delete
}
[4528] Fix | Delete
public static function ajax_enableAllOptionsPage_callback() {
[4529] Fix | Delete
wfConfig::set('displayTopLevelOptions', 1);
[4530] Fix | Delete
$n = wfNotification::getNotificationForCategory('wfplugin_devalloptions');
[4531] Fix | Delete
if ($n !== null) {
[4532] Fix | Delete
$n->markAsRead();
[4533] Fix | Delete
}
[4534] Fix | Delete
[4535] Fix | Delete
$response = array('success' => true);
[4536] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[4537] Fix | Delete
$response['redirect'] = network_admin_url('admin.php?page=WordfenceOptions');
[4538] Fix | Delete
}
[4539] Fix | Delete
else {
[4540] Fix | Delete
$response['redirect'] = admin_url('admin.php?page=WordfenceOptions');
[4541] Fix | Delete
}
[4542] Fix | Delete
[4543] Fix | Delete
return $response;
[4544] Fix | Delete
}
[4545] Fix | Delete
public static function ajax_restoreDefaults_callback() {
[4546] Fix | Delete
if (!empty($_POST['section'])) {
[4547] Fix | Delete
if (wfConfig::restoreDefaults($_POST['section'])) {
[4548] Fix | Delete
return array(
[4549] Fix | Delete
'success' => true,
[4550] Fix | Delete
);
[4551] Fix | Delete
}
[4552] Fix | Delete
else {
[4553] Fix | Delete
return array(
[4554] Fix | Delete
'error' => __('An unknown configuration section was provided.', 'wordfence'),
[4555] Fix | Delete
);
[4556] Fix | Delete
}
[4557] Fix | Delete
}
[4558] Fix | Delete
[4559] Fix | Delete
return array(
[4560] Fix | Delete
'error' => __('No configuration section was provided.', 'wordfence'),
[4561] Fix | Delete
);
[4562] Fix | Delete
}
[4563] Fix | Delete
public static function ajax_saveOptions_callback() {
[4564] Fix | Delete
if (!empty($_POST['changes']) && ($changes = json_decode(stripslashes($_POST['changes']), true)) !== false) {
[4565] Fix | Delete
try {
[4566] Fix | Delete
$errors = wfConfig::validate($changes);
[4567] Fix | Delete
if ($errors !== true) {
[4568] Fix | Delete
if (count($errors) == 1) {
[4569] Fix | Delete
return array(
[4570] Fix | Delete
'error' => sprintf(/* translators: Error message. */ __('An error occurred while saving the configuration: %s', 'wordfence'), $errors[0]['error']),
[4571] Fix | Delete
);
[4572] Fix | Delete
}
[4573] Fix | Delete
else if (count($errors) > 1) {
[4574] Fix | Delete
$compoundMessage = array();
[4575] Fix | Delete
foreach ($errors as $e) {
[4576] Fix | Delete
$compoundMessage[] = $e['error'];
[4577] Fix | Delete
}
[4578] Fix | Delete
return array(
[4579] Fix | Delete
'error' => sprintf(/* translators: Error message. */ __('Errors occurred while saving the configuration: %s', 'wordfence'), implode(', ', $compoundMessage)),
[4580] Fix | Delete
);
[4581] Fix | Delete
}
[4582] Fix | Delete
[4583] Fix | Delete
return array(
[4584] Fix | Delete
'error' => __('Errors occurred while saving the configuration.', 'wordfence'),
[4585] Fix | Delete
);
[4586] Fix | Delete
}
[4587] Fix | Delete
[4588] Fix | Delete
wfConfig::save(wfConfig::clean($changes));
[4589] Fix | Delete
[4590] Fix | Delete
$response = array('success' => true);
[4591] Fix | Delete
if (!empty($_POST['page']) && preg_match('/^Wordfence/i', $_POST['page'])) {
[4592] Fix | Delete
if ($_POST['page'] == 'WordfenceOptions' && isset($changes['displayTopLevelOptions']) && !wfUtils::truthyToBoolean($changes['displayTopLevelOptions'])) {
[4593] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[4594] Fix | Delete
$response['redirect'] = network_admin_url('admin.php?page=Wordfence');
[4595] Fix | Delete
}
[4596] Fix | Delete
else {
[4597] Fix | Delete
$response['redirect'] = admin_url('admin.php?page=Wordfence');
[4598] Fix | Delete
}
[4599] Fix | Delete
}
[4600] Fix | Delete
}
[4601] Fix | Delete
[4602] Fix | Delete
return $response;
[4603] Fix | Delete
}
[4604] Fix | Delete
catch (wfWAFStorageFileException $e) {
[4605] Fix | Delete
return array(
[4606] Fix | Delete
'error' => __('An error occurred while saving the configuration.', 'wordfence'),
[4607] Fix | Delete
);
[4608] Fix | Delete
}
[4609] Fix | Delete
catch (wfWAFStorageEngineMySQLiException $e) {
[4610] Fix | Delete
return array(
[4611] Fix | Delete
'error' => __('An error occurred while saving the configuration.', 'wordfence'),
[4612] Fix | Delete
);
[4613] Fix | Delete
}
[4614] Fix | Delete
catch (Exception $e) {
[4615] Fix | Delete
return array(
[4616] Fix | Delete
'error' => $e->getMessage(),
[4617] Fix | Delete
);
[4618] Fix | Delete
}
[4619] Fix | Delete
}
[4620] Fix | Delete
[4621] Fix | Delete
return array(
[4622] Fix | Delete
'error' => __('No configuration changes were provided to save.', 'wordfence'),
[4623] Fix | Delete
);
[4624] Fix | Delete
}
[4625] Fix | Delete
[4626] Fix | Delete
public static function ajax_setDeactivationOption_callback() {
[4627] Fix | Delete
$key = array_key_exists('option', $_POST) ? $_POST['option'] : null;
[4628] Fix | Delete
$option = wfDeactivationOption::forKey($key);
[4629] Fix | Delete
if ($option === null) {
[4630] Fix | Delete
return array(
[4631] Fix | Delete
'error' => __('Invalid option specified', 'wordfence')
[4632] Fix | Delete
);
[4633] Fix | Delete
}
[4634] Fix | Delete
wfConfig::set('deleteTablesOnDeact', $option->deletesMain());
[4635] Fix | Delete
\WordfenceLS\Controller_Settings::shared()->set('delete-deactivation', $option->deletesLoginSecurity());
[4636] Fix | Delete
return array(
[4637] Fix | Delete
'success' => true
[4638] Fix | Delete
);
[4639] Fix | Delete
}
[4640] Fix | Delete
[4641] Fix | Delete
public static function ajax_updateIPPreview_callback() {
[4642] Fix | Delete
$howGet = $_POST['howGetIPs'];
[4643] Fix | Delete
[4644] Fix | Delete
$validIPs = array();
[4645] Fix | Delete
$invalidIPs = array();
[4646] Fix | Delete
$testIPs = preg_split('/[\r\n,]+/', $_POST['howGetIPs_trusted_proxies']);
[4647] Fix | Delete
foreach ($testIPs as $val) {
[4648] Fix | Delete
if (strlen($val) > 0) {
[4649] Fix | Delete
if (wfUtils::isValidIP($val) || wfUtils::isValidCIDRRange($val)) {
[4650] Fix | Delete
$validIPs[] = $val;
[4651] Fix | Delete
}
[4652] Fix | Delete
else {
[4653] Fix | Delete
$invalidIPs[] = $val;
[4654] Fix | Delete
}
[4655] Fix | Delete
}
[4656] Fix | Delete
}
[4657] Fix | Delete
$trustedProxies = $validIPs;
[4658] Fix | Delete
[4659] Fix | Delete
$preset = $_POST['howGetIPs_trusted_proxy_preset'];
[4660] Fix | Delete
$presets = wfConfig::getJSON('ipResolutionList', array());
[4661] Fix | Delete
if (is_array($presets) && isset($presets[$preset])) {
[4662] Fix | Delete
$testIPs = array_merge($presets[$preset]['ipv4'], $presets[$preset]['ipv6']);
[4663] Fix | Delete
foreach ($testIPs as $val) {
[4664] Fix | Delete
if (strlen($val) > 0) {
[4665] Fix | Delete
if (wfUtils::isValidIP($val) || wfUtils::isValidCIDRRange($val)) {
[4666] Fix | Delete
$trustedProxies[] = $val;
[4667] Fix | Delete
}
[4668] Fix | Delete
}
[4669] Fix | Delete
}
[4670] Fix | Delete
}
[4671] Fix | Delete
[4672] Fix | Delete
$ipAll = wfUtils::getIPPreview($howGet, $trustedProxies);
[4673] Fix | Delete
$ip = wfUtils::getIPForField($howGet, $trustedProxies);
[4674] Fix | Delete
return array('ok' => 1, 'ip' => $ip, 'ipAll' => $ipAll, 'resolvedProxies' => $trustedProxies);
[4675] Fix | Delete
}
[4676] Fix | Delete
[4677] Fix | Delete
public static function ajax_hideFileHtaccess_callback(){
[4678] Fix | Delete
$issues = new wfIssues();
[4679] Fix | Delete
$issue = $issues->getIssueByID((int) $_POST['issueID']);
[4680] Fix | Delete
if (!$issue) {
[4681] Fix | Delete
return array('errorMsg' => __("We could not find that issue in our database.", 'wordfence'));
[4682] Fix | Delete
}
[4683] Fix | Delete
[4684] Fix | Delete
if (!function_exists('get_home_path')) {
[4685] Fix | Delete
include_once(ABSPATH . 'wp-admin/includes/file.php');
[4686] Fix | Delete
}
[4687] Fix | Delete
[4688] Fix | Delete
$homeURL = get_home_url();
[4689] Fix | Delete
$components = parse_url($homeURL);
[4690] Fix | Delete
if ($components === false) {
[4691] Fix | Delete
return array('errorMsg' => __("An error occurred while trying to hide the file.", 'wordfence'));
[4692] Fix | Delete
}
[4693] Fix | Delete
[4694] Fix | Delete
$sitePath = '';
[4695] Fix | Delete
if (isset($components['path'])) {
[4696] Fix | Delete
$sitePath = trim($components['path'], '/');
[4697] Fix | Delete
}
[4698] Fix | Delete
[4699] Fix | Delete
$homePath = wfUtils::getHomePath();
[4700] Fix | Delete
$file = $issue['data']['file'];
[4701] Fix | Delete
$localFile = ABSPATH . '/' . $file; //The scanner uses ABSPATH as its base rather than get_home_path()
[4702] Fix | Delete
$localFile = realpath($localFile);
[4703] Fix | Delete
if (strpos($localFile, $homePath) !== 0) {
[4704] Fix | Delete
return array('errorMsg' => __("An invalid file was requested for hiding.", 'wordfence'));
[4705] Fix | Delete
}
[4706] Fix | Delete
$localFile = substr($localFile, strlen($homePath));
[4707] Fix | Delete
$absoluteURIPath = trim($sitePath . '/' . $localFile, '/');
[4708] Fix | Delete
$regexLocalFile = preg_replace('#/#', '/+', preg_quote($absoluteURIPath));
[4709] Fix | Delete
$filename = basename($localFile);
[4710] Fix | Delete
[4711] Fix | Delete
$htaccessContent = <<<HTACCESS
[4712] Fix | Delete
<IfModule mod_rewrite.c>
[4713] Fix | Delete
RewriteEngine On
[4714] Fix | Delete
RewriteCond %{REQUEST_URI} ^/?{$regexLocalFile}$
[4715] Fix | Delete
RewriteRule .* - [F,L,NC]
[4716] Fix | Delete
</IfModule>
[4717] Fix | Delete
<IfModule !mod_rewrite.c>
[4718] Fix | Delete
<Files "{$filename}">
[4719] Fix | Delete
<IfModule mod_authz_core.c>
[4720] Fix | Delete
Require all denied
[4721] Fix | Delete
</IfModule>
[4722] Fix | Delete
<IfModule !mod_authz_core.c>
[4723] Fix | Delete
Order deny,allow
[4724] Fix | Delete
Deny from all
[4725] Fix | Delete
</IfModule>
[4726] Fix | Delete
</Files>
[4727] Fix | Delete
</IfModule>
[4728] Fix | Delete
HTACCESS;
[4729] Fix | Delete
[4730] Fix | Delete
if (!wfUtils::htaccessPrepend($htaccessContent)) {
[4731] Fix | Delete
return array('errorMsg' => __("You don't have permission to repair .htaccess. You need to either fix the file manually using FTP or change the file permissions and ownership so that your web server has write access to repair the file.", 'wordfence'));
[4732] Fix | Delete
}
[4733] Fix | Delete
$issues->updateIssue((int) $_POST['issueID'], 'delete');
[4734] Fix | Delete
wfScanEngine::refreshScanNotification($issues);
[4735] Fix | Delete
$counts = $issues->getIssueCounts();
[4736] Fix | Delete
return array(
[4737] Fix | Delete
'ok' => 1,
[4738] Fix | Delete
'issueCounts' => $counts,
[4739] Fix | Delete
);
[4740] Fix | Delete
}
[4741] Fix | Delete
public static function ajax_unlockOutIP_callback(){
[4742] Fix | Delete
$IP = $_POST['IP'];
[4743] Fix | Delete
wfBlock::unlockOutIP($IP);
[4744] Fix | Delete
self::clearLockoutCounters($IP);
[4745] Fix | Delete
return array('ok' => 1);
[4746] Fix | Delete
}
[4747] Fix | Delete
public static function ajax_unblockIP_callback(){
[4748] Fix | Delete
$IP = $_POST['IP'];
[4749] Fix | Delete
wfBlock::unblockIP($IP);
[4750] Fix | Delete
self::clearLockoutCounters($IP);
[4751] Fix | Delete
return array('ok' => 1);
[4752] Fix | Delete
}
[4753] Fix | Delete
public static function ajax_permBlockIP_callback(){
[4754] Fix | Delete
$IP = $_POST['IP'];
[4755] Fix | Delete
wfBlock::createIP(__('Manual permanent block by admin', 'wordfence'), $IP, wfBlock::DURATION_FOREVER, time(), false, 0, wfBlock::TYPE_IP_MANUAL);
[4756] Fix | Delete
return array('ok' => 1);
[4757] Fix | Delete
}
[4758] Fix | Delete
public static function ajax_unblockRange_callback(){
[4759] Fix | Delete
$id = trim($_POST['id']);
[4760] Fix | Delete
wfBlock::removeBlockIDs(array($id));
[4761] Fix | Delete
return array('ok' => 1);
[4762] Fix | Delete
}
[4763] Fix | Delete
[4764] Fix | Delete
public static function ajax_whois_callback(){
[4765] Fix | Delete
$val = trim($_POST['val']);
[4766] Fix | Delete
$val = preg_replace('/[^a-zA-Z0-9\.\-:]+/', '', $val);
[4767] Fix | Delete
$api = new wfAPI(wfConfig::get('apiKey'), wfUtils::getWPVersion());
[4768] Fix | Delete
try {
[4769] Fix | Delete
$result = $api->call('whois', array(), array(
[4770] Fix | Delete
'val' => $val,
[4771] Fix | Delete
));
[4772] Fix | Delete
return array('ok' => 1, 'result' => $result['result']);
[4773] Fix | Delete
}
[4774] Fix | Delete
catch (wfAPICallErrorResponseException $e) {
[4775] Fix | Delete
return array('ok' => 0);
[4776] Fix | Delete
}
[4777] Fix | Delete
}
[4778] Fix | Delete
public static function ajax_recentTraffic_callback(){
[4779] Fix | Delete
$ip = trim($_POST['ip']);
[4780] Fix | Delete
try {
[4781] Fix | Delete
$response = self::IPTraf($ip);
[4782] Fix | Delete
$reverseLookup = $response['reverseLookup'];
[4783] Fix | Delete
$results = $response['results'];
[4784] Fix | Delete
ob_start();
[4785] Fix | Delete
require(dirname(__FILE__) . '/IPTrafList.php');
[4786] Fix | Delete
$content = ob_get_clean();
[4787] Fix | Delete
return array('ok' => 1, 'result' => $content);
[4788] Fix | Delete
} catch (InvalidArgumentException $e) {
[4789] Fix | Delete
return array('errorMsg' => $e->getMessage());
[4790] Fix | Delete
}
[4791] Fix | Delete
}
[4792] Fix | Delete
public static function ajax_blockIP_callback() {
[4793] Fix | Delete
$IP = trim($_POST['IP']);
[4794] Fix | Delete
$perm = (isset($_POST['perm']) && $_POST['perm'] == '1') ? wfBlock::DURATION_FOREVER : wfConfig::getInt('blockedTime');
[4795] Fix | Delete
if (!wfUtils::isValidIP($IP)) {
[4796] Fix | Delete
return array('err' => 1, 'errorMsg' => __("Please enter a valid IP address to block.", 'wordfence'));
[4797] Fix | Delete
}
[4798] Fix | Delete
if ($IP == wfUtils::getIP()) {
[4799] Fix | Delete
return array('err' => 1, 'errorMsg' => __("You can't block your own IP address.", 'wordfence'));
[4800] Fix | Delete
}
[4801] Fix | Delete
$forcedWhitelistEntry = false;
[4802] Fix | Delete
if (wfBlock::isWhitelisted($IP, $forcedWhitelistEntry)) {
[4803] Fix | Delete
$message = sprintf(/* translators: IP address. */ __("The IP address %s is allowlisted and can't be blocked. You can remove this IP from the allowlist on the Wordfence options page.", 'wordfence'), wp_kses($IP, array()));
[4804] Fix | Delete
if ($forcedWhitelistEntry) {
[4805] Fix | Delete
$message = sprintf(/* translators: IP address. */ __("The IP address %s is in a range of IP addresses that Wordfence does not block. The IP range may be internal or belong to a service safe to allow access for.", 'wordfence'), wp_kses($IP, array()));
[4806] Fix | Delete
}
[4807] Fix | Delete
return array('err' => 1, 'errorMsg' => $message);
[4808] Fix | Delete
}
[4809] Fix | Delete
if (wfConfig::get('neverBlockBG') != 'treatAsOtherCrawlers') { //Either neverBlockVerified or neverBlockUA is selected which means the user doesn't want to block google
[4810] Fix | Delete
if (wfCrawl::isVerifiedGoogleCrawler($IP)) {
[4811] Fix | Delete
return array('err' => 1, 'errorMsg' => __("The IP address you're trying to block belongs to Google. Your options are currently set to not block these crawlers. Change this in Wordfence options if you want to manually block Google.", 'wordfence'));
[4812] Fix | Delete
}
[4813] Fix | Delete
}
[4814] Fix | Delete
wfBlock::createIP($_POST['reason'], $IP, $perm);
[4815] Fix | Delete
wfActivityReport::logBlockedIP($IP, null, 'manual');
[4816] Fix | Delete
return array('ok' => 1);
[4817] Fix | Delete
}
[4818] Fix | Delete
public static function ajax_avatarLookup_callback() {
[4819] Fix | Delete
$ids = explode(',', $_POST['ids']);
[4820] Fix | Delete
$res = array();
[4821] Fix | Delete
foreach ($ids as $id) {
[4822] Fix | Delete
$avatar = get_avatar($id, 16);
[4823] Fix | Delete
if ($avatar) {
[4824] Fix | Delete
$res[$id] = $avatar;
[4825] Fix | Delete
}
[4826] Fix | Delete
}
[4827] Fix | Delete
return array('ok' => 1, 'avatars' => $res);
[4828] Fix | Delete
}
[4829] Fix | Delete
public static function ajax_reverseLookup_callback(){
[4830] Fix | Delete
$ips = explode(',', $_POST['ips']);
[4831] Fix | Delete
$res = array();
[4832] Fix | Delete
foreach($ips as $ip){
[4833] Fix | Delete
$res[$ip] = wfUtils::reverseLookup($ip);
[4834] Fix | Delete
}
[4835] Fix | Delete
return array('ok' => 1, 'ips' => $res);
[4836] Fix | Delete
}
[4837] Fix | Delete
public static function ajax_deleteIssue_callback(){
[4838] Fix | Delete
$wfIssues = new wfIssues();
[4839] Fix | Delete
$issueID = $_POST['id'];
[4840] Fix | Delete
$wfIssues->deleteIssue($issueID);
[4841] Fix | Delete
wfScanEngine::refreshScanNotification($wfIssues);
[4842] Fix | Delete
return array('ok' => 1);
[4843] Fix | Delete
}
[4844] Fix | Delete
public static function ajax_updateAllIssues_callback(){
[4845] Fix | Delete
$op = $_POST['op'];
[4846] Fix | Delete
$i = new wfIssues();
[4847] Fix | Delete
if($op == 'deleteIgnored'){
[4848] Fix | Delete
$i->deleteIgnored();
[4849] Fix | Delete
} else if($op == 'deleteNew'){
[4850] Fix | Delete
$i->deleteNew();
[4851] Fix | Delete
} else if($op == 'ignoreAllNew'){
[4852] Fix | Delete
$i->ignoreAllNew();
[4853] Fix | Delete
} else {
[4854] Fix | Delete
return array('errorMsg' => __("An invalid operation was called.", 'wordfence'));
[4855] Fix | Delete
}
[4856] Fix | Delete
wfScanEngine::refreshScanNotification($i);
[4857] Fix | Delete
return array('ok' => 1);
[4858] Fix | Delete
}
[4859] Fix | Delete
public static function ajax_updateIssueStatus_callback(){
[4860] Fix | Delete
$wfIssues = new wfIssues();
[4861] Fix | Delete
$status = $_POST['status'];
[4862] Fix | Delete
$issueID = $_POST['id'];
[4863] Fix | Delete
if(! preg_match('/^(?:new|delete|ignoreP|ignoreC)$/', $status)){
[4864] Fix | Delete
return array('errorMsg' => __("An invalid status was specified when trying to update that issue.", 'wordfence'));
[4865] Fix | Delete
}
[4866] Fix | Delete
$wfIssues->updateIssue($issueID, $status);
[4867] Fix | Delete
wfScanEngine::refreshScanNotification($wfIssues);
[4868] Fix | Delete
[4869] Fix | Delete
$counts = $wfIssues->getIssueCounts();
[4870] Fix | Delete
return array(
[4871] Fix | Delete
'ok' => 1,
[4872] Fix | Delete
'issueCounts' => $counts,
[4873] Fix | Delete
);
[4874] Fix | Delete
}
[4875] Fix | Delete
public static function ajax_killScan_callback(){
[4876] Fix | Delete
wordfence::status(1, 'info', __("Scan stop request received.", 'wordfence'));
[4877] Fix | Delete
wordfence::status(10, 'info', 'SUM_KILLED:' . __("A request was received to stop the previous scan.", 'wordfence'));
[4878] Fix | Delete
wfUtils::clearScanLock(); //Clear the lock now because there may not be a scan running to pick up the kill request and clear the lock
[4879] Fix | Delete
wfScanEngine::requestKill();
[4880] Fix | Delete
wfConfig::remove('scanStartAttempt');
[4881] Fix | Delete
wfConfig::set('lastScanFailureType', false);
[4882] Fix | Delete
return array(
[4883] Fix | Delete
'ok' => 1,
[4884] Fix | Delete
);
[4885] Fix | Delete
}
[4886] Fix | Delete
public static function ajax_loadIssues_callback(){
[4887] Fix | Delete
$offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
[4888] Fix | Delete
$limit = isset($_POST['limit']) ? intval($_POST['limit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
[4889] Fix | Delete
$ignoredOffset = isset($_POST['ignoredOffset']) ? intval($_POST['ignoredOffset']) : 0;
[4890] Fix | Delete
$ignoredLimit = isset($_POST['ignoredLimit']) ? intval($_POST['ignoredLimit']) : WORDFENCE_SCAN_ISSUES_PER_PAGE;
[4891] Fix | Delete
[4892] Fix | Delete
$issues = wfIssues::shared()->getIssues($offset, $limit, $ignoredOffset, $ignoredLimit);
[4893] Fix | Delete
$issueCounts = array_merge(array('new' => 0, 'ignoreP' => 0, 'ignoreC' => 0), wfIssues::shared()->getIssueCounts());
[4894] Fix | Delete
[4895] Fix | Delete
return array(
[4896] Fix | Delete
'issues' => $issues,
[4897] Fix | Delete
'issueCounts' => $issueCounts,
[4898] Fix | Delete
);
[4899] Fix | Delete
}
[4900] Fix | Delete
public static function ajax_ticker_callback() {
[4901] Fix | Delete
$wfdb = new wfDB();
[4902] Fix | Delete
$table_wfStatus = wfDB::networkTable('wfStatus');
[4903] Fix | Delete
$serverTime = $wfdb->querySingle("select unix_timestamp()");
[4904] Fix | Delete
$jsonData = array(
[4905] Fix | Delete
'serverTime' => $serverTime,
[4906] Fix | Delete
'serverMicrotime' => microtime(true),
[4907] Fix | Delete
'msg' => wp_kses_data((string) $wfdb->querySingle("SELECT msg FROM {$table_wfStatus} WHERE level < 3 AND ctime > (UNIX_TIMESTAMP() - 3600) ORDER BY ctime DESC LIMIT 1")),
[4908] Fix | Delete
);
[4909] Fix | Delete
$events = array();
[4910] Fix | Delete
if (get_site_option('wordfence_syncAttackDataAttempts') > 10) {
[4911] Fix | Delete
self::syncAttackData(false);
[4912] Fix | Delete
}
[4913] Fix | Delete
$results = self::ajax_loadLiveTraffic_callback();
[4914] Fix | Delete
$events = $results['data'];
[4915] Fix | Delete
if (isset($results['sql'])) {
[4916] Fix | Delete
$jsonData['sql'] = $results['sql'];
[4917] Fix | Delete
}
[4918] Fix | Delete
[4919] Fix | Delete
$jsonData['events'] = $events;
[4920] Fix | Delete
return $jsonData;
[4921] Fix | Delete
}
[4922] Fix | Delete
public static function ajax_activityLogUpdate_callback() {
[4923] Fix | Delete
global $wpdb;
[4924] Fix | Delete
$statusTable = wfDB::networkTable('wfStatus');
[4925] Fix | Delete
$row = $wpdb->get_row("SELECT ctime, msg FROM {$statusTable} WHERE level < 3 AND ctime > (UNIX_TIMESTAMP() - 3600) ORDER BY ctime DESC LIMIT 1", ARRAY_A);
[4926] Fix | Delete
$lastMessage = __('Idle', 'wordfence');
[4927] Fix | Delete
[4928] Fix | Delete
$lastScanCompleted = wfConfig::get('lastScanCompleted');
[4929] Fix | Delete
if ($row) {
[4930] Fix | Delete
$lastMessage = '[' . strtoupper(wfUtils::formatLocalTime('M d H:i:s', $row['ctime'])) . '] ' . wp_kses_data($row['msg']);
[4931] Fix | Delete
}
[4932] Fix | Delete
else if ($lastScanCompleted == 'ok') {
[4933] Fix | Delete
$scanLastCompletion = (int) wfScanner::shared()->lastScanTime();
[4934] Fix | Delete
if ($scanLastCompletion) {
[4935] Fix | Delete
$lastMessage = sprintf(/* translators: Localized date. */ __('Scan completed on %s', 'wordfence'), wfUtils::formatLocalTime(get_option('date_format') . ' ' . get_option('time_format'), $scanLastCompletion));
[4936] Fix | Delete
}
[4937] Fix | Delete
}
[4938] Fix | Delete
else if ($lastScanCompleted === false || empty($lastScanCompleted)) {
[4939] Fix | Delete
//Do nothing
[4940] Fix | Delete
}
[4941] Fix | Delete
else {
[4942] Fix | Delete
$lastMessage = __('Last scan failed', 'wordfence');
[4943] Fix | Delete
}
[4944] Fix | Delete
[4945] Fix | Delete
$issues = wfIssues::shared();
[4946] Fix | Delete
$scanFailed = $issues->hasScanFailed();
[4947] Fix | Delete
[4948] Fix | Delete
$scanner = wfScanner::shared();
[4949] Fix | Delete
$stages = $scanner->stageStatus();
[4950] Fix | Delete
foreach ($stages as $key => &$value) {
[4951] Fix | Delete
switch ($value) {
[4952] Fix | Delete
case wfScanner::STATUS_PENDING:
[4953] Fix | Delete
$value = 'wf-scan-step';
[4954] Fix | Delete
break;
[4955] Fix | Delete
case wfScanner::STATUS_RUNNING:
[4956] Fix | Delete
case wfScanner::STATUS_RUNNING_WARNING:
[4957] Fix | Delete
if ($scanFailed) {
[4958] Fix | Delete
$value = 'wf-scan-step';
[4959] Fix | Delete
break;
[4960] Fix | Delete
}
[4961] Fix | Delete
$value = 'wf-scan-step wf-scan-step-running';
[4962] Fix | Delete
break;
[4963] Fix | Delete
case wfScanner::STATUS_COMPLETE_SUCCESS:
[4964] Fix | Delete
$value = 'wf-scan-step wf-scan-step-complete-success';
[4965] Fix | Delete
break;
[4966] Fix | Delete
case wfScanner::STATUS_COMPLETE_WARNING:
[4967] Fix | Delete
$value = 'wf-scan-step wf-scan-step-complete-warning';
[4968] Fix | Delete
break;
[4969] Fix | Delete
case wfScanner::STATUS_PREMIUM:
[4970] Fix | Delete
$value = 'wf-scan-step wf-scan-step-premium';
[4971] Fix | Delete
break;
[4972] Fix | Delete
case wfScanner::STATUS_DISABLED:
[4973] Fix | Delete
$value = 'wf-scan-step wf-scan-step-disabled';
[4974] Fix | Delete
break;
[4975] Fix | Delete
}
[4976] Fix | Delete
}
[4977] Fix | Delete
[4978] Fix | Delete
$stats = array(
[4979] Fix | Delete
'wf-scan-results-stats-postscommentsfiles' => $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_POSTS, 0) + $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_COMMENTS, 0) + $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_FILES, 0),
[4980] Fix | Delete
'wf-scan-results-stats-themesplugins' => $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_PLUGINS, 0) + $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_THEMES, 0),
[4981] Fix | Delete
'wf-scan-results-stats-users' => $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_USERS, 0),
[4982] Fix | Delete
'wf-scan-results-stats-urls' => $scanner->getSummaryItem(wfScanner::SUMMARY_SCANNED_URLS, 0),
[4983] Fix | Delete
'wf-scan-results-stats-issues' => $issues->getIssueCount(),
[4984] Fix | Delete
);
[4985] Fix | Delete
[4986] Fix | Delete
$lastIssueUpdateTimestamp = wfIssues::shared()->getLastIssueUpdateTimestamp();
[4987] Fix | Delete
$issues = 0;
[4988] Fix | Delete
$issueCounts = array_merge(array('new' => 0, 'ignoreP' => 0, 'ignoreC' => 0), wfIssues::shared()->getIssueCounts());
[4989] Fix | Delete
if ($lastIssueUpdateTimestamp > $_POST['lastissuetime']) {
[4990] Fix | Delete
$issues = wfIssues::shared()->getIssues(0, WORDFENCE_SCAN_ISSUES_PER_PAGE, 0, WORDFENCE_SCAN_ISSUES_PER_PAGE);
[4991] Fix | Delete
}
[4992] Fix | Delete
[4993] Fix | Delete
$timeLimit = intval(wfConfig::get('scan_maxDuration'));
[4994] Fix | Delete
if ($timeLimit < 1) {
[4995] Fix | Delete
$timeLimit = WORDFENCE_DEFAULT_MAX_SCAN_TIME;
[4996] Fix | Delete
}
[4997] Fix | Delete
[4998] Fix | Delete
$scanFailedHTML = '';
[4999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function