<?
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';
$ID = intval($_GET['id']);
if (isset($_GET['id']) && $_GET['id']!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `comm` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0){	
$comm = get_comm($ID);
$set['title']='Информация о сообществе '.text($comm['name']).''; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
if($comm['close']==0)echo'<div class="err">Открыто для чтения</div>';
elseif($comm['close']==1)echo'<div class="err">Закрыто для чтения</div>';
$ret = $comm['rating'];
$aqr = $comm['rating']/100;
$aqr = floor($aqr);
if($comm['rating']>100)$ret = $comm['rating']-(100*$aqr);
echo "<div class='nav2'>";
echo'<div style="display: inline-block; height: 14px; width: 140px; border: 1px solid DodgerBlue; position: relative; background-color: White;">
	 <div style="height: 14px; width: 329%; background: LightGray; position: absolute; max-width: 100%;"></div>
	 <div style="height: 14px; width: '.$ret.'%; background: #32CD32; position: absolute;  max-width: 100%;"></div>
	 <span style="position: absolute; text-align: center; width: 100%; display: block; font-size: 11px;">'.$comm['rating'].'%</span>
	</div>

	<br/>';
	echo avatar_comm($comm['id'],128);
	echo "</div><div class='st_2'>";
	echo output_text($comm['status']);
	echo"</div>";
	echo"<div class='nav2'><b>ID: $comm[id]</b><br>Создано: <small>";
	echo vremja($comm['time']);
	echo"</small><br />";
	$creators = mysql_fetch_array(mysql_query("SELECT * FROM `comm_user` WHERE `id_comm` = '".intval($ID)."' AND `level` = '3' ORDER BY `id` DESC LIMIT 1"));
	echo'Создатель: ';
	echo group($creators['id_user']);
	echo user::nick($creators['id_user'],1,1,1);
	echo'<br />';
	echo'Категория: ';
	$category = mysql_fetch_array(mysql_query("SELECT * FROM `comm_category` WHERE `id` = '".intval($comm['id_category'])."' LIMIT 1"));
	echo'<a href="/comm/cat.php?id='.$category['id'].'">'.$category['name'].'</a>';
	echo"</div>";
	if(isset($comm['interes']) && $comm['interes']!=NULL){
		echo"<div class='nav2'>Интересы:</div>";
		echo"<div class='nav1'>".output_text($comm['interes'])."</div>";
	}
	if(isset($comm['opis']) && $comm['opis']!=NULL){
		echo"<div class='nav2'>Описание:</div>";
		echo"<div class='nav1'>".output_text($comm['opis'])."</div>";
	}
	if(isset($comm['pravila']) && $comm['pravila']!=NULL){
		echo"<div class='nav2'>Правила:</div>";
		echo"<div class='nav1'>".output_text($comm['pravila'])."</div>";
	}
echo "<div class='foot'><img src='/style/icons/str2.gif' alt=''/> <a href='/comm/$ID/'>В сообщество</a></div>";
}else{
	header("Location: /");
}
include_once '../sys/inc/tfoot.php';
?>