- <?
- /*
- =============================================
- Движок: SHCMS Engine
- =============================================
- Название файла: Форум
- =============================================
- Official website: http://shcms.ru
- =============================================
- */
- define('SHCMS', true);
- include_once'../system/inc/basic_settings.php';
- if($_GET['id']){$id = $_GET['id'];}
- $title_forum = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id`='$id'"));
- $shcmsengine['title'] = "Тема $title_forum[name]";
- include_once'../template/head.php';
-
- $categorie = mysql_fetch_array(mysql_query("SELECT * FROM `forum_cat` WHERE `id`='$title_forum[id_cat]'"));
- $razdel = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razd` WHERE `id`='$title_forum[id_razd]'"));
-
- echo '<div class="posts"><a href="razd.php?id='.$title_forum['id_cat'].'">'.$categorie['name'].'</a> |
- <a href="them.php?id='.$title_forum['id_razd'].'">'.$razdel['name'].'</a> | <strong>'.$title_forum['name'].'</strong>
- </div>';
- $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them`='$id'"),0);
- $newlist = new Navigation($allfield, 10, true);
-
- $msy = mysql_query("SELECT * FROM `forum_mess` WHERE `id_them`='$id' ORDER BY `id` DESC ". $newlist->limit()."");
- $mysql_mess = mysql_fetch_array($msy);
- $id_text = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id_them`= '$id'"));
- $id_cat = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id_them`= '$id' "));
- $yels = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id`= '$id'"));
- if(!$id)
- {
- errors("Такой темы не существует");
- header('Refresh: 1; url=/forum');
- include_once'../template/foot.php';
- exit();
- }
- if($title_forum['close'] != 1)
- {
- if($user_id)
- {
- $form = new form("?id=$id");
- $form->textarea('<strong>Текст комментария:</strong>','text','',true);
- $form->submit('Отправить','submit');
- $form->submit('Обновить','resfresh');
- $form->submit('Добавить файл','form');
- $form->finish();
- if($_POST['form'] == true) {
- echo '<div class="posts">';
- $form = new form("?id=$id",false,false,'enctype="multipart/form-data"');
- $form->input('Прикрепить файл:','filename','file',false,true);
- $form->submit('Загрузить','submit1');
- $form->finish();
- echo '<small>* Файл который вы будете загружать не должно превышать 2мб</small>';
- echo '</div>';
- }
- }
- }
- else
- {
- errors('Тема закрыта для обсуждений');
- }
-
-
- if($_POST['submit1']) {
-
-
-
- $file = basename(utf8_win(SHCMS_core::Upload_end($_FILES['filename']['name'])));
- $filename = '../system/thumbs/'.$file.'';
- if($file == '.htaccess' || $file == 'index.php') {
- echo'Ошибка! Файл входит в состав запрещеных!';
- } else {
- if (file_exists($filename)) {
- errors('Файл уже существует!');
- } else {
- $siize = basename($_FILES['filename']['size']);
- $a = $siize / 1024;
- $otvet = round($a, 2);
- if($otvet > 2048) {
- echo ("Размер файла превышает 2 Mб");
- exit;
- }
- // Проверяем загружен ли файл
- if(is_uploaded_file($_FILES["filename"]["tmp_name"])) {
- // Если файл загружен успешно, перемещаем его
- // из временной директории в конечную
- move_uploaded_file($_FILES["filename"]["tmp_name"], "../system/thumbs/".utf8_win(SHCMS_core::Upload_end($_FILES["filename"]["name"])));
- $message_file = "<u>Прикрепленый файл</u><br /><a href='loading.php?file=".$file."'>".$file."</a> [".$otvet." kb]";
- $messag = mysql_query("INSERT INTO `forum_mess` (`id_cat`,`id_razd`,`id_them`,`message`,`time`,`id_user`) VALUES ('$yels[id_cat]','$yels[id_razd]','$id','".my_esc($message_file)."','".time()."','$user_id')");
- $q=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them` = '$id'"),0);
- $total = intval(($q - 1) / 10) + 1;
- echo '<div class="actshcms">Файл загружен</div>';
- header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
- } else {
- errors('Ошибка при загрузки файла');
- header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
- }
- }
- }
-
-
-
-
- }
-
- if($_POST['submit'])
- {
- $submit = $_POST['submit'];
- }
- if(isset($submit))
- {
- if($_POST['text'])
- {
- $message = $_POST['text'];
- }
-
- if(empty($message))
- {
- echo'<div class="errors">Введите описание</div>';
- header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
- include_once'../template/foot.php';
- exit();
- }
-
- $message = stripslashes($message);
- $message = htmlspecialchars($message);
-
- if($settings_shcms['antilink'] == true) {
- $message = system_function::antilink($message);
- }
- if($settings_shcms['antimat'] == true) {
- $message = system_function::antimat($message);
- }
-
-
- if(strlen($message)< 0 || strlen($message) >3000)
- {
- echo'<div class="errors">Описание должен быть не больше 3000 символов</div>';
- exit();
- }
-
- if(isset($message))
- {
- $messag = mysql_query("INSERT INTO `forum_mess` (`id_cat`,`id_razd`,`id_them`,`message`,`time`,`id_user`) VALUES ('$yels[id_cat]','$yels[id_razd]','$id','".my_esc($message)."','".time()."','$user_id')");
- $balls = $user4['ball'] +1;
- mysql_query("UPDATE `users` SET `ball`='$balls' WHERE `id`='$user_id'");
- if($messag == true)
- {
- echo '<div class="actshcms">Сообщение добавлено</div>';
- header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
- include_once'../template/foot.php';
- exit();
- }
- else
- {
- echo '<div class="errors">Сообщение не добавлено</div>';
- header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
- include_once'../template/foot.php';
- exit();
- }
- }
- }
-
- if($mysql_mess == null)
- {
- echo '<div class="posts">В теме нет сообщений</div>';
- }
- else
- {
-
- do
- {
-
- echo '<div class="maintitle"> ';
- users_profile($mysql_mess['id_user']);
- echo '<span class="maintime">'.$timedate->times($mysql_mess['time']).' </span></div>';
- echo '<div class="maintext">'.processing($mysql_mess['message']);
-
- if($title_forum['id'] == $user_id || $user4['team'] == 6)
- {
- echo '<span style="float:right">
- <a href="/forum/delete.mess.php?id='.$id.'&id_del='.$mysql_mess['id'].'">Удалить</a>
- </span>';
- }
- echo '</div>';
- }
- while($mysql_mess = mysql_fetch_array($msy));
- echo '<div class="pages">';
- echo $newlist->pagination("id=$id");
- echo '</div>';
- }
-
- echo '<div class="maintext"><div class="posts"><a href="javascript:history.back()">Назад</a></div>';
- if($user4['team'] == 6)
- {
- echo '<div class="posts"><a href="/forum/edit.them.php?id='.$id.'">Параметры темы</a></div>';
- echo '<div class="posts"><a href="/forum/delete.them.php?id='.$id.'">Удаление темы</a></div>';
- }
- echo '</div>';
-
- include_once'../template/foot.php';
- ?>