Cod: Selectaţi tot
$sql = "SELECT user_id, username, user_birthday, user_level
FROM " . USERS_TABLE . "
WHERE user_birthday >= " . gmdate('md0000',time() + (3600 * $board_config['board_timezone'])) . "
AND user_birthday <gmdate>sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query members birthday information', '', __LINE__, __FILE__, $sql);
}
$user_birthdays = array();
while ( $row = $db->sql_fetchrow($result) )
{
$bday_year = $row['user_birthday'] % 10000;
$age = ( $bday_year ) ? ' ('.(gmdate('Y')-$bday_year).')' : '';
$color = '';
if ( $row['user_level'] == ADMIN )
{
$color = ' style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$color = ' style="color:#' . $theme['fontcolor2'] . '"';
}
$user_birthdays[] = '<a href="' . append_sid(" POST_USERS_URL=" . $row['user_id']) . '">' . $row['username'] . '</a>' . $age;
}
$db->sql_freeresult($result);
$birthdays = (!empty($user_birthdays)) ?
sprintf($lang['Congratulations'],implode(', ',$user_birthdays)) :
$lang['No_birthdays'];
if ( $board_config['bday_lookahead'] != -1 )
{
$start = gmdate('md9999',strtotime('+'.$board_config['bday_lookahead'].' day') + (3600 * $board_config['board_timezone']));
$end = gmdate('md0000',strtotime('+1 day') + (3600 * $board_config['board_timezone']));
$operator = ($start > $end) ? 'AND' : 'OR';
$sql = "SELECT user_id, username, user_birthday, user_level
FROM " . USERS_TABLE . "
WHERE (user_birthday <start>= $end)
AND user_birthday <> 0
AND user_active = 1
ORDER BY username DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query upcoming birthday information', '', __LINE__, __FILE__, $sql);
}
$upcoming_birthdays = array();
while ( $row = $db->sql_fetchrow($result) )
{
$bday_year = $row['user_birthday'] % 10000;
$age = ( $bday_year ) ? ' ('.(gmdate('Y')-$bday_year).')' : '';
$color = '';
if ( $row['user_level'] == ADMIN )
{
$color = ' style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$color = ' style="color:#' . $theme['fontcolor2'] . '"';
}
$upcoming_birthdays[] = '<a href="' . append_sid(" POST_USERS_URL=" . $row['user_id']) . '">' . $row['username'] . '</a>' . $age;
}
$upcoming = (!empty($upcoming_birthdays)) ?
sprintf($lang['Upcoming_birthdays'],$board_config['bday_lookahead'],implode(', ',$upcoming_birthdays)) :
sprintf($lang['No_upcoming'],$board_config['bday_lookahead']);
}
if ( !empty($user_birthdays) || !empty($upcoming_birthdays) || $board_config['bday_show'] )
{
$template->assign_block_vars('birthdays',array());
if ( !empty($upcoming_birthdays) || $board_config['bday_show'] )
{
$template->assign_block_vars('birthdays.upcoming',array());
}
}