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
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib
File: wfConfig.php
<?php
[0] Fix | Delete
class wfConfig {
[1] Fix | Delete
const TABLE_EXISTS_OPTION = 'wordfence_installed'; //Also exists in bootstrap.php
[2] Fix | Delete
[3] Fix | Delete
const AUTOLOAD = 'yes';
[4] Fix | Delete
const DONT_AUTOLOAD = 'no';
[5] Fix | Delete
[6] Fix | Delete
const TYPE_BOOL = 'boolean';
[7] Fix | Delete
const TYPE_INT = 'integer';
[8] Fix | Delete
const TYPE_FLOAT = 'double';
[9] Fix | Delete
const TYPE_DOUBLE = 'double';
[10] Fix | Delete
const TYPE_STRING = 'string';
[11] Fix | Delete
const TYPE_ARRAY = 'array';
[12] Fix | Delete
const TYPE_JSON = 'json';
[13] Fix | Delete
[14] Fix | Delete
const OPTIONS_TYPE_GLOBAL = 'global';
[15] Fix | Delete
const OPTIONS_TYPE_FIREWALL = 'firewall';
[16] Fix | Delete
const OPTIONS_TYPE_BLOCKING = 'blocking';
[17] Fix | Delete
const OPTIONS_TYPE_SCANNER = 'scanner';
[18] Fix | Delete
const OPTIONS_TYPE_TWO_FACTOR = 'twofactor';
[19] Fix | Delete
const OPTIONS_TYPE_LIVE_TRAFFIC = 'livetraffic';
[20] Fix | Delete
const OPTIONS_TYPE_DIAGNOSTICS = 'diagnostics';
[21] Fix | Delete
const OPTIONS_TYPE_ALL = 'all';
[22] Fix | Delete
[23] Fix | Delete
public static $diskCache = array();
[24] Fix | Delete
private static $diskCacheDisabled = false; //enables if we detect a write fail so we don't keep calling stat()
[25] Fix | Delete
private static $cacheDisableCheckDone = false;
[26] Fix | Delete
private static $tableExists = true;
[27] Fix | Delete
private static $cache = array();
[28] Fix | Delete
private static $DB = false;
[29] Fix | Delete
private static $tmpFileHeader = "<?php\n/* Wordfence temporary file security header */\necho \"Nothing to see here!\\n\"; exit(0);\n?>";
[30] Fix | Delete
private static $tmpDirCache = false;
[31] Fix | Delete
public static $defaultConfig = array(
[32] Fix | Delete
//All exportable boolean options
[33] Fix | Delete
"checkboxes" => array(
[34] Fix | Delete
"alertOn_update" => array('value' => false, 'autoload' => self::AUTOLOAD),
[35] Fix | Delete
"alertOn_scanIssues" => array('value' => true, 'autoload' => self::AUTOLOAD),
[36] Fix | Delete
"alertOn_throttle" => array('value' => false, 'autoload' => self::AUTOLOAD),
[37] Fix | Delete
"alertOn_block" => array('value' => true, 'autoload' => self::AUTOLOAD),
[38] Fix | Delete
"alertOn_loginLockout" => array('value' => true, 'autoload' => self::AUTOLOAD),
[39] Fix | Delete
'alertOn_breachLogin' => array('value' => true, 'autoload' => self::AUTOLOAD),
[40] Fix | Delete
"alertOn_lostPasswdForm" => array('value' => true, 'autoload' => self::AUTOLOAD),
[41] Fix | Delete
"alertOn_adminLogin" => array('value' => true, 'autoload' => self::AUTOLOAD),
[42] Fix | Delete
"alertOn_firstAdminLoginOnly" => array('value' => false, 'autoload' => self::AUTOLOAD),
[43] Fix | Delete
"alertOn_nonAdminLogin" => array('value' => false, 'autoload' => self::AUTOLOAD),
[44] Fix | Delete
"alertOn_firstNonAdminLoginOnly" => array('value' => false, 'autoload' => self::AUTOLOAD),
[45] Fix | Delete
"alertOn_wordfenceDeactivated" => array('value' => true, 'autoload' => self::AUTOLOAD),
[46] Fix | Delete
"alertOn_wafDeactivated" => array('value' => true, 'autoload' => self::AUTOLOAD),
[47] Fix | Delete
"liveTrafficEnabled" => array('value' => false, 'autoload' => self::AUTOLOAD),
[48] Fix | Delete
"advancedCommentScanning" => array('value' => true, 'autoload' => self::AUTOLOAD),
[49] Fix | Delete
"checkSpamIP" => array('value' => true, 'autoload' => self::AUTOLOAD),
[50] Fix | Delete
"spamvertizeCheck" => array('value' => true, 'autoload' => self::AUTOLOAD),
[51] Fix | Delete
"liveTraf_ignorePublishers" => array('value' => true, 'autoload' => self::AUTOLOAD),
[52] Fix | Delete
"liveTraf_displayExpandedRecords" => array('value' => false, 'autoload' => self::DONT_AUTOLOAD),
[53] Fix | Delete
"scheduledScansEnabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[54] Fix | Delete
"lowResourceScansEnabled" => array('value' => false, 'autoload' => self::AUTOLOAD),
[55] Fix | Delete
"scansEnabled_checkGSB" => array('value' => true, 'autoload' => self::AUTOLOAD),
[56] Fix | Delete
"scansEnabled_checkHowGetIPs" => array('value' => true, 'autoload' => self::AUTOLOAD),
[57] Fix | Delete
"scansEnabled_core" => array('value' => true, 'autoload' => self::AUTOLOAD),
[58] Fix | Delete
"scansEnabled_themes" => array('value' => false, 'autoload' => self::AUTOLOAD),
[59] Fix | Delete
"scansEnabled_plugins" => array('value' => false, 'autoload' => self::AUTOLOAD),
[60] Fix | Delete
"scansEnabled_coreUnknown" => array('value' => true, 'autoload' => self::AUTOLOAD),
[61] Fix | Delete
"scansEnabled_malware" => array('value' => true, 'autoload' => self::AUTOLOAD),
[62] Fix | Delete
"scansEnabled_fileContents" => array('value' => true, 'autoload' => self::AUTOLOAD),
[63] Fix | Delete
"scansEnabled_fileContentsGSB" => array('value' => true, 'autoload' => self::AUTOLOAD),
[64] Fix | Delete
"scansEnabled_checkReadableConfig" => array('value' => true, 'autoload' => self::AUTOLOAD),
[65] Fix | Delete
"scansEnabled_suspectedFiles" => array('value' => true, 'autoload' => self::AUTOLOAD),
[66] Fix | Delete
"scansEnabled_posts" => array('value' => true, 'autoload' => self::AUTOLOAD),
[67] Fix | Delete
"scansEnabled_comments" => array('value' => true, 'autoload' => self::AUTOLOAD),
[68] Fix | Delete
"scansEnabled_suspiciousOptions" => array('value' => true, 'autoload' => self::AUTOLOAD),
[69] Fix | Delete
"scansEnabled_passwds" => array('value' => true, 'autoload' => self::AUTOLOAD),
[70] Fix | Delete
"scansEnabled_diskSpace" => array('value' => true, 'autoload' => self::AUTOLOAD),
[71] Fix | Delete
'scansEnabled_wafStatus' => array('value' => true, 'autoload' => self::AUTOLOAD),
[72] Fix | Delete
"scansEnabled_options" => array('value' => true, 'autoload' => self::AUTOLOAD),
[73] Fix | Delete
"scansEnabled_wpscan_fullPathDisclosure" => array('value' => true, 'autoload' => self::AUTOLOAD),
[74] Fix | Delete
"scansEnabled_wpscan_directoryListingEnabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[75] Fix | Delete
"scansEnabled_scanImages" => array('value' => false, 'autoload' => self::AUTOLOAD),
[76] Fix | Delete
"scansEnabled_highSense" => array('value' => false, 'autoload' => self::AUTOLOAD),
[77] Fix | Delete
"scansEnabled_oldVersions" => array('value' => true, 'autoload' => self::AUTOLOAD),
[78] Fix | Delete
"scansEnabled_suspiciousAdminUsers" => array('value' => true, 'autoload' => self::AUTOLOAD),
[79] Fix | Delete
"scan_force_ipv4_start" => array('value' => false, 'autoload' => self::AUTOLOAD),
[80] Fix | Delete
"liveActivityPauseEnabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[81] Fix | Delete
"firewallEnabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[82] Fix | Delete
"autoBlockScanners" => array('value' => true, 'autoload' => self::AUTOLOAD),
[83] Fix | Delete
"loginSecurityEnabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[84] Fix | Delete
"loginSec_strongPasswds_enabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[85] Fix | Delete
"loginSec_breachPasswds_enabled" => array('value' => true, 'autoload' => self::AUTOLOAD),
[86] Fix | Delete
"loginSec_lockInvalidUsers" => array('value' => false, 'autoload' => self::AUTOLOAD),
[87] Fix | Delete
"loginSec_maskLoginErrors" => array('value' => true, 'autoload' => self::AUTOLOAD),
[88] Fix | Delete
"loginSec_blockAdminReg" => array('value' => true, 'autoload' => self::AUTOLOAD),
[89] Fix | Delete
"loginSec_disableAuthorScan" => array('value' => true, 'autoload' => self::AUTOLOAD),
[90] Fix | Delete
"loginSec_disableApplicationPasswords" => array('value' => true, 'autoload' => self::AUTOLOAD),
[91] Fix | Delete
"loginSec_disableOEmbedAuthor" => array('value' => false, 'autoload' => self::AUTOLOAD),
[92] Fix | Delete
'loginSec_requireAdminTwoFactor' => array('value' => false, 'autoload' => self::AUTOLOAD),
[93] Fix | Delete
"notification_updatesNeeded" => array('value' => true, 'autoload' => self::AUTOLOAD),
[94] Fix | Delete
"notification_securityAlerts" => array('value' => true, 'autoload' => self::AUTOLOAD),
[95] Fix | Delete
"notification_promotions" => array('value' => true, 'autoload' => self::AUTOLOAD),
[96] Fix | Delete
"notification_blogHighlights" => array('value' => true, 'autoload' => self::AUTOLOAD),
[97] Fix | Delete
"notification_productUpdates" => array('value' => true, 'autoload' => self::AUTOLOAD),
[98] Fix | Delete
"notification_scanStatus" => array('value' => true, 'autoload' => self::AUTOLOAD),
[99] Fix | Delete
"enableRemoteIpLookup" => array('value' => true, 'autoload' => self::AUTOLOAD),
[100] Fix | Delete
"other_hideWPVersion" => array('value' => false, 'autoload' => self::AUTOLOAD),
[101] Fix | Delete
"other_blockBadPOST" => array('value' => false, 'autoload' => self::AUTOLOAD),
[102] Fix | Delete
"other_scanComments" => array('value' => true, 'autoload' => self::AUTOLOAD),
[103] Fix | Delete
"other_pwStrengthOnUpdate" => array('value' => true, 'autoload' => self::AUTOLOAD),
[104] Fix | Delete
"other_WFNet" => array('value' => true, 'autoload' => self::AUTOLOAD),
[105] Fix | Delete
"other_scanOutside" => array('value' => false, 'autoload' => self::AUTOLOAD),
[106] Fix | Delete
"other_bypassLitespeedNoabort" => array('value' => false, 'autoload' => self::AUTOLOAD),
[107] Fix | Delete
"deleteTablesOnDeact" => array('value' => false, 'autoload' => self::AUTOLOAD),
[108] Fix | Delete
"autoUpdate" => array('value' => false, 'autoload' => self::AUTOLOAD),
[109] Fix | Delete
"startScansRemotely" => array('value' => false, 'autoload' => self::AUTOLOAD),
[110] Fix | Delete
"disableConfigCaching" => array('value' => false, 'autoload' => self::AUTOLOAD),
[111] Fix | Delete
"addCacheComment" => array('value' => false, 'autoload' => self::AUTOLOAD),
[112] Fix | Delete
"disableCodeExecutionUploads" => array('value' => false, 'autoload' => self::AUTOLOAD),
[113] Fix | Delete
"allowHTTPSCaching" => array('value' => false, 'autoload' => self::AUTOLOAD),
[114] Fix | Delete
"debugOn" => array('value' => false, 'autoload' => self::AUTOLOAD),
[115] Fix | Delete
'email_summary_enabled' => array('value' => true, 'autoload' => self::AUTOLOAD),
[116] Fix | Delete
'email_summary_dashboard_widget_enabled' => array('value' => true, 'autoload' => self::AUTOLOAD),
[117] Fix | Delete
'ssl_verify' => array('value' => true, 'autoload' => self::AUTOLOAD),
[118] Fix | Delete
'ajaxWatcherDisabled_front' => array('value' => false, 'autoload' => self::AUTOLOAD),
[119] Fix | Delete
'ajaxWatcherDisabled_admin' => array('value' => false, 'autoload' => self::AUTOLOAD),
[120] Fix | Delete
'wafAlertOnAttacks' => array('value' => true, 'autoload' => self::AUTOLOAD),
[121] Fix | Delete
'disableWAFIPBlocking' => array('value' => false, 'autoload' => self::AUTOLOAD),
[122] Fix | Delete
'showAdminBarMenu' => array('value' => true, 'autoload' => self::AUTOLOAD),
[123] Fix | Delete
'displayTopLevelOptions' => array('value' => true, 'autoload' => self::AUTOLOAD),
[124] Fix | Delete
'displayTopLevelBlocking' => array('value' => false, 'autoload' => self::AUTOLOAD),
[125] Fix | Delete
'displayTopLevelLiveTraffic' => array('value' => false, 'autoload' => self::AUTOLOAD),
[126] Fix | Delete
'displayAutomaticBlocks' => array('value' => true, 'autoload' => self::AUTOLOAD),
[127] Fix | Delete
'allowLegacy2FA' => array('value' => false, 'autoload' => self::AUTOLOAD),
[128] Fix | Delete
'wordfenceI18n' => array('value' => true, 'autoload' => self::AUTOLOAD),
[129] Fix | Delete
),
[130] Fix | Delete
//All exportable variable type options
[131] Fix | Delete
"otherParams" => array(
[132] Fix | Delete
"scan_include_extra" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[133] Fix | Delete
"alertEmails" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[134] Fix | Delete
"liveTraf_ignoreUsers" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[135] Fix | Delete
"liveTraf_ignoreIPs" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[136] Fix | Delete
"liveTraf_ignoreUA" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[137] Fix | Delete
"maxMem" => array('value' => 256, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[138] Fix | Delete
'scan_exclude' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[139] Fix | Delete
'scan_maxIssues' => array('value' => 1000, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[140] Fix | Delete
'scan_maxDuration' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[141] Fix | Delete
"scan_max_resume_attempts" => array('value' => wfScanMonitor::DEFAULT_RESUME_ATTEMPTS, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[142] Fix | Delete
'whitelisted' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[143] Fix | Delete
'whitelistedServices' => array('value' => '{}', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_JSON)),
[144] Fix | Delete
'bannedURLs' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[145] Fix | Delete
'maxExecutionTime' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[146] Fix | Delete
'howGetIPs' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[147] Fix | Delete
'actUpdateInterval' => array('value' => 2, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[148] Fix | Delete
'alert_maxHourly' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[149] Fix | Delete
'loginSec_userBlacklist' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[150] Fix | Delete
'liveTraf_maxRows' => array('value' => 2000, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[151] Fix | Delete
'liveTraf_maxAge' => array('value' => 30, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[152] Fix | Delete
"neverBlockBG" => array('value' => "neverBlockVerified", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[153] Fix | Delete
"loginSec_countFailMins" => array('value' => 240, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[154] Fix | Delete
"loginSec_lockoutMins" => array('value' => 240, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[155] Fix | Delete
'loginSec_strongPasswds' => array('value' => 'pubs', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[156] Fix | Delete
'loginSec_breachPasswds' => array('value' => 'admins', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[157] Fix | Delete
'loginSec_maxFailures' => array('value' => 20, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[158] Fix | Delete
'loginSec_maxForgotPasswd' => array('value' => 20, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[159] Fix | Delete
'maxGlobalRequests' => array('value' => 'DISABLED', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[160] Fix | Delete
'maxGlobalRequests_action' => array('value' => "throttle", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[161] Fix | Delete
'maxRequestsCrawlers' => array('value' => 'DISABLED', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[162] Fix | Delete
'maxRequestsCrawlers_action' => array('value' => "throttle", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[163] Fix | Delete
'maxRequestsHumans' => array('value' => 'DISABLED', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[164] Fix | Delete
'maxRequestsHumans_action' => array('value' => "throttle", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[165] Fix | Delete
'max404Crawlers' => array('value' => 'DISABLED', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[166] Fix | Delete
'max404Crawlers_action' => array('value' => "throttle", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[167] Fix | Delete
'max404Humans' => array('value' => 'DISABLED', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[168] Fix | Delete
'max404Humans_action' => array('value' => "throttle", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[169] Fix | Delete
'blockedTime' => array('value' => 300, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[170] Fix | Delete
'email_summary_interval' => array('value' => 'weekly', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[171] Fix | Delete
'email_summary_excluded_directories' => array('value' => 'wp-content/cache,wp-content/wflogs', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[172] Fix | Delete
'allowed404s' => array('value' => "/favicon.ico\n/apple-touch-icon*.png\n/*@2x.png\n/browserconfig.xml", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[173] Fix | Delete
'wafAlertWhitelist' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[174] Fix | Delete
'wafAlertInterval' => array('value' => 600, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[175] Fix | Delete
'wafAlertThreshold' => array('value' => 100, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[176] Fix | Delete
'howGetIPs_trusted_proxies' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[177] Fix | Delete
'howGetIPs_trusted_proxy_preset' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[178] Fix | Delete
'scanType' => array('value' => wfScanner::SCAN_TYPE_STANDARD, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[179] Fix | Delete
'manualScanType' => array('value' => wfScanner::MANUAL_SCHEDULING_ONCE_DAILY, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[180] Fix | Delete
'schedStartHour' => array('value' => -1, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[181] Fix | Delete
'schedMode' => array('value' => wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[182] Fix | Delete
'cbl_loggedInBlocked' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[183] Fix | Delete
'cbl_action' => array('value' => 'block', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[184] Fix | Delete
'cbl_redirURL' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[185] Fix | Delete
'cbl_bypassRedirURL' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[186] Fix | Delete
'cbl_bypassRedirDest' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[187] Fix | Delete
'cbl_bypassViewURL' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[188] Fix | Delete
'loginSec_enableSeparateTwoFactor' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[189] Fix | Delete
'blockCustomText' => array('value' => '', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[190] Fix | Delete
'alertOn_severityLevel' => array('value' => wfIssues::SEVERITY_LOW, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[191] Fix | Delete
),
[192] Fix | Delete
//Set as default only, not included automatically in the settings import/export or options page saving
[193] Fix | Delete
'defaultsOnly' => array(
[194] Fix | Delete
"apiKey" => array('value' => "", 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[195] Fix | Delete
'keyType' => array('value' => wfLicense::KEY_TYPE_FREE, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[196] Fix | Delete
'isPaid' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[197] Fix | Delete
'hasKeyConflict' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[198] Fix | Delete
'timeoffset_wf_updated' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[199] Fix | Delete
'cacheType' => array('value' => 'disabled', 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[200] Fix | Delete
'detectProxyRecommendation' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[201] Fix | Delete
'dismissAutoPrependNotice' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[202] Fix | Delete
'onboardingAttempt1' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[203] Fix | Delete
'onboardingAttempt2' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[204] Fix | Delete
'onboardingAttempt3' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[205] Fix | Delete
'onboardingAttempt3Initial' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[206] Fix | Delete
'onboardingDelayedAt' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[207] Fix | Delete
'needsNewTour_dashboard' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[208] Fix | Delete
'needsNewTour_firewall' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[209] Fix | Delete
'needsNewTour_scan' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[210] Fix | Delete
'needsNewTour_blocking' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[211] Fix | Delete
'needsNewTour_livetraffic' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[212] Fix | Delete
'needsNewTour_loginsecurity' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[213] Fix | Delete
'needsUpgradeTour_dashboard' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[214] Fix | Delete
'needsUpgradeTour_firewall' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[215] Fix | Delete
'needsUpgradeTour_scan' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[216] Fix | Delete
'needsUpgradeTour_blocking' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[217] Fix | Delete
'needsUpgradeTour_livetraffic' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[218] Fix | Delete
'needsUpgradeTour_loginsecurity' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[219] Fix | Delete
'supportContent' => array('value' => '{}', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[220] Fix | Delete
'supportHash' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[221] Fix | Delete
'whitelistPresets' => array('value' => '{}', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[222] Fix | Delete
'whitelistHash' => array('value' => '', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[223] Fix | Delete
'touppPromptNeeded' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[224] Fix | Delete
'touppBypassNextCheck' => array('value' => false, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[225] Fix | Delete
'autoUpdateAttempts' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[226] Fix | Delete
'lastPermissionsTemplateCheck' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[227] Fix | Delete
'previousWflogsFileList' => array('value' => '[]', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[228] Fix | Delete
'diagnosticsWflogsRemovalHistory' => array('value' => '[]', 'autoload' => self::DONT_AUTOLOAD, 'validation' => array('type' => self::TYPE_STRING)),
[229] Fix | Delete
'satisfactionPromptDismissed' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[230] Fix | Delete
'satisfactionPromptInstallDate' => array('value' => 0, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_INT)),
[231] Fix | Delete
'satisfactionPromptOverride' => array('value' => true, 'autoload' => self::AUTOLOAD, 'validation' => array('type' => self::TYPE_BOOL)),
[232] Fix | Delete
),
[233] Fix | Delete
);
[234] Fix | Delete
public static $serializedOptions = array('lastAdminLogin', 'scanSched', 'emailedIssuesList', 'wf_summaryItems', 'adminUserList', 'twoFactorUsers', 'alertFreqTrack', 'wfStatusStartMsgs', 'vulnerabilities_core', 'vulnerabilities_plugin', 'vulnerabilities_theme', 'dashboardData', 'malwarePrefixes', 'coreHashes', 'noc1ScanSchedule', 'allScansScheduled', 'disclosureStates', 'scanStageStatuses', 'adminNoticeQueue', 'suspiciousAdminUsernames', 'wordpressPluginVersions', 'wordpressThemeVersions');
[235] Fix | Delete
// Configuration keypairs that can be set from Central.
[236] Fix | Delete
private static $wfCentralInternalConfig = array(
[237] Fix | Delete
'wordfenceCentralUserSiteAuthGrant',
[238] Fix | Delete
'wordfenceCentralConnected',
[239] Fix | Delete
'wordfenceCentralPluginAlertingDisabled',
[240] Fix | Delete
);
[241] Fix | Delete
[242] Fix | Delete
public static function setDefaults() {
[243] Fix | Delete
foreach (self::$defaultConfig['checkboxes'] as $key => $config) {
[244] Fix | Delete
$val = $config['value'];
[245] Fix | Delete
$autoload = $config['autoload'];
[246] Fix | Delete
if (self::get($key) === false) {
[247] Fix | Delete
self::set($key, $val ? '1' : '0', $autoload);
[248] Fix | Delete
}
[249] Fix | Delete
}
[250] Fix | Delete
foreach (self::$defaultConfig['otherParams'] as $key => $config) {
[251] Fix | Delete
$val = $config['value'];
[252] Fix | Delete
$autoload = $config['autoload'];
[253] Fix | Delete
if (self::get($key) === false) {
[254] Fix | Delete
self::set($key, $val, $autoload);
[255] Fix | Delete
}
[256] Fix | Delete
}
[257] Fix | Delete
foreach (self::$defaultConfig['defaultsOnly'] as $key => $config) {
[258] Fix | Delete
$val = $config['value'];
[259] Fix | Delete
$autoload = $config['autoload'];
[260] Fix | Delete
if (self::get($key) === false) {
[261] Fix | Delete
if ($val === false) {
[262] Fix | Delete
self::set($key, '0', $autoload);
[263] Fix | Delete
}
[264] Fix | Delete
else if ($val === true) {
[265] Fix | Delete
self::set($key, '1', $autoload);
[266] Fix | Delete
}
[267] Fix | Delete
else {
[268] Fix | Delete
self::set($key, $val, $autoload);
[269] Fix | Delete
}
[270] Fix | Delete
}
[271] Fix | Delete
}
[272] Fix | Delete
self::set('encKey', substr(wfUtils::bigRandomHex(), 0, 16));
[273] Fix | Delete
self::set('longEncKey', bin2hex(wfWAFUtils::random_bytes(32)));
[274] Fix | Delete
if (self::get('maxMem', false) === false) {
[275] Fix | Delete
self::set('maxMem', '256');
[276] Fix | Delete
}
[277] Fix | Delete
if (self::get('other_scanOutside', false) === false) {
[278] Fix | Delete
self::set('other_scanOutside', 0);
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
if (self::get('email_summary_enabled')) {
[282] Fix | Delete
wfActivityReport::scheduleCronJob();
[283] Fix | Delete
} else {
[284] Fix | Delete
wfActivityReport::disableCronJob();
[285] Fix | Delete
}
[286] Fix | Delete
}
[287] Fix | Delete
public static function loadAllOptions() {
[288] Fix | Delete
global $wpdb;
[289] Fix | Delete
[290] Fix | Delete
$options = wp_cache_get('alloptions', 'wordfence');
[291] Fix | Delete
if (!$options) {
[292] Fix | Delete
$table = self::table();
[293] Fix | Delete
self::updateTableExists();
[294] Fix | Delete
$suppress = $wpdb->suppress_errors();
[295] Fix | Delete
if (!($rawOptions = $wpdb->get_results("SELECT name, val FROM {$table} WHERE autoload = 'yes'"))) {
[296] Fix | Delete
$rawOptions = $wpdb->get_results("SELECT name, val FROM {$table}");
[297] Fix | Delete
}
[298] Fix | Delete
$wpdb->suppress_errors($suppress);
[299] Fix | Delete
$options = array();
[300] Fix | Delete
foreach ((array) $rawOptions as $o) {
[301] Fix | Delete
if (in_array($o->name, self::$serializedOptions)) {
[302] Fix | Delete
$val = maybe_unserialize($o->val);
[303] Fix | Delete
if ($val) {
[304] Fix | Delete
$options[$o->name] = $val;
[305] Fix | Delete
}
[306] Fix | Delete
}
[307] Fix | Delete
else {
[308] Fix | Delete
$options[$o->name] = $o->val;
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
wp_cache_add_non_persistent_groups('wordfence');
[313] Fix | Delete
wp_cache_add('alloptions', $options, 'wordfence');
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
return $options;
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
/**
[320] Fix | Delete
* Bases the table's existence on the option specified by wfConfig::TABLE_EXISTS_OPTION for performance. We only
[321] Fix | Delete
* set that option just prior to deletion in the uninstall handler and after table creation in the install handler.
[322] Fix | Delete
*/
[323] Fix | Delete
public static function updateTableExists($change = null) {
[324] Fix | Delete
if ($change !== null) {
[325] Fix | Delete
self::$tableExists = !!$change;
[326] Fix | Delete
if (is_multisite() && function_exists('update_network_option')) {
[327] Fix | Delete
update_network_option(null, wfConfig::TABLE_EXISTS_OPTION, self::$tableExists);
[328] Fix | Delete
}
[329] Fix | Delete
else {
[330] Fix | Delete
update_option(wfConfig::TABLE_EXISTS_OPTION, self::$tableExists);
[331] Fix | Delete
}
[332] Fix | Delete
return;
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
self::$tableExists = true;
[336] Fix | Delete
if (is_multisite() && function_exists('get_network_option')) {
[337] Fix | Delete
$optionValue = get_network_option(null, wfConfig::TABLE_EXISTS_OPTION, null);
[338] Fix | Delete
}
[339] Fix | Delete
else {
[340] Fix | Delete
$optionValue = get_option(wfConfig::TABLE_EXISTS_OPTION, null);
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
if ($optionValue === null) { //No value, set an initial one
[344] Fix | Delete
global $wpdb;
[345] Fix | Delete
self::updateTableExists(!!$wpdb->get_col($wpdb->prepare('SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME=%s', self::table())));
[346] Fix | Delete
return;
[347] Fix | Delete
}
[348] Fix | Delete
if (!$optionValue) {
[349] Fix | Delete
self::$tableExists = false;
[350] Fix | Delete
}
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
public static function tableExists() {
[354] Fix | Delete
return self::$tableExists;
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
private static function updateCachedOption($name, $val) {
[358] Fix | Delete
$options = self::loadAllOptions();
[359] Fix | Delete
$options[$name] = $val;
[360] Fix | Delete
wp_cache_set('alloptions', $options, 'wordfence');
[361] Fix | Delete
}
[362] Fix | Delete
private static function removeCachedOption($name) {
[363] Fix | Delete
$options = self::loadAllOptions();
[364] Fix | Delete
if (isset($options[$name])) {
[365] Fix | Delete
unset($options[$name]);
[366] Fix | Delete
wp_cache_set('alloptions', $options, 'wordfence');
[367] Fix | Delete
}
[368] Fix | Delete
}
[369] Fix | Delete
private static function getCachedOption($name) {
[370] Fix | Delete
$options = self::loadAllOptions();
[371] Fix | Delete
if (isset($options[$name])) {
[372] Fix | Delete
return $options[$name];
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
$table = self::table();
[376] Fix | Delete
$val = self::getDB()->querySingle("SELECT val FROM {$table} WHERE name='%s'", $name);
[377] Fix | Delete
if ($val !== null) {
[378] Fix | Delete
$options[$name] = $val;
[379] Fix | Delete
wp_cache_set('alloptions', $options, 'wordfence');
[380] Fix | Delete
}
[381] Fix | Delete
return $val;
[382] Fix | Delete
}
[383] Fix | Delete
public static function hasCachedOption($name) {
[384] Fix | Delete
$options = self::loadAllOptions();
[385] Fix | Delete
return isset($options[$name]);
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
/**
[389] Fix | Delete
* Returns an array of all option keys that are eligible for export with the exception of serialized options.
[390] Fix | Delete
*
[391] Fix | Delete
* @return array
[392] Fix | Delete
*/
[393] Fix | Delete
public static function getExportableOptionsKeys() {
[394] Fix | Delete
$ret = array();
[395] Fix | Delete
foreach (self::$defaultConfig['checkboxes'] as $key => $val) {
[396] Fix | Delete
$ret[] = $key;
[397] Fix | Delete
}
[398] Fix | Delete
foreach (self::$defaultConfig['otherParams'] as $key => $val) {
[399] Fix | Delete
$ret[] = $key;
[400] Fix | Delete
}
[401] Fix | Delete
return $ret;
[402] Fix | Delete
}
[403] Fix | Delete
public static function parseOptions($excludeOmitted = false) {
[404] Fix | Delete
$ret = array();
[405] Fix | Delete
foreach (self::$defaultConfig['checkboxes'] as $key => $val) { //value is not used. We just need the keys for validation
[406] Fix | Delete
if ($excludeOmitted && isset($_POST[$key])) {
[407] Fix | Delete
$ret[$key] = (int) $_POST[$key];
[408] Fix | Delete
}
[409] Fix | Delete
else if (!$excludeOmitted || isset($_POST[$key])) {
[410] Fix | Delete
$ret[$key] = isset($_POST[$key]) ? '1' : '0';
[411] Fix | Delete
}
[412] Fix | Delete
}
[413] Fix | Delete
foreach (self::$defaultConfig['otherParams'] as $key => $val) {
[414] Fix | Delete
if (!$excludeOmitted || isset($_POST[$key])) {
[415] Fix | Delete
if (isset($_POST[$key])) {
[416] Fix | Delete
$ret[$key] = stripslashes($_POST[$key]);
[417] Fix | Delete
}
[418] Fix | Delete
else {
[419] Fix | Delete
error_log("Missing options param \"$key\" when parsing parameters.");
[420] Fix | Delete
}
[421] Fix | Delete
}
[422] Fix | Delete
}
[423] Fix | Delete
/* for debugging only:
[424] Fix | Delete
foreach($_POST as $key => $val){
[425] Fix | Delete
if($key != 'action' && $key != 'nonce' && (! array_key_exists($key, self::$checkboxes)) && (! array_key_exists($key, self::$otherParams)) ){
[426] Fix | Delete
error_log("Unrecognized option: $key");
[427] Fix | Delete
}
[428] Fix | Delete
}
[429] Fix | Delete
*/
[430] Fix | Delete
return $ret;
[431] Fix | Delete
}
[432] Fix | Delete
public static function setArray($arr){
[433] Fix | Delete
foreach($arr as $key => $val){
[434] Fix | Delete
self::set($key, $val);
[435] Fix | Delete
}
[436] Fix | Delete
}
[437] Fix | Delete
public static function getHTML($key){
[438] Fix | Delete
return esc_html(self::get($key));
[439] Fix | Delete
}
[440] Fix | Delete
public static function inc($key){
[441] Fix | Delete
$val = self::get($key, false);
[442] Fix | Delete
if(! $val){
[443] Fix | Delete
$val = 0;
[444] Fix | Delete
}
[445] Fix | Delete
self::set($key, $val + 1);
[446] Fix | Delete
return $val + 1;
[447] Fix | Delete
}
[448] Fix | Delete
public static function atomicInc($key) {
[449] Fix | Delete
if (!self::$tableExists) {
[450] Fix | Delete
return false;
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
global $wpdb;
[454] Fix | Delete
$old_suppress_errors = $wpdb->suppress_errors(true);
[455] Fix | Delete
$table = self::table();
[456] Fix | Delete
$rowExists = false;
[457] Fix | Delete
$successful = false;
[458] Fix | Delete
$attempts = 0;
[459] Fix | Delete
do {
[460] Fix | Delete
if (!$rowExists && $wpdb->query($wpdb->prepare("INSERT INTO {$table} (name, val, autoload) values (%s, %s, %s)", $key, 1, self::DONT_AUTOLOAD))) {
[461] Fix | Delete
$val = 1;
[462] Fix | Delete
$successful = true;
[463] Fix | Delete
}
[464] Fix | Delete
else {
[465] Fix | Delete
$rowExists = true;
[466] Fix | Delete
$val = self::get($key, 1);
[467] Fix | Delete
if ($wpdb->query($wpdb->prepare("UPDATE {$table} SET val = %s WHERE name = %s AND val = %s", $val + 1, $key, $val))) {
[468] Fix | Delete
$val++;
[469] Fix | Delete
$successful = true;
[470] Fix | Delete
}
[471] Fix | Delete
}
[472] Fix | Delete
$attempts++;
[473] Fix | Delete
} while (!$successful && $attempts < 100);
[474] Fix | Delete
$wpdb->suppress_errors($old_suppress_errors);
[475] Fix | Delete
return $val;
[476] Fix | Delete
}
[477] Fix | Delete
public static function remove($key) {
[478] Fix | Delete
global $wpdb;
[479] Fix | Delete
[480] Fix | Delete
if (!self::$tableExists) {
[481] Fix | Delete
return;
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
$table = self::table();
[485] Fix | Delete
$wpdb->query($wpdb->prepare("DELETE FROM {$table} WHERE name = %s", $key));
[486] Fix | Delete
self::removeCachedOption($key);
[487] Fix | Delete
[488] Fix | Delete
if (!WFWAF_SUBDIRECTORY_INSTALL && class_exists('wfWAFIPBlocksController') && (substr($key, 0, 4) == 'cbl_' || $key == 'blockedTime' || $key == 'disableWAFIPBlocking')) {
[489] Fix | Delete
wfWAFIPBlocksController::setNeedsSynchronizeConfigSettings();
[490] Fix | Delete
}
[491] Fix | Delete
}
[492] Fix | Delete
public static function set($key, $val, $autoload = self::AUTOLOAD) {
[493] Fix | Delete
global $wpdb;
[494] Fix | Delete
[495] Fix | Delete
if (is_array($val)) {
[496] Fix | Delete
$msg = sprintf(
[497] Fix | Delete
/* translators: 1. Key in key-value store. 2. Value in key-value store. */
[498] Fix | Delete
__('wfConfig::set() got an array as second param with key: %1$s and value: %2$s', 'wordfence'), $key, var_export($val, true));
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function