Файл: forum/action/create_theme.php
Строк: 51
<?php
/*
* Форум
* DCMS Special
* Автор yadalay
* Модифицировал densnet
* Файл create_theme.php
*/
if ($razdel->type == 0 || ($razdel->type == 1) && $user['group_access'] > 2) {
if (isset($_POST['create'])) {
$name = mysql_real_escape_string(trim($_POST['name']));
$description = mysql_real_escape_string(trim($_POST['description']));
$type = ($user['group_access'] > 7 && isset($_POST['type'])) ? 1 : 0;
if (mb_strlen($name) < 3 || mb_strlen($name) > 40) {
echo "<div class = 'errs'>В поле 'Название темы' можно использовать от 3 до 40 символов.</div>";
} elseif (mb_strlen($description) < 3) {
echo "<div class = 'errs'>Слишком короткое содержание темы.</div>";
} else {
$_SESSION['create_theme'] = '<div class = "msgs">Тема успешно создана.</div>';
mysql_query('INSERT INTO `forum_themes` SET `id_forum` = ' . $forum->id . ', `id_razdel` = ' . $razdel->id . ', `name` = "' . $name . '", `description` = "' . $description . '", `type` = ' . $type . ', `time` = ' . $time . ', `time_edit` = "0", `time_post` = ' . $time . ', `reason_close` = "", `id_user` = ' . $user['id']);
header('Location: /forum/'.$forum->id.'/'.$razdel->id.'/' . mysql_insert_id() . '.html');
exit;
}
} elseif (isset($_POST['cancel'])) {
header('Location: /forum/'.$forum->id.'/'.$razdel->id.'/');
exit;
}
echo "<form class = 'razd' action = '/forum/$forum->id/$razdel->id/create_theme.html' method = 'post'>";
echo "<b>Название темы:</b><br />";
echo "<input type = 'text' name = 'name' value = '' style = 'width: 50%' /><br />";
echo "<b>Содержание темы:</b><br />";
echo L . "<textarea name = 'description' style = 'width: 50%'></textarea><br />";
if ($user['group_access'] > 7) {
echo "<b>Вывод темы в разделе:</b><br />";
echo "<label><input type = 'checkbox' name = 'type' value = '1' /> Тема всегда вверху</label><br />";
}
echo "<button name = 'create' class = 'action'>";
echo "<span class = 'label'><span class = 'icon icon44' /> Создать</span>";
echo "</button>";
echo "<button name = 'cancel' class = 'action'>";
echo "<span class = 'label'> Отмена</span>";
echo "</button></form>";
require_once '../sys/inc/tfoot.php';
} else {
header('Location: /forum/'.$forum->id.'/'.$razdel->id.'/');
}
exit;