Размер файла: 4.79Kb
<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Форум
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
if($_GET['id']){$id = $_GET['id'];}
$tits = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id=$id"));
$shcmsengine['title'] = 'Тема '.$tits['name'].'';
include_once'../template/head.php';
$user4 = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$user_id"));
$allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM forum_mess WHERE id_them=$id"),0);
$newlist = new Navigation($allfield, // кол-во полей для вывода
10, // выводить 5 записей на страницу
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)
{
echo'<div class="errors">Вы зашли неправильно</div>';
header('Refresh: 1; url=/forum');
include_once'../template/foot.php';
exit();
}
if($user_id)
{
if($brodilka == "web")
{
$text_list->text_lister();
}
echo '<form action="?id='.$id.'" method="post" name="form">';
echo 'Текст: <textarea name="text"></textarea>';
echo '<input type="submit" name="submit">';
}
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(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','$message','$time_date','$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();
}
}
}
$ri_them = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id=$id"));
$user_them = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$ri_them[user_id]"));
echo '<div class="mysql_yes">';
if( $user_them['pol'] == 1)
{echo '<img src="../template/icon/users/1.png"/>';}else{echo '<img src="../template/icon/users/2.png"/>';}
echo '<a href="'.DIR_SHCMS.'change_view.php?id='.$user_them['id'].'"> '.$user_them['login'].'</a>';
echo '('.$timedate->when($ri_them['time']).')<br/><hr/>';
echo handling_smileys($ri_them['text']).'</div><hr/>';
if($mysql_mess==null){echo '<div class="posts">В теме нет сообщений</div>';}
else
{
do
{
$user_mysql = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$mysql_mess[id_user]"));
print '<div class="posts">';
if( $user_mysql['pol'] == 1)
{echo '<img src="../template/icon/users/1.png"/>';}else{echo '<img src="../template/icon/users/2.png"/>';}
echo '<a href="'.DIR_SHCMS.'change_view.php?id='.$mysql_mess['user_id'].'"> '.$user_mysql['login'].'</a> ';
echo '('.$timedate->when($mysql_mess['time']).')';
echo '<br/>'.handling_smileys($mysql_mess['message']).'</div>';
}
while($mysql_mess = mysql_fetch_array($msy));
echo '<div class="pages">';
echo $newlist->pagination();
echo '</div>';
}
echo '<div class="posts"><a href="them.php?id='.$id_cat['id_cat'].'">Назад</a></div>';
if($users_nav['team'] == 6){echo '<div class="posts"><a href="edit.them.php?id='.$id.'">Параметры темы</a></div>';
echo '<div class="posts"><a href="delete.them.php?id='.$id.'">Удаление темы</a></div>';}
include_once'../template/foot.php';
?>