aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profiles.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-11-11 01:05:29 -0800
committerfriendica <info@friendica.com>2014-11-11 01:05:29 -0800
commit325b269b224615a9c584e0ec631a11d68bb24eb8 (patch)
treef5645acf4db71fcfa3b756fcf37578e4dc7a47f1 /mod/profiles.php
parent0a84b45793735645357986bab20a0ed3cda80b38 (diff)
downloadvolse-hubzilla-325b269b224615a9c584e0ec631a11d68bb24eb8.tar.gz
volse-hubzilla-325b269b224615a9c584e0ec631a11d68bb24eb8.tar.bz2
volse-hubzilla-325b269b224615a9c584e0ec631a11d68bb24eb8.zip
the code is a bit crufty, but this should fix issue #687
Diffstat (limited to 'mod/profiles.php')
-rw-r--r--mod/profiles.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/mod/profiles.php b/mod/profiles.php
index 86de72629..bea006384 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -234,6 +234,22 @@ function profiles_post(&$a) {
}
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
+
+ $y = substr($dob,0,4);
+ if((! ctype_digit($y)) || ($y < 1900))
+ $ignore_year = true;
+ else
+ $ignore_year = false;
+
+ if($dob != '0000-00-00') {
+ if(strpos($dob,'0000-') === 0) {
+ $ignore_year = true;
+ $dob = substr($dob,5);
+ }
+ $dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
+ if($ignore_year)
+ $dob = '0000-' . $dob;
+ }
$name = escape_tags(trim($_POST['name']));