Файл: modules/public/forum_otvet.php
Строк: 54
<?php
/* DCMS Special
* Дата последнего редактирования 23.01.2016
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../../sys/inc/$inc.php";
}
if (isset($_GET['id'])) {
$them['id'] = intval($_GET['id']);
}
$them = mysql_fetch_array(mysql_query("SELECT * FROM `public_forum` WHERE `id` = '" . $them['id'] . ")'"));
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '" . $them['id_user'] . ")'"));
if ($them['id'] == 0) {
$set['title'] = 'Нет такой темы'; // заголовок страницы
require_once H . 'sys/inc/thead.php';
aut();
err();
echo "<span class='err'>Нет такой темы</span><br />";
$msg = "[url=/info.php?id=" . $user['id'] . "] " . $user['nick'] . "[/url] предупрежден за некоректые запросы в сообществах";
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '1', '" . $msg . "', '$time')");
if (!isset($_GET['ajax'])) {
$_SESSION['message'] = 'Нет такой темы пока предупреждение';
header('Location: /modules/public/index.php?id=' . $them['id_public']);
}
exit;
require_once H . 'sys/inc/tfoot.php';
exit;
}
$set['title'] = "ответ " . $ank['nick'];
require_once H . 'sys/inc/thead.php';
if (isset($_POST['msg']) && isset($user)) {
$komm = $_POST['msg'];
if (utf8_strlen($komm) > 1024) {
$err[] = 'Сообщение превышает 1024 символа';
}
if (utf8_strlen($komm) < 2) {
$err[] = 'Слишком короткое сообщение';
}
if (!isset($err)) {
// отправка сообщения
mysql_query("INSERT INTO `public_forum` (`id_user`, `time`, `komm`, `id_them`, `otv`) values('" . $user['id'] . "', '$time', '" . $komm . "', '" . $them['id_them'] . "', '" . $them['id'] . "')");
$f['id'] = mysql_insert_id();
mysql_query("INSERT INTO `notification` (`id_user`, `avtor`, `type`, `time`, `id_object`) values('" . $ank['id'] . "', '" . $user['id'] . "', 'f_komm', '$time', '" . $f['id'] . "')");
if (isset($user) && $user['id'] != $them['id_user']) {
$msgrat = "$SexOtv " . lang('на Ваше сообщение в') . " [url=/modules/public/them.php?id=$them[id_them]]" . lang('обсуждениях') . "[/url].
Ответ: [b]" . toOutput($them['komm']) . "[/b]";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `id_img`, `msg`, `time`) values('$user[id]', '" . $them['id_user'] . "', '2', '$msgrat', '$time')");
}
if (!isset($_GET['ajax'])) {
$_SESSION['message'] = 'Сообщение успешно отправлено';
header('Location: them.php?id=' . $them['id_them']);
}
exit;
}
}
aut();
err();
if (isset($user)) {
if ($them['close'] == '0') {
echo "<form method='post' name='message' class='list-group-item' action='?id=" . $them['id'] . "&$passgen'>";
echo "<textarea name='msg' class='form-control'></textarea><br />";
$doc->Button('btn btn-primary btn-sm', null, 'pencil', 'Опубликовать');
echo "</form>";
} else {
echo "<div class='err'>Тема закрыта</div>";
}
}
$doc->Link('list-group-item', "them.php?id=" . $them['id'] . "", 'arrow-left', 'Назад');
require_once H . 'sys/inc/tfoot.php';