исправление ошибок git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@224 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-08-17 01:42:24 +00:00
commit a46d1b5176
3 changed files with 79 additions and 39 deletions

View file

@ -36,7 +36,7 @@ if ($bb_cfg['gender'])
{
$sql = DB()->fetch_rowset("SELECT user_gender FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")");
$data['male'] = $data['female'] = $data['unselect'] = 0;
foreach($sql as $row)
{
if($row['user_gender'] == MALE) $data['male']++;
@ -46,7 +46,7 @@ if ($bb_cfg['gender'])
}
// birthday stat
if($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled'])
if ($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled'])
{
$sql = DB()->fetch_rowset("SELECT user_id, username, user_birthday, user_birthday, user_level, user_rank FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .") ORDER BY user_level DESC, username");
$this_year = bb_date(TIMENOW, 'Y', '', false);
@ -65,12 +65,24 @@ if($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled'])
if ($user_birthday2 > $date_today && $user_birthday2 <= $date_forward)
{
// user are having birthday within the next days
$birthday_week_list[] = '<a href="'. PROFILE_URL . $row['user_id'] .'">'. wbr($row['username']) .'</a> <span class="small">('. birthday_age($row['user_birthday'], 1) .')</span>';
$birthday_week_list[] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'level' => $row['user_level'],
'rank' => $row['user_rank'],
'age' => $row['user_birthday'],
);
}
elseif ($user_birthday2 == $date_today)
{
//user have birthday today
$birthday_today_list[] = '<a href="'. PROFILE_URL . $row['user_id'] .'">'. wbr($row['username']) .'</a> <span class="small">('. birthday_age($row['user_birthday'], 1) .')</span>';
$birthday_today_list[] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'level' => $row['user_level'],
'rank' => $row['user_rank'],
'age' => $row['user_birthday'],
);
}
}

View file

@ -1572,43 +1572,48 @@ function bb_date ($gmepoch, $format = false, $tz = null, $replace = true)
}
$date = gmdate($format, $gmepoch + (3600 * $tz));
if (empty($lang))
{
require_once($bb_cfg['default_lang_dir'] .'lang_main.php');
}
$thetime = ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
if($replace)
{
$time_format = " H:i";
$time_format = " H:i";
$date = getdate();
$today = $date['mday'];
$month = $date['mon'];
$year = $date['year'];
$date = getdate();
$today = $date['mday'];
$month = $date['mon'];
$year = $date['year'];
$forum_date_today = @gmdate ("d", $gmepoch + (3600 * $tz));
$forum_date_month = @gmdate ("m", $gmepoch + (3600 * $tz));
$forum_date_year = @gmdate ("Y", $gmepoch + (3600 * $tz));
$forum_date_today = @gmdate ("d", $gmepoch + (3600 * $tz));
$forum_date_month = @gmdate ("m", $gmepoch + (3600 * $tz));
$forum_date_year = @gmdate ("Y", $gmepoch + (3600 * $tz));
if ($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year)
{
$thetime = $lang['TODAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year)
{
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today == 1 && $month != 1)
{
$yesterday = date ("t", mktime(0, 0, 0, ($month-1), 1, $year));
if ($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year)
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today == 1 && $month == 1)
{
$yesterday = date ("t", mktime(0, 0, 0, 12, 1, ($year -1)));
if ($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1))
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
}
return ($thetime);
if ($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year)
{
$thetime = $lang['TODAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year)
{
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today == 1 && $month != 1)
{
$yesterday = date ("t", mktime(0, 0, 0, ($month-1), 1, $year));
if ($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year)
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
elseif ($today == 1 && $month == 1)
{
$yesterday = date ("t", mktime(0, 0, 0, 12, 1, ($year -1)));
if ($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1))
$thetime = $lang['YESTERDAY'] . @gmdate($time_format, $gmepoch + (3600 * $tz));
}
}
return ($thetime);
}
// Birthday

View file

@ -337,12 +337,35 @@ if ($bb_cfg['show_latest_news'])
}
}
if($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled'])
if ($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled'])
{
$template->assign_vars(array(
'WHOSBIRTHDAY_WEEK' => ($stats['birthday_week_list']) ? sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $stats['birthday_week_list'])) : sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']),
'WHOSBIRTHDAY_TODAY' => ($stats['birthday_today_list']) ? $lang['BIRTHDAY_TODAY'] . join(', ', $stats['birthday_today_list']) : $lang['NOBIRTHDAY_TODAY'],
));
$week_list = $today_list = array();
if ($stats['birthday_week_list'])
{
foreach($stats['birthday_week_list'] as $week)
{
$week_list[] = '<a href="'. PROFILE_URL . $week['user_id'] .'">'. $week['username'] .'</a> <span class="small">('. birthday_age($week['age'], 1) .')</span>';
}
$week_list = join(', ', $week_list);
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], $week_list);
}
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
if ($stats['birthday_today_list'])
{
foreach($stats['birthday_today_list'] as $today)
{
$today_list[] = '<a href="'. PROFILE_URL . $today['user_id'] .'">'. $today['username'] .'</a> <span class="small">('. birthday_age($today['age'], 1) .')</span>';
}
$today_list = join(', ', $today_list);
$today_list = $lang['BIRTHDAY_TODAY'] . $today_list;
}
else $today_list = $lang['NOBIRTHDAY_TODAY'];
$template->assign_vars(array(
'WHOSBIRTHDAY_WEEK' => $week_list,
'WHOSBIRTHDAY_TODAY' => $today_list,
));
}
// Allow cron