mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r222
git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@222 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
b224e95c84
commit
3507f4fc8d
2 changed files with 39 additions and 41 deletions
|
@ -29,23 +29,49 @@ $data['leechers'] = number_format($row['leechers']);
|
||||||
$data['peers'] = number_format($row['seeders'] + $row['leechers']);
|
$data['peers'] = number_format($row['seeders'] + $row['leechers']);
|
||||||
$data['speed'] = $row['speed'];
|
$data['speed'] = $row['speed'];
|
||||||
|
|
||||||
// gender + birthday stat
|
global $bb_cfg, $lang;
|
||||||
$sql = DB()->fetch_rowset("SELECT user_gender, user_id, username, user_birthday, user_level, user_rank FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .") ORDER BY user_level DESC, username");
|
|
||||||
$birthday = array();
|
// gender stat
|
||||||
|
$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;
|
$data['male'] = $data['female'] = $data['unselect'] = 0;
|
||||||
foreach($sql as $row)
|
foreach($sql as $row)
|
||||||
{
|
{
|
||||||
if($row['user_gender'] == 1) $data['male']++;
|
if($row['user_gender'] == 1) $data['male']++;
|
||||||
if($row['user_gender'] == 2) $data['female']++;
|
if($row['user_gender'] == 2) $data['female']++;
|
||||||
if(!$row['user_gender']) $data['unselect']++;
|
if(!$row['user_gender']) $data['unselect']++;
|
||||||
if($row['user_birthday']) $birthday[] = array(
|
|
||||||
'username' => $row['username'],
|
|
||||||
'user_id' => $row['user_id'],
|
|
||||||
'user_rank' => $row['user_rank'],
|
|
||||||
'user_level' => $row['user_level'],
|
|
||||||
'user_birthday' => $row['user_birthday'],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
$data['birthday'] = $birthday;
|
|
||||||
|
// birthday stat
|
||||||
|
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);
|
||||||
|
$date_today = bb_date(TIMENOW, 'Ymd', '', false);
|
||||||
|
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday']['check_day']*86400), 'Ymd', '', false);
|
||||||
|
|
||||||
|
$birthday_today_list = $birthday_week_list = array();
|
||||||
|
|
||||||
|
foreach ($sql as $row)
|
||||||
|
{
|
||||||
|
$user_birthday = realdate($row['user_birthday'], 'md');
|
||||||
|
$user_birthday2 = $this_year . $user_birthday;
|
||||||
|
|
||||||
|
if ($user_birthday2 < $date_today) $user_birthday2 += 10000;
|
||||||
|
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['birthday_today_list'] = ($birthday_today_list) ? $lang['BIRTHDAY_TODAY'] . join(', ', $birthday_today_list) : $lang['NOBIRTHDAY_TODAY'];
|
||||||
|
$data['birthday_week_list'] = ($birthday_week_list) ? sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $birthday_week_list)) : sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->store('stats', $data);
|
$this->store('stats', $data);
|
||||||
|
|
|
@ -339,37 +339,9 @@ 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'])
|
||||||
{
|
{
|
||||||
$this_year = bb_date(TIMENOW, 'Y', '', false);
|
|
||||||
$date_today = bb_date(TIMENOW, 'Ymd', '', false);
|
|
||||||
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday']['check_day']*86400), 'Ymd', '', false);
|
|
||||||
|
|
||||||
$birthday_today_list = $birthday_week_list = array();
|
|
||||||
|
|
||||||
foreach ($stats['birthday'] as $birthdayrow)
|
|
||||||
{
|
|
||||||
$user_birthday = realdate($birthdayrow['user_birthday'], 'md');
|
|
||||||
$user_birthday2 = $this_year . $user_birthday;
|
|
||||||
|
|
||||||
if ($user_birthday2 < $date_today) $user_birthday2 += 10000;
|
|
||||||
|
|
||||||
if ($user_birthday2 > $date_today && $user_birthday2 <= $date_forward)
|
|
||||||
{
|
|
||||||
// user are having birthday within the next days
|
|
||||||
$birthday_week_list[] = '<a href="'. PROFILE_URL . $birthdayrow['user_id'] .'">'. wbr($birthdayrow['username']) .'</a> <span class="small">('. birthday_age($birthdayrow['user_birthday'], 1) .')</span>';
|
|
||||||
}
|
|
||||||
elseif ($user_birthday2 == $date_today)
|
|
||||||
{
|
|
||||||
//user have birthday today
|
|
||||||
$birthday_today_list[] = '<a href="'. PROFILE_URL . $birthdayrow['user_id'] .'">'. wbr($birthdayrow['username']) .'</a> <span class="small">('. birthday_age($birthdayrow['user_birthday'], 1) .')</span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$birthday_today_list = ($birthday_today_list) ? $lang['BIRTHDAY_TODAY'] . join(', ', $birthday_today_list) : $lang['NOBIRTHDAY_TODAY'];
|
|
||||||
$birthday_week_list = ($birthday_week_list) ? sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $birthday_week_list)) : sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'WHOSBIRTHDAY_WEEK' => $birthday_week_list,
|
'WHOSBIRTHDAY_WEEK' => $stats['birthday_week_list'],
|
||||||
'WHOSBIRTHDAY_TODAY' => $birthday_today_list,
|
'WHOSBIRTHDAY_TODAY' => $stats['birthday_today_list'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue