mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r255
упрощение вывода именинников git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@255 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
d68564590d
commit
b272eb83ca
5 changed files with 79 additions and 13 deletions
|
@ -74,6 +74,7 @@ class ajax_common
|
||||||
'view_torrent' => array('guest'),
|
'view_torrent' => array('guest'),
|
||||||
'user_register' => array('guest'),
|
'user_register' => array('guest'),
|
||||||
'posts' => array('guest'),
|
'posts' => array('guest'),
|
||||||
|
'birthday_list' => array('guest'),
|
||||||
);
|
);
|
||||||
|
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
@ -364,6 +365,52 @@ class ajax_common
|
||||||
else $this->ajax_die($lang['NOT_AUTHORISED']);
|
else $this->ajax_die($lang['NOT_AUTHORISED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function birthday_list()
|
||||||
|
{
|
||||||
|
global $bb_cfg, $lang, $datastore;
|
||||||
|
|
||||||
|
if (!$stats = $datastore->get('stats'))
|
||||||
|
{
|
||||||
|
$datastore->update('stats');
|
||||||
|
$stats = $datastore->get('stats');
|
||||||
|
}
|
||||||
|
|
||||||
|
$mode = (string) $this->request['mode'];
|
||||||
|
switch($mode)
|
||||||
|
{
|
||||||
|
case 'week':
|
||||||
|
if ($stats['birthday_week_list'])
|
||||||
|
{
|
||||||
|
foreach($stats['birthday_week_list'] as $week)
|
||||||
|
{
|
||||||
|
$html[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
|
||||||
|
}
|
||||||
|
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $html));
|
||||||
|
}
|
||||||
|
else $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'today':
|
||||||
|
if ($stats['birthday_today_list'])
|
||||||
|
{
|
||||||
|
foreach($stats['birthday_today_list'] as $today)
|
||||||
|
{
|
||||||
|
$html[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
|
||||||
|
}
|
||||||
|
$html = $lang['BIRTHDAY_TODAY'] . join(', ', $html);
|
||||||
|
}
|
||||||
|
else $html = $lang['NOBIRTHDAY_TODAY'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$html = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response['html'] = $html;
|
||||||
|
$this->response['mode'] = $mode;
|
||||||
|
}
|
||||||
|
|
||||||
function view_post ()
|
function view_post ()
|
||||||
{
|
{
|
||||||
require(AJAX_DIR .'view_post.php');
|
require(AJAX_DIR .'view_post.php');
|
||||||
|
@ -399,3 +446,4 @@ class ajax_common
|
||||||
require(AJAX_DIR .'posts.php');
|
require(AJAX_DIR .'posts.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ if ($bb_cfg['gender'])
|
||||||
// birthday stat
|
// 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_rank FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .") ORDER BY user_level DESC, username");
|
$sql = DB()->fetch_rowset("SELECT user_id, username, user_birthday, user_birthday, user_rank FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .") AND user_birthday != 0 ORDER BY user_level DESC, username");
|
||||||
$this_year = bb_date(TIMENOW, 'Y', 'false');
|
$this_year = bb_date(TIMENOW, 'Y', 'false');
|
||||||
$date_today = bb_date(TIMENOW, 'Ymd', 'false');
|
$date_today = bb_date(TIMENOW, 'Ymd', 'false');
|
||||||
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday']['check_day']*86400), 'Ymd', 'false');
|
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday']['check_day']*86400), 'Ymd', 'false');
|
||||||
|
|
|
@ -1565,10 +1565,7 @@ function bb_date ($gmepoch, $format = false, $tz = null)
|
||||||
if (is_null($tz))
|
if (is_null($tz))
|
||||||
{
|
{
|
||||||
$tz = $bb_cfg['board_timezone'];
|
$tz = $bb_cfg['board_timezone'];
|
||||||
$replace = true;
|
|
||||||
}
|
}
|
||||||
else $replace = false;
|
|
||||||
|
|
||||||
if (!$format)
|
if (!$format)
|
||||||
{
|
{
|
||||||
$format = $bb_cfg['default_dateformat'];
|
$format = $bb_cfg['default_dateformat'];
|
||||||
|
@ -1582,7 +1579,7 @@ function bb_date ($gmepoch, $format = false, $tz = null)
|
||||||
|
|
||||||
$thetime = ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
$thetime = ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
|
||||||
|
|
||||||
if($replace)
|
if(is_numeric($tz))
|
||||||
{
|
{
|
||||||
$time_format = " H:i";
|
$time_format = " H:i";
|
||||||
|
|
||||||
|
|
|
@ -340,25 +340,41 @@ 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'])
|
||||||
{
|
{
|
||||||
$week_list = $today_list = array();
|
$week_list = $today_list = array();
|
||||||
|
$week_all = $today_all = false;
|
||||||
|
|
||||||
if ($stats['birthday_week_list'])
|
if ($stats['birthday_week_list'])
|
||||||
{
|
{
|
||||||
foreach($stats['birthday_week_list'] as $week)
|
shuffle($stats['birthday_week_list']);
|
||||||
|
foreach($stats['birthday_week_list'] as $i => $week)
|
||||||
{
|
{
|
||||||
|
if($i >= 5)
|
||||||
|
{
|
||||||
|
$week_all = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$week_list[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
|
$week_list[] = profile_url($week) .' <span class="small">('. birthday_age($week['age']) .')</span>';
|
||||||
}
|
}
|
||||||
$week_list = join(', ', $week_list);
|
$week_all = ($week_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'birthday_list\', mode: \'week\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
|
||||||
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], $week_list);
|
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $week_list)) . $week_all;
|
||||||
}
|
}
|
||||||
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
|
else $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']);
|
||||||
|
|
||||||
if ($stats['birthday_today_list'])
|
if ($stats['birthday_today_list'])
|
||||||
{
|
{
|
||||||
foreach($stats['birthday_today_list'] as $today)
|
shuffle($stats['birthday_today_list']);
|
||||||
|
foreach($stats['birthday_today_list'] as $i => $today)
|
||||||
{
|
{
|
||||||
|
if($i >= 5)
|
||||||
|
{
|
||||||
|
$today_all = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$today_list[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
|
$today_list[] = profile_url($today) .' <span class="small">('. birthday_age($today['age'], 1) .')</span>';
|
||||||
}
|
}
|
||||||
$today_list = join(', ', $today_list);
|
$today_all = ($today_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'birthday_list\', mode: \'today\'}); return false;" title="'. $lang['ALL'] .'">...</a>' : '';
|
||||||
$today_list = $lang['BIRTHDAY_TODAY'] . $today_list;
|
$today_list = $lang['BIRTHDAY_TODAY'] . join(', ', $today_list) . $today_all;
|
||||||
}
|
}
|
||||||
else $today_list = $lang['NOBIRTHDAY_TODAY'];
|
else $today_list = $lang['NOBIRTHDAY_TODAY'];
|
||||||
|
|
||||||
|
|
|
@ -178,9 +178,14 @@
|
||||||
<p>{SPEED_STAT}</p>
|
<p>{SPEED_STAT}</p>
|
||||||
|
|
||||||
<!-- IF $bb_cfg['birthday']['enabled'] -->
|
<!-- IF $bb_cfg['birthday']['enabled'] -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
ajax.callback.birthday_list = function(data) {
|
||||||
|
$('#birthday_'+ data.mode).html(data.html);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
<div class="hr1" style="margin: 5px 0 4px;"></div>
|
<div class="hr1" style="margin: 5px 0 4px;"></div>
|
||||||
<p>{WHOSBIRTHDAY_TODAY}</p>
|
<p id="birthday_today">{WHOSBIRTHDAY_TODAY}</p>
|
||||||
<p>{WHOSBIRTHDAY_WEEK}</p>
|
<p id="birthday_week">{WHOSBIRTHDAY_WEEK}</p>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<div class="hr1" style="margin: 5px 0 4px;"></div>
|
<div class="hr1" style="margin: 5px 0 4px;"></div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue