updated to 0.0.1a
fixed a small error calculating the right time
to upgrade from 0.0.1 to 0.0.1a
Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
// Generate birthday ahead list if required ...
$birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . "
WHERE user_birthday <> ''
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
$now = getdate();
$today = (mktime(0, 0, 0, $now[mon], $now[mday], $now[year])) + $user->timezone + $user->dst + date('Z');
while ($row = $db->sql_fetchrow($result))
{
$birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
$user_birthday = strtotime($birthdaydate) + $user->timezone + $user->dst + date('Z');
if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($config['allow_birthdays_ahead'] * 86400) ) )
{
if ($row['user_colour'])
{
$user_colour = ' style="color:#' . $row['user_colour'] . '"';
$row['username'] = '<strong>' . $row['username'] . '</strong>';
}
else
{
$user_colour = '';
}
$birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '" title="' . date('d M', $user_birthday) . '">' . $row['username'] . '</a>';
if ( $age = (int) substr($row['user_birthday'], -4) )
{
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
}
}
}
$db->sql_freeresult($result);
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
// Generate birthday ahead list if required ...// Generate birthday ahead list if required ...
$birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . "
WHERE user_birthday <> ''
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$today = (mktime(0, 0, 0, $now[mon], $now[mday], $now[year]));
while ($row = $db->sql_fetchrow($result))
{
$birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
$user_birthday = strtotime($birthdaydate);
if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($config['allow_birthdays_ahead'] * 86400) ) )
{
if ($row['user_colour'])
{
$user_colour = ' style="color:#' . $row['user_colour'] . '"';
$row['username'] = '<strong>' . $row['username'] . '</strong>';
}
else
{
$user_colour = '';
}
$birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '" title="' . date('d M', $user_birthday) . '">' . $row['username'] . '</a>';
if ( $age = (int) substr($row['user_birthday'], -4) )
{
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
}
}
}
$db->sql_freeresult($result);
}