Accept empty values for profile birthday

This commit is contained in:
Hypolite Petovan 2020-02-09 02:17:48 -05:00
parent 7180fa18dd
commit 5552f5ee72
1 changed files with 8 additions and 8 deletions

View File

@ -40,16 +40,16 @@ class Index extends BaseSettings
Hook::callAll('profile_post', $_POST); Hook::callAll('profile_post', $_POST);
$dob = Strings::escapeHtml(trim($_POST['dob'] ?? '0000-00-00')); $dob = trim($_POST['dob'] ?? '');
$y = substr($dob, 0, 4); if ($dob && !in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
if ((!ctype_digit($y)) || ($y < 1900)) { $y = substr($dob, 0, 4);
$ignore_year = true; if ((!ctype_digit($y)) || ($y < 1900)) {
} else { $ignore_year = true;
$ignore_year = false; } else {
} $ignore_year = false;
}
if (!in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) { if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
$ignore_year = true; $ignore_year = true;
$dob = substr($dob, 5); $dob = substr($dob, 5);