Add more Strings::isHex() checks to photos
This commit is contained in:
parent
392137b433
commit
4c5dd9f47c
2 changed files with 5 additions and 2 deletions
|
@ -188,6 +188,9 @@ function photos_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc > 3 && $a->argv[2] === 'album') {
|
if ($a->argc > 3 && $a->argv[2] === 'album') {
|
||||||
|
if (!Strings::isHex($a->argv[3])) {
|
||||||
|
$a->internalRedirect();
|
||||||
|
}
|
||||||
$album = hex2bin($a->argv[3]);
|
$album = hex2bin($a->argv[3]);
|
||||||
|
|
||||||
if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
|
if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
|
||||||
|
@ -960,7 +963,7 @@ function photos_content(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$selname = $datum ? hex2bin($datum) : '';
|
$selname = Strings::isHex($datum) ? hex2bin($datum) : '';
|
||||||
|
|
||||||
$albumselect = '';
|
$albumselect = '';
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Strings
|
||||||
*/
|
*/
|
||||||
public static function isHex($hexCode)
|
public static function isHex($hexCode)
|
||||||
{
|
{
|
||||||
return @preg_match("/^[a-f0-9]{2,}$/i", $hexCode) && !(strlen($hexCode) & 1);
|
return !empty($hexCode) ? @preg_match("/^[a-f0-9]{2,}$/i", $hexCode) && !(strlen($hexCode) & 1) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue