<?php
// 23.07.2015
$table = "users";
$title = $l ="Пользователи";
$link = $thisPage;
$lBack = profile :: getLink($user);
$tab = intval($_GET['tab']);
$tab = (in_array($tab, array(1,2)) ? $tab : 1);
require (CORE."head.php");
$query = "SELECT * FROM `{$table}` WHERE `id` <> '{$config['SYS_ID']}'".( $tab == 2 ? " AND `last_time` > '".(time()-$config['TIME_ONLINE'])."' ORDER by `last_time`" : " ORDER by `id`" )." DESC ";
$total = ($tab == 2 ? cache :: count_people_online() : cache :: count_people() );
if($total > 10) {
$p = (($_GET['p']) ? intval($_GET['p']) : 1);
$pagination = new pagination(10, $total, $p);
$query .= $pagination -> limit;
}
$q = DB :: $pdo -> query("{$query}");
$i = 0;
$in = 0;
?>
<div class="app-block">
<div class="sw-block"><div class="sw-cont sw-2">
<div class="sw-item"><a href="<?=$link?>?tab=1" class="sw-c<?=($tab == 1 ? " sw-act" : '' )?>">Все</a></div>
<div class="sw-item"><a href="<?=$link?>?tab=2" class="sw-c<?=($tab == 2 ? " sw-act" : '' )?>">Онлайн</a></div>
</div></div>
<div class="list _bg-blue _gray _font-m">
<?=( $tab == 2 ? "Сейчас" : "Всего зарегистрировано" )?> на сайте <?=$total." ".(profile :: getPhrase($total, array('человек','человека','людей')))?>
</div>
<?php
while($r = $q -> fetch()) {
echo system :: touch(profile :: getLink($r),"
<div class=\"post-l emotion-show\" data-emotions=\"". system::textOut($r['emotions']) ."\">
".profile :: userAvatar($r,0)."
</div>
<div class=\"post-c\">
<span class=\"_name\">".profile :: getFullName($r, true)." ".profile :: ver($r)." </span><br>
</div>
");
}
if($total > 10) echo $pagination -> printPages($thisLink."?");
require (CORE."foot.php");