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/wp-conte.../plugins/wordfenc.../modules/login-se.../classes/controll...
File: users.php
}
[1000] Fix | Delete
}
[1001] Fix | Delete
$validHashes = array_slice($validHashes, 0, self::CAPTCHA_SCORE_LIMIT);
[1002] Fix | Delete
update_user_meta($user->ID, self::META_KEY_CAPTCHA_SCORES, $validHashes);
[1003] Fix | Delete
}
[1004] Fix | Delete
[1005] Fix | Delete
/**
[1006] Fix | Delete
* Hashes the captcha token for storage.
[1007] Fix | Delete
*
[1008] Fix | Delete
* @param string $token
[1009] Fix | Delete
* @return string
[1010] Fix | Delete
*/
[1011] Fix | Delete
private function hash_captcha_token($token) {
[1012] Fix | Delete
return wp_hash($token);
[1013] Fix | Delete
}
[1014] Fix | Delete
[1015] Fix | Delete
/**
[1016] Fix | Delete
* Returns the cached score for the given captcha score and user if available. This action removes it from the cache
[1017] Fix | Delete
* since the intent is for it only to be used for the initial login request to validate credentials + the follow-up
[1018] Fix | Delete
* request either finalizing the login (no 2FA set) or with the 2FA token.
[1019] Fix | Delete
*
[1020] Fix | Delete
* $expired will be set to `true` if the reason for returning `false` is because the $token is recently expired. It
[1021] Fix | Delete
* will be false when the $token is either uncached or has been expired long enough to be removed from the internal
[1022] Fix | Delete
* list.
[1023] Fix | Delete
*
[1024] Fix | Delete
* @param string $token
[1025] Fix | Delete
* @param \WP_User $user
[1026] Fix | Delete
* @param bool $expired
[1027] Fix | Delete
* @return float|false
[1028] Fix | Delete
*/
[1029] Fix | Delete
public function cached_captcha_score($token, $user, &$expired = false) {
[1030] Fix | Delete
$hash = $this->hash_captcha_token($token);
[1031] Fix | Delete
$score = $this->load_captcha_score($hash, $user);
[1032] Fix | Delete
if ($score === false) {
[1033] Fix | Delete
$storedHashes = get_user_meta($user->ID, self::META_KEY_CAPTCHA_SCORES, true);
[1034] Fix | Delete
if (is_array($storedHashes)) {
[1035] Fix | Delete
$expired = in_array($hash, $storedHashes);
[1036] Fix | Delete
}
[1037] Fix | Delete
}
[1038] Fix | Delete
[1039] Fix | Delete
$this->clear_captcha_score($token, $user);
[1040] Fix | Delete
return $score;
[1041] Fix | Delete
}
[1042] Fix | Delete
[1043] Fix | Delete
/**
[1044] Fix | Delete
* Caches the $token/$score pair for $user, automatically pruning its cached list to the maximum allowable count
[1045] Fix | Delete
*
[1046] Fix | Delete
* @param string $token
[1047] Fix | Delete
* @param float|false $score
[1048] Fix | Delete
* @param \WP_User $user
[1049] Fix | Delete
*/
[1050] Fix | Delete
public function cache_captcha_score($token, $score, $user) {
[1051] Fix | Delete
if ($score === false) {
[1052] Fix | Delete
return;
[1053] Fix | Delete
}
[1054] Fix | Delete
[1055] Fix | Delete
$storedHashes = get_user_meta($user->ID, self::META_KEY_CAPTCHA_SCORES, true);
[1056] Fix | Delete
$validHashes = array();
[1057] Fix | Delete
if (is_array($storedHashes)) {
[1058] Fix | Delete
foreach ($storedHashes as $hash) {
[1059] Fix | Delete
$storedScore = $this->load_captcha_score($hash, $user);
[1060] Fix | Delete
if ($storedScore !== false) {
[1061] Fix | Delete
$validHashes[] = $hash;
[1062] Fix | Delete
}
[1063] Fix | Delete
}
[1064] Fix | Delete
}
[1065] Fix | Delete
[1066] Fix | Delete
$hash = $this->hash_verification_token($token);
[1067] Fix | Delete
array_unshift($validHashes, $hash);
[1068] Fix | Delete
while (count($validHashes) > self::CAPTCHA_SCORE_LIMIT) {
[1069] Fix | Delete
$excessHash = array_pop($validHashes);
[1070] Fix | Delete
delete_transient($this->get_captcha_score_transient_key($excessHash));
[1071] Fix | Delete
}
[1072] Fix | Delete
[1073] Fix | Delete
$key = $this->get_captcha_score_transient_key($hash);
[1074] Fix | Delete
set_transient($key, array('user' => $user->ID, 'score' => $score), self::CAPTCHA_SCORE_CACHE_DURATION);
[1075] Fix | Delete
update_user_meta($user->ID, self::META_KEY_CAPTCHA_SCORES, $validHashes);
[1076] Fix | Delete
}
[1077] Fix | Delete
[1078] Fix | Delete
public function get_user_count() {
[1079] Fix | Delete
global $wpdb;
[1080] Fix | Delete
if (function_exists('get_user_count'))
[1081] Fix | Delete
return get_user_count();
[1082] Fix | Delete
return $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->users}");
[1083] Fix | Delete
}
[1084] Fix | Delete
[1085] Fix | Delete
public function has_large_user_base() {
[1086] Fix | Delete
return $this->get_user_count() >= self::LARGE_USER_BASE_THRESHOLD;
[1087] Fix | Delete
}
[1088] Fix | Delete
[1089] Fix | Delete
public function should_force_user_counts() {
[1090] Fix | Delete
return isset($_GET['wfls-show-user-counts']);
[1091] Fix | Delete
}
[1092] Fix | Delete
[1093] Fix | Delete
public function get_detailed_user_counts_if_enabled() {
[1094] Fix | Delete
$force = $this->should_force_user_counts();
[1095] Fix | Delete
if ($this->has_large_user_base() && !$force)
[1096] Fix | Delete
return null;
[1097] Fix | Delete
return $this->detailed_user_counts($force);
[1098] Fix | Delete
}
[1099] Fix | Delete
[1100] Fix | Delete
}
[1101] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function