func_topic_threaded.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 509 行 · 第 1/2 页

PHP
509
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   =============================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services, Inc.|   |   =============================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:29 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2005-12-01 16:45:12 +0000 (Thu, 01 Dec 2005) $|   > $Revision: 88 $|   > $Author: bfarber $+---------------------------------------------------------------------------||   > Topic Outline Display Module wodule wookie, nookie shut up|   > Module written by Matt Mecham|   > Date started: 1st December 2003 (Pinch and a punch!)||	> Module Version Number: 1.0.0|   > DBA Checked: Fri 21 May 2004+--------------------------------------------------------------------------*/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 topic_display{	# Global	var $ipsclass;	    var $output         = "";    var $html           = "";    var $forum          = array();    var $topic          = array();    var $mem_titles     = array();    var $mod_action     = array();    var $poll_html      = "";    var $parser         = "";    var $mimetypes      = "";    var $nav_extra      = "";    var $mod_panel_html = "";    var $warn_range     = 0;    var $warn_done      = 0;    var $pfields        = array();    var $pfields_dd     = array();    var $md5_check      = "";    var $post_count     = 0;    var $cached_members = array();    var $pids           = array();    var $lib            = "";    var $structured_pids = array();    var $post_cache      = array();        	/*-------------------------------------------------------------------------*/	// Register class	/*-------------------------------------------------------------------------*/		function register_class(&$class)	{		$this->lib = &$class;				$this->topic = $this->lib->topic;        $this->forum = $this->lib->forum;                $this->topic['SHOW_PAGES'] = "";    }		/*-------------------------------------------------------------------------*/	//	// Our constructor, load words, load skin, print the topic listing	//	/*-------------------------------------------------------------------------*/	    function auto_run()    {        //-----------------------------------------        // Require and init topics.php        //-----------------------------------------                require_once( ROOT_PATH.'sources/action_public/topics.php' );                $this->lib = new topics();        $this->lib->ipsclass =& $this->ipsclass;                $this->lib->init();        $this->lib->topic_set_up();                $this->topic = &$this->lib->topic;        $this->forum = &$this->lib->forum;                $this->topic['SHOW_PAGES'] = "";                //-----------------------------------------        // Checky checky        //-----------------------------------------                if ( ! $this->topic['topic_firstpost'] )        {        	$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid'].'&amp;mode=standard');        }                $this->display_topic();                //-----------------------------------------		// Print it		//-----------------------------------------				$this->topic['id'] = $this->topic['forum_id'];				$this->output = str_replace( "<!--IBF.FORUM_RULES-->", $this->ipsclass->print_forum_rules($this->topic), $this->output );				// Pass it to our print routine				$this->ipsclass->print->add_output("$this->output");        $this->ipsclass->print->do_output( array( 'TITLE'    => $this->ipsclass->vars['board_name']." -> {$this->topic['title']}",        					 	  'JS'       => 1,        					 	  'NAV'      => $this->lib->nav,        				 )      );	}		/*-------------------------------------------------------------------------*/	//	// Show the damned topic batman	//	/*-------------------------------------------------------------------------*/	    function display_topic()    {		//-----------------------------------------		// Grab the posts we'll need		//-----------------------------------------				$query_type = 'topics_get_posts';				$first = intval($this->ipsclass->input['start']);		$last  = $this->ipsclass->vars['threaded_per_page'] ? $this->ipsclass->vars['threaded_per_page'] : 250;				if ( $this->ipsclass->vars['custom_profile_topic'] == 1 )		{			$query_type = 'topics_get_posts_with_join';		}				//-----------------------------------------		// GET meh pids		//-----------------------------------------				if ( $first > 0 )		{			// we're on a page, make sure init val is there						$this->pids[0]                = $this->topic['topic_firstpost'];			$this->structured_pids[ 0 ][] = $this->topic['topic_firstpost'];		}				$this->ipsclass->DB->simple_construct( array (									   'select' => 'pid, post_parent',									   'from'   => 'posts',									   'where'  => 'topic_id='.$this->topic['tid']. ' and queued != 1',									   'order'  => 'pid',									   'limit'  => array( $first, $last )							)        );									$this->ipsclass->DB->simple_exec();				while( $p = $this->ipsclass->DB->fetch_row() )		{			$this->pids[] = $p['pid'];						// Force to be children of 'root' post						if ( ! $p['post_parent'] and $p['pid'] != $this->topic['topic_firstpost'] )			{				$p['post_parent'] = $this->topic['topic_firstpost'];			}						$this->structured_pids[ $p['post_parent'] ][] = $p['pid'];		}				//-----------------------------------------		// Get post bodah		//-----------------------------------------				if ( count( $this->pids ) )		{			$this->ipsclass->DB->simple_construct( array (											'select' => 'pid, post, author_id, author_name, post_date, post_title, post_parent, topic_id, icon_id',											'from'   => 'posts',											'where'  => 'pid IN('.implode(',',$this->pids).')',											'order'  => 'pid',								 )        );								 			$this->ipsclass->DB->simple_exec();						while( $p = $this->ipsclass->DB->fetch_row() )			{				if ( ! $p['post_parent'] and $p['pid'] != $this->topic['topic_firstpost'] )				{					$p['post_parent'] = $this->topic['topic_firstpost'];				}								$this->post_cache[ $p['pid'] ] = $p;								$this->last_id = $p['pid'];			}		}				//-----------------------------------------		// Force root in cache		//-----------------------------------------				$this->post_cache[0] = array( 'id' => 1 );				$this->post_cache[$this->topic['topic_firstpost']]['post_title']  = $this->topic['title'];				//-----------------------------------------		// Are we viewing Posts?		//-----------------------------------------				$post_id = intval($this->ipsclass->input['pid']);				$postid_array = array( 1 => $post_id );				if ( $post_id and $post_id != $this->topic['topic_firstpost'] )		{			$parents = $this->post_get_parents( $post_id );						if ( count($parents) )			{				foreach( $parents as $p => $pid )				{					if ( $pid != $this->topic['topic_firstpost'] )					{						$postid_array[] = $pid;					}				}			}		}				if ( count($postid_array) )		{			//-----------------------------------------			// Get root post and children of clicked

⌨️ 快捷键说明

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