Файл: forum/loadtopic.php
Строк: 80
<?php
# Script by seg0ro http://mobilarts.ru
# Not for sale!!!
defined('_IN_JOHNCMS') or die('Error: restricted access');
$textl .= ' | Скачать тему';
if (!$topic){
require_once('../incfiles/head.php');
echo functions::display_error('Отсутствует идентификатор темы!<br /><a href="index.php">Форум</a>');
require_once('../incfiles/end.php');
exit;
}
if (!$user_id){
require_once('../incfiles/head.php');
echo functions::display_error('Только для авторизованных!<br /><a href="index.php?topic='.$topic.'&page='.$page.'">Назад</a>');
require_once('../incfiles/end.php');
exit;
}
$req = mysql_query("SELECT * FROM `forum_posts` WHERE `topic` = '$topic' ORDER BY `time` ASC ");
$name = 'Тема: '.functions::checkout($topicRes['topicname'])."rn".'Скачано с сайта '.$set['homeurl'];
$text = array();
if(isset($_POST['loadtxt'])){
while ($res = mysql_fetch_assoc($req)){
$text[] = $res['user']." (".date("d.m.Y/H:i", $res['time']).")rn".bbcode::notags($res['text'])."";
}
array_unshift($text, $name);
$tmp = implode("rnrn",$text);
header ('Content-Encoding: none');
header ('Content-type: text/plain');
header ('Content-Disposition: attachment; filename="topic_'.$topic.'.txt"');
header ('Last-Modified: ' . date("D, d M Y H:i:s T"));
echo $tmp;
exit;
}elseif(isset($_POST['loadgzip'])){
while ($res = mysql_fetch_assoc($req)){
$text[] = $res['user']." (".date("d.m.Y/H:i", $res['time']).")rn".bbcode::notags($res['text'])."";
}
array_unshift($text, $name);
$tmp = implode("rnrn",$text);
header ('Content-Encoding: none');
header ('Content-type: multipart/alternative');
header ('Content-Disposition: attachment; filename="topic_'.$topic.'.txt.gz"');
header ('Last-Modified: ' . date("D, d M Y H:i:s T"));
echo gzencode($tmp);
exit;
}else{
require('../incfiles/head.php');
$tree = array('<a href="index.php">Форум</a>', '<a href="index.php?topic='.$topic.'&page='.$page.'">'.functions::checkout($topicRes['topicname']).'</a>', 'Загрузить тему');
echo '<div class="phdr">'.functions::display_menu($tree).'</div>';
echo '<form action="index.php?act=loadtopic&topic='.$topic.'&page='.$page.'" method="post"><div class="gmenu"><input type="submit" name="loadtxt" value="Загрузить .txt" />'.
/*' <input type="submit" name="loadgzip" value="Загрузить .gzip" />'.*/
'</div></form>';
}