From 7e3a86aab84b5de022ccc075efbb7e5a544c4dfc Mon Sep 17 00:00:00 2001 From: "Duck (Jakob Munih)" Date: Tue, 28 Apr 2009 19:51:56 +0200 Subject: [PATCH] avoid malware dates --- folks/lib/Folks.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/folks/lib/Folks.php b/folks/lib/Folks.php index 5adfbbccb..fad96af0e 100644 --- a/folks/lib/Folks.php +++ b/folks/lib/Folks.php @@ -117,6 +117,10 @@ class Folks { */ static public function calcAge($birthday) { + if (substr($birthday, 0, 4) == '0000') { + return array('age' => '', 'sign' => ''); + } + list($year, $month, $day) = explode('-', $birthday); $year_diff = date('Y') - $year; $month_diff = date('m') - $month; @@ -128,7 +132,7 @@ class Folks { $year_diff--; } - if ($year_diff < 1 || $year == '0000') { + if (empty($year_diff)) { return array('age' => '', 'sign' => ''); } -- 2.11.0