Файл: soc-set/moduls/forum/edit_post.php
Строк: 16
<?php
require_once('../../core/start.php');
check_auth();
$post = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_POST." WHERE `id` = ? ", array(abs(num($_GET['post']))));
$theme = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_THEME." WHERE `id` = ? ", array($post['theme_id']));
if (empty($post)) {
head('Пост не найден');
echo DIV_TITLE . 'Пост не найден' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/forum/">Форум</a> / <b>Пост не найден</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if ($post['user_id'] != $user['user_id'] && privilegy('forum_moder') == FALSE) {
head('Ошибка доступа');
echo DIV_TITLE . 'Ошибка доступа' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/forum/">Форум</a> / <b>Ошибка доступа</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
if ($theme['status'] == 1) {
head('Тема закрыта');
echo DIV_TITLE . 'Тема закрыта' . CLOSE_DIV;
echo DIV_ERROR . 'Ошибка!' . CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/forum/">Форум</a> / <b>Тема закрыта</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
exit();
}
head('Редактирование поста');
echo DIV_TITLE . 'Редактирование поста' . CLOSE_DIV;
if ($_POST['edit']) {
$msg = html($_POST['msg']);
if (empty($msg)) {
DIV_ERROR . 'Введите сообщение' . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".FORUMS_POST." SET `msg` = ? WHERE `id` = ? ", array($msg, $post['id']));
header("Location: ".HOME."/forum/".$post['forum_id']."/".$post['forumc_id']."/".$post['theme_id']."/");
}
}
echo DIV_BLOCK;
echo '<form action="#" method="POST">';
echo '<b>Сообщение:</b> [min. 20]<br /><textarea name="msg">'.$post['msg'].'</textarea><br />';
echo '<input type="submit" name="edit" value="Изменить" /><br />';
echo '</form>';
echo CLOSE_DIV;
$forum = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS." WHERE `id` = ? ", array($post['forum_id']));
$forumc = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_CAT." WHERE `id` = ? ", array($post['forumc_id']));
$theme = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_THEME." WHERE `id` = ? ", array($post['theme_id']));
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/forum/">Форум</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/">'.$forum['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/">'.$forumc['name'].'</a> / <a href="'.HOME.'/forum/'.$forum['id'].'/'.$forumc['id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> / <b>Редактирование поста</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>