Version 2.0.0

This commit is contained in:
Neo committed 2025-12-19 00:19:56 -08:00
1 parent 5699abfc0e
commit 0eecc172d9
696 files changed
+120723 -77160

No files matched your search

+150 -159
View File
@@ -2,16 +2,15 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board v1.3.1 Final
| ========================================
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2003 Invision Power Services
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| ========================================
| =============================================
| Web: http://www.invisionboard.com
| Time: Thu, 23 Sep 2004 23:05:01 GMT
| Release: 3cb325c445e1909182084806ae7f8226
| Email: matt@invisionpower.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
@@ -20,13 +19,18 @@
| > Date started: 25th March 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
$idx = new Printable;
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class Printable {
class printpage {
var $output = "";
var $base_url = "";
@@ -41,20 +45,19 @@ class Printable {
var $poll_html = "";
var $parser = "";
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
//
// Our constructor, load words, load skin, print the topic listing
//
/***********************************************************************************/
/*-------------------------------------------------------------------------*/
function Printable() {
global $ibforums, $DB, $std, $print, $skin_universal;
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);
@@ -64,84 +67,70 @@ class Printable {
$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'] < 0 or $ibforums->input['f'] < 0)
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
//-------------------------------------
//-----------------------------------------
// Get the forum info based on the
// forum ID, get the category name, ID,
// and get the topic details
//-----------------------------------------
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.password, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, f.use_html, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".$ibforums->input['t'] ) );
$DB->simple_exec();
$this->topic = $DB->fetch_row();
$this->forum = array( 'id' => $this->topic['forum_id'] ,
'name' => $this->topic['forum_name'] ,
'posts' => $this->topic['forum_posts'] ,
'topics' => $this->topic['forum_topics'] ,
'read_perms' => $this->topic['read_perms'] ,
'allow_poll' => $this->topic['allow_poll'] ,
'password' => $this->topic['password'] ,
'use_html' => $this->topic['use_html']
);
$this->forum = $forums->forum_by_id[ $this->topic['forum_id'] ];
$this->category = array( 'name' => $this->topic['cat_name'],
'id' => $this->topic['cat_id'] ,
);
//-------------------------------------
//-----------------------------------------
// Error out if we can not find the forum
//-------------------------------------
//-----------------------------------------
if (!$this->forum['id'])
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') );
}
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
/***********************************/
//-----------------------------------------
// 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') );
}
$bad_entry = $this->check_access();
//-----------------------------------------
// Check access
//-----------------------------------------
if ($bad_entry == 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
$forums->forums_check_access( $this->forum['id'], 1 );
//------------------------------------------------------------
//-----------------------------------------
//
// Main logic engine
//
//------------------------------------------------------------
//-----------------------------------------
if ($ibforums->input['client'] == 'choose')
{
@@ -149,8 +138,8 @@ class Printable {
$this->page_title = $this->topic['title'];
$this->nav = array ( "<a href='{$this->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
$this->nav = array ( "<a href='{$ibforums->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='{$ibforums->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
);
@@ -187,7 +176,6 @@ class Printable {
//$this->output .= "<br><br><font size='1'><center>Powered by Invision Power Board<br>&copy; 2002 Invision PS</center></font></body></html>";
@flush();
@header("Content-type: $header");
if ($ibforums->input['client'] != 'printer')
@@ -202,33 +190,45 @@ class Printable {
}
/*-------------------------------------------------------------------------*/
// GET POSTS
/*-------------------------------------------------------------------------*/
function get_posts()
{
global $ibforums, $DB, $std, $skin_universal;
global $ibforums, $DB, $std, $print;
/***********************************/
//-----------------------------------------
// Render the page top
/***********************************/
//-----------------------------------------
$posts_html = $this->html->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid']);
$max_posts = 300;
$DB->query( "SELECT * FROM ibf_posts WHERE topic_id='".$this->topic['tid']."'".
" and queued !='1' ORDER BY pid LIMIT 0, ".$max_posts);
$DB->simple_construct( array ( 'select' => '*',
'from' => 'posts',
'where' => "topic_id='{$this->topic['tid']}' and queued !='1'",
'order' => 'pid',
'limit' => array(0, $max_posts)
) );
$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 = $DB->fetch_row() )
while ( $i = $DB->fetch_row() )
{
$the_posts[] = $i;
if ($i['author_id'] != 0)
{
if (preg_match( "/'".$i['author_id']."',/", $mem_ids) )
@@ -242,15 +242,21 @@ class Printable {
}
}
//-----------------------------------------
// Fix up the member_id string
//-----------------------------------------
$mem_ids = preg_replace( "/,$/", "", $mem_ids);
//-----------------------------------------
// Get the member profiles needed for this topic
//-----------------------------------------
if ($mem_ids != "")
{
$DB->query("SELECT g.*, m.* FROM ibf_members m, ibf_groups g WHERE m.id in ($mem_ids) AND m.mgroup=g.g_id");
$DB->cache_add_query( 'print_page_get_members', array( 'mem_ids' => $mem_ids ) );
$DB->cache_exec_query();
while ( $m = $DB->fetch_row() )
{
if ($m['id'] and $m['name'])
@@ -267,44 +273,62 @@ class Printable {
}
}
/***********************************/
//-----------------------------------------
// 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 = $std->set_up_guest( $row['author_id'] );
$row['name_css'] = 'unreg';
}
@@ -312,31 +336,34 @@ class Printable {
}
else
{
//-----------------------------------------
// It's definately a guest...
//-----------------------------------------
$poster = $std->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'] = $std->get_date( $row['post_date'], 'LONG' );
$row['post'] = $this->parse_message($row['post']);
//--------------------------------------------------------------
//-----------------------------------------
// Siggie stuff
//--------------------------------------------------------------
//-----------------------------------------
$row['signature'] = "";
@@ -344,113 +371,77 @@ class Printable {
{
if ($row['use_sig'] == 1)
{
if ( $ibforums->vars['sig_allow_html'] == 1 )
{
$poster['signature'] = $this->parser->parse_html($poster['signature'], 0);
}
$this->parser->pp_do_html = intval($ibforums->vars['sig_allow_html']);
$this->parser->pp_wordwrap = $ibforums->vars['post_wordwrap'];
$this->pp_nl2br = 1;
if ( $ibforums->vars['post_wordwrap'] > 0 )
{
$poster['signature'] = $this->parser->my_wordwrap( $poster['signature'], $ibforums->vars['post_wordwrap']) ;
}
$row['signature'] = $skin_universal->signature_separator($poster['signature']);
$row['signature'] = $ibforums->skin_global->signature_separator( $this->parser->post_db_parse($poster['signature']) );
}
}
//--------------------------------------------------------------
//-----------------------------------------
// Parse HTML tag on the fly
//--------------------------------------------------------------
//-----------------------------------------
if ( $this->forum['use_html'] == 1 )
{
// So far, so good..
if ( stristr( $row['post'], '[dohtml]' ) )
{
// [doHTML] tag found..
$parse = ($this->forum['use_html'] AND $poster['g_dohtml']) ? 1 : 0;
$row['post'] = $this->parser->post_db_parse($row['post'], $parse );
}
}
$this->parser->pp_do_html = ( $this->forum['use_html'] and $ibforums->cache['group_cache'][ $ibforums->member['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
$this->parser->pp_wordwrap = $ibforums->vars['post_wordwrap'];
$this->parser->pp_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
$row['post'] = $this->parser->post_db_parse( $row['post'] );
$posts_html .= $this->html->pp_postentry( $poster, $row );
}
/***********************************/
//-----------------------------------------
// Print the footer
/***********************************/
//-----------------------------------------
$posts_html .= $this->html->pp_end();
//-----------------------------------------
// Macros
//-----------------------------------------
$print->_unpack_macros();
if ( is_array( $print->macros ) )
{
foreach( $print->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#>", $ibforums->skin['_imagedir'], $posts_html );
$posts_html = str_replace( "<#EMO_DIR#>", $ibforums->skin['_emodir'] , $posts_html );
//-----------------------------------------
// CSS
//-----------------------------------------
$ibforums->skin['_usecsscache'] = 0;
$css = $print->_get_css();
$posts_html = str_replace( '<!--IPB.CSS-->', $css, $posts_html );
return $posts_html;
}
function parse_message($message="") {
//$message = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $message );
//$message = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", "\n\n------------ CODE SAMPLE ----------\n" , $message );
//$message = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", "\n-----------------------------------\n\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , "\n-----------------------------\n\n" , $message );
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
//$message = preg_replace( "#<img src=[\"'](\S+?)['\"].+"."?".">#" , "(IMAGE: \\1)" , $message );
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 );
//$message = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "(EMAIL: \\2)" , $message );
//$message = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#e" , "\n\n--------------- SQL -----------\n\\2\n----------------\n\n", $message);
//$message = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#e", "\n\n-------------- HTML -----------\n\\2\n----------------\n\n", $message);
return $message;
}
function check_access() {
global $ibforums, $std, $HTTP_COOKIE_VARS;
$return = 1;
$this->m_group = $ibforums->member['mgroup'];
if ( $std->check_perms($this->forum['read_perms']) == TRUE )
{
$return = 0;
}
if ($this->forum['password'] != "")
{
if ( ! $c_pass = $std->my_getcookie('iBForum'.$this->forum['id']) )
{
return 1;
}
if ( $c_pass == $this->forum['password'] )
{
return 0;
}
else
{
return 1;
}
}
return $return;
}
}
?>
?>