<?PHP

require '../Core/start.php';


//if(!isset($_GET['translitit']) || !isset($_GET['id'])){main('Location: /');}

if(isset($_GET['translitit']))
{
$translitit = text($_GET['translitit']);

# Р�С‰РµРј РґР°РЅРЅСѓСЋ РєР°С‚РµРіРѕСЂРёСЋ
$category_result = mysql_result(mysql_query("SELECT COUNT(*) FROM `category` WHERE `translitit` = '$translitit'"),0);
}
elseif(isset($_GET['id']))
{
$id = num($_GET['id']);

# Р�С‰РµРј РґР°РЅРЅСѓСЋ РєР°С‚РµРіРѕСЂРёСЋ
$category_result = mysql_result(mysql_query("SELECT COUNT(*) FROM `category` WHERE `id` = '$id'"),0);
}


if($category_result == '0')
{
$title = 'РљР°С‚РµРіРѕСЂРёСЏ РЅРµ РЅР°Р№РґРµРЅР°';
require '../Core/header_fix.php';
?><div class="link">РљР°С‚РµРіРѕСЂРёСЏ РЅРµ РЅР°Р№РґРµРЅР°</div><?
$error = TRUE;
}
else
{

if(isset($_GET['translitit']))
{
$category = mysql_fetch_array(mysql_query("SELECT * FROM `category` WHERE `translitit` = '$translitit'"));
$id = $category['id'];
}
elseif(isset($_GET['id']))
{
$id = num($_GET['id']);
$category = mysql_fetch_array(mysql_query("SELECT * FROM `category` WHERE `id` = '$id'"));
}

$title = $category['name'];
$description = $category['description'];
$keywords = $category['keywords'];
require '../Core/head.php';

?>
<div class="content">
<?


/* РЎС‡РёС‚Р°РµРј РєРѕР»РёС‡РµСЃС‚РІРѕ СЃР°Р№С‚РѕРІ РІ РєР°С‚РµРіРѕРёРё */
if(!isset($error))
{
$count_site = mysql_result(mysql_query("SELECT COUNT(*) FROM `site` WHERE `id_category` = '".num($category['id'])."' AND `ban` = '0' AND `mod` = '1'"),0);

		$objects  = $system['page'];
		nav_start($count_site, $objects);
}

/* Р•СЃР»Рё РІ РєР°С‚РµРіРѕСЂРёРё РµСЃС‚СЊ СЃР°Р№С‚С‹, С‚Рѕ РІС‹РІРѕРґРёРј РёС… */
if($count_site !== '0')
{
  
 $site_query = mysql_query("SELECT * FROM `site` WHERE `id_category` = '$id' AND `ban` = '0' AND `mod` = '1' ORDER BY `id` DESC LIMIT $start, $objects");
 while($site = mysql_fetch_array($site_query))
    
   {
    ?>
    <a class="link-c" href="/pages/site/<?=on_text($site['translitit'])?>.html"> 
	<img src="/design/icons/site.png" alt="" /> <?=on_text($site['name'])?><br />
	<span class="op"><?=on_text($site['about'])?></span>
	</a>
	<?
   }
 # Р’С‹РІРѕРґРёРј РїРѕСЃС‚СЂР°РЅРёС‡РЅСѓСЋ РЅР°РІРёРіР°С†РёСЋ
 ?>
 </div>
 <?
 view_nav('/pages/category/'.$category['translitit'].'.html&');

}

else {?>РЎР°Р№С‚Р