Файл: element_forum_list2.php
Строк: 111
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
require_once './element_function/element_function_forum.php';
// Городской список
if ($id) {
$cache_town = cache_town($id);
if (!$cache_town) {
$title = 'Ошибка';
$error1 = 'Произошла какая-то ошибка';
require_once 'element_error_page.php';
exit;
}
$title = 'Форум "'.$cache_town['lost_name'].'"';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mt5 small mlra">';
$query = mysql_query("SELECT * FROM `element_forum_list_2` WHERE `lost_town` = '$id'");
$i = 1;
while ($myrrow = mysql_fetch_array($query)) {
$count_topic = Count_Topic_Subforum($myrrow['lost_id']);
$image = 'forum_new';
if ($count_topic > 0) {
$query_topic = mysql_query("SELECT `lost_id`,`lost_time_comment` FROM `element_forum_topic_2` WHERE `lost_subforum` = '$myrrow[lost_id]'");
$c = 0;
while ($myr = mysql_fetch_array($query_topic)) {
$read_topic = Read_Topic_User($user['lost_id'], $myr['lost_id']);
if ($read_topic) {
if ($read_topic < $myr['lost_time_comment']) break; else $c++;
} else break;
}
if ($c == $count_topic) $image = 'forum';
} else $image = 'forum';
$odd = ($i % 2) ? ' odd' : '';
echo '
<div class="ml5 mr5">
<a class="bl p5 block'.$odd.'" href="/forum/subforum/?id='.$myrrow['lost_id'].'">
<img width="16" height="16" alt="" src="/images/icons/'.$image.'.png"/>
<span class="yellow1 small">'.$myrrow['lost_name'].'</span><br/>
<span class="small white">'.$myrrow['lost_sub_name'].'</span>
</a>
</div>';
$i++;
}
echo ($i == 1) ? '<div class="cntr white">Разделов нет</div>' : '';
if ($id == $user['lost_town'] and $town_other[0] <= 1)
echo '<div class="cntr small mt10"><a class="button w70" href="/forum/subforum/create?id='.$id.'">Создать раздел</a></div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
} else { // Основной форум
$query = mysql_query("SELECT * FROM `element_forum_list_2` WHERE `lost_town` = '0' ORDER BY `lost_dostype` ASC");
$ii = 1;
$title = 'Форум';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mt5 small mlra">';
$i = 1;
while ($myrrow = mysql_fetch_array($query)) {
// $read_topic = Read_Topic_User($user['lost_id'], $id);
$odd = ($i % 2) ? ' odd' : '';
if ($myrrow['lost_dostype'] == 0) {
$count_topic = Count_Topic_Subforum($myrrow['lost_id']);
$image = 'forum_new';
if ($count_topic > 0) {
$query_topic = mysql_query("SELECT `lost_id`,`lost_time_comment` FROM `element_forum_topic_2` WHERE `lost_subforum` = '$myrrow[lost_id]'");
$c = 0;
while ($myr = mysql_fetch_array($query_topic)) {
$read_topic = Read_Topic_User($user['lost_id'], $myr['lost_id']);
if ($read_topic) {
if ($read_topic < $myr['lost_time_comment']) break; else $c++;
} else break;
}
if ($c == $count_topic) $image = 'forum';
} else $image = 'forum';
echo '
<div class="ml5 mr5">
<a class="bl p5 block'.$odd.'" href="/forum/subforum/?id='.$myrrow['lost_id'].'">
<img width="16" height="16" alt="" src="/images/icons/'.$image.'.png"/>
<span class="yellow1 small">'.$myrrow['lost_name'].'</span><br/>
<span class="small white">'.$myrrow['lost_sub_name'].'</span>
</a>
</div>';
$i++;
}
if ($myrrow['lost_dostype'] > 0) {
$moderation = explode(" ", $myrrow['lost_moderation']);
if ($user['lost_privilege'] == 3 OR in_array($user['lost_id'], $moderation)) {
$count_topic = Count_Topic_Subforum($myrrow['lost_id']);
$image = 'forum_new';
if ($count_topic > 0) {
$query_topic = mysql_query("SELECT `lost_id`,`lost_time_comment` FROM `element_forum_topic_2` WHERE `lost_subforum` = '$myrrow[lost_id]'");
$c = 0;
while ($myr = mysql_fetch_array($query_topic)) {
$read_topic = Read_Topic_User($user['lost_id'], $myr['lost_id']);
if ($read_topic) {
if ($read_topic < $myr['lost_time_comment']) break; else $c++;
} else break;
}
if ($c == $count_topic) $image = 'forum';
} else $image = 'forum';
echo '
<div class="ml5 mr5">
<a class="bl p5 block'.$odd.'" href="/forum/subforum/?id='.$myrrow['lost_id'].'">
<img width="16" height="16" alt="" src="/images/icons/'.$image.'.png"/>
<span class="yellow1 small">'.$myrrow['lost_name'].'</span><br/>
<span class="small white">'.$myrrow['lost_sub_name'].'</span>
</a>
</div>';
$i++;
}
}
}
if ($user['lost_privilege'] == 3) echo '<div class="cntr small mt10"><a class="button w70" href="/forum/subforum/create">Создать раздел</a></div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
}
?>