Файл: CMS/comm/comm_comm.php
Строк: 115
<?php
if (!defined('CMS')) { die('Access Denied!'); }
$prs = parse_url($_SERVER['REQUEST_URI']);
$row = array();
$row = $db->selectRow("SELECT ?_comm_comm.*, ?_comm_category.*,
(SELECT COUNT(1) FROM ?_users_bookmarks WHERE `book_path` = ?) AS `bookmarks`,
(SELECT COUNT(1) FROM ?_comm_users WHERE ?_comm_comm.`comm_id` = ?_comm_users.`cu_comm`) AS `count_users`,
(SELECT COUNT(1) FROM ?_comm_chat WHERE ?_comm_comm.`comm_id` = ?_comm_chat.`chat_comm`) AS `count_chat`,
(SELECT COUNT(1) FROM ?_comm_topics WHERE ?_comm_comm.`comm_id` = ?_comm_topics.`topics_comm`) AS `topics`,
(SELECT COUNT(1) FROM ?_comm_posts WHERE ?_comm_comm.`comm_id` = ?_comm_posts.`posts_comm`) AS `posts`,
(SELECT COUNT(1) FROM ?_comm_files WHERE ?_comm_comm.`comm_id` = ?_comm_files.`files_comm`) AS `files`
FROM ?_comm_comm LEFT JOIN ?_comm_category
ON ?_comm_comm.`comm_cats_id` = ?_comm_category.`cats_id`
WHERE `comm_url` = ? LIMIT 1;", $prs['path'], $soo);
if (empty($row) || !is_array($row)) {
$inSes->addMessage('Ошибка! Сообщество не найдено или ссылка неверна!');
redirect($config['site_url'] . '/comm/' . gen_uri('index', '', RND));
}
$arr_admins = @explode(',', $row['comm_admins']);
$cnt_admins = @count($arr_admins);
$new_users = true;
$users = array();
if ($is_logged) {
$users = $db->selectRow("SELECT * FROM ?_comm_users WHERE `cu_comm` = ? AND `cu_user` = ? LIMIT 1;", $row['comm_id'], $log);
if (!empty($users)) {
// if ($log == $row['comm_user']) {
if (in_array($log, $arr_admins) && $users['cu_admin'] == 2) {
$is_admin_soo = true;
$is_moder_soo = true;
}
if (in_array($log, $arr_admins) && $users['cu_admin'] == 1) {
$is_moder_soo = true;
}
$new_users = false;
}
}
show_header($row['comm_name'] . ' - Сообщества');
echo '<div class="b">';
if ($row['comm_status'] == 1) {
echo icon('com_closed.gif', 'icons');
}
else {
echo icon('com_open.gif', 'icons');
}
echo '<b>' . $row['comm_name'] . '</b><br />';
if (!empty($row['comm_image']) && file_exists(ROOTPATH . '/upload/comm/' . $row['comm_image'])) {
$org = str_replace('_small', '', $row['comm_image']);
echo '<a href="' . $config['site_url'] . '/upload/comm/' . $org . '">';
echo '<img src="' . $config['site_url'] . '/upload/comm/' . $row['comm_image'] . '" alt="Фото" /></a>';
}
else echo '<img src="' . $config['site_url'] . '/images/no_photos_small.png" alt="Фото" />';
if ($is_logged && $log == $row['comm_user']) echo '<br /><a href="' . gen_uri('add_screen', $id, RND) . '">Изменить</a>';
echo '<br />';
echo icon('site.png') . '<a href="' . gen_comm($soo, 'chat', '', RND) . '">Чат</a> (' . $row['count_chat'] . ')<br />';
if (!empty($row['comm_obmen'])) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'files', '', RND) . '">Файлы</a> (' . $row['files'] . ')<br />';
}
else {
if ($is_admin_soo) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'add_obmen', '', RND) . '">Купить обменник в сообщество</a><br />';
}
}
if (!empty($row['comm_forum'])) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'forum', '', RND) . '">Форум</a> (' . $row['topics'] . '/' . $row['posts'] . ')<br />';
}
else {
if ($is_admin_soo) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'add_forum', '', RND) . '">Купить форум в сообщество</a><br />';
}
}
echo '</div>';
echo '<div class="b">';
if (empty($_GET['info'])) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'index', '', 'info=1&' . RND) . '">Инфа</a><br />';
}
else {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'index', '', RND) . '">Инфа</a><br />';
echo '<div style="border: 1px solid ' . $themes['border_color'] . '; padding:5px;">';
echo '- Создано: <b>' . get_date($row['comm_create']) . '</b><br />';
echo '- Категория: <b><a href="../' . gen_uri('cats', $row['comm_cats_id'], RND) . '">' . $row['cats_name'] . '</a></b><br />';
echo '- Создатель: <b>' . users_anketa($row['comm_user']) . '</b><br />';
echo '- Описание: ' . nl2br(bb_code($row['comm_about'])) . '<br />';
echo '- Адрес: <a href="' . $config['site_url'] . '/comm/' . $row['comm_url'] . '">' . $config['site_url'] . '/comm/' . $row['comm_url'] . '</a><br />';
echo '</div>';
}
echo icon('site.png') . '<a href="' . gen_comm($soo, 'rules', '', RND) . '">Правила</a><br />';
echo icon('site.png') . '<a href="' . gen_comm($soo, 'users', '', RND) . '">Участники</a> (' . $row['count_users'] . ')<br />';
echo icon('site.png') . '<a href="' . gen_comm($soo, 'admins', '', RND) . '">Администрация</a> (' . $cnt_admins . ')<br />';
if ($is_logged && $log == $row['comm_user']) {
echo icon('site.png') . '<a href="' . gen_comm($soo, 'edit', '', RND) . '">Управление сообществом</a><br />';
echo icon('site.png') . '<a href="' . gen_comm($soo, 'invite', '', RND) . '">Пригласить в сообщество</a><br />';
}
else {
if ($new_users) {
echo icon('site.png') . '<a href="' . gen_uri('enter', $id, RND) . '">Вступить в сообщество</a><br />';
}
else {
echo icon('site.png') . '<a href="' . gen_uri('invite', $id, RND) . '">Пригласить в сообщество</a><br />';
echo icon('site.png') . '<a href="' . gen_uri('exit', $id, RND) . '">Покинуть сообщество</a><br />';
}
}
echo '</div>';
echo show_bookmarks($row['comm_name'], '', $row['bookmarks']);
echo '<div class="b">' . icon('return.png');
echo '<a href="../' . gen_uri('index', '', RND) . '">Сообщества</a> | ';
echo '<a href="../' . gen_uri('cats', $row['cats_id'], RND) . '">' . $row['cats_name'] . '</a></div>';
?>