<?php
global $IsAuditcheck,$_DCACHE,$boardid,$RootID,$Announceid, $_GET, $_POST,$Postid,$lang,$board_settings,$boardsettings46,$UserToday0;


if (!empty($_GET['star'])) {
	$httpreq['star'] = $_GET['star'];
} elseif (!empty($_POST['star'])) {
	$httpreq['star'] = $_POST['star'];
}
if (!empty($_GET['page'])) {
	$httpreq['page'] = $_GET['page'];
} elseif (!empty($_POST['page'])) {
	$httpreq['page'] = $_POST['page'];
}
$RootID = intval($RootID);
$boardid = $_GET['boardid'];
switch($board_settings[48]){
	case '0':
		$tourl = 'index.php';
		$PostRetrunName = $lang['template.strings13'];
		break;
	case '1':
		$tourl = 'index.php?boardid='.$boardid;
		$PostRetrunName = $lang['template.strings14'];
		break;
	case '2':
		if( $IsAudit == 1 ){
			$tourl = 'index.php?boardid='.$boardid;
			if( $IsAuditcheck == 1 ){
				$PostRetrunName = $lang['template.strings6'];
			} elseif( $IsAuditcheck == 2 ){
				$PostRetrunName = $lang['template.strings7'];
			} else{
				$PostRetrunName = $lang['template.strings19'];
			}
		} else{
			switch($action){
				case 'snew':
					$tourl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'];
					$PostRetrunName = $lang['template.strings15'];
					break;
				case 'sre':
					$tourl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$Announceid;
					$PostRetrunName = $lang['template.strings16'];
					if ($_GET[method]!='fastreply')
					{
					$getActionMode = '1';
					}
					break;
				case 'svote':
					$tourl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'];
					$PostRetrunName = $lang['template.strings17'];
					break;
				case 'sedit':
					$tourl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$RootID;
					$PostRetrunName = $lang['template.strings18'];
					$getActionMode = '1';
					break;
				case 'argue_topic':
					$tourl = 'dispargue.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$RootID;
					$PostRetrunName = $lang['tpl.str5'];	//	您发表的辩论！
					break;
				case 'argue_topic_edit':
					$tourl = 'dispargue.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$RootID;
					$PostRetrunName = $lang['tpl.str6'];	//	您编辑的辩论！
					$getActionMode = '1';
					break;
				case 'argue_reply':
					$tourl = 'dispargue.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$RootID;
					$PostRetrunName = $lang['tpl.str7'];	//	您回复/评论的辩论观点！
					$getActionMode = '1';
					break;
				case 'argue_append':
					$tourl = 'dispargue.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'].'#'.$RootID;
					$PostRetrunName = $lang['tpl.str9'];	//	您补充的辩论观点！
					$getActionMode = '1';
					break;
				case 'active_topic':
				$tourl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'];
				$PostRetrunName = $lang['tpl.Active.str1'];//您发布的活动
				break;				
			}
		}
		break;
}
require_once INC_PATH.'BoardCache.class.php';
Create_index_forumnum();//20070523//首页的贴子统计
if($action=='snew' or $action=='svote' or $action=='active_topic' or $action=='argue_topic'){ 
	Create_Forum_Topic_List(1,$RootID);//创建首页右边贴子列表
}


if (check_ajax()){
	
	if( $IsAudit == 1 ){
		echo $lang['template.strings35']."<br>".$PostRetrunName."@@@1@@@";
	}
	else{
         $retvalue=($boardsettings46>1?3:0);
		echo $lang['template.strings35']."@@@1@@@";
	    RunDispbbs();
		echo "@@@".((($UserToday0>0)&&($UserToday0%$boardsettings46==0))?get_cercode():"&nbsp;")."@@@";
		encoding_footer();
	}
	exit;
}

if (false === strpos($action, 'argue')) {
	$returnurl = 'dispbbs.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'];
} else {
	$returnurl = 'dispargue.php?boardid='.$boardid.'&id='.$RootID.'&star='.$httpreq['star'].'&page='.$httpreq['page'];
}
$boardname = $_DCACHE['all_forums']["{$boardid}"]['boardtype'];
$page = $httpreq['page'];

$datepost=0;
if( $IsAudit == 1 ){
	  head(0);		  
	  showmsg($PostRetrunName);
	$datepost=3000;
	exit;
}

if ( !empty($returnurl) ){
	header("Location: ".$returnurl); exit;
}


?>

<?

function RunDispbbs(){

	global $bodystyle,$position,$dv,$AnnounceID,$RootID,$httpreq,$boardid,$skins,$replyid,$pagesize,$db,$_DCACHE,$SQL_CACHE;
	global $empath,$star,$page,$_PostResults,$userinfo, $TrueMaster,$forum_ads,$currUserInfo,$_DCACHE,$imgurl,$postUserResult
		,$upostalipay,$isspace,$username,$userid,$plus_index_value,$GLOBALS,$boardmaster,$boardid,$fsetting;
	require_once CACHE_PATH.'forum_pic.php';
	$empath = $_DCACHE['forum_emot'][0];
	$isspace = $fsetting['plus_blog'];

	(!empty($AnnounceID)) && $AnnounceID = intval($AnnounceID);
	(!empty($boardid)) && $boardid = intval($boardid);
	(!empty($RootID)) && $RootID = intval($RootID);
	
	$star = $httpreq[star];
	$page = $httpreq[page];

if( $query = $db->query("SELECT {$SQL_CACHE} CASE WHEN topicmode<>1 THEN REPLACE(title,'<','&lt;') ELSE title END AS title,istop,isbest,postusername,postuserid,hits,isvote,child,pollid,locktopic,posttable,boardid,topicmode,getmoney,usetools,getmoneytype,dateandtime,expression,topicid,activeid,topicid AS replyid,topicid AS star,topicid AS page,@PostUserIDList:=NULL FROM {$dv}topic WHERE topicid={$RootID} AND boardid={$boardid}",array('pageSize'=>1)) ){
 $TopicInfo =& $db->fetch_array($query);
}

if( $TopicInfo['topicmode'] != 1 ){
	$topicStmt = "topic";
} else{
	$topicStmt = "topic";
}
//End 过滤标题HTML
if ( !empty($AnnounceID) and !empty($boardid) ) {
	$stmt = "SELECT {$SQL_CACHE} announceid,username,{$topicStmt},dateandtime,body,expression,ip,rootid,signflag,emailflag,isbest,postuserid,layer,isagree,getmoneytype,isupload,ubblist,locktopic,getmoney,usetools,postbuyuser,parentid,@PostUserIDList:=COALESCE(CONCAT(@PostUserIDList,',',postuserid),postuserid) AS postuseridlist FROM ".strtolower($TopicInfo['posttable'])." WHERE announceid={$AnnounceID} AND boardid={$boardid} ORDER BY dateandtime ASC";
}
$NumRows = 0;
if( $query = $db->query($stmt,array('absolutePage'=>$star,'pageSize'=>$pagesize)) ){
	$postResultCount = 0;
	$refPostResult = array();
	$NumRows = $db->num_rows($query);
	while( $result =& $db->fetch_array($query) ){
		//过滤脏字
		$result['username'] = ChkBadWords($result['username']);
		$result['topic'] = ChkBadWords($result['topic']);
		$result['body'] = ChkBadWords($result['body']);
		$_PostResults[$postResultCount] =& $result;

		$refPostResult["{$result[postuserid]}"][] =& $result;
		$postResultCount++;
	}
	$db->free_result($query);
}

if( !empty($_PostResults) ){
	$nameglow = array( $_DCACHE['stylecss'][43] ,$_DCACHE['stylecss'][41] ,$_DCACHE['stylecss'][41] ,$_DCACHE['stylecss'][39] ,null ,null  ,$_DCACHE['stylecss'][40] );
	$TopicInfo['replyid'] = $_PostResults[0]['announceid'];
	$TopicInfo['star'] = $star;
	$TopicInfo['page'] = $page;
	$TopicInfo['skin'] = $skins;
	//如果顶楼是主题帖，并且是购买帖的时候，提取购买信息
		//主题金币帖子类型0=无，1=赠送金币帖，2=获赠金币帖，3=金币购买帖，4=回复赠送金币（回复表），5=已结帖（主题表）
	if( $_PostResults[0]['parentid'] == 0 && $TopicInfo['getmoneytype'] == 3 ){
		$_PostResults[0]['postbuyuser'] = trim($_PostResults[0]['postbuyuser']);
		$postbuyinfo = array( 'money' => 0 ,'maxbuy' => 0 ,'notvipbuy' => '' ,'buyuser' => '' );
		if ($_PostResults[0]['postbuyuser'] !== '') {
			$postbuyusers = explode('|||', $_PostResults[0]['postbuyuser']);
			//postbuyinfo[0] 收入 postbuyinfo[1] 购买限制 postbuyinfo[2] vip是否需要购买 postbuyinfo[3] 允许购买用户列表
			$postbuyinfo = explode('@@@',$postbuyusers[0]);
			if( count($postbuyinfo) > 3 ){
				$postbuyinfo = array( 'money' => $postbuyinfo[0] ,'maxbuy' => $postbuyinfo[1] ,'notvipbuy' => $postbuyinfo[2] ,'buyuser' => ",{$postbuyinfo[3]}," );
			}
		}
	}
	//发帖用户ID列表
	if( $postResultCount > 0 ) $postuseridlist = $_PostResults[$postResultCount-1]['postuseridlist'];
	if(intval($plus_index_value['beplusvalue']['isuse'])==1){//edit 2007-04-25
		$query_sql="SELECT {$SQL_CACHE} u.userid,u.username,u.useremail,u.userim,u.usermobile,u.usersign,u.userclass,u.usertitle,u.userwidth,u.userheight,u.userpost,u.userface,u.joindate,u.userwealth,u.userep,u.usercp,u.userbirthday,u.usersex,u.usergroup,u.lockuser,u.userpower,u.titlepic,CASE WHEN u.usergroupid IS NULL OR u.usergroupid<=0 THEN 7 ELSE u.usergroupid END AS usergroupid,u.lastlogin,u.userhidden,u.ischallenge,u.usermoney,u.userticket,u.useravasetting,u.userisava,u.userhonor FROM {$dv}user u WHERE u.userid IN ({$postuseridlist})";
	}
	else{
		$query_sql="SELECT {$SQL_CACHE} u.userid,u.username,u.useremail,u.userim,u.usermobile,u.usersign,u.userclass,u.usertitle,u.userwidth,u.userheight,u.userpost,u.userface,u.joindate,u.userwealth,u.userep,u.usercp,u.userbirthday,u.usersex,u.usergroup,u.lockuser,u.userpower,u.titlepic,CASE WHEN u.usergroupid IS NULL OR u.usergroupid<=0 THEN 7 ELSE u.usergroupid END AS usergroupid,u.lastlogin,u.userhidden,u.ischallenge,u.usermoney,u.userticket,u.useravasetting,u.userisava FROM {$dv}user u WHERE u.userid IN ({$postuseridlist})";
	}

	if( !empty($postuseridlist) ){
		if( $query = $db->query($query_sql) ){
			$forumad_topic = intval($fsetting['forumad_topic']);
			include_once INC_PATH.'dv_code.php';
			$nowtimes = TIME_NOW;
			while( $result =& $db->fetch_array($query) ){
				if (2 == $result['userhidden']) {
					if (is_numeric($result['lastlogin']) AND $result['lastlogin'] > 0) {
						if (dateDiff('s', $result['lastlogin'], $nowtimes) > $fsetting['onlinetimeout'] * 60) {
							$result['userhidden'] = 1;
						}
					} else {
						$result['userhidden'] = 1;
					}
				} else {
					$result['userhidden'] = 1;
				}
				$tmpRef =& $refPostResult["{$result[userid]}"];
				foreach( $tmpRef AS $key=>$val ){
					$result['current_replyid'] = $result['current_announceid'] = $tmpRef[$key]['announceid'];
					$result['current_rootid'] = $tmpRef[$key]['rootid'];
					$result['posttable'] = $TopicInfo['posttable'];
					$result['postbuyuser'] = $tmpRef[$key]['postbuyuser'];
					//Ubb转换
					if( strpos($tmpRef[$key]['ubblist'],',39,') !== false ){
						$tmpRef[$key]['body'] = Dv_CodeProcess($tmpRef[$key]['body'],$result,$tmpRef[$key]['ubblist'],1,0);
					} else{
						$tmpRef[$key]['body'] = Dv_CodeProcess($tmpRef[$key]['body'],$result,$tmpRef[$key]['ubblist'],1,1);
					}
					//利用ubblist节点传送广告数据
					if( $forumad_topic === 1 ){
						$tmpRef[$key]['ubblist'] = Topic_Ads();
					} else{
						$tmpRef[$key]['ubblist'] = '';
					}
				}
				$postUserResult["{$result['userid']}"] =& $result;
			}
		}
	}
}

 ShowDispbbs($TopicInfo);
}

function ShowDispbbs($TopicInfo)
{
	global $_PostResults;
	global $PageCount;

if( is_array($_PostResults) ){

	$position = 0;
	global  $bodystyle,$position,$star,$page,$pagesize,$userinfo, $TrueMaster,$forum_ads,$currUserInfo,$_DCACHE,$imgurl,$postUserResult
		,$upostalipay,$isspace,$username,$userid,$plus_index_value,$GLOBALS,$boardmaster
		,$boardid,$mofaface;
	$lang = load_lang($lang, 'dispbbs' );

	if (1 == $board_settings[68]) {
		$userinfo['cananony'] = 1;
	}
	$userinfo['truemaster'] = $TrueMaster;
	$isBuyUser = ((!empty($membername) AND is_array($postbuyusers)) ? in_array($membername,$postbuyusers) : false );
	$bodystyle = 'tablebody2';
	$get_all_content='';
	foreach( $_PostResults as $result ){
		//帖间随机广告
		if($forum_ads[12] && $ScriptName == 'dispbbs') {
			$dispbbs_ads = explode("\r\n", $forum_ads[13]);
			$num = count($dispbbs_ads) - 1;
			$num = rand(0, $num);
			$ShowAds = $dispbbs_ads[$num];
		}
		$currUserID = intval($result['postuserid']);
		$lastpostid = $result['announceid'];
		$position++;
		list($firstIP,$secondIP)=explode('.',$result['ip']);
		$currUserInfo =& $postUserResult["{$currUserID}"];
		if ( $bodystyle == 'tablebody2' ){
			$bodystyle = 'tablebody1';
		}else{
			$bodystyle = 'tablebody2';
		}
print <<<EOT
<table class="tablebox border" cellspacing="0" cellpadding="0">
EOT;


#---------左边用户信息-----------------
	$ShowUserInfo='';
	$ShowUserFace='';
	$ShowUserico='';
	#匿名用户 发帖图像
	if (1 == $userinfo['cananony'] AND 2 == $result['signflag'] AND true !== $userinfo['truemaster'] AND $userid != $currUserID )
	{
		$ShowUserInfo = $lang['tpl.str44']."(".$firstIP.$secondIP.")";
		$ShowUserFace = "<img src='{$imgurl}anyon.gif' width=111 height=111 border=0 />";
	}
	#客人 发帖图像
	elseif( $result['postuserid'] == 0 )
	{
		$ShowUserInfo = $lang['tpl.str45']."(".$firstIP.$secondIP."*.*)";
		$ShowUserFace = "<img src='{$imgurl}guest.gif' width=111 height=111 border=0 />";
	}
	#会员
	else
	{
		$currGrpSettings =& getCurrUserGrpSettings($currUserInfo['usergroupid']);
		$currUserInfo['namestyle'] = $currGrpSettings[58];
		list($tmp1,$tmp2) = explode($lang['tpl.str211'], $currUserInfo['namestyle']);
		if( $currUserInfo['usergroupid'] < 9 ){
			$currNameGlow = $nameglow[$currUserInfo['usergroupid']-1];
		} else{
			$currNameGlow = $_DCACHE['stylecss'][39];
		}

		$ShowUserInfo .= <<<EOT
		<div class="user_self_nav">
		  <ul>	
		  <li class="user2" onMouseOver="this.className='user1'" onMouseOut="this.className='user2'">{$tmp1}{$result['username']}{$tmp2}<img src="{$imgurl}down.gif" style="margin:5px;vertical-align:middle">
			  <div class="user_list">
EOT;
		
	$userim = explode('|||',$currUserInfo['userim']);
	if( $result['postuserid'] != 0 && ($userinfo['cananony'] != 1 || $result['signflag'] != 2 || $TrueMaster === true || $userid == $result['postuserid']) )
	{
		if( $upostalipay == 1 ){
			$ShowUserInfo .=  "<a href=\"https://www.alipay.com/payto:{$currUserInfo[useremail]}&partner=2088002048522272\" target=\"_blank\"><img alt=\"{$lang['tpl.str64']}{$result[username]}{$lang['tpl.str65']}\" border=\"0\" src=\"{$imgurl}alipay_s.gif\"  align=\"middle\"/></a><br /> \r\n";
		}
		if( $isspace == 1 ){
			$ShowUserInfo .= "<a href=\"space.php?UserID_{$result[postuserid]}.index.html\" title=\"{$lang['tpl.str66']}{$result[username]}{$lang['tpl.str67']}\" target=\"_blank\"><img src=\"{$imgurl}space.gif\">&nbsp;".$lang['disp.user.fun.info1']."</a><br /> \r\n";
		}
		if( $userid>0 && $userim[1] != '' && is_numeric($userim[1])){#发送QQ消息
			$ShowUserInfo .= "<a href=\"http://wpa.qq.com/msgrd?V=1&Uin={$userim[1]}&Site={$fsetting['forumname']}&Menu=yes\" title=\"{$lang['tpl.str68']}{$result[username]}\" target=\"_blank\"><img src=\"{$imgurl}qq.gif\">&nbsp;".$lang['disp.user.fun.info18']."</a><br /> \r\n";
		}
		elseif( empty($userid) && $userim[1] != '' && is_numeric($userim[1])){
			$ShowUserInfo .= "<a href=\"http://wpa.qq.com/msgrd?V=1&Uin={$userim[1]}&Site={$fsetting['forumname']}&Menu=yes\" title=\"{$lang['tpl.str68']}{$result[username]}\" target=\"_blank\"><img src=\"{$imgurl}qq.gif\">&nbsp;".$lang['disp.user.fun.info18']."</a><br /> \r\n";
		}
		if( $userid != 0 )
		{
			$username = urlencode($result['username']);
			$ShowUserInfo .= <<<EOT
			<a href="friendlist.php?action=addF&myFriend={$username}" target="_blank" alt="{$lang['tpl.str71']}{$result[username]}{$lang['tpl.str72']}"><img src="{$imgurl}friend.gif">&nbsp;{$lang['disp.user.fun.info14']}</a><br />
			<a href="dispuser.php?id={$result[postuserid]}" target="_blank" alt="{$lang['tpl.str73']}{$result[username]}{$lang['tpl.str74']}"><img src="{$imgurl}profile.gif">&nbsp;{$lang['disp.user.fun.info15']}</a><br /> 					
EOT;
			if( $currUserInfo['useremail'] != '' ){
				$ShowUserInfo .= "<a href=\"mailto:{$currUserInfo[useremail]}\"  alt=\"{$lang['tpl.str77']}{$result[username]}\"><img src=\"{$imgurl}email.gif\">&nbsp;E-Mail</a><br />\r\n";
			}
		}
		if( $userim[0] != '' ){
			$ShowUserInfo .= "<a href=\"{$userim[0]}\" target=\"_blank\" alt=\"{$lang['tpl.str78']}{$result[username]}{$lang['tpl.str79']}\"><img src=\"{$imgurl}homepage.gif\">&nbsp;".$lang['disp.user.fun.info19']."</a><br /> \r\n";
		}
		if( $userim[6] != '' ){
			$ShowUserInfo .= "<a href=\"http://service.51uc.com/user_info/show_user_info_base.shtml?UID={$userim[6]}\" title=\"{$result[username]}[{$userim[6]}]{$lang['tpl.str80']}\" target=\"_blank\"><img src=\"{$imgurl}uc.gif\">&nbsp;".$lang['disp.user.fun.info20']."</a>\r\n";
		}
	}
	$ShowUserInfo .= <<<EOT
		  </div>
	  </li>
	  </ul>
	</div>
EOT;
		#头像 在线或离线
		if (1 == $currUserInfo['userhidden']){
			if( $currUserInfo['usersex'] != 1 ){
				$ShowUserico =  "<img src=\"{$imgurl}offemale.gif\" alt=\"{$lang['tpl.str46']}\"/>\r\n";
			} else{
				$ShowUserico =  "<img src=\"{$imgurl}ofmale.gif\" alt=\"{$lang['tpl.str47']}\"/>\r\n";
			}
		} else{
			if( $currUserInfo['usersex'] != 1 ){
				$ShowUserico =  "<img src=\"{$imgurl}female.gif\" alt=\"{$lang['tpl.str48']}\"/>\r\n";
			} else{
				$ShowUserico =  "<img src=\"{$imgurl}male.gif\" alt=\"{$lang['tpl.str49']}\"/>\r\n";
			}
		}
		#生日
		$ShowUserBirthday ='';
		if ( $currUserInfo['userbirthday'] != ''){
			$ShowUserBirthday = "<div class=\"buser\"><script type=\"text/javascript\" language=\"javascript\">document.write (astro('{$currUserInfo[userbirthday]}'));</script></div>\r\n";
		}
		#用户头像图片
		$ShowUserFace ='';
		$userface = $currUserInfo['userface'];
		if( strpos($userface,'|') != false ){
			list(,$userfacePath) = explode('|',$userface);
			$ShowUserFace .= "<img class=cimg src=\"{$userfacePath}\"  alt=\"\" width=\"{$currUserInfo[userwidth]}\" height=\"{$currUserInfo[userheight]}\" />\r\n";
			list($tmp1,$tmp2) = explode('|',$userface);
			if( $tmp1 != '0' ){
				$ShowUserFace .=  "<BR><a href=\"javascript:void(DispMagicEmot({$tmp1},350,500));\" target=\"_self\">{$lang['tpl.str50']}</a>\r\n";
			}
		} else{
			$ShowUserFace =  "<img  class=cimg src=\"{$userface}\" width=\"{$currUserInfo[userwidth]}\" height=\"{$currUserInfo[userheight]}\"/>\r\n";
		}
		#等级图片
		$ShowUserStar = "<img class=\"cimg\" src=\"images/star/{$currUserInfo[titlepic]}\"/ >\r\n";
		#勋章
		$ShowUserHonorpics='';
		if(intval($plus_index_value['beplusvalue']['isuse'])==1)
		{
			if($currUserInfo['userhonor']!=''){
				
				if($currUserInfo['userhonor']!=''){
					if(strpos($currUserInfo['userhonor'],'|||')!==false){
						$tmpuserhonor=explode('|||',$currUserInfo['userhonor']);
						foreach ($tmpuserhonor as $tmpuserhonorarrs){			
							$h_title=honortitle($tmpuserhonorarrs);
							$ShowUserHonorpics.='<img class="cimg" src=dv_plus/honor/images/'.$tmpuserhonorarrs.' border=0 width=15 height=30 title='.$h_title.'>&nbsp;';
						}
					}
					else{			
						$h_title=honortitle($currUserInfo['userhonor']);
						$ShowUserHonorpics='<img class="cimg" src=dv_plus/honor/images/'.$currUserInfo['userhonor'].' border=0 width=15 height=30 title='.$h_title.'>';
					}
				}
				else{
					$ShowUserHonorpics='';
				}
			}
		}
		#头衔
		$ShowUserTitle ='';
		if( $usertitle == 1 ){
			if( $currUserInfo['usertitle'] != '' ){
				$ShowUserTitle = "{$lang['tpl.str51']}{$currUserInfo['usertitle']}";
			}
		}
		#给用户发短信和用户发表帖子
		$ShowUserMessanger='';
		if( $userid > 0 ) {
			$ShowUserMessanger =  "<a href=\"messanger.php?action=new&touser={$username}\" title=\"{$lang['tpl.str69']}{$result[username]}{$lang['tpl.str70']}\" target=\"_parent\"><img src=\"{$imgurl}/message.gif\">{$lang['disp.user.fun.info13']}</a>&nbsp;&nbsp;<a href=\"query.php?stype=1&nsearch=3&keyword={$username}&boardid={$TopicInfo[boardid]}&searchdate=ALL\" target=\"_blank\" alt=\"{$lang['tpl.str75']}{$result[username]}{$lang['tpl.str214']}{$TopicInfo[boardtype]}{$lang['tpl.str76']}\"><img src=\"{$imgurl}/find.gif\">{$lang['disp.user.fun.info16']}</a>\r\n";
		}
		#等级
		$ShowUserClass = "{$lang['tpl.str52']}{$currUserInfo[userclass]}\r\n";
		#威望
		$ShowUserPower = '';
		if( $currUserInfo['userpower'] != 0 ){
			$ShowUserPower =  "{$lang['tpl.str53']}<font color=\"red\"><b>{$currUserInfo['userpower']}</b></font>\r\n";
		}
		#文章
		$ShowUserPostEp = "<p>{$lang['tpl.str54']}{$currUserInfo[userpost]}</p>\r\n";
		# 积分
		$ShowUserPostMONEY = "<p>{$lang['tpl.str55']}{$currUserInfo[userep]}</p>\r\n";
		#门派
		$groupname = $currUserInfo['usergroup'];
		$ShowUserGroup = '';
		if( $menpai == 1 && $currUserInfo['usergroup'] != '' ){
			$ShowUserGroup = "<p>{$lang['tpl.str56']}{$currUserInfo['usergroup']}</p>";
		}
		#注册日期
		$ShowUserJoindate = "{$lang['tpl.str58']}".gmdate("Y-m-d H:i:s",$currUserInfo['joindate']+getUserTimeZoneOffset());
		if (1== $userinfo['cananony'] AND 2 == $result['signflag']) {
			$ShowUserCananony = '';
			$ShowUserCananony = '<p><font color="ff0000">'.$lang['tpl.str212'].$lang['tpl.str59'].$lang['tpl.str213'].'</font></p>'."\r\n";
		}

	}#会员 end
#---------帖子右边部分-----------------
	$getpostdate = gmdate('Y-m-d H:i:s',$result['dateandtime']+getUserTimeZoneOffset()).'&nbsp;&nbsp;';
	#用户发帖IP和发帖时间
	$ShowUserPostIpDate = "<img src=\"{$imgurl}time.gif\"  border=\"0\" style=\"vertical-align:middle;\" />&nbsp;&nbsp;{$getpostdate}&nbsp;&nbsp;<img src=\"{$imgurl}ip.gif\" title=\"{$lang['disp.user.fun.info23']}\" alt=\"{$lang['disp.user.fun.info23']}\" border=\"0\" style=\"vertical-align:middle;\" />&nbsp;&nbsp;{$result['ip']}";
	#收录该帖到我的空间
	if( $isspace == 1 ){
		$ShowUserIsSpace = '';
		$ShowUserIsSpace =  "<a href=\"spacemanage.php?s=1&t=1&m=1&boardid={$TopicInfo[boardid]}&replyid={$result[announceid]}&id={$TopicInfo[topicid]}\" title=\"{$lang['tpl.str60']}\" target=\"_blank\"><img src=\"{$imgurl}spacefav.gif\"  border=\"0\" align=\"middle\" /></a> \r\n";
	}
	#帖子楼数
	if( $TopicInfo['skin'] != 1 ){
		$ShowUserPosition = '';
		if( $TopicInfo['star'] == 1 ){
			switch($position){
				case 1: $ShowUserPosition = $lang['tpl.str61'];break;
				case 2: $ShowUserPosition = $lang['tpl.str61.1'];break;
				case 3: $ShowUserPosition = $lang['tpl.str61.2'];break;
				case 4: $ShowUserPosition = $lang['tpl.str61.3'];break;
				default: 
					$ShowUserPosition = "{$lang['tpl.str62']} <font color=\"red\">{$position}</font> {$lang['tpl.str63']}";
			}
		} else{
			$ShowUserPosition = $lang['tpl.str62'].' <font color="red">'.($position + ($TopicInfo['star'] - 1) * $pagesize).'</font> '.$lang['tpl.str63'];
		}
	} else{
		$ShowUserPosition = ' ';
	}
print <<<EOT
  <tr>
	<td class="infoleft leftcolor" valign="top" rowspan="4">
	   <a name="{$result['announceid']}"></a>
		<p class="username">{$ShowUserico}{$ShowUserInfo}</p>
		<p>{$ShowUserFace}</p>
		<p>{$ShowUserStar}</p>
		<p>{$ShowUserHonorpics}</p>
		<p>{$ShowUserTitle}</p>
		<p>{$ShowUserMessanger}</p>
		<p>{$ShowUserClass}</p>
		<p>{$ShowUserPower}</p>
		<p>{$ShowUserPostEp}</p>
		<p>{$ShowUserPostMONEY}</p>
		<p>{$ShowUserGroup}</p>
		<p>{$ShowUserJoindate}</p>
		<p>{$ShowUserCananony}</p>
	</td>
	<td class="usermenu">
		<em>{$ShowUserIsSpace} {$ShowUserPosition}</em>{$ShowUserPostIpDate}
	</td>
  </tr>
EOT;
#---------右边内容-----------------
	#您无权查看精华帖子
	$checkinfo = '';  
	if( intval($result['isbest']) == 1 ){
		if( $groupsetting[41] != 1 ){
			$checkinfo = $lang['tpl.str81'];
		}
	} else{
		if( $result['locktopic'] == 2 ){
			$checkinfo = $lang['tpl.str82'];
		} else{
			if( $currUserInfo['lockuser'] == 1 ){
				$checkinfo = $lang['tpl.str83'];
			} elseif( $currUserInfo['lockuser'] == 2 ){
				$checkinfo = $lang['tpl.str84'];
			} elseif( $result['locktopic'] == 3 ){
				$checkinfo = $lang['tpl.str85'];
			}
		}
	}
	$ShowContentCheckInfo='';
	if( $checkinfo != '' ){
		$ShowContentCheckInfo = "<div class=\"lockuser\">{$checkinfo}</div>\r\n";
	}
	#内容处理部分
	$ShowContent = '';
	if( $checkinfo == '' || $userinfo['truemaster'] == 1 || ( $boardmaster && $userinfo['usergroupid'] != 3 ) ){
		#已参加活动
		if ( strpos($getActiveUserName , ",") and !empty($getActiveUserName))
		{
			if ( strpos ( $getActiveUserName , "{$result['username']}") !== false)
			$ShowContent .= "<div style=\"float:right;width:100px;\">".$lang['tpl_Active.str46']."</div>";
		}
		#魔法表型
		if( $result['parentid'] == 0 ){
			if( !empty($mofaface) ){
			$ShowContent .= <<<EOT
			<div style="float:right;margin-right:20px;"><a href="javascript:void(DispMagicEmot({$mofaface},350,500));" target="_self"><img src="dv_plus/tools/magicface/gif/{$mofaface}.gif" border="0"/><br />{$lang['tpl.str87']}</a></div>
			<script type="text/javascript" language="javascript">
			LoadMagicEmot('{$mofaface}','{$TopicInfo['topicid']}');
			</script>
EOT;
			}
		}
		#内容认证部分
		$ShowContent .= "<base target=\"_blank\" />\r\n<div class=\"bodys\" onload=\"this.style.overflowX='auto';\">\r\n";
		if( $result['parentid'] == 0 && $TopicInfo['getmoneytype'] == 3 ){
			$ShowContent .= '<fieldset style="border : 1px dotted #ccc;">';
			#以下内容需要支付
			if( $TopicInfo['postuserid'] == $userid ){
				$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str88']} <b><font color=\"red\">{$TopicInfo['getmoney']}</font></b> {$lang['tpl.str89']}</legend>{$result['body']}";
			} else{
				#以下内容需要支付
				if( true === $userinfo['truemaster']){
					$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str90']} <b><font color=\"red\">{$TopicInfo[getmoney]}</font></b> {$lang['tpl.str91']}</legend>{$result['body']}";
				} else{
					#以下内容需要支付
					if( $isBuyUser === true ){
						$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str90']} <b><font color=\"red\">{$TopicInfo['getmoney']}</font></b> {$lang['tpl.str92']}</legend>{$result['body']}";
					} else{
						#以下内容需要支付
						if( $userinfo['vipgroupuser'] == 1 && $postbuyinfo['notvipbuy'] == 1 ){
							$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str90']} <b><font color=\"red\">{$TopicInfo['getmoney']}</font></b> {$lang['tpl.str93']}</legend>{$result['body']}";
						} else{
							#以下内容需要支付
							if( $userid != 0 && ($postbuyinfo['buyuser'] == ',,' || strpos($postbuyinfo['buyuser'],",{$membername},") !== false) ){
								$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str90']} <b><font color=\"red\">{$TopicInfo['getmoney']}</font></b> {$lang['tpl.str94']}</legend><input type=\"button\" value=\"{$lang['tpl.str95']}\" class=\"button\" onclick=\"location.href='buypost.php?action=buy&boardid={$TopicInfo['boardid']}&id={$TopicInfo['topicid']}&replyid={$result['announceid']}&posttable={$TopicInfo['posttable']}'\"/>";
							} else{
								$ShowContent .= "<legend style=\"text-indent:0px;\">{$lang['tpl.str96']} <b><font color=\"red\">{$TopicInfo['getmoney']}</font></b> {$lang['tpl.str97']}</legend>";
								if( $userid != 0 ){
									$ShowContent .= $lang['tpl.str98'];#楼主设置了您不可以购买。
								} else{
									$ShowContent .= $lang['tpl.str99'];#您还未登录，不能购买。
								}
							}
						}
					}
				}
			}
			$ShowContent .= '</fieldset>';
		} else {
			$ShowContent .= $result['body'];
		}
		$ShowContent .= "</div>\r\n";

		#签名
		$UserSign='';
		$ShowUserSign='';
		if(!empty($currUserInfo['usersign'])){
			$UserSign .= "<base target=\"_self\" />\r\n";
			if (canusersign($currUserInfo['usergroupid']) AND (1 == $result['signflag'])){
				if (!isset($currUserInfo['UserSignCache'])){
					$currUserInfo['UserSignCache'] = trim(Dv_SignUbbCode($currUserInfo['usersign'],$currUserInfo['usergroupid']));
				}
				$UserSign .= $currUserInfo['UserSignCache'];
			}
			else{
				$UserSign = '';
			}
			if ($UserSign) {
				$ShowUserSign = "<img src=\"{$imgurl}sigline.gif\" /><BR>{$UserSign}\r\n";
			} else {
				$ShowUserSign= '';
			}
		}
		else{
			$ShowUserSign='';
		}
	}
	#本帖被加为精华||赠送金币帖，要送出
	$postinfo = '';
	if( intval($result['isbest']) == 1 ){
		$postinfo = "<img src=\"{$imgurl}jing.gif\" border=\"0\" title=\"{$lang['tpl.str100']}\" align=\"middle\"/> ";
	}
	#好评，获得|个金币奖励
	if( $result['isagree'] != '' && strpos($result['isagree'],'|') != false ){
		list($tmp1,$tmp2) = explode('|',$result['isagree']);
		if( !empty($tmp2) ){
			$postinfo = "<img src=\"{$imgurl}agree.gif\" border=\"0\" alt=\"{$lang['tpl.str101']}{$tmp2}{$lang['tpl.str102']}\" / > ";
		}
		if( !empty($tmp1) ){
			$postinfo = "<img src=\"{$imgurl}disagree.gif\" border=\"0\" alt=\"{$lang['tpl.str101']}{$tmp1}{$lang['tpl.str102']}\" / > ";
		}
	}
	#Wap-手机发帖
	if( intval($result['isupload']) == 2 || intval($result['isupload']) == 3 ){
		$postinfo = "<a href=\"wap.php?Action=readme\" target=\"_blank\" ><img src=\"{$imgurl}wap00.gif\" border=\"0\" alt=\"{$lang['tpl.str103']}\"/></a> ";
	}
	#查看使用道具详细信息
	if( $TopicInfo['usetools'] != '' || $TopicInfo['getmoneytype'] != 0 ){
		$postinfo = "<img src=\"{$imgurl}mini_query.gif\" border=\"0\" alt=\"{$lang['tpl.str104']}\" onclick=\"openScript('viewinfo.php?t=2&action=View&posttable={$TopicInfo['posttable']}&boardid={$TopicInfo['boardid']}&id={$TopicInfo['topicid']}&replyid={$result['announceid']}',600,450)\" class=\"imgonclick\" /> ";
	}
	#金币帖
	if( $result['parentid'] == 0 ){//call template TopicSendMoneyStr
		$tmp = intval($TopicInfo['getmoneytype']);
		if( $tmp == 1 ){#赠送金币帖，要送出
			$postinfo = "{$lang['tpl.str105']}<font color=\"red\">{$result['getmoney']}</font> {$lang['tpl.str106']}";
		}
		if( $tmp == 2 ){#获赠金币帖，共获得
			$postinfo = "{$lang['tpl.str107']}<font color=\"red\">{$TopicInfo['getmoney']}</font> {$lang['tpl.str106']}";
		}
		if( $tmp == 3 ){#查看本帖需支付
			$postinfo = "{$lang['tpl.str108']}<font color=\"red\">{$TopicInfo['getmoney']}</font>{$lang['tpl.str106']}";
		}
		if( $tmp == 5 ){#个金币[已结帖]
			$postinfo = "{$lang['tpl.str105']}<font color=\"red\">{$result['getmoney']}</font>{$lang['tpl.str109']}";
		}
	} else{//call template SendMoneyStr
		$tmp = intval($TopicInfo['getmoneytype']);
		#获得 个金币
		if( ($tmp == 1 || $tmp == 5 ) && ( $TopicInfo['postuserid'] != $result['postuserid']) ){
			$postinfo = "{$lang['tpl.str110']}<font color=\"red\">{$result['getmoney']}</font>{$lang['tpl.str106']}";
		}
		#赠送金币
		if ($TopicInfo['postuserid'] == $userinfo['userid'] AND $result['postuserid'] != $userinfo['userid'] AND $tmp != 5 && $tmp == 1) {
			$postinfo = "<a href=\"buypost.php?action=send&posttable={$TopicInfo['posttable']}&boardid={$TopicInfo['boardid']}&id={$TopicInfo['topicid']}&replyid={$result['announceid']}&UserName={$result['username']}\" title=\"{$lang['tpl.str111']}{$result['username']}\" target=\"_blank\">{$lang['tpl.str112']}</a>";
		}
		#赠送楼主
		if( $tmp == 2 ){
			$postinfo = "{$lang['tpl.str113']}<font color=\"red\">{$result['getmoney']}</font>{$lang['tpl.str106']}";
		}
	}
	$ShowPostInfo = '';
	if( $postinfo != '' ){
		$ShowPostInfo= "<div class=\"info\">{$postinfo}</div>";
	}
	#帖子管理菜单
	if( $userid != 0 ){
		$strNoteActionMenu = '<div class="submenu" style="width:65px;" id="NoteActionMenu_'.$position.'" onmouseout="hidemenu(1);hidemenu(0);"><ul>';
		$strNoteActionMenu .= "<li><a href=\"topicother.php?t=6&boardid={$TopicInfo['boardid']}&id={$TopicInfo['topicid']}&replyid={$result['announceid']}\" title=\"{$lang['tpl.str116']}\">{$lang['tpl.str117']}</a></li>";
		if( $position != 1 || $TopicInfo['star'] != 1 ){
			if( $userid == $currUserID && $boardmaster == false ){
				if( $userinfo['candelmypost'] == 1 ){
					$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_delete_single_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str118']}</a></li>";
				}
			} else{
				if( $boardmaster === true ){
					$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_delete_single_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str118']}</a></li>";
				}
			}
		}
		if( $boardmaster === true ){
			$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_copy_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star=star={$TopicInfo['star']}&userid=userid={$result['postuserid']}\">{$lang['tpl.str119']}</a></li>";
			if( intval($result['isbest']) == 0 ) {
				$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_set_best_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str120']}</a></li>";
			} else{
				$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_unset_best_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str121']}</a></li>";
			}
			if( $result['locktopic'] != 2 ){
				if( $result['locktopic'] == 3 ){
					$strNoteActionMenu .= "<li><a href=\"accesstopic.php?action=unlock_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}\">{$lang['tpl.str122']}</a></li>";
				} else{
					$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_shield_single_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str123']}</a></li>";
				}
			} else{
				$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_unshield_single_topic&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&userid={$result['postuserid']}\">{$lang['tpl.str124']}</a></li>";
			}
			$strNoteActionMenu .= "<li><a href=\"admin_postings.php?action=p_reward_money&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}\" title=\"{$lang['tpl.str125']}\">{$lang['tpl.str126']}</a></li>";
		}
		if (1 == $GLOBALS['fsetting']['plus_tools']) {
			$strNoteActionMenu .= "<li><a title=\"{$lang['tpl.str127']}\" href=\"javascript:openScript('plus_tools_infosetting.php?action=0&amp;boardid={$TopicInfo['boardid']}&amp;topicid={$TopicInfo['topicid']}&amp;replyid={$result['announceid']}',500,400)\">{$lang['tpl.str128']}</a></li>";
		}
		$strNoteActionMenu .= '</ul></div>';
		$ShowUserAdmin = '';
		$ShowUserAdmin = "<li class=\"m_li_n\" onmouseover=\"showmenu('NoteActionMenu_{$position}',0);\" style=\"display:inline;\"><span alt=\"{$lang['tpl.str132']}\" style=\"cursor: pointer;\">{$forumuserinfo_spaceline}<font color=\"#2779a5\">{$lang['disp.user.fun.info11']}</font></span>{$strNoteActionMenu}</li>&nbsp;| ";
	}
	#引用 回复
	$ShowContentRe = '';
	if( $boardmaster === true || ($TopicInfo['locktopic'] != 1 && $userinfo['canreply'] == 1) ){
		if( $result['postuserid'] == 0 )
		{
			$ShowContentRe = <<<EOT
			<a href="post.php?action=re&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&pagecount={$PageCount}&reply=true&guest=true" title="{$lang['tpl.str129']}">{$lang['disp.user.fun.info8']}</a> | 
			{$forumuserinfo_spaceline}<a href="post.php?action=re&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&pagecount={$PageCount}&guest=true" title="{$lang['tpl.str130']}">{$lang['disp.user.fun.info9']}</a> | 
EOT;
		} else {
			$ShowContentRe = <<<EOT
			<a href="post.php?action=re&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&pagecount={$PageCount}&reply=true"    title="{$lang['tpl.str129']}">{$lang['disp.user.fun.info8']}</a> | 
			{$forumuserinfo_spaceline}<a href="post.php?action=re&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$TopicInfo['star']}&page={$GLOBALS['page']}&pagecount={$PageCount}"   title="{$lang['tpl.str130']}">{$lang['disp.user.fun.info9']}</a> |  
EOT;
		}
	}
	#编辑帖子链接
	$ShowUserEdit = '';
	if( $userid != 0 ){
		if( $userid == $currUserID && $boardmaster == false ){
			if( $groupsetting[10] == 1 ){
				$ShowUserEdit = "{$forumuserinfo_spaceline}<a href=\"post.php?action=edit&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$_GET['star']}&page={$GLOBALS['page']}\"  title=\"{$lang['tpl.str131']}\">{$lang['disp.user.fun.info10']}</a> | ";
			}
		} else{
			if( $boardmaster === true ){
				$ShowUserEdit = "{$forumuserinfo_spaceline}<a href=\"post.php?action=edit&boardid={$TopicInfo['boardid']}&replyid={$result['announceid']}&id={$TopicInfo['topicid']}&star={$_GET['star']}&page={$GLOBALS['page']}\"  title=\"{$lang['tpl.str131']}\">{$lang['disp.user.fun.info10']}</a> | ";
			}
		}
	}
#-----------内容/签名和管理菜单显示-----------------
print <<<EOT
  <tr>
	<td class="inforight" valign="top">{$ShowContentCheckInfo}{$ShowContent}{$ShowPostInfo}{$ShowAds}</td>
  </tr>
EOT;
	if(!empty($ShowUserSign)){
		print <<<EOT
  <tr>
	<td class="signed">{$ShowUserSign}</td>
  </tr>
EOT;
	}
	print <<<EOT
  <tr>
	<td class="usermenu2">
		{$ShowContentRe}{$ShowUserEdit}{$ShowUserAdmin}<a href="#top">TOP</a>
	</td>
  </tr>
</table>
EOT;
	}#end while
	}//end is_array($_PostResults)
}#End ShowDispbbs

?>