Файл: soc-set/moduls/forum/edit_theme.php
Строк: 59
<?php
require_once('../../core/start.php');
check_auth();
$theme = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_THEME." WHERE `id` = ? ", array(abs(num($_GET['theme']))));
if (empty($theme)) {
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();
}
if ($theme['user_id'] != $user['user_id'] && !privilegy('forum_moder')) {
header("Location: ".HOME."");
}
head('Редактирование темы: ' . $theme['name']);
echo DIV_TITLE . 'Редактирование темы: ' . $theme['name'] . CLOSE_DIV;
if ($_POST['edit']) {
$name = html($_POST['name']);
$uvedom = abs(num($_POST['uvedom']));
$vote = html($_POST['vote']);
$vote_1 = html($_POST['vote_1']);
$vote_2 = html($_POST['vote_2']);
$vote_3 = html($_POST['vote_3']);
$vote_4 = html($_POST['vote_4']);
$vote_5 = html($_POST['vote_5']);
$vote_6 = html($_POST['vote_6']);
$vote_7 = html($_POST['vote_7']);
$vote_8 = html($_POST['vote_8']);
$vote_9 = html($_POST['vote_9']);
$vote_10 = html($_POST['vote_10']);
if (empty($name)) {
$err = 'Введите название темы.<br />';
}
if (strlen($name) < 8) {
$err .= 'Слишком короткое название темы. [min. 8 символа]<br />';
}
if (!empty($vote) && strlen($vote) < 20) {
$err .= 'Слишком короткое название голосования. [min. 10 символа]<br />';
}
if (!empty($vote) && (empty($vote_1) || empty($vote_2))) {
$err .= 'Заполните основные варианты голосований';
}
if (empty($err)) {
DB::$dbs->query("UPDATE ".FORUM_THEME." SET `name` = ?, `uvedom` = ?, `vote` = ?, `vote_1` = ?, `vote_2` = ?, `vote_3` = ?, `vote_4` = ?, `vote_5` = ?, `vote_6` = ?, `vote_7` = ?, `vote_8` = ?, `vote_9` = ?, `vote_10` = ? WHERE `id` = ? ",
array($name, $uvedom, $vote, $vote_1, $vote_2, $vote_3, $vote_4, $vote_5, $vote_6, $vote_7, $vote_8, $vote_9, $vote_10, $theme['id']));
header("Location: ".HOME."/forum/".$theme['forum_id']."/".$theme['forumc_id']."/".$theme['id']."/");
} else {
echo DIV_ERROR . $err . CLOSE_DIV;
}
}
echo DIV_BLOCK;
echo '<form action="#" enctype="multipart/form-data" method="POST">';
echo '<b>Название темы:</b> [min. 8]<br /><input type="text" name="name" value="'.$theme['name'].'" /><br /><br />';
echo 'Уведомлять о оставленных сообщениях: <input type="checkbox" name="uvedom" value="1" '.($theme['uvedom'] ? 'checked' : NULL).' /><br /><br />';
echo '<b>Голосование:</b><br />';
echo '<b>Название:</b> [min. 10]<br /><input type="text" name="vote" value="'.$theme['vote'].'"/><br />';
echo '<b>Варианты:</b> [Обязательных вариантов min. 2]<br />';
echo '<b>1.</b><input type="text" name="vote_1" value="'.$theme['vote_1'].'" /><br />';
echo '<b>2.</b><input type="text" name="vote_2" value="'.$theme['vote_2'].'" /><br />';
echo '<b>3.</b><input type="text" name="vote_3" value="'.$theme['vote_3'].'" /><br />';
echo '<b>4.</b><input type="text" name="vote_4" value="'.$theme['vote_4'].'" /><br />';
echo '<b>5.</b><input type="text" name="vote_5" value="'.$theme['vote_5'].'" /><br />';
echo '<b>6.</b><input type="text" name="vote_6" value="'.$theme['vote_6'].'" /><br />';
echo '<b>7.</b><input type="text" name="vote_7" value="'.$theme['vote_7'].'" /><br />';
echo '<b>8.</b><input type="text" name="vote_8" value="'.$theme['vote_8'].'" /><br />';
echo '<b>9.</b><input type="text" name="vote_9" value="'.$theme['vote_9'].'" /><br />';
echo '<b>10.</b><input type="text" name="vote_10" value="'.$theme['vote_10'].'" /><br /><br />';
echo '<input type="submit" name="edit" value="Изменить" /><br />';
echo '</form>';
echo CLOSE_DIV;
$forum = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS." WHERE `id` = ? ", array($theme['forum_id']));
$forumc = DB::$dbs->queryFetch("SELECT * FROM ".FORUMS_CAT." WHERE `id` = ? ", array($theme['forumc_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');
?>