update dependencies and add voku\AntiXSS

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2020-10-31 15:50:16 +01:00
parent 63d00cd453
commit 6bf5eccc24
3 changed files with 1436 additions and 272 deletions

View File

@@ -46,7 +46,8 @@
"phpmailer/phpmailer": "~6.0",
"monolog/monolog": "^1.24",
"robthree/twofactorauth": "^1.6",
"froxlor/idna-convert-legacy": "^2.1"
"froxlor/idna-convert-legacy": "^2.1",
"voku/anti-xss": "^4.1"
},
"require-dev": {
"phpunit/phpunit": "8.4.1",

1676
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -223,9 +223,17 @@ class PhpHelper
*/
public static function gethostbynamel6($host, $try_a = true)
{
$dns6 = dns_get_record($host, DNS_AAAA);
$dns6 = @dns_get_record($host, DNS_AAAA);
if (!is_array($dns6)) {
// no record or failed to check
$dns6 = [];
}
if ($try_a == true) {
$dns4 = dns_get_record($host, DNS_A);
$dns4 = @dns_get_record($host, DNS_A);
if (!is_array($dns4)) {
// no record or failed to check
$dns4 = [];
}
$dns = array_merge($dns4, $dns6);
} else {
$dns = $dns6;
@@ -382,4 +390,21 @@ class PhpHelper
}
return $returnval;
}
/**
* function to check a super-global passed by reference
* so it gets automatically updated
*
* @param array $global
* @param \voku\helper\AntiXSS $antiXss
*/
public static function cleanGlobal(&$global = [], &$antiXss)
{
if (isset($global) && ! empty($global)) {
$tmp = $global;
foreach ($tmp as $index => $value) {
$global[$index] = $antiXss->xss_clean($value);
}
}
}
}