Файл: vsime.com/comm/inc/act_cat.php
Строк: 73
<?
if (mysqli_result("SELECT COUNT(*) FROM `comm_cat` WHERE `id` = '".intval($_GET['id'])."'")) {
$cat = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `comm_cat` WHERE `id` = '".intval($_GET['id'])."'"));
$title .= ' - '.htmlspecialchars($cat['name']); // Заголовок страницы
$navigation = "<a href='/index/comm'>Сообщества</a> / ".hsc($cat['name']);
if ($user['level'] >= 3)$navigation .= " <a href='?act=edit_cat&id=$cat[id]'>$config[code_edit]</a> <a href='?act=delete_cat&id=$cat[id]'>$config[code_delete]</a>";
ex_head();
if (isset($_GET['sort'])) {
$sort=htmlspecialchars($_GET['sort']);
if ($sort=='new') {
$querysort = "time";
} elseif ($sort=='open') {
$querysort = "visits";
} else {
$sort = 'visits';
$querysort = "visits";
}
} else {
$sort = 'visits';
$querysort = "visits";
}
echo "<div class='grand_h'>n";
echo "<table>n";
echo "<td>".($sort!='visits'?"<a href='?act=cat&id=$cat[id]&sort=visits'".title_link('Популярные сообщества').">":NULL)."<span class='block_l'>Популярные</span>".($sort!='visits'?"</a>":NULL)."</td><td>".($sort!='new'?"<a href='?act=cat&id=$cat[id]&sort=new'".title_link('Новые сообщества').">":NULL)."<span class='block_l'>Новые</span>".($sort!='new'?"</a>":NULL)."</td><td>".($sort!='open'?"<a href='?act=cat&id=$cat[id]&sort=open'".title_link('Открытые сообщества').">":NULL)."<span class='block_l'>Открытые</span>".($sort!='open'?"</a>":NULL)."</td>n";
echo "</table>n";
echo "</div>n";
$count_results = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm` WHERE `id_cat` = '$cat[id]'".($sort=='open'?" AND `read_rule` = '1'":NULL).""));
$count_pages = count_pages($count_results);
$page = page();
$start = start_pages();
$query = mysqli_query($dbi, "SELECT * FROM `comm` WHERE `id_cat` = '$cat[id]'".($sort=='open'?" AND `read_rule` = '1'":NULL)." ORDER BY `$querysort` DESC LIMIT $start, $config[rop]");
if ($count_results == 0) {
echo "<div class='list'>n";
echo "Нет сообществ.n";
echo "</div>n";
}
$num = 0;
while($post = mysqli_fetch_array($query)) {
$num++;
echo "<div class='list'>n";
echo "<img src='/i/site/comm.png' /> <a href='?act=comm&id=$post[id]'".title_link('Открыть сообщество').">".htmlspecialchars($post['name'])."</a> (".mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `comm_users` WHERE `id_comm` = '$post[id]' AND `invite` = '0' AND `activate` = '1'")).") <img src='/i/site/comm_".($post['read_rule']==1?"open":"closed").".png' /><br/>".($post['desc']!=NULL?output_text($post['desc'], $post['id_user']).'<br/>':NULL);
echo "</div>n";
}
pages_show("?act=cat&id=$cat[id]&sort=$sort&"); // Вывод страниц
if(isset($user)) {
echo "<div class='mod_grad'>n";
echo "$config[code_add] <a href='?act=add_comm&id=$cat[id]'".title_link('Создать свое сообщество').">Создать сообщество</a><br/>n";
echo "</div>n";
}
echo "<div class='foot'>n";
echo image_back()." <a href='/index/comm'".title_link('Список кактегорий').">Категории</a><br/>n";
echo "</div>n";
} else {header("Location: ?");exit();}
?>