diff --git a/upload/includes/datastore/build_stats.php b/upload/includes/datastore/build_stats.php
index 72dcfd1a3..1783b3b1a 100644
--- a/upload/includes/datastore/build_stats.php
+++ b/upload/includes/datastore/build_stats.php
@@ -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[] = ''. wbr($row['username']) .' ('. birthday_age($row['user_birthday'], 1) .')';
+ $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[] = ''. wbr($row['username']) .' ('. birthday_age($row['user_birthday'], 1) .')';
+ $birthday_today_list[] = array(
+ 'user_id' => $row['user_id'],
+ 'username' => $row['username'],
+ 'level' => $row['user_level'],
+ 'rank' => $row['user_rank'],
+ 'age' => $row['user_birthday'],
+ );
}
}
diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index 44ee11dbb..af325537b 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -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
diff --git a/upload/index.php b/upload/index.php
index 06a840291..298b92dd5 100644
--- a/upload/index.php
+++ b/upload/index.php
@@ -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[] = ''. $week['username'] .' ('. birthday_age($week['age'], 1) .')';
+ }
+ $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[] = ''. $today['username'] .' ('. birthday_age($today['age'], 1) .')';
+ }
+ $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