From 8b079894f3e528c9ffe652f8f3a041599d8cbdc0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 6 Aug 2006 17:25:29 +0000 Subject: - finally making the age calculation work [Bug #3582] - replacing all occurances of L_NONE with a more specific string [Bug #3494] - a few corrections to html id attributes in the installer - using correct permission in mcp_report [Bug #2471] - allow deleting the avatar, when no upload method is enabled and hide the delete button if no avatar is set git-svn-id: file:///svn/phpbb/trunk@6241 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 694f173268..43aca88ade 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1072,7 +1072,18 @@ while ($row = $db->sql_fetchrow($result)) if ($bday_year) { - $user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - (($today['month'] - $bday_month < 0) ? 1 : (($today['day'] - $bday_day < 0) ? 1 : 0))); + $diff = $today['month'] - $bday_month; + if ($diff == 0) + { + $diff = ($today['day'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $age = (int) (date('Y', $time) - $bday_year - $diff); + $user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - $diff); } } } -- cgit v1.2.1