Файл: pages/app/category.php
Строк: 44
<?php
/*
** Автор кода: Евгений (rnddev)
** ICQ: 448235
** Email: rnddev@mail.ru
** Skype: rnddev
** Все права принадлежат автору.
** Модефикация и продажа запрещены.
*/
define('ACCESS', TRUE);
define('R', $_SERVER['DOCUMENT_ROOT']);
require_once R.'/system/bootstrap.php';
$tpl->getHead();
$id = abs(intval($_GET['id']));
$navi = new Pagination;
$query = $db->prepare("SELECT COUNT(*) as count
FROM video mov
INNER JOIN contact cont
ON (mov.id = cont.id_video)
WHERE cont.id_category = :id",
array(':id' => $id));
$colp = $query->fetch(PDO::FETCH_OBJ)->count;
$k_page = $navi->k_page($colp, PAGESTR);
$page = $navi->page($k_page);
define('START', (PAGESTR * $page - PAGESTR));
$sql = $db->prepare("SELECT mov.name, mov.id, mov.screen, mov.timeleft, mov.view_count
FROM video mov
INNER JOIN contact cont
ON (mov.id = cont.id_video)
WHERE cont.id_category = :id
ORDER BY id DESC LIMIT ".START.", ".PAGECAT,
array(':id' => $id));
if($sql->fetch() !== false) {
echo '<div class="content"><center>';
while($row = $sql->fetch()) {
echo '<div class="videoBox">',
'<a class="img" href="'.HOST.'/view/'.$row['id'].'/">',
'<img src="/files/screen/'.$row['screen'].'" alt=""/>',
'<div class="info"><span>'.$row['view_count'].'</span>'.Main::timeleft($row['timeleft']).'</div>',
'</a>',
'<a href="'.HOST.'/view/'.$row['id'].'/">'.htmlspecialchars($row['name']).'</a>',
'</div>';
}
echo '</center></div>';
if ($k_page > 1) $navi->navig('/category/'.$id.'/page', $k_page, $page);
} else { echo '<div class="content">Категория пуста!</div>'; }
$tpl->getFoot();