Remove superfluous parentheses
This commit is contained in:
parent
80ab3216d5
commit
a6ebab3e03
|
@ -383,7 +383,7 @@ final class MD_STD {
|
|||
];
|
||||
|
||||
if (isset($_GET['navlang']) and in_array($_GET['navlang'], $allowed_langs, true)) {
|
||||
if (!(setcookie('__Host-lang', $_GET['navlang'], $cookie_options))) {
|
||||
if (!setcookie('__Host-lang', $_GET['navlang'], $cookie_options)) {
|
||||
throw new Exception("Failed to set language");
|
||||
}
|
||||
$lang = $_GET['navlang'];
|
||||
|
@ -393,7 +393,7 @@ final class MD_STD {
|
|||
}
|
||||
else {
|
||||
$lang = self::lang_getfrombrowser($allowed_langs, $default_lang, "", false);
|
||||
if (!(setcookie('__Host-lang', $lang, $cookie_options))) {
|
||||
if (!setcookie('__Host-lang', $lang, $cookie_options)) {
|
||||
throw new Exception("Failed to set language");
|
||||
}
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ final class MD_STD {
|
|||
*/
|
||||
public static function human_filesize(int $bytes, int $decimals = 2):string {
|
||||
|
||||
$size = ['B','kB','MB','GB','TB','PB','EB','ZB','YB'];
|
||||
$size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
$factor = \floor((\strlen((string)$bytes) - 1) / 3);
|
||||
return \sprintf("%.{$decimals}f", $bytes / \pow(1024, $factor)) . $size[$factor];
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function sanitize_id($input):int {
|
||||
public static function sanitize_id(mixed $input):int {
|
||||
|
||||
$input = \filter_var($input, \FILTER_VALIDATE_INT, [
|
||||
'options' => [
|
||||
|
@ -26,7 +26,7 @@ final class MD_STD_IN {
|
|||
]
|
||||
);
|
||||
|
||||
if (!($input)) {
|
||||
if (!$input) {
|
||||
throw new MDpageParameterNotNumericException("Value is not numeric.");
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function sanitize_id_or_zero($input):int {
|
||||
public static function sanitize_id_or_zero(mixed $input):int {
|
||||
|
||||
if ($input === "") {
|
||||
return 0;
|
||||
|
@ -71,7 +71,7 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitize_text($input):string {
|
||||
public static function sanitize_text(mixed $input):string {
|
||||
|
||||
$output = \filter_var($input,
|
||||
FILTER_SANITIZE_STRING,
|
||||
|
@ -95,14 +95,14 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitize_rgb_color($input):string {
|
||||
public static function sanitize_rgb_color(mixed $input):string {
|
||||
|
||||
$output = \filter_var($input,
|
||||
FILTER_SANITIZE_STRING,
|
||||
FILTER_FLAG_NO_ENCODE_QUOTES);
|
||||
|
||||
if ($output === false
|
||||
|| ((preg_match('/^[a-zA-Z0-9]{3}$/', $output)) === false && (preg_match('/^[a-zA-Z0-9]{6}$/', $output)) === false)
|
||||
|| (preg_match('/^[a-zA-Z0-9]{3}$/', $output) === false && preg_match('/^[a-zA-Z0-9]{6}$/', $output) === false)
|
||||
) {
|
||||
throw new MDInvalidColorCode("Invalid color code provided: " . $output);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitize_url($input):string {
|
||||
public static function sanitize_url(mixed $input):string {
|
||||
|
||||
if ($input === "") {
|
||||
return "";
|
||||
|
@ -197,7 +197,7 @@ final class MD_STD_IN {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function sanitize_email($input):string {
|
||||
public static function sanitize_email(mixed $input):string {
|
||||
|
||||
if ($input === "") {
|
||||
return "";
|
||||
|
|
|
@ -8,6 +8,12 @@ declare(strict_types = 1);
|
|||
* Gathers wrappers for handling basic security operations.
|
||||
*/
|
||||
final class MD_STD_SEC {
|
||||
|
||||
const BRUTE_FORCE_DELAY_DEFAULT = 2000; // 2000 microseconds = 2 milliseconds
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_COMMON = 1.08;
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_PER_USER = 1.8;
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_PER_IP = 4;
|
||||
|
||||
/**
|
||||
* Function for retrieving the anti-csrf token or generating it if need be.
|
||||
*
|
||||
|
@ -45,11 +51,6 @@ final class MD_STD_SEC {
|
|||
|
||||
}
|
||||
|
||||
const BRUTE_FORCE_DELAY_DEFAULT = 2000; // 2000 microseconds = 2 milliseconds
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_COMMON = 1.08;
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_PER_USER = 1.8;
|
||||
const BRUTE_FORCE_DELAY_MULTIPLIER_PER_IP = 4;
|
||||
|
||||
/**
|
||||
* Prevent brute force attacks by delaying the login .
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user