Файл: modules/forum/action/create_theme.php
Строк: 109
<?php
/* DCMS Special
* Дата последнего редактирования 19.12.2015
* Модифицировал densnet
* Автор yadalay
*/
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='alert alert-danger'>В поле 'Название темы' можно использовать от 3 до 40 символов.</div>";
} elseif (mb_strlen($description) < 3) {
echo "<div class='alert alert-danger'>Слишком короткое содержание темы.</div>";
} else {
$_SESSION['create_theme'] = '<div class="alert alert-success">Тема успешно создана.</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: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . mysql_insert_id() . '.html');
exit;
}
} elseif (isset($_POST['cancel'])) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/');
exit;
}
#Навигация
echo "<nav class='navbar navbar-light' style='background-color: #607D8B; color: #fff;'>";
echo "<ul class='nav navbar-nav'>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/'><i class='material-icons'>home</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='" . DIR_FORUM . "'>Форум</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='" . DIR_FORUM . "$forum->id/'>" . toOutput($forum->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='" . DIR_FORUM . "$forum->id/$razdel->id/'>" . toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'>Создание темы</a></li>";
echo "</ul>";
echo "</nav>";
echo "<form class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/create_theme.html' method='post'>";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<input id='name' name='name' length='40' type='text' value='' class='validate'>";
echo "<label for='name'>Название темы</label>";
echo "</div>";
echo "</div>";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<textarea name='description' id='description' length='100' class='materialize-textarea'></textarea>";
echo "<label for='description'>Содержание темы</label>";
echo "</div>";
echo "</div>";
if ($user['group_access'] > 7) {
echo "<div class='switch'>";
echo "Вывод темы в разделе:<br />";
echo "<label><input type='checkbox' name='type' value='1'><span class='lever'></span>Тема всегда вверху</label>";
echo "</div>";
}
echo "<div class='hr'></div>";
echo "<button name='create' class='waves-effect waves-light btn'>Создать</button> ";
echo "<button name='cancel' class='waves-effect waves-light btn btn-secondary'>Отмена</button>";
echo "</form>";
require_once H . 'sys/inc/tfoot.php';
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/');
}
exit;