Файл: moduls/faq/smiles.php
Строк: 20
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
check_auth();
head('Smayllar');
switch ($select) {
default:
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".SMILES_CAT."");
if (empty($all)) {
echo DIV_BLOCK . 'Bo`limlar ochilmagan' . 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 ''.icon('smile.png').' <a href="'.HOME.'/smiles/'.$cat['id'].'/">'.$cat['name'].'</a> ['.$smiles.']';
echo CLOSE_DIV;
}
}
$array = array('Ma`lumotlar', 'Smayllar');
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 . 'Smayllar yo`q' . 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'].'" width="20px;"/> ' . $smile['name'];
echo CLOSE_DIV;
}
echo $n->navi();
}
$array = array('Ma`lumotlar', 'Smayllar');
nav($array);
break;
}
require_once('../../core/stop.php');
?>