topics.php

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

PHP
1,929 行
字号
				}								if ( $temp_out )				{					$html = str_replace( "<!--IBF.ATTACHMENT_{$row[$type]}-->", $temp_out, $html );				}			}		}				return $html;	}		/*-------------------------------------------------------------------------*/	// Parse post	/*-------------------------------------------------------------------------*/		function parse_row( $row = array() )	{		$poster = array();				//-----------------------------------------		// Cache member		//-----------------------------------------				if ($row['author_id'] != 0)		{			//-----------------------------------------			// Is it in the hash?			//-----------------------------------------						if ( isset($this->cached_members[ $row['author_id'] ]) )			{				//-----------------------------------------				// Ok, it's already cached, read from it				//-----------------------------------------								$poster = $this->cached_members[ $row['author_id'] ];				$row['name_css'] = 'normalname';			}			else			{				$row['name_css'] = 'normalname';				$poster = $this->parse_member( $row );								//-----------------------------------------				// Add it to the cached list				//-----------------------------------------								$this->cached_members[ $row['author_id'] ] = $poster;			}		}		else		{			//-----------------------------------------			// It's definitely a guest...			//-----------------------------------------						$poster = $this->ipsclass->set_up_guest( $row['author_name'] );			$poster['members_display_name'] = $row['author_name'];			$row['name_css']                = 'unreg';		}				//-----------------------------------------				if ( $row['queued'] or ($this->topic['topic_firstpost'] == $row['pid'] and $this->topic['approved'] != 1) )		{			$row['post_css'] = $this->post_count % 2 ? 'post1shaded' : 'post2shaded';			$row['altrow']   = 'row4shaded';		}		else		{			$row['post_css'] = $this->post_count % 2 ? 'post1' : 'post2';			$row['altrow']   = 'row4';		}				//-----------------------------------------				if ( ($row['append_edit'] == 1) and ($row['edit_time'] != "") and ($row['edit_name'] != "") )		{			$e_time = $this->ipsclass->get_date( $row['edit_time'] , 'LONG' );						$row['post'] .= "<br /><br /><span class='edit'>".sprintf($this->ipsclass->lang['edited_by'], $row['edit_name'], $e_time)."</span>";		}				//-----------------------------------------				if (!$this->ipsclass->member['view_img'])		{			//-----------------------------------------			// unconvert smilies first, or it looks a bit crap.			//-----------------------------------------						$row['post'] = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $row['post'] );						$row['post'] = preg_replace( "/<img src=[\"'](.+?)[\"'].+?".">/", "(IMG:<a href='\\1' target='_blank'>\\1</a>)", $row['post'] );		}				//-----------------------------------------		// Highlight...		//-----------------------------------------				if ($this->ipsclass->input['hl'])		{			$this->ipsclass->input['hl'] = $this->ipsclass->parse_clean_value(urldecode($this->ipsclass->input['hl']));			$loosematch = strstr( $this->ipsclass->input['hl'], '*' ) ? 1 : 0;			$keywords   = str_replace( '*', '', str_replace( "+", " ", str_replace( '-', '', trim($this->ipsclass->input['hl']) ) ) );			$word_array = array();			$endmatch1  = "";			# Added '?' to mean 'or not'. Another bug spotted by TheWalrus. :D			$endmatch2  = "(.)?";						if ( preg_match("/,(and|or),/i", $keywords) )			{				while ( preg_match("/,(and|or),/i", $keywords, $match) )				{					$word_array = explode( ",".$match[1].",", $keywords );					$keywords   = str_replace( $match[0], '' ,$keywords );				}			}			else if ( strstr( $keywords, ' ' ) )			{				$word_array = explode( ' ', str_replace( '  ', ' ', $keywords ) );			}			else			{				$word_array[] = $keywords;			}						if ( ! $loosematch )			{				$endmatch1 = "(\s|,|\.|!|<br|&|$)";				$endmatch2 = "(\<|\s|,|\.|!|<br|&|$)";			}							if (is_array($word_array))			{				foreach ($word_array as $keywords)				{					while( preg_match( "/(^|\s|;)(".preg_quote($keywords, '/')."){$endmatch1}/i", $row['post'] ) )				   {					   $row['post'] = preg_replace( "/(^|\s|;|\>)(".preg_quote($keywords, '/')."){$endmatch2}/is", "\\1<span class='searchlite'>\\2</span>\\3", $row['post'] );				   }				}			}		}				//-----------------------------------------		// Online, offline?		//-----------------------------------------				if ( $row['author_id'] )		{			$time_limit = time() - $this->ipsclass->vars['au_cutoff'] * 60;					$poster['online_status_indicator'] = '<{PB_USER_OFFLINE}>';					list( $be_anon, $loggedin ) = explode( '&', $row['login_anonymous'] );						if ( ( $row['last_visit'] > $time_limit or $row['last_activity'] > $time_limit ) AND $be_anon != 1 AND $loggedin == 1 )			{				$poster['online_status_indicator'] = '<{PB_USER_ONLINE}>';			}		}		else		{			$poster['online_status_indicator'] = '';		}				//-----------------------------------------		// Multi Quoting?		//-----------------------------------------				$row['mq_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->mq_image_add($row['pid']);				if ( $this->qpids )		{			if ( strstr( ','.$this->qpids.',', ','.$row['pid'].',' ) )			{				$row['mq_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->mq_image_remove($row['pid']);			}		}				//-----------------------------------------		// Multi PIDS?		//-----------------------------------------				if ( $this->ipsclass->member['is_mod'] )		{			$row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->pid_image_unselected($row['pid']);						if ( $this->ipsclass->input['selectedpids'] )			{				if ( strstr( ','.$this->ipsclass->input['selectedpids'].',', ','.$row['pid'].',' ) )				{					$row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->pid_image_selected($row['pid']);				}								$this->ipsclass->input['selectedpidcount'] = count( explode( ",", $this->ipsclass->input['selectedpids'] ) );			}		}				//-----------------------------------------		// Delete button..		//-----------------------------------------				if ( $row['pid'] != $this->topic['topic_firstpost'] )		{			$row['delete_button'] = $this->delete_button($row['pid'], $poster);		}				$row['edit_button']   = $this->edit_button($row['pid'], $poster, $row['post_date']);				$row['post_date']     = $this->ipsclass->get_date( $row['post_date'], 'LONG' );				$row['post_icon']     = $row['icon_id']							  ? $this->ipsclass->compiled_templates['skin_topic']->post_icon( $row['icon_id'] )							  : "";				$row['ip_address']    = $this->view_ip($row, $poster);				$row['report_link']   = (($this->ipsclass->vars['disable_reportpost'] != 1) and ( $this->ipsclass->member['id'] ))							  ? $this->ipsclass->compiled_templates['skin_topic']->report_link($row)							  : "";				//-----------------------------------------		// 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;								//判断是否显示签名图片				if (!$this->ipsclass->vars['allow_img_sig'])                {                    $poster['signature'] = preg_replace("/<img +src=(\'|\")|\" +border=\"0\" +alt *?= *?\"IPB +Image\" +\/>/i", "", $poster['signature']);                }				//判断是否显示签名图片				$row['signature'] = $this->ipsclass->compiled_templates['skin_global']->signature_separator( $this->parser->pre_display_parse($poster['signature']) );			}		}				//-----------------------------------------		// Fix up the membername so it links to the members profile		//-----------------------------------------				if ( $poster['id'] )		{			$poster['members_display_name'] = "<a href='{$this->base_url}showuser={$poster['id']}'>{$poster['members_display_name']}</a>";		}				//-----------------------------------------		// 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'] );				//-----------------------------------------		// A bit hackish - but there are lots of <br> => <br /> changes to make		//-----------------------------------------				//$row['post']      = str_replace( "<br>", "<br />", $row['post'] );		//$row['signature'] = str_replace( "<br>", "<br />", $row['signature'] );				//-----------------------------------------		// Post number		//-----------------------------------------				if ( $this->topic_view_mode == 'linearplus' and $this->topic['topic_firstpost'] == $row['pid'])		{			$row['post_count'] = 1;						if ( ! $this->first )			{				$this->post_count++;			}		}		else		{			$this->post_count++;					$row['post_count'] = intval($this->ipsclass->input['st']) + $this->post_count;		}				$row['forum_id'] = $this->topic['forum_id'];				return array( 'row' => $row, 'poster' => $poster );	}		/*-------------------------------------------------------------------------*/	// Parse the member info	/*-------------------------------------------------------------------------*/		function parse_member( $member=array() )	{		$member['avatar'] = $this->ipsclass->get_avatar( $member['avatar_location'], $this->ipsclass->member['view_avs'], $member['avatar_size'], $member['avatar_type'] );				$pips = 0;				foreach($this->mem_titles as $k => $v)		{			if ($member['posts'] >= $v['POSTS'])			{				if (!$member['title'])				{					$member['title'] = $this->mem_titles[ $k ]['TITLE'];				}								$pips = $v['PIPS'];				break;			}		}				if ( $this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_icon'] )		{			$member['member_rank_img'] = $this->ipsclass->compiled_templates['skin_topic']->member_rank_img($this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_icon']);		}		else if ( $pips )		{			if ( is_numeric( $pips ) )			{				for ($i = 1; $i <= $pips; ++$i)				{					$member['member_rank_img'] .= "<{A_STAR}>";				}			}			else			{				$member['member_rank_img'] = $this->ipsclass->compiled_templates['skin_topic']->member_rank_img( 'style_images/<#IMG_DIR#>/folder_team_icons/'.$pips );			}		}				$member['member_joined'] = $this->ipsclass->compiled_templates['skin_topic']->member_joined( $this->ipsclass->get_date( $member['joined'], 'JOINED' ) );				$member['member_group']  = $this->ipsclass->compiled_templates['skin_topic']->member_group( $this->ipsclass->cache['group_cache'][ $member['mgroup'] ]['g_title'] );				$member['member_posts']  = $this->ipsclass->compiled_templates['skin_topic']->member_posts( $this->ipsclass->do_number_format($member['posts']) );				$member['member_number'] = $this->ipsclass->compiled_templates['skin_topic']->member_number( $this->ipsclass->do_number_format($member['id']) );				$member['profile_icon']  = $this->ipsclass->compiled_templates['skin_topic']->member_icon_profile( $member['id'] );				$member['message_icon']  = $this->ipsclass->compiled_templates['skin_topic']->member_icon_msg( $member['id'] );				if ($member['location'])		{			$member['member_location']  = $this->ipsclass->compiled_templates['skin_topic']->member_location( $member['location'] );		}				if (! $member['hide_email'])		{			$member['email_icon'] = $this->ipsclass->compiled_templates['skin_topic']->member_icon_email( $member['id'] );		}				if ( $member['id'] )		{			$member['addresscard'] = $this->ipsclass->compiled_templates['skin_topic']->member_icon_vcard( $member['id'] );		}				//-----------------------------------------		// Warny porny?		//-----------------------------------------				if ( $this->ipsclass->vars['warn_on'] and ( ! strstr( ','.$this->ipsclass->vars['warn_protected'].',', ','.$member['mgroup'].',' ) ) )		{			if (   $this->ipsclass->member['_moderator'][ $this->topic['forum_id'] ]['allow_warn']				or ( $this->ipsclass->member['g_is_supmod'] == 1 )				or ( $this->ipsclass->vars['warn_show_own'] and ( $this->ipsclass->member['id'] == $member['id'] ) )			   )			{				// Work out which image to show.								if ( ! $this->ipsclass->vars['warn_show_rating'] )				{					if ( $member['warn_level'] <= $this->ipsclass->vars['warn_min'] )					{

⌨️ 快捷键说明

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