Файл: moduls/lenta/index.php
Строк: 24
<?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('Tasma');
if (isset($_GET['del'])) {
DB::$dbs->query("DELETE FROM ".LENTA." WHERE `id` = ? && `user_id` = ? ", array(num($_GET['del']), $user['user_id']));
header("Location: ".HOME."/lenta/");
}
if (!empty($_POST['clean'])) {
DB::$dbs->query("DELETE FROM ".LENTA." WHERE `user_id` = ? ", array($user['user_id']));
header("Location: ".HOME."/lenta/");
}
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".LENTA." WHERE `user_id` = ? ", array($user['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Tasma bo`sh' . CLOSE_DIV;
} else {
echo '<form action="#" method="POST">';
$n = new Navigator($all,$config['write']['guest'],'');
$sql = DB::$dbs->query("SELECT * FROM ".LENTA." WHERE `user_id` = ? ORDER BY `id` DESC LIMIT {$n->start()}, ".$config['write']['guest']."", array($user['user_id']));
while($post = $sql -> fetch()) {
echo DIV_BLOCK . vrem($post['time']) . '</b> <a href="?del='.$post['id'].'">[O`chr.]</a><br />' . text($post['text']) . CLOSE_DIV;
if ($post['status'] == 1) {
DB::$dbs->query("UPDATE ".LENTA." SET `status` = '0' WHERE `id` = ? ", array($post['id']));
}
}
echo $n->navi();
echo DIV_LI . '<input type="submit" name="clean" value="Tasmani tozalash"/></form>' . CLOSE_DIV;
}
$array = array('Tasma');
nav($array);
require_once('../../core/stop.php');
?>