]> git.mxchange.org Git - friendica.git/commitdiff
bug #511 - if birth year supplied but not a month or day, force a sane default. PHP...
authorfriendica <info@friendica.com>
Sun, 2 Dec 2012 21:47:41 +0000 (13:47 -0800)
committerfriendica <info@friendica.com>
Sun, 2 Dec 2012 21:47:41 +0000 (13:47 -0800)
mod/profiles.php

index e30c982182d74b1ceff4f84cf9afa57f97c4a17b..d4a3db83e0b104516c9c28fcdbfb49e3533825c2 100644 (file)
@@ -42,6 +42,13 @@ function profiles_post(&$a) {
                $day = intval($_POST['day']);
                        if(($day > $mtab[$month]) || ($day < 0))
                                $day = 0;
+
+               // It's OK to have an empty (0) year, but if you supplied a year you have to have a non-zero month and day
+               if($year && ! $month)
+                       $month = 1;
+               if($year && ! $day)
+                       $day = 1;
+
                $dob = '0000-00-00';
                $dob = sprintf('%04d-%02d-%02d',$year,$month,$day);