Файл: forum/topic.php
Строк: 84
<?
include_once('../apahe/ini.php');
$forum_u = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-u` WHERE `id` = '".int($_GET['id'])."'"));
$urlup='/forum/index';
$inc['title'] = 'Форум - '.$forum_u['name'].'';
include_once('../apahe/top.php');
if (!isset($apache)){
header ('location: /input.dll');
exit;
}
if (!$forum_u){
header ('location: /forum/index.dll');
exit;
}
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id` = '".int($forum_u['id-forum'])."'"));
$forum_r = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-r` WHERE `id` = '".int($forum_u['id-forum-r'])."'"));
$forum_s = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-s` WHERE `id` = '1'"));
if ($forum_u['act']==0){
if (isset($_POST['post-new-ok'])){
$message = txt($_POST['message']);
$apa = int($apache['id']);
if (empty($message)) $err .= 'Не введёно сообщение.</br>';
if (!empty($message) && (strlen($message) < 2 || strlen($message) > 1024)) $err .= 'Неверная длина сообщения.</br>';
if (!isset($err)){
mysql_query("INSERT INTO `forum-m` SET `id-forum` = '".int($forum['id'])."', `id-forum-r` = '".int($forum_r['id'])."', `id-forum-u` = '".int($forum_u['id'])."', `id-apache` = '".$apa."', `message` = '$message', `date` = '".time()."'");
mysql_query("UPDATE `forum-u` SET `last` = '".time()."' WHERE `id` = '".int($forum_u['id'])."'");
mysql_query("UPDATE `apache` SET `rub` = `rub`+1 WHERE `id` = '".$apa."'");
header('Location: /forum/topic-'.int($forum_u['id']).'.dll?page=end');
}}
error($err);
}
echo '<div class="main-text">';
echo '<a href="index.dll" title="Форум">Форум</a> | ';
echo '<a href="forum-'.int($forum['id']).'.dll" title="'.$forum['name'].'">'.$forum['name'].'</a> | ';
echo '<a href="forum-r-'.int($forum_r['id']).'.dll" title="'.$forum_r['name'].'">'.$forum_r['name'].'</a>';
if ($apache['id']==$forum_u['id-apache']){
echo ' | <a href="topic-sett-'.int($forum_u['id']).'.dll" title="'.$forum_u['name'].'">Настройки темы</a>';
}else if ($apache['level']>=2){
echo ' | <a href="topic-sett-'.int($forum_u['id']).'.dll" title="'.$forum_u['name'].'">Настройки темы</a>';
}
echo '</div>';
if ($forum_u['act']==0){
echo '<a class="main-href" href="topic-'.int($forum_u['id']).'.dll" title="Обновить">';
icons('refresh');
echo 'Обновить</a>';
echo '<div class="main-href"><form method="post" action="topic-'.int($forum_u['id']).'.dll?">';
echo 'Сообщение: <a href="/module/infomation.dll?selest=smiles" title="Список смайлов">Смайлы</a> | ';
echo '<a href="/module/infomation.dll?selest=bb-code" title="Список ББ-кодов">ББ-коды</a></br>';
echo '<textarea placeholder="Мах 1024 символов" name="message" maxlength="1024"></textarea></br>';
echo '<input type="submit" name="post-new-ok" title="Написать" value="Написать">';
echo '</form></div>';
}else{
error('Тема закрыта от обсуждений.');
}
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum-m` WHERE `id-forum-u` = '".int($forum_u['id'])."'"), 0);
nav_start($total, $forum_s[tm]);
if ($total!=0){
$forum_m_c = mysql_query("SELECT * FROM `forum-m` WHERE `id-forum-u` = '".int($forum_u['id'])."' ORDER BY `date` LIMIT $start, $forum_s[tm]");
while ($forum_m = mysql_fetch_assoc($forum_m_c)){
$forum_m_t = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum-m` WHERE `id-forum-u` = '".int($forum_u['id'])."' ORDER BY `id` LIMIT 1"));
$forum_f_t = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum-f` WHERE `id-forum-m` = '".int($forum_m['id'])."'"), 0);
echo '<div class="main-href">';
echo '<table width="100%" cellspacing="0" cellpadding="0">';
echo '<tr><td class="apa-l">';
echo '<a href="/id-'.int($forum_m ['id-apache']).'.dll" title="'.name($forum_m['id-apache']).'">';
echo ''.apache($forum_m ['id-apache']).''.name($forum_m ['id-apache']).''.status($forum_m['id-apache']).'';
if ($forum_u['id-apache']==$forum_m ['id-apache'])echo ' <name>автор</name>';
echo '</a>';
echo '</td>';
echo '<td class="apa-r">';
echo '<time>'.vtime($forum_m['date']).'</time>';
echo '</td></tr>';
echo '</table>';
echo ''.out($forum_m['message']).'</br>';
$forum_f_c = mysql_query("SELECT * FROM `forum-f` WHERE `id-forum-m` = '".int($forum_m['id'])."' ORDER BY `date` LIMIT 3");
while ($forum_f = mysql_fetch_assoc($forum_f_c)){
echo '<table width="100%" cellspacing="0" cellpadding="0">';
echo '<tr><td class="apa-l">';
echo '<a href="topic-file-'.int($forum_f['id']).'.dll?selest=loading" title="Скачать '.$forum_f['file'].'">';
icons('file');
echo ''.$forum_f['file'].'</a>';
if ($apache['level']>=1)echo ' <a href="topic-file-'.int($forum_f['id']).'.dll?selest=delete" title="Удалить файл">[Удал]</a>';
echo '</br>Скачано: '.$forum_f['count'].' раз(а)';
echo '</td>';
echo '<td class="apa-r">';
echo '<time>'.size(filesize('file/f'.int($forum_f['id']).'_'.$forum_f['file'])).'</time>';
echo '</td></tr>';
echo '</table>';
}
if ($forum_u['act']==0){
if ($apache['id']==$forum_m['id-apache']){
if ($forum_f_t<=2)echo '<a href="topic-post-'.int($forum_m['id']).'.dll?selest=files" title="Прикрепить файл">[Файл]</a> ';
}
if ($apache['level']>=1)echo '<a href="topic-post-'.int($forum_m['id']).'.dll" title="Редактировать пост">[Ред]</a>';
if ($apache['id']!=$forum_m['id-apache'])echo ' <a href="topic-post-'.int($forum_m['id']).'.dll?selest=otvet" title="Ответить">[Отв]</a>';
if ($apache['level']>=1 && $forum_m_t['id']!=$forum_m['id'])echo ' <a href="topic-post-'.int($forum_m['id']).'.dll?selest=delete" title="Удал">[Удал]</a>';
}
echo '</div>';
}}else{
error('В теме соощения отсутствуют.');
}
view_nav('/forum/topic-'.int($forum_u['id']).'.dll?');
include_once('../apahe/bottom.php');
?>