File size: 5.8Kb
<?
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_razd` WHERE `id`='$id'"));
$shcmsengine['title'] = Lang::get('Форум - %s',$title_forum['name']);
include_once'../template/head.php';
$categorie = mysql_fetch_array(mysql_query("SELECT * FROM `forum_cat` WHERE `id`='$title_forum[id_cat]'"));
echo '<div class="maintext"><a href="index.php">'.Lang::get('Все категории').'</a> | <a href="razd.php?id='.$title_forum['id_cat'].'">'.$categorie['name'].'</a> | <strong>'.$title_forum['name'].'</strong></div>';
$allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them` WHERE `id_razd`='$id'"),0);
$newlist = new Navigation($allfield,10, true);
$catr = mysql_query("SELECT * FROM `forum_them` WHERE `id_razd`='$id' ORDER BY `id` DESC ". $newlist->limit()."");
$catw = mysql_fetch_array($catr);
switch($act):
case 'share':
if($user_id == true) {
if(isset($_GET['full'])) {$full_share = $_GET['full'];}
$sql_news = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id` = '$full_share'"));
$sql_share = mysql_fetch_array(mysql_query("SELECT * FROM `share` WHERE `id_forum` = '$full_share' and `user_id` = '$user_id'"));
if($sql_share['id_forum'] == $full_share) {
errors(Lang::get("Тема %s уже существует в закладках",$sql_news['title']));
header("Refresh: 1; url=them.php?id=$full_share");
include_once'../template/foot.php';
exit;
}
if(isset($full_share)) {
mysql_query("INSERT INTO `share` (`user_id`,`id_forum`,`time`,`listing`) VALUES ('$user_id','$full_share','".time()."','2')");
messag(Lang::get('Тема %s успешно добавлена',$sql_news['title']));
header("Refresh: 1; url=them.php?id=$id");
include_once'../template/foot.php';
exit;
}else {
errors(Lang::get('Тема %s не добавлена',$sql_news['title']));
header("Refresh: 1; url=them.php?id=$id");
include_once'../template/foot.php';
exit;
}
}
break;
case'delshare':
if($user_id == true) {
if(isset($_GET['full'])) {$full_share = $_GET['full'];}
$sql_news = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id` = '$full_share'"));
$sql_share = mysql_fetch_array(mysql_query("SELECT * FROM `share` WHERE `id_forum` = '$full_share' and `user_id` = '$user_id'"));
if(isset($full_share)) {
mysql_query("DELETE FROM `share` WHERE `id_forum` = '$full_share' and `user_id` = '$user_id'");
messag(Lang::get('Тема %s успешно удалена из закладок',$sql_news['title']));
header("Refresh: 1; url=them.php?id=$id");
include_once'../template/foot.php';
exit;
}else {
errors(Lang::get('Тема %s не удалена из закладок',$sql_news['title']));
header("Refresh: 1; url=them.php?id=$id");
include_once'../template/foot.php';
exit;
}
}
break;
endswitch;
if($id == false){
errors(Lang::get("Раздел отсутствует"));
include_once'../template/foot.php';
header("Refresh: 1; url=/forum/");
exit();
}
if($catw == null)
{
echo '<div class="posts"><img class="img_s" src="/template/icon/empty.png"> '.Lang::get('В разделе <b>%s</b> нет тем.',$title_forum['name']).'</div>';
}
else
{
do
{
$count_forum = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_mess` WHERE `id_them`='$catw[id]'"),0);
echo '<div class="maintext"><img src="/forum/icon/icon_them/them.gif"/> ';
if($catw['close'] == 2)
{
echo SHCMS_core::img_shcms('../template/icon/close.png');
}
$minus = mysql_fetch_array(mysql_query("SELECT * FROM `share` WHERE `id_forum` = '$catw[id]' and `user_id` = '$user_id'"));
echo '<strong><a href="message.php?id='.$catw['id'].'">'.$catw['name'].'</a></strong> ';
echo '<span class="count maintime">'.Lang::get('Ответов:'). $count_forum.'</span>';
echo '<br/><span style="font-size:11px">'.Lang::get('Просмотров:').' '.$catw['count'].'</span><span style="float:right;">';
if($user_id == true) {
if($minus['id_forum'] != $catw['id']) {
echo '<a title="'.Lang::get('Добавить в Закладки').'" href="?id='.$id.'&act=share&full='.$catw['id'].'"><img src="../template/icon/plus.gif"></a> ';
}else {
echo '<a title="'.Lang::get('Удалить из Закладок').'" href="?id='.$id.'&act=delshare&full='.$catw['id'].'"><img src="../template/icon/minus.gif"></a> ';
}
}
echo '</span>';
echo '</div>';
}
while($catw = mysql_fetch_array($catr));
echo '<div class="pages">';
echo $newlist->pagination("id=$id");
echo '</div>';
}
if($user_id)
{
echo '<div class="maintitle mainrazd">'.Lang::get('Навигация').'</div>';
echo '<div class="maintext"><div class="posts"><a href="/forum/new.them.php?id='.$id.'">'.Lang::get('Открыть тему').'</a></div>';
if($user4['team'] == 6)
{
echo '<div class="posts"><a href="/forum/edit.razd.php?id='.$id.'">'.Lang::get('Параметры раздела').'</a></div>';
echo '<div class="posts"><a href="/forum/delete.razd.php?id='.$id.'">'.Lang::get('Удаление раздела').'</a></div>';
}
echo '</div>';
}
include_once'../template/foot.php';
?>