View file comm/index.php

File size: 1.77Kb
<?

/**
 * Сообщества. Доработка и исправление.
 *
 * Автор: Платонов Кирилл (Plato)
 * URL: http://promob.net/forum/
 */

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';

$set['title'] = 'Сообщества';
include_once '../sys/inc/thead.php';

title();
aut();
err();

// Управление
if ($user['level'] == 10) include_once 'inc/razd_act.php';

// Кол-во разделов
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `community_razd`"), 0);

if ($count == 0) {
	echo '<div class="menu">Разделов нет.</div>';
} else {
	// Готовим запрос
    $q = mysql_query("SELECT * FROM `community_razd` ORDER BY `sort`");
    
    // Запускаем цикл
    while($post = mysql_fetch_array($q)) {
        echo '<div class="menu"><a href="razd.php?id_razd='. $post['id'] .'">'.$post['name'] .'</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `community_comm` WHERE `id_razd` = '$post[id]'"),0) .')<br />'. output_text($post['opis']);
        
        // Управление
        if ($user['level'] == 10) echo '<br /><small>[<a href="index.php?razd=edit&amp;id_razd='.$post['id'].'">Изменить</a>] [<a href="index.php?razd=delete&amp;id_razd='.$post['id'].'">Удалить</a>]</small>';
        
        echo '</div>';
    }
}

// Управление
if ($user['level'] == 10) include_once 'inc/razd_form.php';

include_once '../sys/inc/tfoot.php';

?>