Файл: 4mast/profmas.ru/adm/blogs.php
Строк: 22
<?php
function _highlight_code($code)
{
$code = stripslashes($code);
$code = trim($code);
return highlight_string($code,true);
}
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if (!isset ($us)) {
header ('location: /');
exit;
}
if ($us['level']<2) {
header ('location:/');
exit;
}
H ('Панель управления', '<a href="/adm"/>Модерация статей</a>');
if (isset($_GET['yes']))
{
DB::$dbs->query('UPDATE `blogs` SET `check` = "1" WHERE `id` = '.DB::$dbs->quote($_GET['yes']));
}
if (isset($_GET['no']))
{
DB::$dbs->query('DELETE FROM `blogs` WHERE `id` = '.DB::$dbs->quote($_GET['no']));
}
if (isset($_GET['show'])
AND DB::$dbs->query('SELECT `id` FROM `blogs` WHERE `id` = '.DB::$dbs->quote($_GET['show']))->rowCount() == 1)
{
$row=DB::$dbs -> query('SELECT `sub` FROM `blogs` WHERE `id` = '.DB::$dbs->quote($_GET['show']))->fetch(PDO::FETCH_LAZY);
echo '<div class="block"><span style="word-wrap:break-word;">',_highlight_code($row->sub),'</div>';
}
$query=DB::$dbs -> query('SELECT * FROM `blogs` WHERE `check` = "0" ORDER BY `id` DESC');
if ($query->rowCount() == 0)
{
echo '<div class="error">Нет статей на модерации</div>';
}
else
{
while ($row = $query -> fetch(PDO::FETCH_LAZY))
{
echo '<div class="block"><a href="/adm/blogs.php?show=',$row->id,'">',$row->name,'</a>
<a href="?yes=',$row->id,'" style="color: green;">[Одобрить]</a> / <a style="color: red;" href="?no=',$row->id,'">[Отклонить]</a></div>';
}
}
require_once('../includes/Footers.php');
?>