Файл: api_forum/all_theme.php
Строк: 37
<?
////////////////////////////////////////
///// Основа ApiCMS //////
///// Автор биллинга - IvanDanilov /////
///// Автор биллинга - IvanDanilov /////
///// ICQ 936545, mail: KyberID@ya.ru //
////////////////////////////////////////
/////////////////////////////////////////
$title = 'Форум - Подфорум - Темы';
require_once '../api_core/apicms_system.php';
require_once '../api_core/head.php';
/////////////////////////////////////////
if (isset($_GET['id']))$subforum_id = intval($_GET['id']);
$sub_name = mysql_fetch_assoc(mysql_query("SELECT * FROM `api_forum_subforum` WHERE `id` = '$subforum_id' LIMIT 1"));
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `api_forum_subforum` WHERE `id` = '".$subforum_id."'"),0)==1){
/////////////////////////////////////////
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `api_forum_theme` WHERE `subforum` = '$subforum_id'"),0);
$k_page=k_page($k_post,$api_settings['on_page']);
$page=page($k_page);
$start=$api_settings['on_page']*$page-$api_settings['on_page'];
if ($k_post==0)echo "<div class='content'><center>Тем не найдено!</center></div>";
/////////////////////////////////////////
$qii=mysql_query("SELECT * FROM `api_forum_theme` WHERE `subforum` = '$subforum_id' ORDER BY id DESC LIMIT $start, $api_settings[on_page]");
while ($post_all_theme = mysql_fetch_assoc($qii)){
$counts = mysql_result(mysql_query("SELECT COUNT(*) FROM `api_forum_post` WHERE `theme` = '$post_all_theme[id]'"), 0);
$who_theme = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = $post_all_theme[id_user] LIMIT 1"));
echo '<div class="subhead"><table width="100%" ><tr><td width="10%"><center>';
if ($post_all_theme['close']==0)echo '<img src="/design/forum/theme.png">';
if ($post_all_theme['close']==1)echo '<img src="/design/forum/locked_theme.png">';
echo "</center></td><td width='90%'><a href='theme.php?id=$post_all_theme[id]'><b>".htmlspecialchars($post_all_theme['name'])."</b></a> </br> Автор темы: <a href='profile.php?id=".$who_theme['id']."'>".$who_theme['login']."</a>";
echo "<span style='float:right'><small> ".apicms_data($post_all_theme['time'])." </span> </br> <span style='float:right'> Ответов: ".$counts." </small></span></td></tr></table></div>";
}
/////////////////////////////////////////
if ($k_page > 1){
echo '<div class="subhead"><center>';
str('&',$k_page,$page); // генерируем постраничную навигацию
echo '</center></div>';
}
/////////////////////////////////////////
if ($user)echo "<div class='subhead'> - <a href='theme_create.php?id=$subforum_id'>Создать новую тему</a></div>";
}else{
echo '<div class="erors">Ошибка доступа</div>';
}
/////////////////////////////////////////
apicms_foot();
?>