PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
wordfence
/
lib
<?php class wfNotification { const PRIORITY_LOW = 1500; const PRIORITY_DEFAULT = 1000; const PRIORITY_HIGH = 500; const PRIORITY_HIGH_CRITICAL = 501; const PRIORITY_HIGH_WARNING = 502; protected $_id; protected $_category; protected $_priority; protected $_ctime; protected $_html; protected $_links; public static function notifications($since = 0) { global $wpdb; $table_wfNotifications = wfDB::networkTable('wfNotifications'); $rawNotifications = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table_wfNotifications} WHERE `new` = 1 AND `ctime` > %d ORDER BY `priority` ASC, `ctime` DESC", $since), ARRAY_A); $notifications = array(); foreach ($rawNotifications as $raw) { $notifications[] = new wfNotification($raw['id'], $raw['priority'], $raw['html'], $raw['category'], $raw['ctime'], json_decode($raw['links'], true), true); } return $notifications; } public static function getNotificationForID($id) { global $wpdb; $table_wfNotifications = wfDB::networkTable('wfNotifications'); $rawNotifications = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table_wfNotifications} WHERE `id` = %s ORDER BY `priority` ASC, `ctime` DESC", $id), ARRAY_A); if (count($rawNotifications) == 1) { $raw = $rawNotifications[0]; return new wfNotification($raw['id'], $raw['priority'], $raw['html'], $raw['category'], $raw['ctime'], json_decode($raw['links'], true), true); } return null; } public static function getNotificationForCategory($category, $requireNew = true) { global $wpdb; $table_wfNotifications = wfDB::networkTable('wfNotifications'); $rawNotifications = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table_wfNotifications} WHERE " . ($requireNew ? '`new` = 1 AND ' : '') . "`category` = %s ORDER BY `priority` ASC, `ctime` DESC LIMIT 1", $category), ARRAY_A); if (count($rawNotifications) == 1) { $raw = $rawNotifications[0]; return new wfNotification($raw['id'], $raw['priority'], $raw['html'], $raw['category'], $raw['ctime'], json_decode($raw['links'], true), true); } return null; } public static function reconcileNotificationsWithOptions() { $notification_updatesNeeded = wfConfig::get('notification_updatesNeeded'); $notification_securityAlerts = wfConfig::get('notification_securityAlerts') || !wfConfig::p(); $notification_promotions = wfConfig::get('notification_promotions') || !wfConfig::p(); $notification_blogHighlights = wfConfig::get('notification_blogHighlights') || !wfConfig::p(); $notification_productUpdates = wfConfig::get('notification_productUpdates') || !wfConfig::p(); $notification_scanStatus = wfConfig::get('notification_scanStatus'); $notifications = self::notifications(); foreach ($notifications as $n) { $category = $n->category; if (preg_match('/^release/i', $category) && !$notification_productUpdates) { $n->markAsRead(); } if (preg_match('/^digest/i', $category) && !$notification_blogHighlights) { $n->markAsRead(); } if (preg_match('/^alert/i', $category) && !$notification_securityAlerts) { $n->markAsRead(); } if (preg_match('/^promo/i', $category) && !$notification_promotions) { $n->markAsRead(); } switch ($category) { case 'wfplugin_scan': if (!$notification_scanStatus) { $n->markAsRead(); } break; case 'wfplugin_updates': if (!$notification_updatesNeeded) { $n->markAsRead(); } break; case 'wfplugin_keyconflict': default: //Allow it break; } } } public function __construct($id, $priority, $html, $category = null, $ctime = null, $links = null, $memoryOnly = false) { if ($id === null) { $id = 'site-' . wfUtils::base32_encode(pack('I', wfConfig::atomicInc('lastNotificationID'))); } if ($category === null) { $category = ''; } if ($ctime === null) { $ctime = time(); } if (!is_array($links)) { $links = array(); } $this->_id = $id; $this->_category = $category; $this->_priority = $priority; $this->_ctime = $ctime; $this->_html = $html; $this->_links = $links; global $wpdb; if (!$memoryOnly) { $linksJSON = json_encode($links); $notification_updatesNeeded = wfConfig::get('notification_updatesNeeded'); $notification_securityAlerts = wfConfig::get('notification_securityAlerts') || !wfConfig::p(); $notification_promotions = wfConfig::get('notification_promotions') || !wfConfig::p(); $notification_blogHighlights = wfConfig::get('notification_blogHighlights') || !wfConfig::p(); $notification_productUpdates = wfConfig::get('notification_productUpdates') || !wfConfig::p(); $notification_scanStatus = wfConfig::get('notification_scanStatus'); if (preg_match('/^release/i', $category) && !$notification_productUpdates) { return; } if (preg_match('/^digest/i', $category) && !$notification_blogHighlights) { return; } if (preg_match('/^alert/i', $category) && !$notification_securityAlerts) { return; } if (preg_match('/^promo/i', $category) && !$notification_promotions) { return; } switch ($category) { case 'wfplugin_scan': if (!$notification_scanStatus) { return; } break; case 'wfplugin_updates': if (!$notification_updatesNeeded) { return; } break; case 'wfplugin_keyconflict': default: //Allow it break; } $table_wfNotifications = wfDB::networkTable('wfNotifications'); if (!empty($category)) { $existing = self::getNotificationForCategory($category); if ($existing) { $wpdb->query($wpdb->prepare("UPDATE {$table_wfNotifications} SET priority = %d, ctime = %d, html = %s, links = %s WHERE id = %s", $priority, $ctime, $html, $linksJSON, $existing->id)); return; } } $wpdb->query($wpdb->prepare("INSERT IGNORE INTO {$table_wfNotifications} (id, category, priority, ctime, html, links) VALUES (%s, %s, %d, %d, %s, %s)", $id, $category, $priority, $ctime, $html, $linksJSON)); } } public function __get($key){ if ($key == 'id') { return $this->_id; } else if ($key == 'category') { return $this->_category; } else if ($key == 'priority') { return $this->_priority; } else if ($key == 'ctime') { return $this->_ctime; } else if ($key == 'html') { return $this->_html; } else if ($key == 'links') { return $this->_links; } throw new InvalidArgumentException(); } public function markAsRead() { global $wpdb; $table_wfNotifications = wfDB::networkTable('wfNotifications'); $wpdb->query($wpdb->prepare("UPDATE {$table_wfNotifications} SET `new` = 0 WHERE `id` = %s", $this->_id)); } }
[-] menu_support.php
[edit]
[-] wfBinaryList.php
[edit]
[-] sysinfo.php
[edit]
[-] menu_scanner.php
[edit]
[-] wfViewResult.php
[edit]
[-] wfScanMonitor.php
[edit]
[-] wfScanEngine.php
[edit]
[-] WFLSPHP52Compatability.php
[edit]
[-] .htaccess
[edit]
[-] wfSupportController.php
[edit]
[-] wfConfig.php
[edit]
[-] menu_firewall_waf.php
[edit]
[-] menu_dashboard_options.php
[edit]
[-] wfScan.php
[edit]
[-] wfUtils.php
[edit]
[-] wfDashboard.php
[edit]
[-] wordfenceScanner.php
[edit]
[+]
Diff
[-] menu_tools_whois.php
[edit]
[-] wfIpLocator.php
[edit]
[-] wfUnlockMsg.php
[edit]
[-] menu_wordfence_central.php
[edit]
[-] wfDirectoryIterator.php
[edit]
[-] wfHelperString.php
[edit]
[-] wfDB.php
[edit]
[-] live_activity.php
[edit]
[-] wfCrawl.php
[edit]
[-] email_genericAlert.php
[edit]
[-] IPTrafList.php
[edit]
[-] wfBrowscap.php
[edit]
[-] geoip.mmdb
[edit]
[-] wfAlerts.php
[edit]
[-] wfWebsite.php
[edit]
[-] noc1.key
[edit]
[-] wfCurlInterceptor.php
[edit]
[-] wordfenceHash.php
[edit]
[-] wfDateLocalization.php
[edit]
[-] menu_tools_importExport.php
[edit]
[-] wfScanEntrypoint.php
[edit]
[-] wfView.php
[edit]
[-] menu_tools.php
[edit]
[-] wfJWT.php
[edit]
[-] wfCache.php
[edit]
[-] menu_tools_livetraffic.php
[edit]
[-] wfCrypt.php
[edit]
[-] wfScanFile.php
[edit]
[-] wfAdminNoticeQueue.php
[edit]
[-] wfInaccessibleDirectoryException.php
[edit]
[-] wfVersionCheckController.php
[edit]
[-] wfRESTAPI.php
[edit]
[-] wfDeactivationOption.php
[edit]
[-] menu_tools_diagnostic.php
[edit]
[-] flags.php
[edit]
[-] email_newIssues.php
[edit]
[-] wfBrowscapCache.php
[edit]
[-] wfModuleController.php
[edit]
[-] wfLicense.php
[edit]
[-] wfIpLocation.php
[edit]
[-] wfCredentialsController.php
[edit]
[+]
rest-api
[-] wordfenceClass.php
[edit]
[-] wf503.php
[edit]
[+]
audit-log
[-] wfNotification.php
[edit]
[-] wfLog.php
[edit]
[-] wfActivityReport.php
[edit]
[-] wfScanFileProperties.php
[edit]
[-] wfHelperBin.php
[edit]
[-] wfAPI.php
[edit]
[-] viewFullActivityLog.php
[edit]
[-] wfLockedOut.php
[edit]
[-] wfScanPath.php
[edit]
[-] sodium_compat_fast.php
[edit]
[-] wfIssues.php
[edit]
[-] wordfenceConstants.php
[edit]
[-] menu_firewall_waf_options.php
[edit]
[-] wfI18n.php
[edit]
[-] menu_scanner_options.php
[edit]
[-] IPTraf.php
[edit]
[-] wfAuditLog.php
[edit]
[-] wfCommonPasswords.php
[edit]
[-] wfOnboardingController.php
[edit]
[-] wfInvalidPathException.php
[edit]
[-] email_unsubscribeRequest.php
[edit]
[-] wordfenceURLHoover.php
[edit]
[-] diffResult.php
[edit]
[-] menu_firewall_blocking_options.php
[edit]
[-] menu_scanner_credentials.php
[edit]
[-] wfFileUtils.php
[edit]
[-] wfPersistenceController.php
[edit]
[-] wfVersionSupport.php
[edit]
[-] Diff.php
[edit]
[+]
..
[-] wfMD5BloomFilter.php
[edit]
[-] wfUpdateCheck.php
[edit]
[-] wfDiagnostic.php
[edit]
[-] menu_install.php
[edit]
[-] wfCentralAPI.php
[edit]
[-] menu_options.php
[edit]
[-] wfSchema.php
[edit]
[-] menu_dashboard.php
[edit]
[-] compat.php
[edit]
[-] menu_firewall_blocking.php
[edit]
[-] wfIPWhitelist.php
[edit]
[-] wfBulkCountries.php
[edit]
[-] menu_tools_auditlog.php
[edit]
[-] email_unlockRequest.php
[edit]
[-] menu_firewall.php
[edit]
[-] wfScanFileListItem.php
[edit]
[-] wfImportExportController.php
[edit]
[-] menu_tools_twoFactor.php
[edit]
[+]
dashboard
[-] wfScanFileLink.php
[edit]
[-] wfStyle.php
[edit]