Topic display in printable format module
| > Module written by Matt Mecham
| > Date started: 25th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "
Incorrect access
You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class printpage {
var $output = "";
var $base_url = "";
var $html = "";
var $moderator = array();
var $forum = array();
var $topic = array();
var $category = array();
var $mem_groups = array();
var $mem_titles = array();
var $mod_action = array();
var $poll_html = "";
var $parser = "";
/*-------------------------------------------------------------------------*/
//
// Our constructor, load words, load skin, print the topic listing
//
/*-------------------------------------------------------------------------*/
function auto_run()
{
global $ibforums, $DB, $std, $print, $forums;
//-----------------------------------------
// Compile the language file
//-----------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_printpage', $ibforums->lang_id);
$this->html = $std->load_template('skin_printpage');
require ROOT_PATH."sources/lib/post_parser.php";
$this->parser = new post_parser();
//-----------------------------------------
// Check the input
//-----------------------------------------
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
if ( ! $ibforums->input['t'] or ! $ibforums->input['f'] )
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Get the forum info based on the
// forum ID, get the category name, ID,
// and get the topic details
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".$ibforums->input['t'] ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
$this->forum = $forums->forum_by_id[ $this->topic['forum_id'] ];
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( ! $this->forum['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if (!$this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if ( (!$this->topic['pin_state']) and (!$ibforums->member['g_other_topics']) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
//-----------------------------------------
// Check access
//-----------------------------------------
$forums->forums_check_access( $this->forum['id'], 1 );
//-----------------------------------------
//
// Main logic engine
//
//-----------------------------------------
if ($ibforums->input['client'] == 'choose')
{
// Show the "choose page"
$this->page_title = $this->topic['title'];
$this->nav = array ( "{$this->forum['name']}",
"topic['tid']}'>{$this->topic['title']}"
);
$this->output = $this->html->choose_form($this->forum['id'], $this->topic['tid'], $this->topic['title']);
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
exit(); // Incase we haven't already done so :p
}
else
{
$header = 'text/html';
$ext = '.html';
switch ($ibforums->input['client'])
{
case 'printer':
$header = 'text/html';
$ext = '.html';
break;
case 'html':
$header = 'unknown/unknown';
$ext = '.html';
break;
default:
$header = 'application/msword';
$ext = '.doc';
}
}
$title = substr( str_replace( " ", "_" , preg_replace( "/&(lt|gt|quot|#124|#036|#33|#39);/", "", $this->topic['title'] ) ), 0, 12);
//$this->output .= "
Powered by Invision Power Board
© 2002 Invision PS