Файл: BlogExl_v_3/modules/admin/mod.php
Строк: 26
<?
if($user['level']<2){header('location:/');}
head('Модерация статей');
info();
$id = $func->num($_GET['id']);
$nk = $dbs->query("SELECT * FROM `blog` where `id` = '$id' limit 1")->fetch_assoc();
$ram = $dbs->query("SELECT * FROM `blog` where `activ` = '0'")->num_rows;
$num = 10;
$total = intval(($ram - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$moder = $dbs->query("SELECT * FROM `blog` WHERE `activ` = '0' ORDER BY `time` DESC LIMIT $start,$num");
if(!$moder->num_rows){echo '<div class="post2">На модерации статей нет!</div>';}
while($m = $moder->fetch_assoc()){
echo '<div class="post2"><a href="/read'.$m['id'].'">'.$m['name'].'</a><br/>'.mb_substr($m['msg'], 0, 130, 'utf-8').'...<a href="/read'.$m['id'].'">Далее</a><br/><a href="?id='.$m['id'].'&ok">[Активировать]</a> | <a href="?id='.$m['id'].'&del">[Удалить]</a></div>';
}
if (isset($_GET['ok'])){
$dbs->query("UPDATE `blog` SET `activ` = '1' WHERE `id` = '$id'");
$s = $dbs->query("SELECT * FROM `blog` where `id` = '$id' limit 1")->fetch_assoc();
$text = '[b]Система[/b]: Ваша статья <a href="/read'.$s['id'].'">'.$s['name'].'</a> успешно прошла Модерацию!';
$dbs->query("INSERT INTO `action` SET `id_us` = '$nk[id_us]', `time` = '$time', `read` = '0', `msg` = '$text'");
header('Location: ?');
}
if(isset($_GET['del'])){
$s = $dbs->query("SELECT * FROM `blog` where `id` = '$id' limit 1")->fetch_assoc();
$text = '[b]Система[/b]: Ваша статья <b>'.$s['name'].'</b> не прошла Модерацию!';
$dbs->query("INSERT INTO `action` SET `id_us` = '$nk[id_us]', `time` = '$time', `read` = '0', `msg` = '$text'");
unlink(URL.'/files/read/'.$s['file']);
$dbs->query("DELETE FROM `blog` WHERE `id` = '$id'");
header('Location: ?');
}
str('?&');
foot();
?>