Файл: modules/forum/action/clear_theme.php
Строк: 29
<?php
/* DCMS Special
* Дата последнего редактирования 19.12.2015
* Модифицировал densnet
* Автор yadalay
*/
if (!access('forum_post_ed')) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} else {
if (isset($_POST['clear'])) {
$files = mysql_query('SELECT `name` FROM `forum_post_files` WHERE `id_theme` = ' . $theme->id);
while ($file = mysql_fetch_object($files)) {
unlink(DIR_FORUM_FILES . $file->name);
}
mysql_query('DELETE FROM `forum_post_rating` WHERE `id_theme` = ' . $theme->id);
mysql_query('DELETE FROM `forum_posts` WHERE `id_theme` = ' . $theme->id);
$msg_sys = "[url=/info.php?id=$user[id]]$user[nick][/url] " . ($user['sex'] ? 'почистил' : 'почистила') . " всю тему.";
mysql_query('INSERT INTO `forum_posts` SET `id_theme` = ' . $theme->id . ', `id_user` = "0", `id_admin` = "0", `text` = "' . mysql_real_escape_string($msg_sys) . '", `time` = ' . $time);
$_SESSION['success'] = '<div class="alert alert-success">Тема успешно очищена.</div>';
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_POST['cancel'])) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} else {
echo "<form class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/cleare_theme.html' method='post'>";
echo "Вы уверены, что хотите очистить эту тему от сообщений?<br />";
echo "<button name='clear' class='waves-effect waves-light btn'><i class='material-icons'>delete</i> Очистить</button> ";
echo "<button name='cancel' class='waves-effect waves-light btn btn-secondary'>Отменить</button>";
echo "</form>";
}
}