<?php

/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS                Mobile Content Management System                    //
// Project site:          http://johncms.com                                  //
// Support site:          http://gazenwagen.com                               //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer:        Oleg Kasyanov   (AlkatraZ)  alkatraz@gazenwagen.com //
// Development Team:      Eugene Ryabinin (john77)    john77@gazenwagen.com   //
//                        Dmitry Liseenko (FlySelf)   flyself@johncms.com     //
////////////////////////////////////////////////////////////////////////////////
*/

defined('_IN_JOHNCMS') or die('Error: restricted access');
$error = false;
require('../incfiles/head.php');
if ($id) {
if (isset($_GET['txt'])) {
$res = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE `id` = '$id'"));

 header('Content-Type: text/plain; charset=utf-8', true);
 header('Content-Disposition: attachment; filename="'.htmlspecialchars("".@$_SERVER['HTTP_HOST']."").'_post_'.$res['id'].'.txt";');

$post_i = 1;
$author = mysql_fetch_array(mysql_query('select * from `users` where `id` = "'.$res['user_id'].'"'));
echo "".$post_i++.". ".$author['name']." (".functions::display_date($res['time']).")\r\n";
  echo "".$res['text']."\r\n\r\n";
   exit; 
   }else{
   echo '<div class="phdr">Xabarni yuklash</div>
<div class="menu">
<form name="form" action="index.php?act=txt&amp;id='.$id.'&txt" method="post">
<a name="txt" href="index.php?act=txt&amp;id='.$id.'&txt">Yuklash</a></from>
<br>TXT formatidagi xabarni serverimizdan yuklab oling!</div>';
   }
} else {
    header('location: index.php');
}
require('../incfiles/end.php');
?>