func_topic_threaded.php

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

PHP
509
字号
			//-----------------------------------------						$this->used_post_ids = ','.implode( ",", $postid_array ).',';						$postid_array[0] = $this->topic['topic_firstpost'];						$this->ipsclass->DB->cache_add_query( $query_type, array( 'pids' => $postid_array, 'scol' => 'pid', 'sord' => 'asc') );		}		else		{			//-----------------------------------------			// Just get root			//-----------------------------------------						$this->ipsclass->DB->cache_add_query( $query_type, array( 'pids' => array( 0 => $this->topic['topic_firstpost'] ) ) );		}				//-----------------------------------------		// Attachment PIDS		//-----------------------------------------				$this->lib->attach_pids = $postid_array;				//-----------------------------------------		// Render the original post		//-----------------------------------------				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_page_top( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );										 					 		$this->ipsclass->DB->simple_exec();				//-----------------------------------------		// Format and print out the topic list		//-----------------------------------------				$num_rows = $this->ipsclass->DB->get_num_rows();				while ( $row = $this->ipsclass->DB->fetch_row() )		{			$return = $this->lib->parse_row( $row );						$poster = $return['poster'];			$row    = $return['row'];						//-----------------------------------------			// Are we giving this bloke a good ignoring?			//-----------------------------------------						if ( $this->ipsclass->member['ignored_users'] )			{				if ( strstr( $this->ipsclass->member['ignored_users'], ','.$poster['id'].',' ) and $this->ipsclass->input['p'] != $row['pid'] )				{					if ( ! strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$poster['mgroup'].',' ) )					{						$this->output .= $this->ipsclass->compiled_templates['skin_topic']->render_row_hidden( $row, $poster );						continue;					}				}			}							$this->output .= $this->ipsclass->compiled_templates['skin_topic']->RenderRow( $row, $poster );						if ( ! $this->printed and $num_rows > 1 )			{				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_end_first_post( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1 );				$this->printed = 1;			}		}				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->topic_end_outline( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );				//-----------------------------------------		// Sort out pagination		//-----------------------------------------				$total_replies = $this->topic['posts'];		$show_replies  = count( $this->structured_pids) - 1;				$this->topic['threaded_pages'] = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS'  => $total_replies,																	   'PER_PAGE'    => $last,																	   'CUR_ST_VAL'  => $this->ipsclass->input['start'],																	   'L_SINGLE'    => "",																	   'BASE_URL'    => $this->ipsclass->base_url."showtopic=".$this->topic['tid'],																	   'USE_ST'      => 'start'																	 )  );				//-----------------------------------------		// START GETTING THE OUTLINE LIST		//-----------------------------------------				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->toutline_start_list();				$this->output .= $this->loop_get_children();				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->toutline_end_list($this->topic['threaded_pages']);				$this->output .= $this->ipsclass->compiled_templates['skin_topic']->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ), 1, $this->ipsclass->return_md5_check() );			}		//-----------------------------------------	// Render kiddies	//-----------------------------------------		function loop_get_children($root_id=0, $html="" ,$dguide=-1)	{		$dguide++;				if ( is_array( $this->structured_pids[ $root_id ] ) )		{			if ( count( $this->structured_pids[ $root_id ] ) )			{				$html .= $this->ipsclass->compiled_templates['skin_topic']->toutline_start_new_parent();								foreach( $this->structured_pids[ $root_id ] as $idx => $pid )				{					$html .= $this->render_list_row( $this->post_cache[ $pid ], $dguide );										$html = $this->loop_get_children( $pid, $html, $dguide );				}								$html .= $this->ipsclass->compiled_templates['skin_topic']->toutline_end_new_parent();			}		}				return $html;			}		//-----------------------------------------	// Parse row	//-----------------------------------------		function render_list_row( $post, $depth=0 )	{		$post['depthguide'] = "";				$this->ipsclass->vars['post_showtext_notitle'] = 1;				for( $i = 1 ; $i < $depth; $i++ )		{			$post['depthguide'] .= $this->depth_guide[ $i ];		}				// Last child?				if ( $depth > 0 )		{			$last_id = count($this->structured_pids[ $post['post_parent'] ]) - 1;						if ( $this->structured_pids[ $post['post_parent'] ][$last_id] == $post['pid'] )			{				$this->depth_guide[ $depth ] = '<img src="style_images/<#IMG_DIR#>/spacer.gif" width="20" height="16">';				$post['depthguide'] .= '<img src="style_images/<#IMG_DIR#>/to_post_no_children.gif" />';			}			else			{				$this->depth_guide[ $depth ] = '<img src="style_images/<#IMG_DIR#>/to_down_pipe.gif">';				$post['depthguide'] .= '<img src="style_images/<#IMG_DIR#>/to_post_with_children.gif" />';			}		}				if ( ! $post['post_title'] )		{			if ( $this->ipsclass->vars['post_showtext_notitle'] )			{				$post_text = $this->lib->parser->strip_all_tags( $post['post'] );								if ( strlen($post_text) > 50 )				{					$post['post_title'] = substr( $post_text, 0, 50 ).'...';					$post['post_title'] = preg_replace( "/&#?(\w+)?;?\.\.\.$/", '...', $post['post_title'] );				}				else				{					$post['post_title'] = $post_text;				}								if ( ! trim($post['post_title']) )				{					$post['post_title'] = 'RE: '.$this->topic['title'];				}			}			else			{				$post['post_title'] = 'RE: '.$this->topic['title'];			}		}						$post['linked_name'] = $this->ipsclass->make_profile_link( $post['author_name'], $post['author_id'] );				$post['formatted_date'] = $this->ipsclass->get_date( $post['post_date'], 'LONG' );				$post['new_post'] = '<img src="style_images/<#IMG_DIR#>/to_post_off.gif" />';				if ( $post['post_date'] > $this->lib->last_read_tid )		{			$post['new_post'] = '<img src="style_images/<#IMG_DIR#>/to_post.gif" />';		}				//$post['post_debug'] = "{ID: {$post['pid']}} Last Array Index: $last_id - Last id in tree{$this->structured_pids[ $post['post_parent'] ][$last_id]}, DEPTH: $depth, [parent: {$post['post_parent']}]";				if ( strstr( $this->used_post_ids, ','.$post['pid'].',' ) )		{			return $this->ipsclass->compiled_templates['skin_topic']->toutline_show_row_highlight( $post );		}		else		{			return $this->ipsclass->compiled_templates['skin_topic']->toutline_show_row( $post );		}			}		//-----------------------------------------	// Get parents	//-----------------------------------------		function post_get_parents($root_id, $ids=array())	{		if ( $this->post_cache[ $root_id ]['post_parent'] )		{			$ids[] = $this->post_cache[ $root_id ]['post_parent'];						$ids = $this->post_get_parents( $this->post_cache[ $root_id ]['post_parent'], $ids );		}				return $ids;	}		//-----------------------------------------	// Get children	//-----------------------------------------		function post_get_children($root_id, $ids=array())	{		if ( is_array($this->structured_pids[ $root_id ]) )		{			foreach( $this->structured_pids[ $root_id ] as $id => $pid )			{				$ids[] = $pid;								$ids = $this->post_get_children( $pdaid, $ids );			}		}				return $ids;	}			}?>

⌨️ 快捷键说明

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