Файл: tankon.mobi/tanks/forum.php
Строк: 593
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
err();
aut();
echo '<link rel="stylesheet" type="text/css" href="style.css"/>';
include_once 'function.php';
function cut_msg($text){
mb_internal_encoding("UTF-8");
$text = mb_substr($text, 0, 10);
return str_replace('','',$text);
}
$sum_num=1;
if(intval($_GET['forum'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `id` = '".intval($_GET['forum'])."'"),0)!=0)$forum=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id` = '".intval($_GET['forum'])."'"));
if(isset($forum) && $forum['type']=='tema')
{
$fk=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'komm' AND `mother` = '$forum[id]' ORDER BY `time` ASC LIMIT 1"));
$mother=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id` = '$forum[mother]'"));
if($mother['locked']==1 && $tanks_code['status']<=0)header("Location:?forum");
if(isset($_GET['smen']) && $tanks_code['status']>1)
{
$smen_id=intval($_GET['smen']);
$smen_msg=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id` = '".$smen_id."'"));
echo '<div class="trnt-block p5" style="margin-bottom:3px;">
<div class="wrap-content">
<div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'>Редактирование топика</div>";
if(isset($_GET['ok']))
{
$smen_maseg=htmlspecialchars($_POST['msg']);
mysql_query("UPDATE `kolhoz_forum` SET `msg` = '".$smen_maseg."' WHERE `id` = '".$smen_id."'");
header("Location:?forum=$forum[id]");
}
echo "<form action='?forum=$forum[id]&smen=".$smen_id."&ok' method='post'>
<center>
<textarea class='wide ' rows='5' name='msg'>".$smen_msg['msg']."</textarea></div></label></center>";
echo'
</div>
</div>
</div><div class="bot" >
<span class="input-but border" ><span>';
echo "<input value="Изменить" class='w100' type="submit" /></span></span>
</div></form>";
include_once 'foots.php';
exit;
}
if(isset($_GET['edit']) && $tanks_code['status']>0)
{
echo '<div class="trnt-block mb5">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">
<div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'>Редактирование топика</div>";
if($_GET['edit']=='ok')
{
$name=htmlspecialchars($_POST['name']);
$msg=htmlspecialchars($_POST['msg']);
if($msg==NULL)
{
echo err_game("Слишком короткое сообщение");
$errs=1;
}
if($tanks_code['level']<=2)
{
$errs=1;
err_game("Писать в форуме можно с 2 уровня.");
}
if($tanks_code['bans']!=0)
{
$errs=1;
err_game("Вы находитесь в бане.");
}
if($tanks_code['level']<6 && $tanks_code['forum_time']!=0 && $tanks_code['status']<1)
{
$time_f=time();
$forum_time=time_left($tanks_code['forum_time']-$time_f);
$errs=1;
err_game("Вы можете писать через ".$forum_time."");
}
if(!isset($errs))
{
if($tanks_code['status']<1){
$f_time=time()+60*60;
mysql_querll("UPDATE `tanks` SET `forum_time` = '".$f_time."' WHERE `id`='".$user['id']."'");}
mysql_query("UPDATE `kolhoz_forum` SET `name` = '".my_esc($name)."', `msg` = '".my_esc($msg)."', `visit` = ',".$tanks_code['id']."' WHERE `id` = '$forum[id]'");
mysql_query("UPDATE `kolhoz_forum` SET `msg` = '".my_esc($msg)."' WHERE `id` = '$fk[id]'");
mysql_query("UPDATE `kolhoz_forum` SET `visit` = ',".$tanks_code['id']."' WHERE `id` = '".$forum['mother']."'");
header("Location:?forum=$forum[id]");
exit;
}
}
echo "<form action='?forum=$forum[id]&edit=ok' method='post'><ul><label><div>Заголовок:</div><div><input type='text' class='wide w50 greensmall' value='".$forum['name']."' name='name'></div></label><label><div>Сообщение:</div><div>
<textarea class='wide greensmall' rows='5' name='msg'>".$forum['msg']."</textarea></div></label>";
echo'<div class="bot">
<span class="input-but border"><span>';
echo "<input value="Создать" class='w100' type="submit" /></span></span>
</div></form>";
echo'</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div></div><br>';
echo' <a class="simple-but gray " href="/moder"> <span> <span>Модераторы</span> </span> </a> </div>'; include_once 'foots.php';
}
elseif(isset($_GET['lock']) && $tanks_code['status']>0)
{
mysql_query("UPDATE `kolhoz_forum` SET `locked` = '".($forum['locked']==1?"0":"1")."' WHERE `id` = '$forum[id]'");
header("Location:?forum=$forum[id]");
}
elseif(isset($_GET['pin']) && $tanks_code['status']>0)
{
mysql_query("UPDATE `kolhoz_forum` SET `pined` = '".($forum['pined']==1?"0":"1")."' WHERE `id` = '$forum[id]'");
header("Location:?forum=$forum[id]");
}
elseif(isset($_GET['del']) && $tanks_code['status']>0)
{
if($_GET['del']=='ok')
{
mysql_query("delete from `kolhoz_forum` where `mother` = '$forum[id]' and `type` = 'komm'");
mysql_query("delete from `kolhoz_forum` where `id` = '$forum[id]' and `type` = 'tema'");
header("Location:?forum=$mother[id]");
}
else
echo'
<div w:id="forum" class="odd">
<a class="blck p5 forum" style="border-radius: 3px 3px 0 0;" w:id="forumLink" href="?forum='.$forum['id'].'&del=ok">
<span class="medium bold yellow1"><img src="images/icons/tick.png" width="16" height="16" alt=""> Да, подтверждаю</span>
</a>
</div>
';
echo'
<div w:id="forum" class="odd">
<a style="border-radius: 0 0 3px 3px;margin-bottom:3px;" class="blck p5 forum" w:id="forumLink" href="?forum='.$forum['id'].'">
<span class="medium bold yellow1"><img src="/images/del_chat.png" width="16" height="16" alt=""> Нет, отказываюсь</span>
</a>
</div>
';
include_once 'foots.php';
}
elseif(isset($_GET['chist']) && $tanks_code['status']>0)
{
if($_GET['chist']=='ok')
{
$chist=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `mother` = '".$forum['id']."' AND `type`='komm'"),0);
$chiston=$chist-1;
$chistka= mysql_query("SELECT * FROM `kolhoz_forum` WHERE `mother` = '".$forum['id']."' ORDER BY time DESC LIMIT $chiston");
while($chistkas = mysql_fetch_array($chistka)) {
mysql_query("DELETE FROM `kolhoz_forum` where `id` = '".$chistkas['id']."'");
}
header("Location:?forum=$forum[id]");
}
else
echo'<div w:id="forum" class="odd">
<a style="border-radius: 3px 3px 0 0;" class="blck p5 forum" w:id="forumLink" href="?forum='.$forum['id'].'&chist=ok">
<span class="medium bold yellow1"><img src="images/icons/tick.png" width="16" height="16" alt=""> Да, подтверждаю</span>
</a>
</div>
';
echo'
<div w:id="forum" class="odd">
<a style="border-radius: 0 0 3px 3px;margin-bottom:3px;" class="blck p5 forum" w:id="forumLink" href="?forum='.$forum['id'].'">
<span class="medium bold yellow1"><img src="/images/del_chat.png" width="16" height="16" alt=""> Нет, отказываюсь</span>
</a>
</div>
';
include_once 'foots.php';
}
elseif(isset($_GET['del_komm']) && intval($_GET['del_komm'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `id` = '".intval($_GET['del_komm'])."' AND `type` = 'komm' AND `id` != '$fk[id]'"),0)!=0 && $tanks_code['status']>0)
{
mysql_query("delete from `kolhoz_forum` where `mother` = '$forum[id]' and `type` = 'komm' and `id` = '".intval($_GET['del_komm'])."'");
header("Location:?forum=$forum[id]");
}
else
{
{
$otv=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".intval($_GET['otv'])."'"));
$otvu=$otv;
}
if(isset($_GET['add']) && $_GET['add']=='ok' && $forum['locked']==0 && !isset($molchi))
{
$msg=htmlspecialchars($_POST['msg']);
if($msg==NULL)
{
echo err_game("Слишком короткое сообщение");
$errs=1;
}
if($msg==NULL)
{
echo err_game("Слишком короткое сообщение");
$errs=1;
}
if($tanks_code['level']<=2)
{
$errs=1;
err_game("Писать в форуме можно с 2 уровня.");
}
if($tanks_code['bans']!=0)
{
$errs=1;
err_game("Вы находитесь в бане.");
}
if($tanks_code['level']<6 && $tanks_code['forum_time']!=0 && $tanks_code['status']<1)
{
$time_ff=time();
$forum_times=time_left($tanks_code['forum_times']-$time_ff);
$errs=1;
err_game("Вы можете писать через ".$forum_times."");
}
////=======================================================================================================///
if(!isset($errs))
{
if($tanks_code['status']<1){
$ff_time=time()+60;
mysql_querll("UPDATE `tanks` SET `forum_times` = '".$ff_time."' WHERE `id`='".$user['id']."'");}
mysql_query("INSERT INTO `kolhoz_forum` SET `msg` = '".my_esc($msg)."', `id_user` = '$tanks_code[id]', `type` = 'komm', `mother` = '$forum[id]', `time` = '$time'".(isset($otv)?", `otvet` = '".$_POST['otv']."'":null)."");
mysql_query("UPDATE `kolhoz_forum` SET `time_obnov` = '$time', `visit` = ',".$tanks_code['id']."' WHERE `id` = '$forum[id]'");
$for_raz=mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='".$forum['id']."'"));
mysql_query("UPDATE `kolhoz_forum` SET `visit` = ',".$tanks_code['id']."' WHERE `id` = '".$for_raz['mother']."'");
header("Location:?forum=".$forum['id']."&page=end");
exit;
}
}
//======================================//
$visit=mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='".$forum['id']."'"));
$visit_array=explode(',',$visit['visit']);
$visit_num=count($visit_array)+$sum_num;
if(!in_array($tanks_code['id'],$visit_array)){
$visit_array[$visit_num]=$tanks_code['id'];
mysql_query("UPDATE kolhoz_forum SET visit='".implode(',',$visit_array)."' WHERE id='".$forum['id']."'");
}
//======================================//
if($_GET['dav']==1){echo '1';}
echo "<div class='content'><div class='block'>";
echo "<ul>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `type` = 'komm' AND `mother` = '$forum[id]'"),0);
echo '<div class="trnt-block mb5">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">
<div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'><a href='?forum=$mother[id]'>".$mother['name']."</a> / ".$forum['name']."</div>";
if ($k_post==0)
{
echo "Список пуст...";
}echo'</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div>';
if($tanks_code['status']>0){
echo' <div class="trnt-block p5" style="margin-bottom:3px;padding:0px">
<span w:id="navigation"><div class="brunches1-block">
<table ><tbody><tr><td>
<a href="?forum='.$forum['id'].'&lock">';
if($forum['locked']==0){
echo'<img src="/tanks/images/zakr.png" alt="image">';
}else{
echo'<img src="/tanks/images/otkr.png" alt="image">';
}
echo'<span class="mask"> </span></span>'.($forum['locked']==0?'За':'От').'крыть</a></td>
<td><a href="?forum='.$forum['id'].'&pin">';
if($forum['pined']==0){
echo'<img src="/tanks/images/prik.png" alt="image">';
}else{
echo'<img src="/tanks/images/otkrepit.png" alt="image">';
}
echo'<span class="mask"></span></span>'.($forum['pined']==0?'При':'От').'креп.</a></td>
<td><a href="?forum='.$forum['id'].'&del">
<img src="/tanks/images/delete.png" alt="image">
<span class="mask"></span>';
echo'</span> Удалить</a></td>
<td><a href="?forum='.$forum['id'].'&edit">
<img src="/tanks/images/izm.png" alt="image">
<span class="mask"> </span></span>Измен.</a></td>
</tr></center></tr></tbody></table></div></span></div></div>';
echo'<a class="simple-but red" style="margin-bottom:3px;" href="?forum='.$forum['id'].'&chist"><span><span>Очистить тему</span></span></a></div>';
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'komm' AND `mother` = '$forum[id]' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_array($q))
{
echo '<div class="trnt-block mb5">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">
<div class="clrb"></div>';
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]'"));
$anku=$ank;
echo "<span class='small'><span>";
$tankss_code = mysql_fetch_array(mysql_query("SELECT * FROM `tanks` WHERE `id_u`='".$ank['id']."'"));
$avatar = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_ava` WHERE `id`='".$tankss_code['ava']."'"));
echo'<div class="mb0 inbl">
<div class="thumb fl">
<img src="/images/avatar/'.$avatar['screen'].'" alt="" title="">
<span class="mask2"> </span>
</div>
<div class="ml58 small white sh_b bold">
<span class="green2">';
echo "<a href='profile?id=$ank[id]'>".ansc($ank['id'])."</a>";
echo" (".vremja($post['time']).")<span style='background-position: right bottom;'>";
if($tanks_code['status']>0 && $post['id']!=$fk['id'])echo " <a class='small minor' href='?forum=$forum[id]&del_komm=$post[id]'><img src='images/el_msg.png'></a>";
if($tanks_code['status']>1)echo " <a class='small minor' href='?forum=$forum[id]&smen=$post[id]'><img src='/images/smen_forum.png'></a>";
if ($tanks_code['id']!=$post['id_user']){echo ' <a href="?forum='.$forum['id'].'&otv='.$post['id'].'"><img src="images/otvet.png"></a>'; }
$msgs = $post['msg'];
$msgs = strtr($msgs, array('<'=>':3:', '>'=>':3:', '<script>'=>':3:', 'javascript'=>':3:'));
if($post['id']==$forum['id']+1){
echo "<br><span class='white'>".output_text($msgs)."</span>";
}
else { if ($post['otvet']==$tanks_code['id']){
echo '<br><font color="orange">'.output_text($msgs)."</font>";}
else{
echo '<br>'.output_text($msgs)."";}}
echo'</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div>';
}
if($tanks_code['level']>=3)
{
$for_net=1;
if ($k_page>1){str("?forum=$forum[id]&",$k_page,$page); echo"";} // Вывод страниц
if($forum['locked']==0){
echo "<form method='post' name='message' action='?forum=$forum[id]&add=ok'>";
echo ' <div class="bot" >
<table >
<tbody>
<tr>
';
echo'<td class="w100 pr1">
<a class="simple-but border" href="/forum?forum='.$forum['id'].'&page=end">
<span>
<span>Обновить</span>
</span>
</a>
</td></a></tr>
</tbody>
</table>
</div>
</div>
';
?><script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.message.msg.focus();
document.message.document.selection.createRange().text = text1+document.message.document.selection.createRange().text+text2;
} else if(document.forms['message'].elements['msg'].selectionStart!=undefined) {
var element = document.forms['message'].elements['msg'];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
document.forms['message'].elements['msg'].focus();
} else document.message.msg.value += text1+text2;
document.forms['message'].elements['msg'].focus();}</script>
<?include_once 'smailes.php';
echo'</div></div></div> ';
echo'<table class="chat-msg-panel mt10 mb6">
<tbody><tr>
<td class="msg">
<div class="trnt-block mb0">
<div class="wrap1"><div class="wrap2"><div class="wrap3"><div class="wrap4"><div class="wrap5"><div class="wrap6"><div class="wrap7"><div class="wrap8">
<div class="p5">';
$poster= mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id`='".intval($_GET['otv'])."'"));
$post=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$poster['id_user']."'"));
if (isset($_GET['otv']) && $post['id']!=$tanks_code['id'])
{
echo'<input type="hidden" name="otv" required="required" value="'.$poster['id_user'].'">';
echo'<input w:id="postText" class="chat-msg bold sh_b small lh1 cyan1" value="'.$post['nick'].', " type="text" size="20" maxlength="2500" name="msg">';
}else{
echo'<input w:id="postText" class="chat-msg bold sh_b small lh1 cyan1" value="" type="text" size="20" maxlength="2500" name="msg">';
}
echo'</div>
</div></div></div></div></div><div></div></div></div></div>
</div>
</td>
<td class="btn"><span ><span><input class="simple-but mb0 inbl" style="height:28px;" type="submit" value="Отправить"></span></span></td>
</tr>
</tbody></table>';
echo "</form>n";
}
else {
err_game('Тема закрыта');
}
}
else
{
if ($k_page>1){str("?forum=$forum[id]&",$k_page,$page);} // Вывод страниц
$for_net=1;
err_game('Писать в форуме можно с 3 уровня');
}
if($for_net!=1){
if ($k_page>1)str("?forum=$forum[id]&",$k_page,$page); // Вывод страниц
}
echo' <a class="simple-but gray " href="/moder"> <span> <span>Модераторы</span> </span> </a> </div>'; include_once 'foots.php';
}
}
elseif(isset($forum) && $forum['type']=='razdel' && ($forum['locked']==1 && $tanks_code['status']>0 || $forum['locked']==0))
{
if(isset($_GET['add']) && !isset($molchi) && $tanks_code['level']>=3 && ($forum['admod']==1 || $forum['admod']==0))
{
echo '<div class="trnt-block mb10 cntr" style="margin-bottom:0px"><div class="wrap-content"><div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'>Создание топика</div>";
if($_GET['add']=='ok')
{
$name=htmlspecialchars($_POST['name']);
$msg=htmlspecialchars($_POST['msg']);
if($name==NULL)
{
echo err_game("Слишком короткое название");
$err=1;
}
if($msg==NULL)
{
echo err_game("Слишком короткое сообщение");
$err=1;
}
if($tanks_code['bans']!=0)
{
$err=1;
err_game("Вы находитесь в бане.");
}
if($tanks_code['level']<=2)
{
$err=1;
err_game("Писать в форуме можно писать с 2 уровня.");
}
if(!isset($err))
{
mysql_query("INSERT INTO `kolhoz_forum` SET `name` = '".my_esc($name)."', `msg` = '".my_esc($msg)."', `id_user` = '$tanks_code[id]', `type` = 'tema', `mother` = '$forum[id]', `time` = '$time', `time_obnov` = '$time'");
$id=mysql_insert_id();
mysql_query("INSERT INTO `kolhoz_forum` SET `msg` = '".my_esc($msg)."', `id_user` = '$tanks_code[id]', `type` = 'komm', `mother` = '$id', `time` = '$time'");
mysql_query("UPDATE `kolhoz_forum` SET `visit` = ',".$tanks_code['id']."' WHERE `id` = '".$forum['id']."'");
header("Location:?forum=$id");
exit;
}
}
echo '<div class="content small white bold"><div class="block">';
echo "<form action='?forum=$forum[id]&add=ok' method='post'><ul><label><div>Заголовок:</div><div><input type='text' class='wide w50 greensmall' value='' name='name'></div></label><label>
<div>Сообщение:</div><div><textarea class='wide w50 greensmall' rows='5' name='msg'></textarea></div></label>
</div></div>";
echo'<div class="bot">
<span class="input-but border"><span>';
echo "<input value="Создать" class='w100' type="submit" /></span></span>
</div></form>";
echo'</div></div></div></div></div><br>';
include_once 'foots.php';
}
elseif(isset($_GET['edit']) && $tanks_code['status']>0)
{
echo '<div class="trnt-block mb10" style="margin-bottom:0px"><div class="wrap-content "><div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'>Редактирование раздела</div>";
if($_GET['edit']=='ok')
{
$name=$_POST['name'];
if($name==NULL)
{
echo err_game("Слишком короткое название");
$err=1;
}
if(!isset($err))
{
if($_POST['admod']==1)$admod=1;else $admod=0;
if($_POST['locked']==1)$locked=1;else $locked=0;
mysql_query("UPDATE `kolhoz_forum` SET `name` = '".my_esc($name)."', `admod` = '$admod', `locked` = '$locked' WHERE `id` = '$forum[id]'");
header("Location:?forum=$forum[id]");
exit;
}
}
echo '<div class="content small white bold"><div class="block" >';
echo "<form action='?forum=$forum[id]&edit=ok' method='post'><ul><label><div>Название:</div><div><input type='text' class='wide w100' value='".$forum['name']."' name='name'></div></label>";
echo "<input type='checkbox' name='admod' value='1'".($forum['admod']==1?" checked='checked'":null)."> <span>Создает топики только администрация</span><br/>";
echo "<input type='checkbox' name='locked' value='1'".($forum['locked']==1?" checked='checked'":null)."> <span>Давать доступ только администрации</span><br/>";
echo'</div></div><div class="bot">
<span class="input-but border"><span>';
echo "<input value="Создать" class='w100' type="submit" /></span></span>
</div></form>";
echo'</div></div></div></div></div><br>';
include_once 'foots.php';
}
elseif(isset($_GET['del']) && $tanks_code['status']>0)
{
if($_GET['del']=='ok')
{
$q=mysql_query("SELECT * FROM `kolhoz_forum` WHERE `mother` = '$forum[id]' AND `type` = 'tema'");
while($post=mysql_fetch_array($q))
{
mysql_query("delete from `kolhoz_forum` where `mother` = '$post[id]' and `type` = 'komm'");
mysql_query("delete from `kolhoz_forum` where `id` = '$post[id]'");
}
$links = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'razdel' AND `pos` > '$forum[pos]' ORDER BY `pos` ASC");
while ($p = mysql_fetch_array($links))
{
mysql_query("UPDATE `kolhoz_forum` SET `pos` = '".($p['pos']-1)."' WHERE `id` = '$p[id]' LIMIT 1");
}
mysql_query("delete from `kolhoz_forum` where `id` = '$forum[id]' and `type` = 'razdel'");
header("Location:?forum");
}
else
echo'
<div w:id="forum" class="odd">
<a style="border-radius: 3px 3px 0 0;" class="blck p5 forum" w:id="forumLink" href="?forum='.$forum['id'].'&del=ok">
<span class="medium bold yellow1"><img src="images/icons/tick.png" width="16" height="16" alt=""> Да, подтверждаю</span>
</a>
</div>
';
echo'
<div w:id="forum" class="odd">
<a style="border-radius: 0 0 3px 3px;margin-bottom:3px;" class="blck p5 forum" w:id="forumLink" href="?forum='.$forum['id'].'">
<span class="medium bold yellow1"><img src="/images/del_chat.png" width="16" height="16" alt=""> Нет, отказываюсь</span>
</a>
</div>
';
include_once 'foots.php';
}
else
{
echo "<div class='white sh_b bold cntr'><a href='forum'>Форум</a> / ".$forum['name']."</div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `type` = 'tema' AND `mother` = '$forum[id]'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'tema' AND `mother` = '$forum[id]' ORDER BY `pined` DESC, `time_obnov` DESC LIMIT $start, $set[p_str]");
//======================================//
$visit=mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='".$forum['id']."'"));
$visit_array=explode(',',$visit['visit']);
$visit_num=count($visit_array)+$sum_num;
if(!in_array($tanks_code['id'],$visit_array)){
$visit_array[$visit_num]=$tanks_code['id'];
mysql_query("UPDATE kolhoz_forum SET visit='".implode(',',$visit_array)."' WHERE id='".$forum['id']."'");
}
//======================================//
if(isset($_GET['proshit'])){
while($post=mysql_fetch_array($q))
{
$visit_array=explode(',',$post['visit']);
$visit_num=count($visit_array)+$sum_num;
if(!in_array($tanks_code['id'],$visit_array)){
$visit_array[$visit_num]=$tanks_code['id'];
mysql_query("UPDATE kolhoz_forum SET visit='".implode(',',$visit_array)."' WHERE id='".$post['id']."'");
}
}
header("Location:?forum=".$forum['id'].""); exit;
}
/////===========================================================================================//
echo "<div class='big white sh_b bold '>";
while($post=mysql_fetch_array($q))
{
$visit_array=explode(',',$post['visit']);
$visit_num=count($visit_array)+$sum_num;
echo'
<div w:id="forum" class="odd">
<a class="blck p5 forum" w:id="forumLink" href="?forum='.$post['id'].'">';
if(!in_array($tanks_code['id'],$visit_array)){echo"<img width='16' height='16' src='images/icons/forum_topic_new.png' alt='x' title='x'>";
} else {
if($post['locked']==1){echo"<img width='16' height='16' src='images/icons/forum_topic_closed.png' alt='x' title='x'>";
} else {
echo"<img width='16' height='16' src='images/icons/forum_topic.png' alt='*' title='*'>";
}
}echo " <span class='medium bold yellow1'>".$post['name']."";
$msgs = $post['msg'];
$msgs = strtr($msgs, array('<'=>':3:', '>'=>':3:', '<script>'=>':3:', 'javascript'=>':3:'));
echo '</span><br>
<span class="small white">'.cut_msg($msgs)
.'...</span>
</a>';
echo'</div>
';
}
echo'</div>';
echo '<div class="bot"><table class="tlist big bold white mb5"><tbody>';
if($tanks_code['level']>=3 && ($forum['admod']==1 && $tanks_code['status']>0 || $forum['admod']==0)){
echo'<tr class="dark">';echo'<td class="usr w100">';
echo"<a href='?forum=$forum[id]&add' class='white big'>Создать топик";
if($forum['admod']==1 && $tanks_code['status']>0){echo'</a><div class="hr"></td></tr>';
}
elseif($forum['admod']!=1 && $tanks_code['status']>0){echo'</a><div class="hr"></td></tr>';}
elseif($forum['admod']==1){echo'</a></tr>';}
}
if($tanks_code['status']>0){
echo'<tr class="dark">';echo'<td class="usr w100">';
echo"<a href='?forum=$forum[id]&del' class='white big'>Удалить форум";
echo'</a><div class="hr"></td></tr>';
echo'<tr class="dark">';echo'<td class="usr w100">';
echo"<a href='?forum=$forum[id]&edit' class='white big'>Изменить название";
echo'</a><div class="hr"></td></tr>';
echo'<tr class="dark">';echo'<td class="usr w100">';
echo"<a href='?forum=".$forum['id']."&proshit' class='white big'>Прочитать все";
echo'</a></td></tr>';}
echo'
</tbody></table></div>';
if ($k_page>1)str("?forum=$forum[id]&",$k_page,$page); // Вывод страниц
echo' <a class="simple-but gray " href="/moder"> <span> <span>Модераторы</span> </span> </a> </div>'; include_once 'foots.php';
}
}
else
{
if(isset($_GET['add']) && $tanks_code['status']>0)
{
echo '<div class="trnt-block mb5">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4">
<div class="wrap5">
<div class="wrap6">
<div class="wrap7">
<div class="wrap8">
<div class="wrap-content">
<div class="clrb"></div>';
echo "<div class='white sh_b bold cntr'>Создание раздела</div>";
if($_GET['add']=='ok')
{
$name=htmlspecialchars($_POST['name']);
$msg=htmlspecialchars($_POST['msg']);
if($name==NULL)
{
echo err_game("Слишком короткое название");
$err=1;
}
if(!isset($err))
{
if($_POST['admod']==1)$admod=1;else $admod=0;
$pos=mysql_result(mysql_query("SELECT MAX(`pos`) FROM `kolhoz_forum` WHERE `type` = 'razdel'"), 0)+1;
mysql_query("INSERT INTO `kolhoz_forum` SET `name` = '".my_esc($name)."',`msg` = '".my_esc($msg)."', `id_user` = '$tanks_code[id]', `type` = 'razdel', `mother` = '0', `time` = '$time', `admod` = '$admod', `pos` = '$pos', `locked` = '".($_POST['locked']==1?"1":"0")."'");
header("Location:?forum");
exit;
}
}
echo "<form action='?forum&add=ok' method='post'><ul><label><div class='bold small white'>Название:<div><input type='text' class=' w50 greensmall' value='' name='name'></div></label><label><div>Описание:</div><div><input type='text' class='w50 greensmall' value='' name='msg'></div></label>";
echo "<input type='checkbox' name='admod' value='1'> <span>Создает топики только администрация</span><br/>";
echo "<input type='checkbox' name='locked' value='1'> <span>Давать доступ только администрации</span><br/>";
echo'</div><div class="bot">
<span class="input-but border"><span>';
echo "<input type='submit' class='w100' value='Создать'></span></span>
</div></form>";echo'</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div>
</div>
</div></div><br>';
include_once 'foots.php';
}
else
{
echo '
<div class="white cntr bold big md5">
Форум
</div>
';if($tanks_code['status']>0){
$q=mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'razdel' ORDER BY `pos` ASC");}
else{
$q=mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'razdel' AND `id`!= '953' ORDER BY `pos` ASC");
}
echo "<div class='big white sh_b bold '>";
echo'<div w:id="forum" class="odd">
<a class="blck p5 forum" w:id="forumLink" href="/news">
<span class="medium bold yellow1"><img src="images/icons/news_forum.png" width="16" height="16" alt=""> Новости</span><br>
<span class="small white">Новости, акции, события</span>
</a>
</div>';
echo'<div w:id="forum" class="odd">
<a class="blck p5 forum" w:id="forumLink" href="/help">
<span class="medium bold yellow1">';
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `help` WHERE `id_user` = '".$tanks_code['id']."' AND `read_u` = '1' "), 0)>0 || mysql_result(mysql_query("SELECT COUNT(*) FROM `help` WHERE `id_vopros` = '".$tanks_code['id']."' AND `read_h` = '1' AND `locked` = '0'"), 0)>0){
echo'<img src="/images/icons/forum_new.png"> '; }else{
echo'<img src="/images/icons/forum.png"> '; }
echo'Помощь</span><br>
<span class="small white">Вопросы задавать сюда</span>
</a>
</div>';
while($post=mysql_fetch_array($q))
{
$visit_array=explode(',',$post['visit']);
$visit_num=count($visit_array)+$sum_num;
$msgs = $post['msg'];
$msgs = strtr($msgs, array('<'=>':3:', '>'=>':3:', '<script>'=>':3:', 'javascript'=>':3:'));
$msgss = $post['name'];
$msgss = strtr($msgss, array('<'=>':3:', '>'=>':3:', '<script>'=>':3:', 'javascript'=>':3:'));
echo'
<div w:id="forum" class="odd">
<a class="blck p5 forum" w:id="forumLink" href="?forum='.$post['id'].'">';
if(!in_array($tanks_code['id'],$visit_array)){echo"<img width='16' height='16' src='images/icons/forum_new.png' alt='*' title='*'>";} else {echo"<img width='16' height='16' src='images/icons/forum.png' alt='*' title='*'>";}
echo " <span class='medium bold yellow1'>".$msgss."";
echo '</span><br>
<span class="small white">'.$msgs.'</span>
</a>';
echo'</div>
';
}
if($tanks_code['status']>0){
echo '<div class="bot"><table class="tlist big bold white mb5"><tbody>';
echo'<tr class="dark">
<td class="usr w100">
<a href="/forum?add" class="white cntr big">
Создать раздел
</a>
</td>
</tr>';
echo'
</tbody></table></div>';}
echo' <a class="simple-but gray " href="/moder"> <span> <span>Модераторы</span> </span> </a> </div>'; include_once 'foots.php';
}
}
?>