⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 print_page.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
字号:
<?php

class printable
{

	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 = "";

	function printable( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		global $skin_universal;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_printpage", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_printpage" );
		$ibforums->input['t'] = intval( $ibforums->input['t'] );
		$ibforums->input['f'] = intval( $ibforums->input['f'] );
		if ( $ibforums->input['t'] < 0 || $ibforums->input['f'] < 0 )
		{
			$std->error( array( 1, "missing_files" ) );
		}
		$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, 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" );
		$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']
		);
		$this->category = array(
			"name" => $this->topic['cat_name'],
			"id" => $this->topic['cat_id']
		);
		if ( !$this->forum['id'] )
		{
			$std->error( array( 1, "missing_files" ) );
		}
		if ( !$this->topic['tid'] )
		{
			$std->error( array( 1, "missing_files" ) );
		}
		$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
		if ( !$this->topic['pin_state'] && !$ibforums->member['g_other_topics'] )
		{
			$std->error( array( 1, "no_view_topic" ) );
		}
		$bad_entry = $this->check_access( );
		if ( $bad_entry == 1 )
		{
			$std->error( array( 1, "no_view_topic" ) );
		}
		if ( $ibforums->input['client'] == "choose" )
		{
			$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->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( );
		}
		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 );
		@flush( );
		@header( "Content-type: {$header}" );
		if ( $ibforums->input['client'] != "printer" )
		{
			@header( "Content-Disposition: attachment; filename={$title}".$ext );
		}
		print $this->get_posts( );
		exit( );
	}

	function get_posts( )
	{
		global $ibforums;
		global $DB;
		global $std;
		$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 );
		$the_posts = array( );
		$mem_ids = "";
		$member_array = array( );
		$cached_members = array( );
		while ( $i = $DB->fetch_row( ) )
		{
			$the_posts[] = $i;
			if ( $i['author_id'] != 0 )
			{
				if ( preg_match( "/'".$i['author_id']."',/", $mem_ids ) )
				{
				}
				else
				{
					$mem_ids .= "'".$i['author_id']."',";
				}
			}
		}
		$mem_ids = preg_replace( "/,\$/", "", $mem_ids );
		if ( $mem_ids != "" )
		{
			$DB->query( "SELECT id,name,mgroup,email,joined,ip_address,avatar,avatar_size,posts,aim_name,icq_number,signature,\r\n\t\t\t\t\t\t\t   website,yahoo,title,hide_email,msnname from ibf_members WHERE id in ({$mem_ids})" );
			while ( $m = $DB->fetch_row( ) )
			{
				if ( $m['id'] && $m['name'] )
				{
					if ( isset( $member_array[$m['id']] ) )
					{
					}
					else
					{
						$member_array[$m['id']] = $m;
					}
				}
			}
		}
		$td_col_cnt = 0;
		foreach ( $the_posts as $row )
		{
			$poster = array( );
			if ( $row['author_id'] != 0 )
			{
				if ( isset( $cached_members[$row['author_id']] ) )
				{
					$poster = $cached_members[$row['author_id']];
					$row['name_css'] = "normalname";
				}
				else if ( $member_array[$row['author_id']] )
				{
					$row['name_css'] = "normalname";
					$poster = $member_array[$row['author_id']];
					$cached_members[$row['author_id']] = $poster;
				}
				else
				{
					$poster = $std->set_up_guest( $row['author_id'] );
					$row['name_css'] = "unreg";
				}
			}
			else
			{
				$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'] );
			if ( !$ibforums->vars[SIG_SEP] )
			{
				$ibforums->vars[SIG_SEP] = "<br><br>--------------------<br>";
			}
			if ( $poster['signature'] && $ibforums->member['view_sigs'] && $row['use_sig'] == 1 )
			{
				$row['signature'] = "<!--Signature-->{$ibforums->vars[SIG_SEP]}<span class='signature'>{$poster['signature']}</span><!--E-Signature-->";
			}
			$posts_html .= $this->html->pp_postentry( $poster, $row );
		}
		$posts_html .= $this->html->pp_end( );
		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;
	}

	function check_access( )
	{
		global $ibforums;
		global $std;
		global $HTTP_COOKIE_VARS;
		$return = 1;
		$this->m_group = $ibforums->member['mgroup'];
		if ( $this->forum['read_perms'] == "*" )
		{
			$return = 0;
		}
		else if ( preg_match( "/(^|,){$this->m_group}(,|\$)/", $this->forum['read_perms'] ) )
		{
			$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;
	}

}

$idx = new printable( );
echo "\r\n\r\n\r\n\r\n\r\n";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -