Файл: soc-set/faq/smiles.php
Строк: 17
<?php
require_once('../core/start.php');
check_auth();
head('FAQ: Смайлы');
panel();
switch ($select) {
default:
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SMILES_CAT."");
if (empty($all)) {
echo DIV_BLOCK . 'Каталоги не созданы' . CLOSE_DIV;
} else {
$sql = DB::$dbs->query("SELECT * FROM ".SMILES_CAT."");
while($cat = $sql -> fetch()) {
$smiles = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SMILES." WHERE `cat_id` = ?", array($cat['id']));
echo DIV_LI;
echo '<a href="'.HOME.'/smiles/'.$cat['id'].'/">'.$cat['name'].'</a> ['.$smiles.']';
echo CLOSE_DIV;
}
}
$array = array('Информация', 'Смайлы');
nav($array);
break;
case 'cat':
$id = abs(num($_GET['id']));
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SMILES." WHERE `cat_id` = ? ", array($id));
if ($all == 0) {
echo DIV_AUT . 'Смайлов нет' . CLOSE_DIV;
} else {
$n = new Navigator($all,10,'id='.$id.'&select=cat');
$sql = DB::$dbs->query("SELECT * FROM ".SMILES." WHERE `cat_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, 10", array($id));
while($smile = $sql -> fetch()) {
echo DIV_LI;
echo '<img src="'.HOME.'/files/smiles/'.$smile['url'].'" /> ' . $smile['name'];
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Информация', 'Смайлы');
nav($array);
break;
}
require_once('../core/stop.php');
?>