aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/index.php')
-rw-r--r--phpBB/index.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/phpBB/index.php b/phpBB/index.php
index 0830dd0686..419b66cfdb 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -81,10 +81,10 @@ $db->sql_freeresult($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
-$birthday_list = '';
+$birthday_list = array();
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
- $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
+ $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
@@ -96,12 +96,17 @@ if ($config['load_birthdays'] && $config['allow_birthdays'])
while ($row = $db->sql_fetchrow($result))
{
- $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
+ $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
+ $birthday_year = (int) substr($row['user_birthday'], -4);
+ $birthday_age = ($birthday_year) ? $now['year'] - $birthday_year : '';
- if ($age = (int) substr($row['user_birthday'], -4))
- {
- $birthday_list .= ' (' . ($now['year'] - $age) . ')';
- }
+ $template->assign_block_vars('birthdays', array(
+ 'USERNAME' => $birthday_username,
+ 'AGE' => $birthday_age,
+ ));
+
+ // For 3.0 compatibility
+ $birthday_list[] = $birthday_username . (($birthday_year) ? ' (' . $birthday_age . ')' : '');
}
$db->sql_freeresult($result);
}
@@ -114,7 +119,7 @@ $template->assign_vars(array(
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'LEGEND' => $legend,
- 'BIRTHDAY_LIST' => $birthday_list,
+ 'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode(', ', $birthday_list),
'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'),
'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'),