Файл: forums/nep.php
Строк: 16
<?
include_once '../system/sys.php';
include '../system/funcs.php';
if (!isset ($us['id'])) {
header ('location: /');
exit;
}
H ('Непрочитанное', '<a href="/forum.php" style="color:white;">Форум</a> | Непрочитанное');
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` LEFT JOIN `forum_visit` ON `forum_t`.`id`=`forum_visit`.`id_t` AND `forum_visit`.`us`='" . $us['id'] . "' WHERE `forum_t`.`type` != '2' AND (`forum_visit`.`id_t` IS NULL)");
echo '
<div class="menu2">
Всего <b>' . $items . '</b> непрочитанных тем
</div>
';
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
$page = (int) $_GET['page'];
if ($page < 1)
$page = 1;
if ($page > $pages)
$page = $pages;
$start = $page * $items_per_page - $items_per_page;
if ($items==0) {
echo '<div class="list1">Непрочитанных тем пока нет..</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT `forum_t`.* FROM `forum_t` LEFT JOIN `forum_visit` ON `forum_t`.`id`=`forum_visit`.`id_t` AND `forum_visit`.`us`='" . $us['id'] . "' WHERE `forum_t`.`type` != '2' AND (`forum_visit`.`id_t` IS NULL) ORDER BY `id` DESC LIMIT $start, $items_per_page");
while ($t = $query -> fetch()) {
$r = DB :: $dbs -> queryFetch ("SELECT * FROM `foruM_r` WHERE (`id`='" . $t['id_r'] . "')");
$pr = DB :: $dbs -> queryFetch ("SELECT * FROM `foruM_pr` WHERE (`id`='" . $t['id_pr'] . "')");
$c_p = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`id_t`='" . $t['id'] . "') " . ($us['level']>0 ? '' : 'AND (`del` = '0')'));
echo '
<div class="list1">
Раздел: <a href="/forum/razd' . $r['id'] . '">' . $r['name'] . '</a><br/>
Подраздел: <a href="/forum/' . $r['id'] . '/' . $pr['id'] . '">' . $pr['name'] . '</a><br/>
<img src="/design/' . ($t['top']==1 ? 'prikrep' : ($t['type']==0 ? 'closed' : 'the')) . '.png" alt=""/> <a href="/forum/thema' . $t['id'] . '">' . $t['name'] . '</a> (' . $c_p . ') <a href="/forum/thema' . $t['id'] . '/page' . ceil ( $c_p / 10 ) .'">></a><br/>
' . uNick ( $t['us'] ) . ' / ' . uNick ( $t['last'] ) . ' (' . datef ($t['time']) . ')
</div>
';
}
echo '<div class="list1">' . pages ('/forum/nep') . '</div>';
}
F ();
?>