<?
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `comm` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0)
{
$comm=mysql_query("SELECT * FROM `comm` WHERE `id` = '".intval($_GET['id'])."'");
$comm=mysql_fetch_array($comm);

$cat=mysql_query("SELECT * FROM `comm_cat` WHERE `id` = '$comm[id_cat]'");
$cat=mysql_fetch_array($cat);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `activate` = '1' AND `invite` = '0'"),0)==0)$comm['id_user']=0;
$ank=get_user($comm['id_user']); // sozdak

$set['title'] = 'Сообщество - '.htmlspecialchars($comm['name']).' - Информация'; // Заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
echo "<div class='main'>\n";
echo "Создано: ".vremja($comm['time'])."</div><div class='nav2'>\n";
echo "Категория: <a href='/comm/?act=cat&id=$cat[id]'>".htmlspecialchars($cat['name'])."</a>".($ank['id']==$user['id'] && isset($user) || user_access('comm')?" <a href='?act=comm_cat&id=$comm[id]'><img src='/comm/img/edit.png'/></a>":NULL)."</div><div class='main'>\n";
if($comm['id_user']!=0)
{
echo "Создатель: \n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a> ".online($ank['id']).group($ank['id']);
echo "</div>";
echo "<div class='nav2'><a href='?act=comm_users&id=$comm[id]&sort=2'>Список руководства</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_users` WHERE `id_comm` = '$comm[id]' AND `access` != 'user'"),0).")</div>";
}
if($comm['deviz']!=NULL)echo "<div class='main'>Девиз: ".output_text($comm['deviz'])."</div>\n";
if($comm['desc']!=NULL)echo "<div class='nav2'>Описание: ".output_text($comm['desc'])."</div>\n";
if($comm['interests']!=NULL)echo "<div class='nav2'>Интересы: ".output_text($comm['interests'])."</div>\n";
if($comm['rules']!=NULL)echo "<div class='main'>Правила: ".output_text($comm['rules'])."</div>\n";
echo "<div class='nav2'>\n";
echo "Членство: ".($comm['join_rule']==1?"Свободное":NULL)."".($comm['join_rule']==2?"Через модератора":NULL)."".($comm['join_rule']==3?"По приглашениям":NULL)."</div><div class='main'>\n";
echo "Читатели: ".($comm['read_rule']==2?"Только участники":NULL)."".($comm['read_rule']==1?"Все желающие":NULL)."</div><div class='nav2'>\n";
echo "Писатели: ".($comm['write_rule']==2?"Только участники":NULL)."".($comm['write_rule']==1?"Все желающие":NULL)."<br/>\n";
echo "</div>\n";
//if($ank['id']==$user['id'] && isset($user))echo "<div class='main'><img src='/comm/img/edit.png'/> <a href='?act=comm_object&id=$comm[id]'>Изменить</a><br/></div>\n";
echo "<div class='foot'><img src='/style/icons/str2.gif'> <a href='/comm/?act=comm&id=$comm[id]'>В сообщество</a></div>";
}
else{header("Location:/comm");exit;}
?>