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.../models/scanner
File: wfScanner.php
$day = $oneWeekSchedule[$checkingDayNumber];
[500] Fix | Delete
$dayHour = array_search(1, $day);
[501] Fix | Delete
if ($dayHour !== false) {
[502] Fix | Delete
$preferredHourUTC = (round(($dayHour * 3600 - $tzOffset) / 3600, 2) + 12) % 24;
[503] Fix | Delete
break;
[504] Fix | Delete
}
[505] Fix | Delete
}
[506] Fix | Delete
break;
[507] Fix | Delete
}
[508] Fix | Delete
[509] Fix | Delete
if ($preferredHourUTC !== false) { //The preferred hour of a manual scan schedule has been determined, run the quick scan at the desired offset if we're in that hour
[510] Fix | Delete
return ($currentHourUTC >= $preferredHourUTC);
[511] Fix | Delete
}
[512] Fix | Delete
}
[513] Fix | Delete
[514] Fix | Delete
$noc1ScanSchedule = wfConfig::get_ser('noc1ScanSchedule', array());
[515] Fix | Delete
if (count($noc1ScanSchedule)) {
[516] Fix | Delete
$preferredHourUTC = (((int) (($noc1ScanSchedule[0] % 86400) / 3600)) + 12) % 24;
[517] Fix | Delete
return ($currentHourUTC >= $preferredHourUTC);
[518] Fix | Delete
}
[519] Fix | Delete
[520] Fix | Delete
return false; //If we've reached this point, the scan config is in a weird state so just skip the quick scan
[521] Fix | Delete
}
[522] Fix | Delete
[523] Fix | Delete
/**
[524] Fix | Delete
* Returns an associative array containing the current state each scan stage and its corresponding status.
[525] Fix | Delete
*
[526] Fix | Delete
* @return array
[527] Fix | Delete
*/
[528] Fix | Delete
public function stageStatus() {
[529] Fix | Delete
$status = $this->_defaultStageStatuses();
[530] Fix | Delete
$runningStatus = wfConfig::get_ser('scanStageStatuses', array(), false);
[531] Fix | Delete
$status = array_merge($status, $runningStatus);
[532] Fix | Delete
[533] Fix | Delete
foreach ($status as $stage => &$value) { //Convert value array into status only
[534] Fix | Delete
$value = $value['status'];
[535] Fix | Delete
if (!$this->isRunning() && $value == self::STATUS_RUNNING) {
[536] Fix | Delete
$value = self::STATUS_PENDING;
[537] Fix | Delete
}
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
return $status;
[541] Fix | Delete
}
[542] Fix | Delete
[543] Fix | Delete
/**
[544] Fix | Delete
* Returns an array of all scan options for the given stage that are enabled.
[545] Fix | Delete
*
[546] Fix | Delete
* @param string $stage One of the STAGE_ constants
[547] Fix | Delete
* @return array
[548] Fix | Delete
*/
[549] Fix | Delete
private function _scanJobsForStage($stage) {
[550] Fix | Delete
$always = array();
[551] Fix | Delete
$options = array();
[552] Fix | Delete
switch ($stage) {
[553] Fix | Delete
case self::STAGE_SPAMVERTISING_CHECKS:
[554] Fix | Delete
$options = array(
[555] Fix | Delete
'spamvertizeCheck',
[556] Fix | Delete
);
[557] Fix | Delete
break;
[558] Fix | Delete
case self::STAGE_SPAM_CHECK:
[559] Fix | Delete
$options = array(
[560] Fix | Delete
'checkSpamIP',
[561] Fix | Delete
);
[562] Fix | Delete
break;
[563] Fix | Delete
case self::STAGE_BLACKLIST_CHECK:
[564] Fix | Delete
$options = array(
[565] Fix | Delete
'scansEnabled_checkGSB',
[566] Fix | Delete
);
[567] Fix | Delete
break;
[568] Fix | Delete
case self::STAGE_SERVER_STATE:
[569] Fix | Delete
if ($this->scanType() != self::SCAN_TYPE_QUICK) {
[570] Fix | Delete
$always = array(
[571] Fix | Delete
'checkSkippedFiles',
[572] Fix | Delete
);
[573] Fix | Delete
}
[574] Fix | Delete
$options = array(
[575] Fix | Delete
'scansEnabled_checkHowGetIPs',
[576] Fix | Delete
'scansEnabled_diskSpace',
[577] Fix | Delete
'scansEnabled_wafStatus',
[578] Fix | Delete
'scansEnabled_geoipSupport',
[579] Fix | Delete
);
[580] Fix | Delete
break;
[581] Fix | Delete
case self::STAGE_FILE_CHANGES:
[582] Fix | Delete
$options = array(
[583] Fix | Delete
'scansEnabled_core',
[584] Fix | Delete
'scansEnabled_themes',
[585] Fix | Delete
'scansEnabled_plugins',
[586] Fix | Delete
'scansEnabled_coreUnknown',
[587] Fix | Delete
);
[588] Fix | Delete
break;
[589] Fix | Delete
case self::STAGE_PUBLIC_FILES:
[590] Fix | Delete
$options = array(
[591] Fix | Delete
'scansEnabled_checkReadableConfig',
[592] Fix | Delete
'scansEnabled_suspectedFiles',
[593] Fix | Delete
);
[594] Fix | Delete
break;
[595] Fix | Delete
case self::STAGE_MALWARE_SCAN:
[596] Fix | Delete
$options = array(
[597] Fix | Delete
'scansEnabled_malware',
[598] Fix | Delete
'scansEnabled_fileContents',
[599] Fix | Delete
);
[600] Fix | Delete
break;
[601] Fix | Delete
case self::STAGE_CONTENT_SAFETY:
[602] Fix | Delete
$options = array(
[603] Fix | Delete
'scansEnabled_posts',
[604] Fix | Delete
'scansEnabled_comments',
[605] Fix | Delete
'scansEnabled_fileContentsGSB',
[606] Fix | Delete
);
[607] Fix | Delete
break;
[608] Fix | Delete
case self::STAGE_PASSWORD_STRENGTH:
[609] Fix | Delete
$options = array(
[610] Fix | Delete
'scansEnabled_passwds',
[611] Fix | Delete
);
[612] Fix | Delete
break;
[613] Fix | Delete
case self::STAGE_VULNERABILITY_SCAN:
[614] Fix | Delete
$options = array(
[615] Fix | Delete
'scansEnabled_oldVersions',
[616] Fix | Delete
);
[617] Fix | Delete
break;
[618] Fix | Delete
case self::STAGE_OPTIONS_AUDIT:
[619] Fix | Delete
$options = array(
[620] Fix | Delete
'scansEnabled_suspiciousOptions',
[621] Fix | Delete
'scansEnabled_suspiciousAdminUsers',
[622] Fix | Delete
);
[623] Fix | Delete
break;
[624] Fix | Delete
}
[625] Fix | Delete
[626] Fix | Delete
$enabledOptions = $this->scanOptions();
[627] Fix | Delete
$filteredOptions = array();
[628] Fix | Delete
foreach ($options as $o) {
[629] Fix | Delete
if (isset($enabledOptions[$o]) && $enabledOptions[$o]) {
[630] Fix | Delete
$filteredOptions[] = $o;
[631] Fix | Delete
}
[632] Fix | Delete
}
[633] Fix | Delete
[634] Fix | Delete
return array_merge($filteredOptions, $always);
[635] Fix | Delete
}
[636] Fix | Delete
[637] Fix | Delete
/**
[638] Fix | Delete
* Returns an associative array containing each scan stage's default state. The keys are the stage identifiers and the value
[639] Fix | Delete
* is an array in the format
[640] Fix | Delete
* array(
[641] Fix | Delete
* 'started' => the number of tasks for this stage that have started (initially 0),
[642] Fix | Delete
* 'finished' => the number of tasks that have started and finished (initially 0),
[643] Fix | Delete
* 'expected' => the expected number of tasks to run for this stage (based on the scan type and options enabled)
[644] Fix | Delete
* )
[645] Fix | Delete
*
[646] Fix | Delete
* @return array
[647] Fix | Delete
*/
[648] Fix | Delete
private function _defaultStageStatuses() {
[649] Fix | Delete
$status = array(
[650] Fix | Delete
self::STAGE_SPAMVERTISING_CHECKS => array('status' => ($this->isPremiumScan() ? self::STATUS_PENDING : self::STATUS_PREMIUM), 'started' => 0, 'finished' => 0, 'expected' => 0),
[651] Fix | Delete
self::STAGE_SPAM_CHECK => array('status' => ($this->isPremiumScan() ? self::STATUS_PENDING : self::STATUS_PREMIUM), 'started' => 0, 'finished' => 0, 'expected' => 0),
[652] Fix | Delete
self::STAGE_BLACKLIST_CHECK => array('status' => ($this->isPremiumScan() ? self::STATUS_PENDING : self::STATUS_PREMIUM), 'started' => 0, 'finished' => 0, 'expected' => 0),
[653] Fix | Delete
self::STAGE_SERVER_STATE => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[654] Fix | Delete
self::STAGE_FILE_CHANGES => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[655] Fix | Delete
self::STAGE_PUBLIC_FILES => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[656] Fix | Delete
self::STAGE_MALWARE_SCAN => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[657] Fix | Delete
self::STAGE_CONTENT_SAFETY => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[658] Fix | Delete
self::STAGE_PASSWORD_STRENGTH => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[659] Fix | Delete
self::STAGE_VULNERABILITY_SCAN => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[660] Fix | Delete
self::STAGE_OPTIONS_AUDIT => array('status' => self::STATUS_PENDING, 'started' => 0, 'finished' => 0, 'expected' => 0),
[661] Fix | Delete
);
[662] Fix | Delete
[663] Fix | Delete
foreach ($status as $stage => &$parameters) {
[664] Fix | Delete
if ($parameters['status'] == self::STATUS_PREMIUM) {
[665] Fix | Delete
continue;
[666] Fix | Delete
}
[667] Fix | Delete
[668] Fix | Delete
$jobs = $this->_scanJobsForStage($stage);
[669] Fix | Delete
if (count($jobs)) {
[670] Fix | Delete
$parameters['expected'] = count($jobs);
[671] Fix | Delete
}
[672] Fix | Delete
else {
[673] Fix | Delete
$parameters['status'] = self::STATUS_DISABLED;
[674] Fix | Delete
}
[675] Fix | Delete
}
[676] Fix | Delete
[677] Fix | Delete
return $status;
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
/**
[681] Fix | Delete
* Resets the state of the scan stage status record.
[682] Fix | Delete
*/
[683] Fix | Delete
public function resetStages() {
[684] Fix | Delete
if ($this->scanType() == self::SCAN_TYPE_QUICK) { //Suppress for quick scans
[685] Fix | Delete
return;
[686] Fix | Delete
}
[687] Fix | Delete
wfConfig::set_ser('scanStageStatuses', $this->_defaultStageStatuses(), false, wfConfig::DONT_AUTOLOAD);
[688] Fix | Delete
}
[689] Fix | Delete
[690] Fix | Delete
private function _shouldForceUpdate($stageID) {
[691] Fix | Delete
if ($stageID == wfScanner::STAGE_MALWARE_SCAN) {
[692] Fix | Delete
return true;
[693] Fix | Delete
}
[694] Fix | Delete
return false;
[695] Fix | Delete
}
[696] Fix | Delete
[697] Fix | Delete
/**
[698] Fix | Delete
* Increments the stage started counter and marks it as running if not already in that state.
[699] Fix | Delete
*
[700] Fix | Delete
* @param string $stageID One of the STAGE_ constants
[701] Fix | Delete
*/
[702] Fix | Delete
public function startStage($stageID) {
[703] Fix | Delete
if ($this->scanType() == self::SCAN_TYPE_QUICK) { //Suppress for quick scans
[704] Fix | Delete
return;
[705] Fix | Delete
}
[706] Fix | Delete
[707] Fix | Delete
$runningStatus = wfConfig::get_ser('scanStageStatuses', array(), false);
[708] Fix | Delete
if ($runningStatus[$stageID]['status'] != self::STATUS_RUNNING_WARNING) {
[709] Fix | Delete
$runningStatus[$stageID]['status'] = self::STATUS_RUNNING;
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
$runningStatus[$stageID]['started'] += 1;
[713] Fix | Delete
wfConfig::set_ser('scanStageStatuses', $runningStatus, false, wfConfig::DONT_AUTOLOAD);
[714] Fix | Delete
if (wfCentral::isConnected() && ($this->_shouldForceUpdate($stageID) || (time() - wfConfig::getInt('lastScanStageStatusUpdate', 0)) > self::CENTRAL_STAGE_UPDATE_THRESHOLD)) {
[715] Fix | Delete
wfCentral::updateScanStatus($runningStatus);
[716] Fix | Delete
}
[717] Fix | Delete
}
[718] Fix | Delete
[719] Fix | Delete
/**
[720] Fix | Delete
* Increments the stage finished counter and updates the stage status according to whether it's fully finished or encountered a negative status.
[721] Fix | Delete
*
[722] Fix | Delete
* @param string $stageID One of the STAGE_ constants.
[723] Fix | Delete
* @param string $status One of the wfIssues::STATUS_ constants
[724] Fix | Delete
*/
[725] Fix | Delete
public function completeStage($stageID, $status) {
[726] Fix | Delete
if ($this->scanType() == self::SCAN_TYPE_QUICK) { //Suppress for quick scans
[727] Fix | Delete
return;
[728] Fix | Delete
}
[729] Fix | Delete
[730] Fix | Delete
$runningStatus = wfConfig::get_ser('scanStageStatuses', array(), false);
[731] Fix | Delete
[732] Fix | Delete
if ($runningStatus[$stageID]['status'] == self::STATUS_RUNNING && ($status == wfIssues::STATUS_PROBLEM)) {
[733] Fix | Delete
$runningStatus[$stageID]['status'] = self::STATUS_RUNNING_WARNING;
[734] Fix | Delete
}
[735] Fix | Delete
[736] Fix | Delete
$runningStatus[$stageID]['finished'] += 1;
[737] Fix | Delete
if ($runningStatus[$stageID]['finished'] >= $runningStatus[$stageID]['expected']) {
[738] Fix | Delete
if ($runningStatus[$stageID]['status'] == self::STATUS_RUNNING) {
[739] Fix | Delete
$runningStatus[$stageID]['status'] = self::STATUS_COMPLETE_SUCCESS;
[740] Fix | Delete
}
[741] Fix | Delete
else {
[742] Fix | Delete
$runningStatus[$stageID]['status'] = self::STATUS_COMPLETE_WARNING;
[743] Fix | Delete
}
[744] Fix | Delete
}
[745] Fix | Delete
[746] Fix | Delete
wfConfig::set_ser('scanStageStatuses', $runningStatus, false, wfConfig::DONT_AUTOLOAD);
[747] Fix | Delete
if (wfCentral::isConnected()) {
[748] Fix | Delete
$forceSend = true; //Force sending the last stage completion update even if the timing would otherwise prevent it
[749] Fix | Delete
foreach ($runningStatus as $stageID => $stage) {
[750] Fix | Delete
if ($runningStatus[$stageID]['finished'] < $runningStatus[$stageID]['expected']) {
[751] Fix | Delete
$forceSend = false;
[752] Fix | Delete
break;
[753] Fix | Delete
}
[754] Fix | Delete
}
[755] Fix | Delete
[756] Fix | Delete
if ($forceSend || (time() - wfConfig::getInt('lastScanStageStatusUpdate', 0)) > self::CENTRAL_STAGE_UPDATE_THRESHOLD) {
[757] Fix | Delete
wfCentral::updateScanStatus($runningStatus);
[758] Fix | Delete
}
[759] Fix | Delete
}
[760] Fix | Delete
[761] Fix | Delete
}
[762] Fix | Delete
[763] Fix | Delete
/**
[764] Fix | Delete
* Returns the selected type of the scan.
[765] Fix | Delete
*
[766] Fix | Delete
* @return string
[767] Fix | Delete
*/
[768] Fix | Delete
public function scanType() {
[769] Fix | Delete
switch ($this->_scanType) {
[770] Fix | Delete
case self::SCAN_TYPE_QUICK://SCAN_TYPE_QUICK is not user-selectable
[771] Fix | Delete
case self::SCAN_TYPE_LIMITED:
[772] Fix | Delete
case self::SCAN_TYPE_STANDARD:
[773] Fix | Delete
case self::SCAN_TYPE_HIGH_SENSITIVITY:
[774] Fix | Delete
case self::SCAN_TYPE_CUSTOM:
[775] Fix | Delete
return $this->_scanType;
[776] Fix | Delete
}
[777] Fix | Delete
return self::SCAN_TYPE_STANDARD;
[778] Fix | Delete
}
[779] Fix | Delete
[780] Fix | Delete
/**
[781] Fix | Delete
* Returns the display name for the selected type of the scan.
[782] Fix | Delete
*
[783] Fix | Delete
* @return string
[784] Fix | Delete
*/
[785] Fix | Delete
public function scanTypeName() {
[786] Fix | Delete
switch ($this->_scanType) {
[787] Fix | Delete
case self::SCAN_TYPE_QUICK:
[788] Fix | Delete
return __('Quick Scan', 'wordfence');
[789] Fix | Delete
case self::SCAN_TYPE_LIMITED:
[790] Fix | Delete
return __('Limited Scan', 'wordfence');
[791] Fix | Delete
case self::SCAN_TYPE_HIGH_SENSITIVITY:
[792] Fix | Delete
return __('High Sensitivity', 'wordfence');
[793] Fix | Delete
case self::SCAN_TYPE_CUSTOM:
[794] Fix | Delete
return __('Custom Scan', 'wordfence');
[795] Fix | Delete
case self::SCAN_TYPE_STANDARD:
[796] Fix | Delete
default:
[797] Fix | Delete
return __('Standard Scan', 'wordfence');
[798] Fix | Delete
}
[799] Fix | Delete
}
[800] Fix | Delete
[801] Fix | Delete
/**
[802] Fix | Delete
* Returns a normalized percentage (i.e., in the range [0, 1]) to the corresponding display percentage
[803] Fix | Delete
* based on license type.
[804] Fix | Delete
*
[805] Fix | Delete
* @param float $percentage
[806] Fix | Delete
* @return float
[807] Fix | Delete
*/
[808] Fix | Delete
protected function _normalizedPercentageToDisplay($percentage) {
[809] Fix | Delete
if ($this->isPremiumScan()) {
[810] Fix | Delete
return round($percentage, 2);
[811] Fix | Delete
}
[812] Fix | Delete
[813] Fix | Delete
return round($percentage * 0.70, 2);
[814] Fix | Delete
}
[815] Fix | Delete
[816] Fix | Delete
/**
[817] Fix | Delete
* Returns a normalized percentage (i.e., in the range [0, 1]) for the scan type status indicator.
[818] Fix | Delete
*
[819] Fix | Delete
* @return float
[820] Fix | Delete
*/
[821] Fix | Delete
public function scanTypeStatus() {
[822] Fix | Delete
$isFree = !wfConfig::get('isPaid');
[823] Fix | Delete
$weights = self::_scanOptionWeights();
[824] Fix | Delete
$options = $this->scanOptions();
[825] Fix | Delete
$score = 0.0;
[826] Fix | Delete
$premiumOptions = self::_premiumScanOptions();
[827] Fix | Delete
foreach ($options as $key => $value) {
[828] Fix | Delete
if ($isFree && array_search($key, $premiumOptions) !== false) {
[829] Fix | Delete
continue;
[830] Fix | Delete
}
[831] Fix | Delete
[832] Fix | Delete
if ($value) {
[833] Fix | Delete
$score += $weights[$key];
[834] Fix | Delete
}
[835] Fix | Delete
}
[836] Fix | Delete
return $this->_normalizedPercentageToDisplay($score);
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
public function scanTypeStatusList() {
[840] Fix | Delete
$isFree = !wfConfig::get('isPaid');
[841] Fix | Delete
$weights = self::_scanOptionWeights();
[842] Fix | Delete
$options = $this->scanOptions();
[843] Fix | Delete
$disabledOptionCount = 0;
[844] Fix | Delete
$premiumDisabledOptionCount = 0;
[845] Fix | Delete
$percentage = 0.0;
[846] Fix | Delete
$premiumPercentage = 0.0;
[847] Fix | Delete
$premiumOptions = self::_premiumScanOptions();
[848] Fix | Delete
$statusList = array();
[849] Fix | Delete
foreach ($options as $key => $value) {
[850] Fix | Delete
if ($isFree && array_search($key, $premiumOptions) !== false) {
[851] Fix | Delete
$premiumPercentage += $weights[$key];
[852] Fix | Delete
$premiumDisabledOptionCount++;
[853] Fix | Delete
continue;
[854] Fix | Delete
}
[855] Fix | Delete
[856] Fix | Delete
if (!$value && $weights[$key] > 0) {
[857] Fix | Delete
$percentage += $weights[$key];
[858] Fix | Delete
$disabledOptionCount++;
[859] Fix | Delete
}
[860] Fix | Delete
}
[861] Fix | Delete
[862] Fix | Delete
$remainingPercentage = 1 - $this->scanTypeStatus();
[863] Fix | Delete
if ($isFree) {
[864] Fix | Delete
$remainingPercentage -= 0.30;
[865] Fix | Delete
$statusList[] = array(
[866] Fix | Delete
'percentage' => 0.30,
[867] Fix | Delete
'title' => __('Enable Premium Scan Signatures.', 'wordfence'),
[868] Fix | Delete
);
[869] Fix | Delete
}
[870] Fix | Delete
[871] Fix | Delete
if ($premiumPercentage > 0) {
[872] Fix | Delete
$subtraction = min($this->_normalizedPercentageToDisplay($premiumPercentage), $remainingPercentage);
[873] Fix | Delete
$remainingPercentage -= $subtraction;
[874] Fix | Delete
$statusList[] = array(
[875] Fix | Delete
'percentage' => $subtraction,
[876] Fix | Delete
'title' => __('Enable Premium Reputation Checks.', 'wordfence'),
[877] Fix | Delete
);
[878] Fix | Delete
}
[879] Fix | Delete
[880] Fix | Delete
if ($percentage > 0) {
[881] Fix | Delete
$subtraction = min($this->_normalizedPercentageToDisplay($percentage), $remainingPercentage);
[882] Fix | Delete
$statusList[] = array(
[883] Fix | Delete
'percentage' => $subtraction,
[884] Fix | Delete
'title' => sprintf(_n('Enable %d scan option.', 'Enable %d scan options.', $disabledOptionCount,'wordfence'), number_format_i18n($disabledOptionCount)),
[885] Fix | Delete
);
[886] Fix | Delete
}
[887] Fix | Delete
[888] Fix | Delete
return $statusList;
[889] Fix | Delete
}
[890] Fix | Delete
/**
[891] Fix | Delete
* Returns the malware signature feed that is in use.
[892] Fix | Delete
*
[893] Fix | Delete
* @return string
[894] Fix | Delete
*/
[895] Fix | Delete
public function signatureMode() {
[896] Fix | Delete
if ($this->isPremiumScan()) {
[897] Fix | Delete
return self::SIGNATURE_MODE_PREMIUM;
[898] Fix | Delete
}
[899] Fix | Delete
return self::SIGNATURE_MODE_COMMUNITY;
[900] Fix | Delete
}
[901] Fix | Delete
[902] Fix | Delete
/**
[903] Fix | Delete
* Returns a normalized percentage (i.e., in the range [0, 1]) for the reputation status indicator.
[904] Fix | Delete
*
[905] Fix | Delete
* @return float
[906] Fix | Delete
*/
[907] Fix | Delete
public function reputationStatus() {
[908] Fix | Delete
$score = 0.0;
[909] Fix | Delete
if ($this->isPremiumScan()) {
[910] Fix | Delete
$options = $this->scanOptions();
[911] Fix | Delete
if ($options['spamvertizeCheck']) { $score += 0.333; }
[912] Fix | Delete
if ($options['checkSpamIP']) { $score += 0.333; }
[913] Fix | Delete
if ($options['scansEnabled_checkGSB']) { $score += 0.333; }
[914] Fix | Delete
}
[915] Fix | Delete
return round($score, 2);
[916] Fix | Delete
}
[917] Fix | Delete
[918] Fix | Delete
/**
[919] Fix | Delete
* @return array
[920] Fix | Delete
*/
[921] Fix | Delete
public function reputationStatusList() {
[922] Fix | Delete
$statusList = array();
[923] Fix | Delete
$options = $this->scanOptions();
[924] Fix | Delete
[925] Fix | Delete
$reputationChecks = array(
[926] Fix | Delete
'spamvertizeCheck' => __('Enable scan option to check if this website is being "Spamvertised".', 'wordfence'),
[927] Fix | Delete
'checkSpamIP' => __('Enable scan option to check if your website IP is generating spam.', 'wordfence'),
[928] Fix | Delete
'scansEnabled_checkGSB' => __('Enable scan option to check if your website is on a domain blocklist.', 'wordfence'),
[929] Fix | Delete
);
[930] Fix | Delete
[931] Fix | Delete
foreach ($reputationChecks as $option => $optionLabel) {
[932] Fix | Delete
if (!$this->isPremiumScan() || !$options[$option]) {
[933] Fix | Delete
$statusList[] = array(
[934] Fix | Delete
'percentage' => round(1 / count($reputationChecks), 2),
[935] Fix | Delete
'title' => $optionLabel,
[936] Fix | Delete
);
[937] Fix | Delete
}
[938] Fix | Delete
}
[939] Fix | Delete
return $statusList;
[940] Fix | Delete
}
[941] Fix | Delete
[942] Fix | Delete
/**
[943] Fix | Delete
* Returns the options for the configured scan type.
[944] Fix | Delete
*
[945] Fix | Delete
* @return array
[946] Fix | Delete
*/
[947] Fix | Delete
public function scanOptions() {
[948] Fix | Delete
switch ($this->scanType()) {
[949] Fix | Delete
case self::SCAN_TYPE_QUICK:
[950] Fix | Delete
return self::quickScanTypeOptions();
[951] Fix | Delete
case self::SCAN_TYPE_LIMITED:
[952] Fix | Delete
return self::limitedScanTypeOptions();
[953] Fix | Delete
case self::SCAN_TYPE_STANDARD:
[954] Fix | Delete
return self::standardScanTypeOptions();
[955] Fix | Delete
case self::SCAN_TYPE_HIGH_SENSITIVITY:
[956] Fix | Delete
return self::highSensitivityScanTypeOptions();
[957] Fix | Delete
case self::SCAN_TYPE_CUSTOM:
[958] Fix | Delete
return self::customScanTypeOptions();
[959] Fix | Delete
}
[960] Fix | Delete
}
[961] Fix | Delete
[962] Fix | Delete
/**
[963] Fix | Delete
* Returns the array of jobs for the scan type.
[964] Fix | Delete
*
[965] Fix | Delete
* @return array
[966] Fix | Delete
*/
[967] Fix | Delete
public function jobs() {
[968] Fix | Delete
$options = $this->scanOptions();
[969] Fix | Delete
$preferredOrder = array(
[970] Fix | Delete
'checkSpamvertized' => array('spamvertizeCheck'),
[971] Fix | Delete
'checkSpamIP' => array('checkSpamIP'),
[972] Fix | Delete
'checkGSB' => array('scansEnabled_checkGSB'),
[973] Fix | Delete
'checkHowGetIPs' => array('scansEnabled_checkHowGetIPs'),
[974] Fix | Delete
'diskSpace' => array('scansEnabled_diskSpace'),
[975] Fix | Delete
'wafStatus' => array('scansEnabled_wafStatus'),
[976] Fix | Delete
'geoipSupport' => array('scansEnabled_geoipSupport'),
[977] Fix | Delete
'checkSkippedFiles' => ($this->scanType() != self::SCAN_TYPE_QUICK), //Always runs except for quick
[978] Fix | Delete
'knownFiles' => ($this->scanType() != self::SCAN_TYPE_QUICK), //Always runs except for quick, options are scansEnabled_core, scansEnabled_themes, scansEnabled_plugins, scansEnabled_coreUnknown, scansEnabled_malware
[979] Fix | Delete
'checkReadableConfig' => array('scansEnabled_checkReadableConfig'),
[980] Fix | Delete
'fileContents' => ($this->scanType() != self::SCAN_TYPE_QUICK), //Always runs except for quick, options are scansEnabled_fileContents and scansEnabled_fileContentsGSB
[981] Fix | Delete
'suspectedFiles' => array('scansEnabled_suspectedFiles'),
[982] Fix | Delete
'posts' => array('scansEnabled_posts'),
[983] Fix | Delete
'comments' => array('scansEnabled_comments'),
[984] Fix | Delete
'passwds' => array('scansEnabled_passwds'),
[985] Fix | Delete
'oldVersions' => array('scansEnabled_oldVersions'),
[986] Fix | Delete
'suspiciousAdminUsers' => array('scansEnabled_suspiciousAdminUsers'),
[987] Fix | Delete
'suspiciousOptions' => array('scansEnabled_suspiciousOptions'),
[988] Fix | Delete
);
[989] Fix | Delete
[990] Fix | Delete
$jobs = array();
[991] Fix | Delete
foreach ($preferredOrder as $job => $enabler) {
[992] Fix | Delete
if ($enabler === true) {
[993] Fix | Delete
$jobs[] = $job;
[994] Fix | Delete
}
[995] Fix | Delete
else if (is_array($enabler)) {
[996] Fix | Delete
foreach ($enabler as $o) {
[997] Fix | Delete
if ($options[$o]) {
[998] Fix | Delete
$jobs[] = $job;
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function