Файл: pages/smiles.php
Строк: 60
<?
include('../core/core.php');
include(MAINDIR.'style/head.php');
title('Список смайлов');
echo'<div class="title">Список смайлов</div>';
switch ($mode):
case 'index':
echo'<div class="menu"><b>Общие смайлы</b> | <a href="?mode=admsmiles">Админские смайлы</a></div><div class="menu">';
define('TOPAGE',10); $num = TOPAGE;
$links = '?mode=index&page=';
$page = intval($_GET['page']);
$posts = DB::run() -> query("SELECT * FROM `smiles` WHERE `smiles_cats`=?",array(1)) -> rowCount();
$total = intval(($posts - 1) / $num) + 1;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$themes = DB::run()->query("SELECT * FROM `smiles` WHERE `smiles_cats`=? LIMIT $start,".TOPAGE."",array(1));
$themes = $themes -> fetchAll();
foreach($themes AS $u){
echo'<img src="/images/smiles/'.$u['smiles_name'].'"> - '.$u['smiles_code'].'<br />';
}
if ($page != 1) $pervpage = '<a href= '.$links.'1><<</a> <a href= '.$links.''. ($page - 1) .'><</a> ';
if ($page != $total) $nextpage = ' <a href= '.$links.''. ($page + 1) .'>></a> <a href= '.$links.'' .$total. '>>></a>';
if($page - 2 > 0) $page2left = ' <a href= '.$links.''. ($page - 2) .'>'. ($page - 2) .'</a> | ';
if($page - 1 > 0) $page1left = '<a href= '.$links.''. ($page - 1) .'>'. ($page - 1) .'</a> | ';
if($page + 2 <= $total) $page2right = ' | <a href= '.$links.''. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' | <a href= '.$links.''. ($page + 1) .'>'. ($page + 1) .'</a>';
echo '</div><div class="menu_2">'.$pervpage.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.$nextpage.'</div>';
break;
case 'admsmiles':
echo'<div class="menu"><a href="?mode=index">Общие смайлы</a> | <b>Админские смайлы</b></div><div class="menu">';
define('TOPAGE',10); $num = TOPAGE;
$links = '?mode=admsmiles&page=';
$page = intval($_GET['page']);
$posts = DB::run() -> query("SELECT * FROM `smiles` WHERE `smiles_cats`=?",array(2)) -> rowCount();
$total = intval(($posts - 1) / $num) + 1;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$themes = DB::run()->query("SELECT * FROM `smiles` WHERE `smiles_cats`=? LIMIT $start,".TOPAGE."",array(2));
$themes = $themes -> fetchAll();
foreach($themes AS $u){
echo'<img src="/images/smiles2/'.$u['smiles_name'].'"> - '.$u['smiles_code'].'<br />';
}
if ($page != 1) $pervpage = '<a href= '.$links.'1><<</a> <a href= '.$links.''. ($page - 1) .'><</a> ';
if ($page != $total) $nextpage = ' <a href= '.$links.''. ($page + 1) .'>></a> <a href= '.$links.'' .$total. '>>></a>';
if($page - 2 > 0) $page2left = ' <a href= '.$links.''. ($page - 2) .'>'. ($page - 2) .'</a> | ';
if($page - 1 > 0) $page1left = '<a href= '.$links.''. ($page - 1) .'>'. ($page - 1) .'</a> | ';
if($page + 2 <= $total) $page2right = ' | <a href= '.$links.''. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' | <a href= '.$links.''. ($page + 1) .'>'. ($page + 1) .'</a>';
echo '</div><div class="menu_2">'.$pervpage.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.$nextpage.'</div>';
break;
break;
default:
header ('location: ?mode=index');
endswitch;
include(MAINDIR.'style/foot.php');
?>