Файл: panel/moder.php
Строк: 26
<?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();
if (privilegy('moder') == FALSE) {
header("Location: ".HOME."/panel/");
exit();
}
switch ($select) {
default:
head('Moderatsiya');
$files = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FILES_FILE." WHERE `status` = '1' ");
echo DIV_LI . '<a href="'.HOME.'/panel/moder/usfiles/">Shahsiy fayllar</a> ['.$files.']' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/panel/">Boshqaruv paneli</a> / <b>Moderatsiya</b>' . CLOSE_DIV;
break;
case 'usfiles':
head('Moderatsiya | Shahsiy fayllar');
if (isset($_GET['dopusk'])) {
DB::$dbs->query("UPDATE ".FILES_FILE." SET `status` = '0' WHERE `id` = ? ", array(abs(num($_GET['dopusk']))));
echo DIV_MSG . 'Fayl kiritilishiga ruhsat berildi' . CLOSE_DIV;
}
if (isset($_GET['delete'])) {
$file = DB::$dbs->queryFetch("SELECT * FROM ".FILES_FILE." WHERE `id` = ? ", array(abs(num($_GET['delete']))));
@unlink('../../files/usfiles/' . $file['url']);
DB::$dbs->query("DELETE FROM ".FILES_FILE." WHERE `id` = ? ", array(abs(num($_GET['delete']))));
echo DIV_MSG . 'Fayl o`chirildi' . CLOSE_DIV;
}
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FILES_FILE." WHERE `status` = '1' ");
if (empty($all)) {
echo DIV_BLOCK . 'Moderatsiyada fayllar yo`q' . CLOSE_DIV;
} else {
$n = new Navigator($all,10,'select=usfiles');
$sql = DB::$dbs->query("SELECT * FROM ".FILES_FILE." WHERE `status` = '1' ORDER BY `id` DESC LIMIT {$n->start()}, 10 ");
while($file = $sql -> fetch()) {
echo DIV_LI . '<a href="'.HOME.'/files/'.$file['user_id'].'/'.$file['folder_id'].'/'.$file['id'].'/">'.$file['name'].'</a> | Kiritdi: '.userLink($file['user_id']).' | '.$file['type'].' | '.get_size($file['size']).' <b><a href="?dopusk='.$file['id'].'">[Ruhsat berish]</a></b> <b><a href="?delete='.$file['id'].'">[O1chirish]</a></b>' . CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/panel/">Boshqaruv paneli</a> / <a href="'.HOME.'/panel/moder/">Moderatsiya</a> / <b>Личные файлы</b>' . CLOSE_DIV;
break;
}
require_once('../core/stop.php');
?>