<?php
$set['title'] = 'Сообщества'; // Заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();

$q=mysql_query("SELECT * FROM `comm_cat` ORDER BY `pos` ASC");
if(!mysql_num_rows($q))
{
echo "<div class='main_menu'>\n";
echo "Нет категорий\n";
echo "</div>\n";

}
while($post=mysql_fetch_array($q))
{
echo "<div class='main_menu'>\n";
echo "<img src='/style/themes/$set[set_them]/loads/14/dir.png' alt='dir' />\n";echo " <a href='?act=cat&id=$post[id]'>".htmlspecialchars($post['name'])."</a> <span style='color: #006666;'>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `comm` WHERE `id_cat` = '$post[id]'"),0).")</span><span style='float:right'>".(user_access('comm')?"<a href='?act=edit_cat&id=$post[id]'><img src='/comm/img/edit.png'/></a>":NULL)."".(user_access('comm')?"<a href='?act=delete_cat&id=$post[id]'><img src='/comm/img/delete.png'/></a>":NULL)."</span><br/>".($post['desc']!=NULL?output_text($post['desc']).'<br/>':NULL);
echo "</div>\n";
}
if (isset($user))
{
if (user_access('comm')){
echo "<div class='main'>\n";
echo "<img src='/comm/img/add.png'/> <a href='?act=add_cat'>Добавить категорию</a>\n";
echo "</div>\n";
}
}
?>