forums.php

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

PHP
1,549 行
字号
						}					}				}			}						$active['names'] = preg_replace( "/,\s+$/", "" , $active['names'] );						$this->ipsclass->lang['active_users_title']   = sprintf( $this->ipsclass->lang['active_users_title']  , ($active['members'] + $active['guests'] + $active['anon'] ) );			$this->ipsclass->lang['active_users_detail']  = sprintf( $this->ipsclass->lang['active_users_detail'] , $active['guests'],$active['anon'] );			$this->ipsclass->lang['active_users_members'] = sprintf( $this->ipsclass->lang['active_users_members'], $active['members'] );						$this->output = str_replace( "<!--IBF.FORUM_ACTIVE-->", $this->ipsclass->compiled_templates['skin_forum']->forum_active_users($active), $this->output );		}				if ( ! $this->pinned_topic_count and $this->announce_out )		{			$this->announce_out .= $this->ipsclass->compiled_templates['skin_forum']->render_pinned_end();		}				return TRUE;    }        /*-------------------------------------------------------------------------*/	// Parse data	/*-------------------------------------------------------------------------*/		function parse_data( $topic )	{		//-----------------------------------------		// Get a real ID so that moved		// topic don't break owt		//-----------------------------------------				$topic['real_tid']   = $topic['tid'];		$last_time           = 0;		$topic['_last_post'] = $topic['last_post'];				//-----------------------------------------		// Need to update this topic?		//-----------------------------------------				if ( $topic['state'] == 'open' )		{			if( !$topic['topic_open_time'] OR $topic['topic_open_time'] < $topic['topic_close_time'] )			{				if ( $topic['topic_close_time'] AND ( $topic['topic_close_time'] <= time() AND ( time() >= $topic['topic_open_time'] OR !$topic['topic_open_time'] ) ) )				{					$topic['state'] = 'closed';										$this->update_topics_close[] = $topic['real_tid'];				}			}			else if( $topic['topic_open_time'] OR $topic['topic_open_time'] > $topic['topic_close_time'] )			{				if ( $topic['topic_close_time'] AND ( $topic['topic_close_time'] <= time() AND time() <= $topic['topic_open_time'] ) )				{					$topic['state'] = 'closed';										$this->update_topics_close[] = $topic['real_tid'];				}			}						}		else if ( $topic['state'] == 'closed' )		{			if( !$topic['topic_close_time'] OR $topic['topic_close_time'] < $topic['topic_open_time'] )			{				if ( $topic['topic_open_time'] AND ( $topic['topic_open_time'] <= time() AND ( time() >= $topic['topic_close_time'] OR !$topic['topic_close_time'] ) ) )				{					$topic['state'] = 'open';										$this->update_topics_open[] = $topic['real_tid'];				}			}			else if( $topic['topic_close_time'] OR $topic['topic_close_time'] > $topic['topic_open_time'] )			{				if ( $topic['topic_open_time'] AND ( $topic['topic_open_time'] <= time() AND time() <= $topic['topic_close_time'] ) )				{					$topic['state'] = 'open';										$this->update_topics_open[] = $topic['real_tid'];				}			}							}				//-----------------------------------------		// Using DB?		//-----------------------------------------		//print $this->ipsclass->vars['db_topic_read_cutoff'];print " ".$topic['last_post'];print " ".$this->ipsclass->member['members_markers']['board'];exit;		if ( $this->ipsclass->member['id'] and $this->ipsclass->vars['db_topic_read_cutoff'] AND ($topic['last_post'] > intval($this->ipsclass->member['members_markers']['board'])) )		{			$db_topic_read_cutoff = time() - $this->ipsclass->vars['db_topic_read_cutoff'] * 86400;						if ( $topic['last_post'] ) //> $db_topic_read_cutoff )			{				//-----------------------------------------				// Have we read this topic before?				//-----------------------------------------								if ( $topic['db_read'] )				{					$last_time = $topic['db_read'];				}				else if ( $this->db_row['marker_last_cleared'] )				{					$last_time = $this->db_row['marker_last_cleared'];				}				else				{					$last_time = 1;				}			}		}				//-----------------------------------------		// Not reading from DB or past out tracking limit		// At this point: last_vist =		// last_visit > board_marked ? last_visit : board_marked		//-----------------------------------------		if ( ! $last_time )		{			$last_time = $this->read_array[ $topic['tid'] ] > $this->ipsclass->input['last_visit'] ? $this->read_array[ $topic['tid'] ] : $this->ipsclass->input['last_visit'];						if ( $this->ipsclass->forum_read[ $topic['forum_id'] ] > $last_time )			{				$last_time = $this->ipsclass->forum_read[ $topic['forum_id'] ];			}		}				//-----------------------------------------		// Attachy ment		//-----------------------------------------				//if ( $topic['topic_hasattach'] )		//Hide Attachment for Guest		if ( $topic['topic_hasattach'] and $this->ipsclass->member['id'] > 0 )		{			$topic['attach_img'] = $this->ipsclass->compiled_templates['skin_forum']->topic_attach_icon($topic['tid'], intval($topic['topic_hasattach']));		}				//-----------------------------------------		// Yawn		//-----------------------------------------				$topic['last_text']   = $this->ipsclass->lang['last_post_by'];				$topic['last_poster'] = $topic['last_poster_id'] ? $this->ipsclass->make_profile_link( $topic['last_poster_name'], $topic['last_poster_id']) : "-".$topic['last_poster_name']."-";										$topic['starter']     = $topic['starter_id']     ? $this->ipsclass->make_profile_link( $topic['starter_name'], $topic['starter_id']) : "-".$topic['starter_name']."-";	 		if ($topic['poll_state'])		{			$topic['prefix']  = $this->ipsclass->vars['pre_polls'].' ';		}				if ( ($this->ipsclass->member['id']) and ($topic['author_id']) )		{			$show_dots = 1;		}			$topic['folder_img']     = $this->ipsclass->folder_icon( $topic, $show_dots, $last_time );				$topic['topic_icon']     = $topic['icon_id']  ? '<img src="'.$this->ipsclass->vars['img_url'] . '/folder_post_icons/icon' . $topic['icon_id'] . '.gif" border="0" alt="" />'													  : '&nbsp;';				$topic['start_date'] = $this->ipsclass->get_date( $topic['start_date'], 'LONG' );			//-----------------------------------------		// Pages 'n' posts		//-----------------------------------------				$pages = 1;				if ( $this->ipsclass->member['is_mod'] )		{			$topic['posts'] += intval($topic['topic_queuedposts']);		}				if ($topic['posts'])		{			if ( (($topic['posts'] + 1) % $this->ipsclass->vars['display_max_posts']) == 0 )			{				$pages = ($topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts'];			}			else			{				$number = ( ($topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts'] );				$pages = ceil( $number);			}		}				if ( $pages > 1 )		{			for ( $i = 0 ; $i < $pages ; ++$i )			{				$real_no = $i * $this->ipsclass->vars['display_max_posts'];				$page_no = $i + 1;								if ($page_no == 4 and $pages > 4)				{					$topic['PAGES'] .= $this->ipsclass->compiled_templates['skin_forum']->pagination_show_lastpage($topic['tid'], ($pages - 1) * $this->ipsclass->vars['display_max_posts'], $pages);					break;				}				else				{					$topic['PAGES'] .= $this->ipsclass->compiled_templates['skin_forum']->pagination_show_page($topic['tid'], $real_no , $page_no);				}			}						$topic['PAGES'] = $this->ipsclass->compiled_templates['skin_forum']->pagination_wrap_pages($topic['tid'], $topic['PAGES'], $topic['posts'] + 1, $this->ipsclass->vars['display_max_posts']);		}				//-----------------------------------------		// Format some numbers		//-----------------------------------------				$topic['posts']  = $this->ipsclass->do_number_format( intval($topic['posts']) );		$topic['views']	 = $this->ipsclass->do_number_format( intval($topic['views']) );				//-----------------------------------------		// Last time stuff...		//-----------------------------------------				if ($last_time  && ($topic['last_post'] > $last_time))		{			$this->forum_has_unread_topics++;			$topic['go_new_post']  = "<a href='{$this->ipsclass->base_url}showtopic={$topic['tid']}&amp;view=getnewpost'><{NEW_POST}></a>";		}		else		{				$topic['go_new_post']  = "";		}			$topic['last_post']  = $this->ipsclass->get_date( $topic['last_post'], 'SHORT' );				//-----------------------------------------		// Linky pinky!		//-----------------------------------------					if ($topic['state'] == 'link')		{			$t_array = explode("&", $topic['moved_to']);			$topic['tid']       = $t_array[0];			$topic['forum_id']  = $t_array[1];			$topic['title']     = $topic['title'];			$topic['views']     = '--';			$topic['posts']     = '--';			$topic['prefix']    = $this->ipsclass->vars['pre_moved']." ";			$topic['go_new_post'] = "";		}		else		{			$topic['posts'] = $this->ipsclass->compiled_templates['skin_forum']->who_link($topic['tid'], $topic['posts']);		}				if ( ( $this->ipsclass->member['g_is_supmod'] or $this->ipsclass->member['_moderator'][ $topic['forum_id'] ]['post_q'] == 1 ) and ( $topic['topic_queuedposts'] ) )		{					$topic['_hasqueued'] = 1;		}				//-----------------------------------------		// Topic rating		//-----------------------------------------			    $topic['_rate_img']   = '';	    	    if ( $this->forum['forum_allow_rating'] )		{			if ( $topic['topic_rating_total'] )			{				$topic['_rate_int'] = round( $topic['topic_rating_total'] / $topic['topic_rating_hits'] );			}						//-----------------------------------------			// Show image?			//-----------------------------------------						if ( ( $topic['topic_rating_hits'] >= $this->ipsclass->vars['topic_rating_needed'] ) AND ( $topic['_rate_int'] ) )			{				$topic['_rate_img']  = $this->ipsclass->compiled_templates['skin_forum']->topic_rating_image( $topic['_rate_int'] );			}		}				//-----------------------------------------		// Already switched on?		//-----------------------------------------				if ( $this->ipsclass->member['is_mod'] )		{			if ( $this->ipsclass->input['selectedtids'] )			{				if ( strstr( ','.$this->ipsclass->input['selectedtids'].',', ','.$topic['tid'].',' ) )				{					$topic['tidon'] = 1;				}				else				{					$topic['tidon'] = 0;				}			}		}				return $topic;	}		/*-------------------------------------------------------------------------*/	// Crunches the data into pwetty html	/*-------------------------------------------------------------------------*/	function render_entry($topic)	{		$topic = $this->parse_data( $topic );				$p_start    = "";		$p_end      = "";		$class1     = "row2";		$class2     = "row1";		$classposts = "row2";				if ( $this->ipsclass->member['is_mod'] )		{			if ( ! $topic['approved'] )			{				$class1     = 'row4shaded';				$class2     = 'row2shaded';				$classposts = 'row4shaded';			}			else if ( $topic['_hasqueued'] )			{				$classposts = 'row4shaded';			}		}				if ($topic['pinned'] == 1)		{			$topic['prefix'] = $this->ipsclass->vars['pre_pinned'];						if ($this->pinned_print == 0)			{				// we've a pinned topic, but we've not printed the pinned				// starter row, so..								$show    = $this->announce_out ? 1 : 0;				$p_start = $this->ipsclass->compiled_templates['skin_forum']->render_pinned_start( $show );								$this->pinned_print = 1;			}						return $p_start . $this->ipsclass->compiled_templates['skin_forum']->render_forum_row( $topic, $class1, $class2, $classposts, 1 );		}		else		{			//-----------------------------------------			// This is not a pinned topic, so lets check to see if we've			// printed the footer yet.			//-----------------------------------------						if ($this->pinned_print == 1)			{				//-----------------------------------------				// Nope, so..				//-----------------------------------------								$p_end = $this->ipsclass->compiled_templates['skin_forum']->render_pinned_end();								$this->pinned_print = 0;			}						return $p_end . $this->ipsclass->compiled_templates['skin_forum']->render_forum_row( $topic, $class1, $class2, $classposts, 1 );		}	}		/*-------------------------------------------------------------------------*/	// Returns the last action date	/*-------------------------------------------------------------------------*/	    	function get_last_date($topic)	{		return $this->ipsclass->get_date( $topic['last_post'], 'SHORT' );	}}?>

⌨️ 快捷键说明

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