Version 2.1.7
This commit is contained in:
1 parent
0eecc172d9
commit
f73f8bff6d
941 files changed
+215301
-103093
No files matched your search
@@ -0,0 +1,478 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
|
||||
| > $Revision: 64 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > 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 "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
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()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Compile the language file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->load_language('lang_printpage');
|
||||
$this->ipsclass->load_template('skin_printpage');
|
||||
|
||||
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
|
||||
$this->parser = new parse_bbcode();
|
||||
$this->parser->ipsclass = $this->ipsclass;
|
||||
$this->parser->allow_update_caches = 1;
|
||||
|
||||
$this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check the input
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->input['t'] = intval($this->ipsclass->input['t']);
|
||||
$this->ipsclass->input['f'] = intval($this->ipsclass->input['f']);
|
||||
|
||||
if ( ! $this->ipsclass->input['t'] or ! $this->ipsclass->input['f'] )
|
||||
{
|
||||
$this->ipsclass->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
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".$this->ipsclass->input['t'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$this->topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$this->forum = $this->ipsclass->forums->forum_by_id[ $this->topic['forum_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->forum['id'])
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if (!$this->topic['tid'])
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check viewing permissions, private forums,
|
||||
// password forums, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( ! $this->topic['pinned']) and ( ! $this->ipsclass->member['g_other_topics'] ) )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check access
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->forums->forums_check_access( $this->forum['id'], 1, 'topic' );
|
||||
|
||||
//-----------------------------------------
|
||||
//
|
||||
// Main logic engine
|
||||
//
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->input['client'] == 'choose')
|
||||
{
|
||||
// Show the "choose page"
|
||||
|
||||
$this->page_title = $this->topic['title'];
|
||||
|
||||
$this->nav = array ( "<a href='{$this->ipsclass->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
|
||||
"<a href='{$this->ipsclass->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
|
||||
);
|
||||
|
||||
|
||||
$this->output = $this->ipsclass->compiled_templates['skin_printpage']->choose_form($this->forum['id'], $this->topic['tid'], $this->topic['title']);
|
||||
|
||||
$this->ipsclass->print->add_output("$this->output");
|
||||
|
||||
$this->ipsclass->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 ($this->ipsclass->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);
|
||||
|
||||
@header("Content-type: $header");
|
||||
|
||||
if ($this->ipsclass->input['client'] != 'printer')
|
||||
{
|
||||
@header("Content-Disposition: attachment; filename=$title".$ext);
|
||||
}
|
||||
|
||||
print $this->get_posts();
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// GET POSTS
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function get_posts()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Render the page top
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html = $this->ipsclass->compiled_templates['skin_printpage']->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid']);
|
||||
|
||||
$max_posts = 300;
|
||||
$attach_pids = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array ( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$this->topic['tid']} and queued=0",
|
||||
'order' => 'pid',
|
||||
'limit' => array(0, $max_posts)
|
||||
) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through to pick out the correct member IDs.
|
||||
// and push the post info into an array - maybe in the future
|
||||
// we can add page spans, or maybe save to a PDF file?
|
||||
//-----------------------------------------
|
||||
|
||||
$the_posts = array();
|
||||
$mem_ids = "";
|
||||
$member_array = array();
|
||||
$cached_members = array();
|
||||
|
||||
while ( $i = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$the_posts[] = $i;
|
||||
|
||||
if ($i['author_id'] != 0)
|
||||
{
|
||||
if (preg_match( "/'".$i['author_id']."',/", $mem_ids) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mem_ids .= "'".$i['author_id']."',";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up the member_id string
|
||||
//-----------------------------------------
|
||||
|
||||
$mem_ids = preg_replace( "/,$/", "", $mem_ids);
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the member profiles needed for this topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ($mem_ids != "")
|
||||
{
|
||||
$this->ipsclass->DB->cache_add_query( 'print_page_get_members', array( 'mem_ids' => $mem_ids ) );
|
||||
$this->ipsclass->DB->cache_exec_query();
|
||||
|
||||
while ( $m = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
if ($m['id'] and $m['name'])
|
||||
{
|
||||
if (isset($member_array[ $m['id'] ]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$member_array[ $m['id'] ] = $m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Format and print out the topic list
|
||||
//-----------------------------------------
|
||||
|
||||
$td_col_cnt = 0;
|
||||
|
||||
foreach ($the_posts as $row) {
|
||||
|
||||
$poster = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the member info. We parse the data and cache it.
|
||||
// It's likely that the same member posts several times in
|
||||
// one page, so it's not efficient to keep parsing the same
|
||||
// data
|
||||
//-----------------------------------------
|
||||
|
||||
if ($row['author_id'] != 0)
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Is it in the hash?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset($cached_members[ $row['author_id'] ]) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ok, it's already cached, read from it
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = $cached_members[ $row['author_id'] ];
|
||||
$row['name_css'] = 'normalname';
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ok, it's NOT in the cache, is it a member thats
|
||||
// not been deleted?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($member_array[ $row['author_id'] ])
|
||||
{
|
||||
$row['name_css'] = 'normalname';
|
||||
$poster = $member_array[ $row['author_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Add it to the cached list
|
||||
//-----------------------------------------
|
||||
|
||||
$cached_members[ $row['author_id'] ] = $poster;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// It's probably a deleted member, so treat them as a guest
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = $this->ipsclass->set_up_guest( $row['author_id'] );
|
||||
$row['name_css'] = 'unreg';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// It's definately a guest...
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = $this->ipsclass->set_up_guest( $row['author_name'] );
|
||||
$row['name_css'] = 'unreg';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post_css'] = $td_col_count % 2 ? 'post1' : 'post2';
|
||||
|
||||
++$td_col_count;
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "", $row['post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post_date'] = $this->ipsclass->get_date( $row['post_date'], 'LONG' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Quoted attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
preg_match( "#\[attachmentid=(\d+)\]i#", $row['post'], $match );
|
||||
|
||||
if ( $match[1] )
|
||||
{
|
||||
$attach_pids[ $match[1] ] = $match[1];
|
||||
}
|
||||
|
||||
$attach_pids[ $row['pid'] ] = $row['pid'];
|
||||
|
||||
$row['post'] = $this->parse_message($row['post']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Siggie stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$row['signature'] = "";
|
||||
|
||||
if ($poster['signature'] and $this->ipsclass->member['view_sigs'])
|
||||
{
|
||||
if ($row['use_sig'] == 1)
|
||||
{
|
||||
$this->parser->parse_html = intval($this->ipsclass->vars['sig_allow_html']);
|
||||
$this->parser->parse_nl2br = 1;
|
||||
|
||||
$row['signature'] = $this->ipsclass->compiled_templates['skin_global']->signature_separator( $this->parser->pre_display_parse($poster['signature']) );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse HTML tag on the fly
|
||||
//-----------------------------------------
|
||||
|
||||
$this->parser->parse_html = ( $this->forum['use_html'] and $this->ipsclass->cache['group_cache'][ $poster['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
|
||||
$this->parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
|
||||
|
||||
$row['post'] = $this->parser->pre_display_parse( $row['post'] );
|
||||
|
||||
$posts_html .= $this->ipsclass->compiled_templates['skin_printpage']->pp_postentry( $poster, $row );
|
||||
}
|
||||
|
||||
if ( count( $attach_pids ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// ATTACHMENTS!!!
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH.'sources/action_public/topics.php' );
|
||||
$this->topic = new topics();
|
||||
$this->topic->ipsclass =& $this->ipsclass;
|
||||
|
||||
$this->topic->topic_init();
|
||||
|
||||
$posts_html = $this->topic->parse_attachments( $posts_html, $attach_pids );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print the footer
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html .= $this->ipsclass->compiled_templates['skin_printpage']->pp_end();
|
||||
|
||||
//-----------------------------------------
|
||||
// Macros
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $this->ipsclass->skin['_macros'] ) )
|
||||
{
|
||||
foreach( $this->ipsclass->skin['_macros'] as $i => $row )
|
||||
{
|
||||
if ( $row['macro_value'] != "" )
|
||||
{
|
||||
$posts_html = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $posts_html );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$posts_html = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $posts_html );
|
||||
$posts_html = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir'] , $posts_html );
|
||||
|
||||
//-----------------------------------------
|
||||
// CSS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->skin['_usecsscache'] = 0;
|
||||
|
||||
$css = $this->ipsclass->print->_get_css();
|
||||
|
||||
$posts_html = str_replace( '<!--IPB.CSS-->', $css, $posts_html );
|
||||
|
||||
return $posts_html;
|
||||
}
|
||||
|
||||
|
||||
function parse_message($message="")
|
||||
{
|
||||
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
|
||||
$message = preg_replace( "#<a href=[\"'](http|https|ftp|news)://(\S+?)['\"].+?".">(.+?)</a>#" , "\\1://\\2" , $message );
|
||||
|
||||
return $message;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user