Файл: ferma/inc/selsovet.php
Строк: 127
<?
if($mc['id']==$ct['id'])
{
if(isset($_GET['leave_ct']))
{
if($mcu['status']==1)echo err_game("Председатель не может покинуть свой колхоз.");
else
{
if(isset($_GET['ok']))
{
mysql_query("DELETE FROM `kolhoz_collective_rating_gos` WHERE `id_user` = '$ku[id]'");
mysql_query("DELETE FROM `kolhoz_collective_rubies` WHERE `id_user` = '$ku[id]'");
mysql_query("DELETE FROM `kolhoz_collective_user` WHERE `id_user` = '$ku[id]'");
mysql_query("INSERT INTO `kolhoz_collective_history` SET `id_user` = '$ku[id]', `id_collective` = '$ct[id]', `time` = '$time', `type` = 'out', `dei` = 'user'");
mysql_query("UPDATE `kolhoz_user` SET `time_shmel` = '0', `time_yastreb` = '0', `time_drakon` = '0' WHERE `id` = '$ku[id]'");
header("Location:?collective=$ct[id]");
exit;
}
else
{
echo podtv("?collective=$ct[id]&selsovet&leave_ct&ok","?collective=$ct[id]&selsovet");
include_once 'inc/foot.php';
}
}
}
}
echo "<div class='event'><h1><a
href='?collective=$ct[id]'>".hsc($ct['name'])."</a> / Сельсовет</h1></div>
<div class='content'>
<div class='block'>";
if($mc['id']==$ct['id'])
{
if(isset($_GET['del_komm']) && intval($_GET['del_komm'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_chat` WHERE `id` = '".intval($_GET['del_komm'])."' AND `id_collective` = '$ct[id]'"),0)!=0 && $mcu['status']<=3)
{
mysql_query("delete from `kolhoz_collective_chat` where `id` = '".intval($_GET['del_komm'])."'");
}
if(isset($_GET['otv']) && intval($_GET['otv'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_user` WHERE `id_user` = '".intval($_GET['otv'])."'"),0)!=0 && intval($_GET['otv'])!=$ku['id'])
{
$otv=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '".intval($_GET['otv'])."'"));
$otvu=$otv;
}
echo "<div><img alt='' width='16' height='16' src='i/icons/refresh.png'> <a href='?collective=$ct[id]&selsovet&reflesh=".rand(99999,99999999)."'>Обновить</a> <img alt='' width='16' height='16' src='i/icons/pencil.png'> <a href='?collective=$ct[id]&selsovet".(!isset($_GET['write'])?"&write":null)."'>Написать</a></div>";
if(isset($_POST['msg']) && isset($_GET['add']) && $_GET['add']=='ok' && isset($_GET['write']) && !isset($molchi))
{
$msg=$_POST['msg'];
if($msg==NULL)
{
echo err_game("Слишком короткое сообщение");
$err=1;
}
if(!isset($err))
{
mysql_query("INSERT INTO `kolhoz_collective_chat` SET `msg` = '".my_esc($msg)."', `id_user` = '$ku[id]', `time` = '$time', `id_collective` = '$ct[id]'".(isset($otv)?", `otvet` = '$otv[id]'":null)."");
}
}
if(isset($_GET['write']))
{
if($ban['id'])
{
echo "<ul class='pt'>
<div>
<li class='major'><span>".($ban['izg']==1?'Изгнание':"Обет Молчания до ".vremja($ban['time']))."</span>, выдал".($us_ban['pol']==0?'a':null)." <span>";
echo on_k($us_ban['id']);
echo "<a href='?user=$us_ban[id]'>".nc($us_ban['id'])."</a></span><span>, (".output_text($ban['msg']).")</span></li></div></ul>";
}
else echo "<div><form action='?collective=$ct[id]&selsovet&write=yes&add=ok".(isset($otv)?"&otv=$otv[id]":null)."' method='post'><label>Сообщение".(isset($otv)?" для $otvu[nick]":null).":<br><textarea class='wide' rows='2' name='msg'></textarea></label><br><input type='submit' value='Отправить'></form></div>";
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_chat` WHERE `id_collective` = '$ct[id]'"),0);
if ($k_post==0)
{
echo "пустo...";
}
$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_collective_chat` WHERE `id_collective` = '$ct[id]' ORDER BY `time` DESC LIMIT $start, 10");
while($post=mysql_fetch_array($q))
{
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_user]'"));
if($post['otvet']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$post[otvet]'"),0)!=0)
{
$otvet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[otvet]'"));
$otvetu=$otvet;
}
echo "<li class='pt'><div><span>";
echo on_k($ank['id']);
echo " <a class='' href='?user=$ank[id]'><span>".nc($ank['id'])."</span></a></span> <span class='minor small'> <span>".vremja($post['time'])."</span></span></div><div class='title'><p>".(isset($otvet)?"".($ku['id']==$otvet['id']?"<span class='rare'>":null)."$otvetu[nick]".($ku['id']==$otvet['id']?"</span>":null).", ":null)."".output_text($post['msg'], $ank['id'])."</p></div><div>".($ank['id']!=$ku['id']?"<a class='small minor' href='?collective=$ct[id]&selsovet&otv=$ank[id]&write'>[ответить]</a>":null)."";
if($mcu['status']<=3)echo " <a class='small minor' href='?collective=$ct[id]&selsovet&del_komm=$post[id]'>[удалить]</a>";
echo "</div></li>";
}
if ($k_page>1)str("?collective=$ct[id]&selsovet&",$k_page,$page); // Вывод страниц
echo "</ul>";
echo "<div><img width='16' height='16' src='i/icons/smiles.png' alt='o'> <a href='?smiles'>Смайлы</a></div>";
echo "<div><img width='16' height='16' src='i/icons/forum.png' alt='o'>
<a href='?collective=$ct[id]&club'>Дом культуры</a></div>";
}
echo "<h3>Участники</h3>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_user` WHERE `id_collective` = '$ct[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'];
$num=($page-1)*$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_collective_user` WHERE `id_collective` = '$ct[id]' ORDER BY `status` ASC LIMIT $start, 10");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$num++;
$uk=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_user]'"));
$uuk=$uk;
if($uuk['pol']==1)$post['status_name']='колхозник';else $post['status_name']='колхозница';
if($post['status']==1)$post['status_name']='председатель';
elseif($post['status']==2)$post['status_name']='зампред';
elseif($post['status']==3)$post['status_name']='агроном';
elseif($post['status']==4)$post['status_name']=($uuk['pol']==1?'бригадир':'хозяйка');
elseif($post['status']==5)$post['status_name']='староста';
elseif($post['status']==6)$post['status_name']=($uuk['pol']==1?'механизатор':'товаровёд');
echo "<li><span>";
echo on_k($uk['id']);
echo " <a class='' href='?user=$uk[id]'>".nc($uk['id'])."</a></span> <span class='minor'><span>$post[status_name]</span>, <span>$uk[level]</span>, <span>$uk[tehnika]</span></span></li>";
}
echo "</ul>";
if ($k_page>1)str("?collective=$ct[id]&selsovet&",$k_page,$page); // Вывод страниц
?>
<div class='small minor ptm'>Рядом с именем - должность, уровень, механизация.</div>
<ul class='ptm'>
<li><img width='16' height='16' src='i/icons/rating.png' alt='o'> <a href='?collective=<? echo $ct['id'];?>&selsovet&rating'>Рейтинг</a></li>
<li><img width='16' height='16' src='i/icons/work_log.png' alt='o'> <a href='?collective=<? echo $ct['id'];?>&selsovet&history'>История</a></li>
<?
if(isset($mc) && $ct['id']==$mc['id'])echo "<li><img width='16' height='16' src='i/icons/favorite.png' alt='o'> <a href='?collective=$ct[id]&selsovet&enlarge'>Расширить</a></li>";
if(isset($mc) && $mc['id']==$ct['id'] && $mcu['status']==1)echo "<li><img width='16' height='16' src='i/icons/rename.png' alt='o'> <a href='?collective=$ct[id]&selsovet&rename'>Переименовать</a></li>";
?>
</ul>
<?
if($mc['id']==$ct['id'])
{
echo "<div class='pt'><img alt='o' width='16' height='16' src='i/icons/leave.png'> <a href='?collective=$ct[id]&selsovet&leave_ct'>Покинуть колхоз</a><br/></div>
<div class='pt'><span class='minor'>Внимание! Все бонусы вертолетов исчезнут при выходе из колхоза.</span></div>";
}
?>
</div>
<? include_once 'inc/foot.php';?>