Code: Alles auswählen
$birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<span title="' . $user->format_dateucb(($ucbirthdayrow[$i]['user_birthday_tstamp']), 'D, j. M') . '">' . $user_link . '</span>';
Code: Alles auswählen
$birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<span title="' . $user->format_dateucb(($ucbirthdayrow[$i]['user_birthday_tstamp']), 'D, j. M') . '">' . $user_link . '</span>';
Code: Alles auswählen
function get_upcbirthdays()
{
global $cache, $config, $db, $user, $auth;
global $template, $phpbb_root_path, $phpEx;
$birthday_ahead_list = '';
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . "
WHERE user_birthday NOT LIKE '%- 0-%'
AND user_birthday NOT LIKE '0-%'
AND user_birthday NOT LIKE '0- 0-%'
AND user_birthday NOT LIKE ''
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY username';
//BEGIN for those of you who have the prime birthday mod installed, code provided by primehalo
$prime_birthdate_installed = function_exists('user_show_congrats');
if ($prime_birthdate_installed)
{
$sql = str_replace('FROM ' . USERS_TABLE, ', user_show_age FROM ' . USERS_TABLE, $sql);
}
//END for those of you who have the prime birthday mod installed, code provided by primehalo
$result = $db->sql_query($sql);
//delete the above line and uncomment below line if you want to cache the query for an hour
//$result = $db->sql_query($sql,3600);
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$today = (mktime(0, 0, 0, $now['mon'], $now['mday'], $now['year']));
$ucbirthdayrow = array();
while ($row = $db->sql_fetchrow($result))
{
$birthdaycheck = strtotime(gmdate('Y') . '-' . (int) trim(substr($row['user_birthday'],3,-5)) . '-' . (int) trim(substr($row['user_birthday'],0,-8) ));
$birthdayyear = ( $birthdaycheck < $today ) ? gmdate('Y') + 1 : gmdate('Y');
$birthdaydate = ($birthdayyear . '-' . (int) trim(substr($row['user_birthday'],3,-5)) . '-' . (int) trim(substr($row['user_birthday'],0,-8) ));
$ucbirthdayrow[] = array(
'username' => $row['username'],
'user_birthday_tstamp' => strtotime($birthdaydate),
'user_birthdayyear' => $birthdayyear,
'user_birthday' => $row['user_birthday'],
'user_id' => $row['user_id'],
'user_show_age' => (isset($row['user_show_age'])) ? $row['user_show_age'] : 0,
'user_colour' => $row['user_colour']);
}
$db->sql_freeresult($result);
//sort($ucbirthdayrow);
for ($i = 0, $end = sizeof($ucbirthdayrow); $i < $end; $i ++)
{
if ( $ucbirthdayrow[$i]['user_birthday_tstamp'] >= ($today + 86400) && $ucbirthdayrow[$i]['user_birthday_tstamp'] <= ($today + ((($config['allow_birthdays_ahead'] >365) ? 365 : $config['allow_birthdays_ahead']) * 86400) ) )
{
// BEGIN for those of you who have the prime birthday mod installed, code provided by primehalo
if ($prime_birthdate_installed)
{
if (!user_show_congrats($ucbirthdayrow[$i]['user_show_age']))
{
continue;
}
$ucbirthdayrow[$i]['user_birthday_tstamp'] = (user_show_age($ucbirthdayrow[$i]['user_show_age'])) ? $ucbirthdayrow[$i]['user_birthday_tstamp'] : '';
}
// END for those of you who have the prime birthday mod installed, code provided by primehalo
// Thanks to nickvergessen for the code suggestion
$user_link = get_username_string('full', $ucbirthdayrow[$i]['user_id'], $ucbirthdayrow[$i]['username'], $ucbirthdayrow[$i]['user_colour']);
//lets add to the birthday_ahead list.
$birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<span title="' . $user->format_dateucb(($ucbirthdayrow[$i]['user_birthday_tstamp']), 'D, j. M h') . '">' . $user_link . '</span>';
if ( $age = (int) substr($ucbirthdayrow[$i]['user_birthday'], -4) )
{
$birthday_ahead_list .= ' (' . ($ucbirthdayrow[$i]['user_birthdayyear'] - $age) . ')';
}
}
}
// Assign index specific vars
$template->assign_vars(array(
'BIRTHDAYS_AHEAD_LIST' => $birthday_ahead_list,
'L_BIRTHDAYS_AHEAD' => sprintf($user->lang['BIRTHDAYS_AHEAD'], ($config['allow_birthdays_ahead'] >365) ? 365 : $config['allow_birthdays_ahead']),
));
}