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: wfScanEngine.php
__('This %1$s contains a URL that is currently listed on Wordfence\'s domain blocklist. The URL is: %2$s', 'wordfence'),
[1500] Fix | Delete
esc_html($type),
[1501] Fix | Delete
esc_html($result['URL'])
[1502] Fix | Delete
);
[1503] Fix | Delete
}
[1504] Fix | Delete
[1505] Fix | Delete
if (is_multisite()) {
[1506] Fix | Delete
switch_to_blog($blogID);
[1507] Fix | Delete
}
[1508] Fix | Delete
[1509] Fix | Delete
$ignoreP = $idString;
[1510] Fix | Delete
$ignoreC = $idString . '-' . $contentMD5;
[1511] Fix | Delete
$added = $this->addIssue('commentBadURL', wfIssues::SEVERITY_LOW, $ignoreP, $ignoreC, $shortMsg, $longMsg, array(
[1512] Fix | Delete
'commentID' => $commentID,
[1513] Fix | Delete
'badURL' => $result['URL'],
[1514] Fix | Delete
'author' => $author,
[1515] Fix | Delete
'type' => $type,
[1516] Fix | Delete
'uctype' => $uctype,
[1517] Fix | Delete
'editCommentLink' => get_edit_comment_link($commentID),
[1518] Fix | Delete
'commentDate' => $date,
[1519] Fix | Delete
'isMultisite' => $blog['isMultisite'],
[1520] Fix | Delete
'domain' => $blog['domain'],
[1521] Fix | Delete
'path' => $blog['path'],
[1522] Fix | Delete
'blog_id' => $blogID
[1523] Fix | Delete
));
[1524] Fix | Delete
if ($added == wfIssues::ISSUE_ADDED || $added == wfIssues::ISSUE_UPDATED) {
[1525] Fix | Delete
$haveIssues = wfIssues::STATUS_PROBLEM;
[1526] Fix | Delete
} else if ($haveIssues != wfIssues::STATUS_PROBLEM && ($added == wfIssues::ISSUE_IGNOREP || $added == wfIssues::ISSUE_IGNOREC)) {
[1527] Fix | Delete
$haveIssues = wfIssues::STATUS_IGNORED;
[1528] Fix | Delete
}
[1529] Fix | Delete
[1530] Fix | Delete
if (is_multisite()) {
[1531] Fix | Delete
restore_current_blog();
[1532] Fix | Delete
}
[1533] Fix | Delete
}
[1534] Fix | Delete
}
[1535] Fix | Delete
wfIssues::statusEnd($this->statusIDX['comments'], $haveIssues);
[1536] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_CONTENT_SAFETY, $haveIssues);
[1537] Fix | Delete
$this->scanQueue = '';
[1538] Fix | Delete
}
[1539] Fix | Delete
[1540] Fix | Delete
public function isBadComment($author, $email, $url, $IP, $content) {
[1541] Fix | Delete
$content = $author . ' ' . $email . ' ' . $url . ' ' . $IP . ' ' . $content;
[1542] Fix | Delete
$cDesc = '';
[1543] Fix | Delete
if ($author) {
[1544] Fix | Delete
$cDesc = sprintf(/* translators: WordPress username. */ __("Author: %s", 'wordfence'), $author) . ' ';
[1545] Fix | Delete
}
[1546] Fix | Delete
if ($email) {
[1547] Fix | Delete
$cDesc .= sprintf(/* translators: Email address. */ __("Email: %s", 'wordfence'), $email) . ' ';
[1548] Fix | Delete
}
[1549] Fix | Delete
$cDesc .= sprintf(/* translators: IP address. */ __("Source IP: %s", 'wordfence'), $IP) . ' ';
[1550] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Comment description. */ __("Scanning comment with %s", 'wordfence'), $cDesc));
[1551] Fix | Delete
[1552] Fix | Delete
$h = new wordfenceURLHoover($this->apiKey, $this->wp_version);
[1553] Fix | Delete
$h->hoover(1, $content, wordfenceURLHoover::standardExcludedHosts());
[1554] Fix | Delete
$hooverResults = $h->getBaddies();
[1555] Fix | Delete
if ($h->errorMsg) {
[1556] Fix | Delete
return false;
[1557] Fix | Delete
}
[1558] Fix | Delete
$h->cleanup();
[1559] Fix | Delete
if (sizeof($hooverResults) > 0 && isset($hooverResults[1])) {
[1560] Fix | Delete
$hresults = $hooverResults[1];
[1561] Fix | Delete
foreach ($hresults as $result) {
[1562] Fix | Delete
if ($result['badList'] == 'goog-malware-shavar') {
[1563] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Comment description. */ __("Marking comment as spam for containing a malware URL. Comment has %s", 'wordfence'), $cDesc));
[1564] Fix | Delete
return true;
[1565] Fix | Delete
} else if ($result['badList'] == 'googpub-phish-shavar') {
[1566] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Comment description. */ __("Marking comment as spam for containing a phishing URL. Comment has %s", 'wordfence'), $cDesc));
[1567] Fix | Delete
return true;
[1568] Fix | Delete
} else if ($result['badList'] == 'wordfence-dbl') {
[1569] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Comment description. */ __("Marking comment as spam for containing a malware URL. Comment has %s", 'wordfence'), $cDesc));
[1570] Fix | Delete
} else {
[1571] Fix | Delete
//A list type that may be new and the plugin has not been upgraded yet.
[1572] Fix | Delete
continue;
[1573] Fix | Delete
}
[1574] Fix | Delete
}
[1575] Fix | Delete
}
[1576] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Comment description. */ __("Scanned comment with %s", 'wordfence'), $cDesc));
[1577] Fix | Delete
return false;
[1578] Fix | Delete
}
[1579] Fix | Delete
[1580] Fix | Delete
public static function getBlogsToScan($table, $withID = null) {
[1581] Fix | Delete
$wfdb = new wfDB();
[1582] Fix | Delete
global $wpdb;
[1583] Fix | Delete
$blogsToScan = array();
[1584] Fix | Delete
if (is_multisite()) {
[1585] Fix | Delete
if ($withID === null) {
[1586] Fix | Delete
$q1 = $wfdb->querySelect("select blog_id, domain, path from {$wpdb->blogs} where deleted=0 order by blog_id asc");
[1587] Fix | Delete
} else {
[1588] Fix | Delete
$q1 = $wfdb->querySelect("select blog_id, domain, path from {$wpdb->blogs} where deleted=0 and blog_id = %d", $withID);
[1589] Fix | Delete
}
[1590] Fix | Delete
[1591] Fix | Delete
foreach ($q1 as $row) {
[1592] Fix | Delete
$row['isMultisite'] = true;
[1593] Fix | Delete
$row['table'] = wfDB::blogTable($table, $row['blog_id']);
[1594] Fix | Delete
$blogsToScan[] = $row;
[1595] Fix | Delete
}
[1596] Fix | Delete
} else {
[1597] Fix | Delete
$blogsToScan[] = array(
[1598] Fix | Delete
'isMultisite' => false,
[1599] Fix | Delete
'table' => wfDB::networkTable($table),
[1600] Fix | Delete
'blog_id' => '1',
[1601] Fix | Delete
'domain' => '',
[1602] Fix | Delete
'path' => '',
[1603] Fix | Delete
);
[1604] Fix | Delete
}
[1605] Fix | Delete
return $blogsToScan;
[1606] Fix | Delete
}
[1607] Fix | Delete
[1608] Fix | Delete
private function highestCap($caps) {
[1609] Fix | Delete
foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $cap) {
[1610] Fix | Delete
if (empty($caps[$cap]) === false && $caps[$cap]) {
[1611] Fix | Delete
return $cap;
[1612] Fix | Delete
}
[1613] Fix | Delete
}
[1614] Fix | Delete
return '';
[1615] Fix | Delete
}
[1616] Fix | Delete
[1617] Fix | Delete
private function isEditor($caps) {
[1618] Fix | Delete
foreach (array('contributor', 'author', 'editor', 'administrator') as $cap) {
[1619] Fix | Delete
if (empty($caps[$cap]) === false && $caps[$cap]) {
[1620] Fix | Delete
return true;
[1621] Fix | Delete
}
[1622] Fix | Delete
}
[1623] Fix | Delete
return false;
[1624] Fix | Delete
}
[1625] Fix | Delete
[1626] Fix | Delete
private function scan_passwds_init() {
[1627] Fix | Delete
$this->statusIDX['passwds'] = wfIssues::statusStart(__('Scanning for weak passwords', 'wordfence'));
[1628] Fix | Delete
$this->scanController->startStage(wfScanner::STAGE_PASSWORD_STRENGTH);
[1629] Fix | Delete
global $wpdb;
[1630] Fix | Delete
$counter = 0;
[1631] Fix | Delete
$query = "select ID from " . $wpdb->users;
[1632] Fix | Delete
$dbh = $wpdb->dbh;
[1633] Fix | Delete
$useMySQLi = wfUtils::useMySQLi();
[1634] Fix | Delete
if ($useMySQLi) { //If direct-access MySQLi is available, we use it to minimize the memory footprint instead of letting it fetch everything into an array first
[1635] Fix | Delete
$result = $dbh->query($query);
[1636] Fix | Delete
if (!is_object($result)) {
[1637] Fix | Delete
return array(
[1638] Fix | Delete
'errorMsg' => __("We were unable to generate the user list for your password check.", 'wordfence'),
[1639] Fix | Delete
);
[1640] Fix | Delete
}
[1641] Fix | Delete
while ($rec = $result->fetch_assoc()) {
[1642] Fix | Delete
$this->userPasswdQueue .= pack('N', $rec['ID']);
[1643] Fix | Delete
$counter++;
[1644] Fix | Delete
}
[1645] Fix | Delete
} else {
[1646] Fix | Delete
$res1 = $wpdb->get_results($query, ARRAY_A);
[1647] Fix | Delete
foreach ($res1 as $rec) {
[1648] Fix | Delete
$this->userPasswdQueue .= pack('N', $rec['ID']);
[1649] Fix | Delete
$counter++;
[1650] Fix | Delete
}
[1651] Fix | Delete
}
[1652] Fix | Delete
wordfence::status(2, 'info', sprintf(
[1653] Fix | Delete
/* translators: Number of users. */
[1654] Fix | Delete
_n("Starting password strength check on %d user.", "Starting password strength check on %d users.", $counter, 'wordfence'), $counter));
[1655] Fix | Delete
}
[1656] Fix | Delete
[1657] Fix | Delete
private function scan_passwds_main() {
[1658] Fix | Delete
while (strlen($this->userPasswdQueue) > 3) {
[1659] Fix | Delete
$usersLeft = strlen($this->userPasswdQueue) / 4; //4 byte ints
[1660] Fix | Delete
if ($usersLeft % 100 == 0) {
[1661] Fix | Delete
wordfence::status(2, 'info', sprintf(
[1662] Fix | Delete
/* translators: Number of users. */
[1663] Fix | Delete
_n(
[1664] Fix | Delete
"Total of %d users left to process in password strength check.",
[1665] Fix | Delete
"Total of %d users left to process in password strength check.",
[1666] Fix | Delete
$usersLeft,
[1667] Fix | Delete
'wordfence'),
[1668] Fix | Delete
$usersLeft
[1669] Fix | Delete
));
[1670] Fix | Delete
}
[1671] Fix | Delete
$userID = unpack('N', substr($this->userPasswdQueue, 0, 4));
[1672] Fix | Delete
$userID = $userID[1];
[1673] Fix | Delete
$this->userPasswdQueue = substr($this->userPasswdQueue, 4);
[1674] Fix | Delete
$state = $this->scanUserPassword($userID);
[1675] Fix | Delete
$this->scanController->incrementSummaryItem(wfScanner::SUMMARY_SCANNED_USERS);
[1676] Fix | Delete
if ($state == wfIssues::STATUS_PROBLEM) {
[1677] Fix | Delete
$this->passwdHasIssues = wfIssues::STATUS_PROBLEM;
[1678] Fix | Delete
} else if ($this->passwdHasIssues != wfIssues::STATUS_PROBLEM && $state == wfIssues::STATUS_IGNORED) {
[1679] Fix | Delete
$this->passwdHasIssues = wfIssues::STATUS_IGNORED;
[1680] Fix | Delete
}
[1681] Fix | Delete
[1682] Fix | Delete
$this->forkIfNeeded();
[1683] Fix | Delete
}
[1684] Fix | Delete
}
[1685] Fix | Delete
[1686] Fix | Delete
private function scan_passwds_finish() {
[1687] Fix | Delete
wfIssues::statusEnd($this->statusIDX['passwds'], $this->passwdHasIssues);
[1688] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_PASSWORD_STRENGTH, $this->passwdHasIssues);
[1689] Fix | Delete
}
[1690] Fix | Delete
[1691] Fix | Delete
public function scanUserPassword($userID) {
[1692] Fix | Delete
$suspended = wp_suspend_cache_addition();
[1693] Fix | Delete
wp_suspend_cache_addition(true);
[1694] Fix | Delete
require_once(ABSPATH . 'wp-includes/class-phpass.php');
[1695] Fix | Delete
$passwdHasher = new PasswordHash(8, TRUE);
[1696] Fix | Delete
$userDat = get_userdata($userID);
[1697] Fix | Delete
if ($userDat === false) {
[1698] Fix | Delete
wordfence::status(2, 'error', sprintf(/* translators: WordPress user ID. */ __("Could not get username for user with ID %d when checking password strength.", 'wordfence'), $userID));
[1699] Fix | Delete
return false;
[1700] Fix | Delete
}
[1701] Fix | Delete
//user_login
[1702] Fix | Delete
$this->status(4, 'info', sprintf(
[1703] Fix | Delete
/* translators: 1. WordPress username. 2. WordPress user ID. */
[1704] Fix | Delete
__('Checking password strength of user \'%1$s\' with ID %2$d', 'wordfence'),
[1705] Fix | Delete
$userDat->user_login,
[1706] Fix | Delete
$userID
[1707] Fix | Delete
) . (function_exists('memory_get_usage') ? " (Mem:" . sprintf('%.1f', memory_get_usage(true) / (1024 * 1024)) . "M)" : ""));
[1708] Fix | Delete
$highCap = $this->highestCap($userDat->wp_capabilities);
[1709] Fix | Delete
if ($this->isEditor($userDat->wp_capabilities)) {
[1710] Fix | Delete
$shortMsg = sprintf(
[1711] Fix | Delete
/* translators: 1. WordPress username. 2. WordPress capability. */
[1712] Fix | Delete
__('User "%1$s" with "%2$s" access has an easy password.', 'wordfence'),
[1713] Fix | Delete
esc_html($userDat->user_login),
[1714] Fix | Delete
esc_html($highCap)
[1715] Fix | Delete
);
[1716] Fix | Delete
$longMsg = sprintf(
[1717] Fix | Delete
/* translators: WordPress capability. */
[1718] Fix | Delete
__("A user with the a role of '%s' has a password that is easy to guess. Please change this password yourself or ask the user to change it.", 'wordfence'),
[1719] Fix | Delete
esc_html($highCap)
[1720] Fix | Delete
);
[1721] Fix | Delete
$level = wfIssues::SEVERITY_CRITICAL;
[1722] Fix | Delete
$words = $this->dictWords;
[1723] Fix | Delete
} else {
[1724] Fix | Delete
$shortMsg = sprintf(
[1725] Fix | Delete
/* translators: WordPress username. */
[1726] Fix | Delete
__("User \"%s\" with 'subscriber' access has a very easy password.", 'wordfence'), esc_html($userDat->user_login));
[1727] Fix | Delete
$longMsg = __("A user with 'subscriber' access has a password that is very easy to guess. Please either change it or ask the user to change their password.", 'wordfence');
[1728] Fix | Delete
$level = wfIssues::SEVERITY_HIGH;
[1729] Fix | Delete
$words = array($userDat->user_login);
[1730] Fix | Delete
}
[1731] Fix | Delete
$haveIssues = wfIssues::STATUS_SECURE;
[1732] Fix | Delete
for ($i = 0; $i < sizeof($words); $i++) {
[1733] Fix | Delete
if ($passwdHasher->CheckPassword($words[$i], $userDat->user_pass)) {
[1734] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Scan result description. */ __('Adding issue %s', 'wordfence'), $shortMsg));
[1735] Fix | Delete
$added = $this->addIssue('easyPassword', $level, $userDat->ID, $userDat->ID . '-' . $userDat->user_pass, $shortMsg, $longMsg, array(
[1736] Fix | Delete
'ID' => $userDat->ID,
[1737] Fix | Delete
'user_login' => $userDat->user_login,
[1738] Fix | Delete
'user_email' => $userDat->user_email,
[1739] Fix | Delete
'first_name' => $userDat->first_name,
[1740] Fix | Delete
'last_name' => $userDat->last_name,
[1741] Fix | Delete
'editUserLink' => wfUtils::editUserLink($userDat->ID)
[1742] Fix | Delete
));
[1743] Fix | Delete
if ($added == wfIssues::ISSUE_ADDED || $added == wfIssues::ISSUE_UPDATED) {
[1744] Fix | Delete
$haveIssues = wfIssues::STATUS_PROBLEM;
[1745] Fix | Delete
} else if ($haveIssues != wfIssues::STATUS_SECURE && ($added == wfIssues::ISSUE_IGNOREP || $added == wfIssues::ISSUE_IGNOREC)) {
[1746] Fix | Delete
$haveIssues = wfIssues::STATUS_IGNORED;
[1747] Fix | Delete
}
[1748] Fix | Delete
break;
[1749] Fix | Delete
}
[1750] Fix | Delete
}
[1751] Fix | Delete
$this->status(4, 'info', sprintf(/* translators: WordPress username. */ __("Completed checking password strength of user '%s'", 'wordfence'), $userDat->user_login));
[1752] Fix | Delete
wp_suspend_cache_addition($suspended);
[1753] Fix | Delete
return $haveIssues;
[1754] Fix | Delete
}
[1755] Fix | Delete
[1756] Fix | Delete
/*
[1757] Fix | Delete
private function scan_sitePages(){
[1758] Fix | Delete
if(is_multisite()){ return; } //Multisite not supported by this function yet
[1759] Fix | Delete
$this->statusIDX['sitePages'] = wordfence::statusStart("Scanning externally for malware");
[1760] Fix | Delete
$resp = wp_remote_get(site_url());
[1761] Fix | Delete
if(is_array($resp) && isset($resp['body']) && strlen($rep['body']) > 0){
[1762] Fix | Delete
$this->hoover = new wordfenceURLHoover($this->apiKey, $this->wp_version);
[1763] Fix | Delete
$this->hoover->hoover(1, $rep['body']);
[1764] Fix | Delete
$hooverResults = $this->hoover->getBaddies();
[1765] Fix | Delete
if($this->hoover->errorMsg){
[1766] Fix | Delete
wordfence::statusEndErr();
[1767] Fix | Delete
throw new Exception($this->hoover->errorMsg);
[1768] Fix | Delete
}
[1769] Fix | Delete
$badURLs = array();
[1770] Fix | Delete
foreach($hooverResults as $idString => $hresults){
[1771] Fix | Delete
foreach($hresults as $result){
[1772] Fix | Delete
if(! in_array($result['URL'], $badURLs)){
[1773] Fix | Delete
$badURLs[] = $result['URL'];
[1774] Fix | Delete
}
[1775] Fix | Delete
}
[1776] Fix | Delete
}
[1777] Fix | Delete
if(sizeof($badURLs) > 0){
[1778] Fix | Delete
$this->addIssue('badSitePage', 1, 'badSitePage1', 'badSitePage1', "Your home page contains a malware URL");
[1779] Fix | Delete
}
[1780] Fix | Delete
}
[1781] Fix | Delete
}
[1782] Fix | Delete
*/
[1783] Fix | Delete
private function scan_diskSpace() {
[1784] Fix | Delete
$this->statusIDX['diskSpace'] = wfIssues::statusStart(__('Scanning to check available disk space', 'wordfence'));
[1785] Fix | Delete
$this->scanController->startStage(wfScanner::STAGE_SERVER_STATE);
[1786] Fix | Delete
wfUtils::errorsOff();
[1787] Fix | Delete
$total = function_exists('disk_total_space')?@disk_total_space('.'):false;
[1788] Fix | Delete
$free = function_exists('disk_free_space')?@disk_free_space('.'):false; //Normally false if unreadable but can return 0 on some hosts even when there's space available
[1789] Fix | Delete
wfUtils::errorsOn();
[1790] Fix | Delete
if (!$total || !$free) {
[1791] Fix | Delete
$this->status(2, 'info', __('Unable to access available disk space information', 'wordfence'));
[1792] Fix | Delete
wfIssues::statusEnd($this->statusIDX['diskSpace'], wfIssues::STATUS_SECURE);
[1793] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_SERVER_STATE, wfIssues::STATUS_SECURE);
[1794] Fix | Delete
return;
[1795] Fix | Delete
}
[1796] Fix | Delete
[1797] Fix | Delete
[1798] Fix | Delete
$this->status(2, 'info', sprintf(
[1799] Fix | Delete
/* translators: 1. Number of bytes. 2. Number of bytes. */
[1800] Fix | Delete
__('Total disk space: %1$s -- Free disk space: %2$s', 'wordfence'),
[1801] Fix | Delete
wfUtils::formatBytes($total),
[1802] Fix | Delete
wfUtils::formatBytes($free)
[1803] Fix | Delete
));
[1804] Fix | Delete
$freeMegs = round($free / 1024 / 1024, 2);
[1805] Fix | Delete
$this->status(2, 'info', sprintf(/* translators: Number of bytes. */ __('The disk has %s MB available', 'wordfence'), $freeMegs));
[1806] Fix | Delete
if ($freeMegs < 5) {
[1807] Fix | Delete
$level = wfIssues::SEVERITY_CRITICAL;
[1808] Fix | Delete
} else if ($freeMegs < 20) {
[1809] Fix | Delete
$level = wfIssues::SEVERITY_HIGH;
[1810] Fix | Delete
} else {
[1811] Fix | Delete
wfIssues::statusEnd($this->statusIDX['diskSpace'], wfIssues::STATUS_SECURE);
[1812] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_SERVER_STATE, wfIssues::STATUS_SECURE);
[1813] Fix | Delete
return;
[1814] Fix | Delete
}
[1815] Fix | Delete
$haveIssues = wfIssues::STATUS_SECURE;
[1816] Fix | Delete
$added = $this->addIssue('diskSpace',
[1817] Fix | Delete
$level,
[1818] Fix | Delete
'diskSpace',
[1819] Fix | Delete
'diskSpace' . $level,
[1820] Fix | Delete
sprintf(/* translators: Number of bytes. */ __('You have %s disk space remaining', 'wordfence'), wfUtils::formatBytes($free)),
[1821] Fix | Delete
sprintf(/* translators: Number of bytes. */ __('You only have %s of your disk space remaining. Please free up disk space or your website may stop serving requests.', 'wordfence'), wfUtils::formatBytes($free)),
[1822] Fix | Delete
array('spaceLeft' => wfUtils::formatBytes($free))
[1823] Fix | Delete
);
[1824] Fix | Delete
if ($added == wfIssues::ISSUE_ADDED || $added == wfIssues::ISSUE_UPDATED) {
[1825] Fix | Delete
$haveIssues = wfIssues::STATUS_PROBLEM;
[1826] Fix | Delete
} else if ($haveIssues != wfIssues::STATUS_SECURE && ($added == wfIssues::ISSUE_IGNOREP || $added == wfIssues::ISSUE_IGNOREC)) {
[1827] Fix | Delete
$haveIssues = wfIssues::STATUS_IGNORED;
[1828] Fix | Delete
}
[1829] Fix | Delete
wfIssues::statusEnd($this->statusIDX['diskSpace'], $haveIssues);
[1830] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_SERVER_STATE, $haveIssues);
[1831] Fix | Delete
}
[1832] Fix | Delete
[1833] Fix | Delete
private function scan_wafStatus() {
[1834] Fix | Delete
$this->statusIDX['wafStatus'] = wfIssues::statusStart(__('Checking Web Application Firewall status', 'wordfence'));
[1835] Fix | Delete
$this->scanController->startStage(wfScanner::STAGE_SERVER_STATE);
[1836] Fix | Delete
[1837] Fix | Delete
$haveIssues = wfIssues::STATUS_SECURE;
[1838] Fix | Delete
$added = false;
[1839] Fix | Delete
$firewall = new wfFirewall();
[1840] Fix | Delete
if (wfConfig::get('waf_status') !== $firewall->firewallMode() && $firewall->firewallMode() == wfFirewall::FIREWALL_MODE_DISABLED) {
[1841] Fix | Delete
$added = $this->addIssue('wafStatus',
[1842] Fix | Delete
wfIssues::SEVERITY_CRITICAL,
[1843] Fix | Delete
'wafStatus',
[1844] Fix | Delete
'wafStatus' . $firewall->firewallMode(),
[1845] Fix | Delete
__('Web Application Firewall is disabled', 'wordfence'),
[1846] Fix | Delete
sprintf(/* translators: Support URL. */ __('Wordfence\'s Web Application Firewall has been unexpectedly disabled. If you see a notice at the top of the Wordfence admin pages that says "The Wordfence Web Application Firewall cannot run," click the link in that message to rebuild the configuration. If this does not work, you may need to fix file permissions. <a href="%s" target="_blank" rel="noopener noreferrer">More Details<span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a>', 'wordfence'), wfSupportController::esc_supportURL(wfSupportController::ITEM_SCAN_RESULT_WAF_DISABLED)),
[1847] Fix | Delete
array('wafStatus' => $firewall->firewallMode(), 'wafStatusDisplay' => $firewall->displayText())
[1848] Fix | Delete
);
[1849] Fix | Delete
}
[1850] Fix | Delete
[1851] Fix | Delete
if ($added == wfIssues::ISSUE_ADDED || $added == wfIssues::ISSUE_UPDATED) {
[1852] Fix | Delete
$haveIssues = wfIssues::STATUS_PROBLEM;
[1853] Fix | Delete
} else if ($haveIssues != wfIssues::STATUS_SECURE && ($added == wfIssues::ISSUE_IGNOREP || $added == wfIssues::ISSUE_IGNOREC)) {
[1854] Fix | Delete
$haveIssues = wfIssues::STATUS_IGNORED;
[1855] Fix | Delete
}
[1856] Fix | Delete
wfIssues::statusEnd($this->statusIDX['wafStatus'], $haveIssues);
[1857] Fix | Delete
$this->scanController->completeStage(wfScanner::STAGE_SERVER_STATE, $haveIssues);
[1858] Fix | Delete
}
[1859] Fix | Delete
[1860] Fix | Delete
private function scan_oldVersions_init() {
[1861] Fix | Delete
$this->statusIDX['oldVersions'] = wfIssues::statusStart(__("Scanning for old themes, plugins and core files", 'wordfence'));
[1862] Fix | Delete
$this->scanController->startStage(wfScanner::STAGE_VULNERABILITY_SCAN);
[1863] Fix | Delete
[1864] Fix | Delete
$this->updateCheck = new wfUpdateCheck();
[1865] Fix | Delete
$this->updateCheck->checkCoreVulnerabilities();
[1866] Fix | Delete
$this->updateCheck->checkPluginVulnerabilities();
[1867] Fix | Delete
$this->updateCheck->checkThemeVulnerabilities();
[1868] Fix | Delete
$this->updateCheck->checkAllUpdates(!$this->isFullScan());
[1869] Fix | Delete
[1870] Fix | Delete
foreach ($this->updateCheck->getPluginSlugs() as $slug) {
[1871] Fix | Delete
$this->pluginRepoStatus[$slug] = false;
[1872] Fix | Delete
}
[1873] Fix | Delete
[1874] Fix | Delete
//Strip plugins that have a pending update
[1875] Fix | Delete
if (count($this->updateCheck->getPluginUpdates()) > 0) {
[1876] Fix | Delete
foreach ($this->updateCheck->getPluginUpdates() as $plugin) {
[1877] Fix | Delete
if (!empty($plugin['slug'])) {
[1878] Fix | Delete
unset($this->pluginRepoStatus[$plugin['slug']]);
[1879] Fix | Delete
}
[1880] Fix | Delete
}
[1881] Fix | Delete
}
[1882] Fix | Delete
}
[1883] Fix | Delete
[1884] Fix | Delete
private function scan_oldVersions_main() {
[1885] Fix | Delete
if (!$this->isFullScan()) {
[1886] Fix | Delete
return;
[1887] Fix | Delete
}
[1888] Fix | Delete
[1889] Fix | Delete
if (!function_exists('plugins_api')) {
[1890] Fix | Delete
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
[1891] Fix | Delete
}
[1892] Fix | Delete
[1893] Fix | Delete
foreach ($this->pluginRepoStatus as $slug => $status) {
[1894] Fix | Delete
if ($status === false) {
[1895] Fix | Delete
try {
[1896] Fix | Delete
$result = plugins_api('plugin_information', array(
[1897] Fix | Delete
'slug' => $slug,
[1898] Fix | Delete
'fields' => array(
[1899] Fix | Delete
'short_description' => false,
[1900] Fix | Delete
'description' => false,
[1901] Fix | Delete
'sections' => false,
[1902] Fix | Delete
'tested' => true,
[1903] Fix | Delete
'requires' => true,
[1904] Fix | Delete
'rating' => false,
[1905] Fix | Delete
'ratings' => false,
[1906] Fix | Delete
'downloaded' => false,
[1907] Fix | Delete
'downloadlink' => false,
[1908] Fix | Delete
'last_updated' => true,
[1909] Fix | Delete
'added' => false,
[1910] Fix | Delete
'tags' => false,
[1911] Fix | Delete
'compatibility' => true,
[1912] Fix | Delete
'homepage' => true,
[1913] Fix | Delete
'versions' => false,
[1914] Fix | Delete
'donate_link' => false,
[1915] Fix | Delete
'reviews' => false,
[1916] Fix | Delete
'banners' => false,
[1917] Fix | Delete
'icons' => false,
[1918] Fix | Delete
'active_installs' => false,
[1919] Fix | Delete
'group' => false,
[1920] Fix | Delete
'contributors' => false,
[1921] Fix | Delete
),
[1922] Fix | Delete
));
[1923] Fix | Delete
unset($result->versions);
[1924] Fix | Delete
unset($result->screenshots);
[1925] Fix | Delete
$this->pluginRepoStatus[$slug] = $result;
[1926] Fix | Delete
}
[1927] Fix | Delete
catch (Exception $e) {
[1928] Fix | Delete
error_log(sprintf('Caught exception while attempting to refresh update status for slug %s: %s', $slug, $e->getMessage()));
[1929] Fix | Delete
$this->pluginRepoStatus[$slug] = false;
[1930] Fix | Delete
wfConfig::set(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_KEY, sprintf('%s [%s]', $e->getMessage(), $slug), false);
[1931] Fix | Delete
wfConfig::set(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_SLUG_KEY, $slug, false);
[1932] Fix | Delete
}
[1933] Fix | Delete
catch (Throwable $t) {
[1934] Fix | Delete
error_log(sprintf('Caught error while attempting to refresh update status for slug %s: %s', $slug, $t->getMessage()));
[1935] Fix | Delete
$this->pluginRepoStatus[$slug] = false;
[1936] Fix | Delete
wfConfig::set(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_KEY, sprintf('%s [%s]', $t->getMessage(), $slug), false);
[1937] Fix | Delete
wfConfig::set(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_SLUG_KEY, $slug, false);
[1938] Fix | Delete
}
[1939] Fix | Delete
[1940] Fix | Delete
$this->forkIfNeeded();
[1941] Fix | Delete
}
[1942] Fix | Delete
}
[1943] Fix | Delete
}
[1944] Fix | Delete
[1945] Fix | Delete
private function scan_oldVersions_finish() {
[1946] Fix | Delete
$haveIssues = wfIssues::STATUS_SECURE;
[1947] Fix | Delete
[1948] Fix | Delete
if (!$this->isFullScan()) {
[1949] Fix | Delete
$this->deleteNewIssues(array('wfUpgradeError', 'wfUpgrade', 'wfPluginUpgrade', 'wfThemeUpgrade'));
[1950] Fix | Delete
}
[1951] Fix | Delete
[1952] Fix | Delete
if ($lastError = wfConfig::get(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_KEY)) {
[1953] Fix | Delete
$lastSlug = wfConfig::get(wfUpdateCheck::LAST_UPDATE_CHECK_ERROR_SLUG_KEY);
[1954] Fix | Delete
$longMsg = sprintf(/* translators: error message. */ __("The update check performed during the scan encountered an error: %s", 'wordfence'), esc_html($lastError));
[1955] Fix | Delete
if ($lastSlug === false) {
[1956] Fix | Delete
$longMsg .= ' ' . __('Wordfence cannot detect if the installed plugins and themes are up to date. This might be caused by a PHP compatibility issue in one or more plugins/themes.', 'wordfence');
[1957] Fix | Delete
}
[1958] Fix | Delete
else {
[1959] Fix | Delete
$longMsg .= ' ' . __('Wordfence cannot detect if this plugin/theme is up to date. This might be caused by a PHP compatibility issue in the plugin.', 'wordfence');
[1960] Fix | Delete
}
[1961] Fix | Delete
$longMsg .= ' ' . sprintf(
[1962] Fix | Delete
/* translators: Support URL. */
[1963] Fix | Delete
__('<a href="%s" target="_blank" rel="noopener noreferrer">Get more information.<span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a>', 'wordfence'), wfSupportController::esc_supportURL(wfSupportController::ITEM_SCAN_RESULT_UPDATE_CHECK_FAILED));
[1964] Fix | Delete
[1965] Fix | Delete
$ignoreKey = ($lastSlug === false ? 'wfUpgradeErrorGeneral' : sprintf('wfUpgradeError-%s', $lastSlug));
[1966] Fix | Delete
[1967] Fix | Delete
$added = $this->addIssue(
[1968] Fix | Delete
'wfUpgradeError',
[1969] Fix | Delete
wfIssues::SEVERITY_MEDIUM,
[1970] Fix | Delete
$ignoreKey,
[1971] Fix | Delete
$ignoreKey,
[1972] Fix | Delete
($lastSlug === false ? __("Update Check Encountered Error", 'wordfence') : sprintf(/* translators: plugin/theme slug. */ __("Update Check Encountered Error on '%s'", 'wordfence'), esc_html($lastSlug))),
[1973] Fix | Delete
$longMsg,
[1974] Fix | Delete
array()
[1975] Fix | Delete
);
[1976] Fix | Delete
if ($added == wfIssues::ISSUE_ADDED || $added == wfIssues::ISSUE_UPDATED) {
[1977] Fix | Delete
$haveIssues = wfIssues::STATUS_PROBLEM;
[1978] Fix | Delete
}
[1979] Fix | Delete
else if ($haveIssues != wfIssues::STATUS_PROBLEM && ($added == wfIssues::ISSUE_IGNOREP || $added == wfIssues::ISSUE_IGNOREC)) {
[1980] Fix | Delete
$haveIssues = wfIssues::STATUS_IGNORED;
[1981] Fix | Delete
}
[1982] Fix | Delete
}
[1983] Fix | Delete
[1984] Fix | Delete
// WordPress core updates needed
[1985] Fix | Delete
if ($this->updateCheck->needsCoreUpdate()) {
[1986] Fix | Delete
$updateVersion = $this->updateCheck->getCoreUpdateVersion();
[1987] Fix | Delete
$severity = wfIssues::SEVERITY_HIGH;
[1988] Fix | Delete
$shortMsg = __("Your WordPress version is out of date", 'wordfence');
[1989] Fix | Delete
$longMsg = sprintf(/* translators: Software version. */ __("WordPress version %s is now available. Please upgrade immediately to get the latest security updates from WordPress.", 'wordfence'), esc_html($updateVersion));
[1990] Fix | Delete
[1991] Fix | Delete
$currentVulnerable = $this->updateCheck->isCoreVulnerable('current');
[1992] Fix | Delete
$edgeVulnerable = $this->updateCheck->isCoreVulnerable('edge');
[1993] Fix | Delete
if ($this->updateCheck->coreUpdatePatchAvailable()) { //Non-edge branch with available backported update
[1994] Fix | Delete
$updateVersion = $this->updateCheck->getCoreUpdatePatchVersion();
[1995] Fix | Delete
$patchVulnerable = $this->updateCheck->isCoreVulnerable('patch');
[1996] Fix | Delete
if (!$currentVulnerable && !$patchVulnerable) { //Non-edge branch, neither the current version or patch version have a known vulnerability
[1997] Fix | Delete
$severity = wfIssues::SEVERITY_MEDIUM;
[1998] Fix | Delete
$longMsg = sprintf(/* translators: Software version. */ __("WordPress version %s is now available for your site's current branch. Please upgrade immediately to get the latest fixes and compatibility updates from WordPress.", 'wordfence'), esc_html($updateVersion));
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function