print_page.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 472 行 · 第 1/2 页
PHP
472 行
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;
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?