Файл: sysadm/comes.php
Строк: 176
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut == true and $ya['level'] > 1) {
switch($do) {
case 'del':
$sql = $db -> query("SELECT * FROM `comes` WHERE `id` = '".$id."' LIMIT 1");
if ($sql -> num_rows > 0) {
$ass = $sql -> fetch_assoc();
$db -> query("DELETE FROM `comes` WHERE `id` = '".$id."' LIMIT 1");
header('location: ?do=read&mode='.$mode);
} else header('location: ?do=read&mode='.$mode);
break;
case'read':
$diz -> head('Модерирование комментариев');
$diz -> title('Модерирование комментариев');
if($mode=='news' or $mode=='books' or $mode=='load' or $mode=='obmen' or $mode=='albom' or $mode=='other'){
if($mode=='news' or $mode=='books' or $mode=='load' or $mode=='obmen' or $mode=='albom'){
$count = $db -> dbcount('COUNT(`id`)','comes',"`where`='$mode'");}
elseif($mode=='other' and $ya['level']==7){
$count = $db -> dbcount('COUNT(`id`)','comes',"`where`<>'load' and `where`<>'news' and `where`<>'book' and `where`<>'albom' and `where`<>'obmen'");
}
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
if ($count>0){
if($mode=='news' or $mode=='books' or $mode=='load' or $mode=='obmen' or $mode=='albom'){
$mode=shit($mode);
$for = $db -> query("SELECT * FROM `comes` WHERE `where`='$mode' ORDER BY `id` DESC LIMIT ".$start.",".$num);
}elseif($mode=='other' and $ya['level']==7){
$for = $db -> query("SELECT * FROM `comes` where `where`<>'load' and `where`<>'news' and `where`<>'book' and `where`<>'albom' and `where`<>'obmen' ORDER BY `id` DESC LIMIT ".$start.",".$num);
}else header('Location: comes.php');
while ($assoc = $for -> fetch_assoc()) {
echo '<div class="fon">'.$func->famname($assoc['user']).'
('.$func -> vremja($assoc['time']).') <a href="comes.php?id='.$assoc['id'].'&do=del&mode='.$mode.'&page='.$page.'">[Удалить]</a><br/>';
$text = $func -> tags($func -> smiles($assoc['text']));
echo''.$text.'</div>';
}
$act = '?do=read&mode='.$mode;
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon">Комментариев пока нет!</div>';
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
}else header('location: ?');
break;
//главная
default:
$diz -> head('Модерирование комментариев');
$diz -> title('Модерирование комментариев');
$book = $db -> dbcount('COUNT(`id`)','comes',"`where`='books'");
$bookn = $db -> dbcount('COUNT(`id`)','comes',"`where`='books' and `time` > ".(time()-86400)."");
if($bookn>0){$b='<font class="chet">+'.$bookn.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=books" class="menutuch">'.$diz -> img('r.png').' Комментарии библиотеки <span class="count"/>'.$book.''.$b.'</span></a></div>';
$albom = $db -> dbcount('COUNT(`id`)','comes',"`where`='albom'");
$albomn = $db -> dbcount('COUNT(`id`)','comes',"`where`='albom' and `time` > ".(time()-86400)."");
if($albomn>0){$a='<font class="chet">+'.$albomn.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=albom" class="menutuch">'.$diz -> img('r.png').' Комментарии к альбомам <span class="count"/>'.$albom.''.$a.'</span></a></div>';
$news = $db -> dbcount('COUNT(`id`)','comes',"`where`='news'");
$newsn = $db -> dbcount('COUNT(`id`)','comes',"`where`='news' and `time` > ".(time()-86400)."");
if($newsn>0){$n='<font class="chet">+'.$newsn.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=news" class="menutuch">'.$diz -> img('r.png').' Комментарии к новостям <span class="count"/>'.$news.''.$n.'</span></a></div>';
$load = $db -> dbcount('COUNT(`id`)','comes',"`where`='load'");
$loadn = $db -> dbcount('COUNT(`id`)','comes',"`where`='load' and `time` > ".(time()-86400)."");
if($loadn>0){$l='<font class="chet">+'.$loadn.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=load" class="menutuch">'.$diz -> img('r.png').' Комментарии ЗЦ <span class="count"/>'.$load.''.$l.'</span></a></div>';
$obmen = $db -> dbcount('COUNT(`id`)','comes',"`where`='obmen'");
$obmenn = $db -> dbcount('COUNT(`id`)','comes',"`where`='obmen' and `time` > ".(time()-86400)."");
if($obmenn>0){$o='<font class="chet">+'.$obmenn.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=obmen" class="menutuch">'.$diz -> img('r.png').' Комментарии обменника <span class="count"/>'.$obmen.''.$o.'</span></a></div>';
$other = $db -> dbcount('COUNT(`id`)','comes',"`where`<>'obmen' and `where`<>'load' and `where`<>'books' and `where`<>'albom' and `where`<>'news'");
if($ya['level']==7){
$othern = $db -> dbcount('COUNT(`id`)','comes',"`where`<>'obmen' and `where`<>'load' and `where`<>'books' and `where`<>'albom' and `where`<>'news' and `time` > ".(time()-86400)."");
if($othern>0){$othe='<font class="chet">+'.$othern.'</font>';}
echo '<div class="menu"><a href="?do=read&mode=other" class="menutuch">'.$diz -> img('r.png').' Прочие комментарии <span class="count"/>'.$other.''.$othe.'</span></a></div>';
}
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Админка</a></div>';
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
} else header('location: ../index.php');
?>