Файл: birthday.php
Строк: 37
<?php
define('IN_PHPBB', true);
$phpbb_root_path='./';
include($phpbb_root_path.'extension.inc');
include($phpbb_root_path.'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$sql = "SELECT user_id, username, user_birthday, user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY DATE_FORMAT(from_unixtime(user_birthday*86400+1),'%m%d') asc";
if($result = $db->sql_query($sql))
{
if (!empty($result))
{
$time_now = time();
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*2629743), $board_config['board_timezone']);
while ($birthdayrow = $db->sql_fetchrow($result))
{
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 > $date_today && $user_birthday2 <= $date_forward )
{
$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']);
$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '">' . $birthdayrow['username'] . ' ('.$user_age.')</a><br/>'.realdate("d.M.Y",$birthdayrow['user_birthday']).'<br/>';
}
else if ( $user_birthday2 == $date_today )
{
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '">' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
}
}
if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
}
$db->sql_freeresult($result);
}
if($birthday_today_list==null)
{
$birthday_today_list = 'Именинников сегодня нет';
}
if($birthday_week_list==null)
{
$birthday_week_list = 'Именинников в ближайшие 30 дней нет';
}
$page_title = 'Календарь';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'birthday_body.tpl')
);
$template->assign_vars(array(
'WHOSBIRTHDAY_WEEK' => $birthday_week_list,
'WHOSBIRTHDAY_TODAY' => $birthday_today_list
)
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>