Файл: app/pages/users/online.php
Строк: 20
<?php
$smarty->header('Сейчас на сайте');
$all = $db->query("SELECT `id` FROM `users` WHERE `time_last` > '" . (time() - 600) ."'")->rowCount();
$pages = new Pages($all, $config['pages']);
$query = $db->query("SELECT `time_reg`, `time_last`, `id`, `level` FROM `users` WHERE `time_last` > '" . (time() - 600) . "' ORDER BY `time_last` DESC LIMIT " . $start . ", " . $config['pages']);
while ($list = $query->fetch())
{
$options = null;
if (isset($user) && $user['id'] != $list['id'])
{
$options[] = [
'url' => '/user/mail/chat?id=' . $list['id'],
'title' => Lang::word('Написать сообщение')
];
}
if (isset($user) && $user['level'] > $list['level'])
{
$options[] = [
'url' => '/admin/user/control?id=' . $list['id'],
'title' => Lang::word('Управление профилем')
];
}
$posts[] = [
'image' => User::photo($list['id']),
'title' => User::login($list['id']),
'post' => Lang::word('Регистрация') . ': '.Core::time($list['time_reg']) . '<br/>' . Lang::word('Посл. посещение') . ': '.Core::time($list['time_last']),
'options' => $options
];
}
if ($all == 0)
$posts[] = [
'title' => Lang::word('Нет пользователей.')
];
$smarty->assign([
'post' => $posts
]);
$smarty->display('posts.tpl');
$pages->view('?');
$smarty->footer();