<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
if (empty($action)) {
	$creation_date = gmdate('Y-m-d H:i', $arguetopicinfo['creation_date']+getUserTimeZoneOffset());
	$start_time = gmdate('Y-m-d H:i', $arguetopicinfo['start_time']+getUserTimeZoneOffset());
	$end_time = gmdate('Y-m-d H:i', $arguetopicinfo['end_time']+getUserTimeZoneOffset());
	$now_time = gmdate('Y-m-d H:i');
	$timeoffset = dateDiff('M', $now_time, $end_time);
	$count_down = '';
	if ($timeoffset <= 0) {
		$count_down = $lang['tpl.str1'];
	} else {
		$timeoffset = ($timeoffset - ($imod = $timeoffset % 60)) / 60;
		$count_down = $imod.$lang['tpl.str2'];
		if ($timeoffset < 24) {
			$count_down = $timeoffset.$lang['tpl.str3'].$count_down;
		} else {
			$timeoffset = ($timeoffset - ($imod = $timeoffset % 24)) / 24;
			$count_down = ($timeoffset > 0 ? $timeoffset.$lang['tpl.str4'] : '').$imod.$lang['tpl.str5'].$count_down;
		}
	}
	if ($arguetopicinfo['vote'] <= 0) {
		$vote_width_obverse = $vote_width_reversed = $vote_width_third = '0px';
	} else {
		$vote_width_obverse = ceil(($arguetopicinfo['vote_obverse'] / $arguetopicinfo['vote'])*267).'px';
		$vote_width_reversed = ceil(($arguetopicinfo['vote_reversed'] / $arguetopicinfo['vote'])*267).'px';
		$vote_width_third = ceil(($arguetopicinfo['vote_third'] / $arguetopicinfo['vote'])*267).'px';
	}
	$argueresult = ($arguetopicinfo['vote_obverse'] == $arguetopicinfo['vote_reversed'] ? $lang['tpl.str6'] : ($arguetopicinfo['vote_obverse'] > $arguetopicinfo['vote_reversed'] ? $lang['tpl.str7'] : $lang['tpl.str8']));
	$boardid = $GLOBALS['boardid'];
	$star = intval($GLOBALS['star']);
	$star = 1;
	($star <= 0) AND ($star = 1);
	$page = intval($GLOBALS['page']);
	($page <= 0) AND ($page = 1);
	$chkresult = checktimeout();
	if (false === $chkresult['execflag']) {
		$isexpire = '1';
	} else {
		$isexpire = '0';
	}
	$strlockstatus = '';
	if (1 == $arguetopicinfo['locktopic']) {
		$strlockstatus = $lang['tpl.str9'];
	} elseif (1 == $arguetopicinfo['lockuser']) {
		$strlockstatus = $lang['tpl.str10'];
	} elseif (2 == $arguetopicinfo['lockuser']) {
		$strlockstatus = $lang['tpl.str11'];
	}
	if ($strlockstatus !== '') {
		$strlockstatus = '&nbsp;&nbsp;&nbsp;&nbsp;<font color="red"><b>'.$strlockstatus.'</b></font>';
	}
	$arguetopicinfo['content']['context_info']=ChkBadWords($arguetopicinfo['content']['context_info']);
	$arguetopicinfo['title_obverse']=ChkBadWords($arguetopicinfo['title_obverse']);
	$arguetopicinfo['title_reversed']=ChkBadWords($arguetopicinfo['title_reversed']);
	$langlist = load_lang($lang, 'index.list' );

	print <<<EOT
	<style>
	.normalTextSmall { color: black; }
	</style>
	<script type="text/JavaScript">
	<!--
	function post_argumentation(a_obj)
	{
		if ('{$isexpire}' == 1) {
			alert('{$lang['tpl.str12']}');
			return false;
		}
		return true;
	}//end function post_argumentation
	function argumentation_post_vote(a_obj)
	{
		if ('{$isexpire}' == 1) {
			alert('{$lang['tpl.str13']}');
			return false;
		}
		a_obj.target = 'HiddenIFrame';
		return true;
	}//end function argumentation_post_vote
	//-->
	</script>

<div id="showmenu" style="z-index:100;display:none;"></div>
<table class="mainbox" border="0" align="center" cellpadding="0" cellspacing="0" >
	<tr>
		<td height="35" colspan="2">
		<div class="navmenu">
		  <ul>
		  <li class="menu2" onmouseover="this.className='menu1'" onmouseout="this.className='menu2'">&nbsp;&nbsp;&nbsp;&nbsp; 
		  <div class="list">
			<a style="CURSOR: hand" href="post.php?action=new&amp;boardid={$boardid}" onMouseOver="this.className='menu_list_hover'" onMouseOut="this.className='menu_post'"><span><img src="{$imgurl}post/new_post.gif" border="0" /></span>{$langlist['list.tpl_Active.str2']} </a><br />
			<a style="CURSOR: hand" href="post.php?action=vote&amp;boardid={$boardid}" onMouseOver="this.className='menu_list_hover'" onMouseOut="this.className='menu_post'"><span><img src="{$imgurl}post/vote_post.gif" border="0" /></span>{$langlist['list.tpl_Active.str3']} </a><br />
			<a style="CURSOR: hand" href="post.php?action=argue_topic&amp;boardid={$boardid}" onMouseOver="this.className='menu_list_hover'" onMouseOut="this.className='menu_post'"><span><img src="{$imgurl}post/pk_post.gif" border="0" /></span>{$langlist['list.tpl_Active.str4']} </a><br />
			<a style="CURSOR: hand" href="post.php?action=active_topic&amp;boardid={$boardid}" onMouseOver="this.className='menu_list_hover'" onMouseOut="this.className='menu_post'"><span><img src="{$imgurl}post/survey_post.gif" border="0" /></span>{$langlist['list.tpl_Active.str1']} </a><br />
		  </div>
		  </li>
		  </ul>
		</div>
		</td>
	</tr>
</table>

<div style="clear:both"></div>

<table class="mainbox" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#C6D2E3" >
	<tr>
	<th colspan="2" style="border-bottom:0">{$lang['tpl.str14']}{$arguetopicinfo['title']}{$strlockstatus}</td>
	</th>
	<tr>
		<td width="180" bgcolor="#FFFFFF" height="60px" valign="top" style="padding:5px 15px 5px 15px;line-height:150%;">
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str15']}{$arguetopicinfo['postusername']} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str16']}{$creation_date} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str17']}{$start_time} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str18']}{$end_time} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str19']} {$count_down} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str20']} <br />
			<span style="color:#C6D2E3">{$lang['tpl.str63']}</span> {$lang['tpl.str21']}<span id="HitsID">{$arguetopicinfo['hits']}</span> 
		</td>
		<td bgcolor="#FFFFFF" valign="top">
			<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" >
				<tr>
					<td height="24"><b>{$lang['tpl.str22']}</b></td>
				</tr>
				<tr>
					<td style="line-height:150%;"><hr />{$arguetopicinfo['content']['context_info']} <br />
						<!--<a href="javascript:void(0);">{$lang['tpl.str23']}</a>-->
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<table class="mainbox" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#C6D2E3" >
	<tr>
		<td width="180" rowspan="2" bgcolor="#F3F7FB"  style="padding:5px 15px 5px 15px;line-height:150%;" ><span style="font-weight:bold; color:#cc0000">{$lang['tpl.str24']}<span id="ArgueResult">{$argueresult}</span></span> &nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td height="26" bgcolor="#F3F7FB" style="padding-left:10px;" >{$lang['tpl.str25']}<img id="VoteImage1" src="{$imgurl}bar1.gif" width="{$vote_width_obverse}" height="10" />&nbsp;&nbsp;<span id="VoteNumber1">{$arguetopicinfo['vote_obverse']}</span>{$lang['tpl.str26']} {$arguetopicinfo['child_obverse']}</td>
	</tr>
	<tr>
		<td height="26" bgcolor="#F3F7FB" style="padding-left:10px;" >{$lang['tpl.str25_2']}<img id="VoteImage2" src="{$imgurl}bar1.gif" width="{$vote_width_reversed}" height="10" />&nbsp;&nbsp;<span id="VoteNumber2">{$arguetopicinfo['vote_reversed']}</span>{$lang['tpl.str26']} {$arguetopicinfo['child_reversed']}</td>
	</tr>
</table>

<table class="mainbox"  border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<th style="border:1px solid #C6D2E3;border-bottom:0">  {$lang['tpl.str27']}</th>
		<td bgcolor="#ffffff" ></td>
		<th style="border:1px solid #C6D2E3;border-bottom:0">  {$lang['tpl.str28']}</th>
	</tr>
	<tr class="border">
		<td width="50%" bgcolor="#FFFFFF" height="60px" valign="top" style="border:1px solid #C6D2E3;">
		<!-- 正方观点区域开始 -->
			
			<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center"  style="padding:5px 15px 5px 15px;line-height:150%; background:#F3F7FB">
				<tr>
					<td height="60">
						<span style="font-size:14px; font-weight:bold; color: blue;">{$arguetopicinfo['title_obverse']}</span><br />
						{$lang['tpl.str29']}{$arguetopicinfo['child_obverse']} {$lang['tpl.str30']}<span id="VoteObverseNumber">{$arguetopicinfo['vote_obverse']}</span>
					</td>
					<td height="60" width="30%">
					<div id="menu_quiz"><A href="post.php?action=argue_reply&amp;arguetype=1&amp;id={$arguetopicinfo['rootid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}"><span class="menu_quiz_a"  style="CURSOR: hand;"   onMouseOver="this.className='menu_quiz_hover'" onMouseOut="this.className='menu_quiz_a'">{$lang['tpl.str65']}</span></A></div> 
				</td>
				</tr>
			</table>

			<a name="Anchor_ObverseArea"></a>
			<div id="ObverseArea">
EOT;
$obverseinfo =& $arguedbinfo[1];
if (!empty($obverseinfo) AND is_array($obverseinfo)) {
	foreach ($obverseinfo AS $parentid => $arrval) {
		$postinfo =& $arrval['PostInfo'][0];
		$postdate = gmdate('Y-m-d H:i:s', strtotime('+8 hour', $postinfo['creation_date'])+getUserTimeZoneOffset());
		if(false !== strpos($postinfo['ubblist'],',39,')){
			$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,0);
		} else{
			$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,1);
		}
		$contentmanagestr = getContentManageString($postinfo);
		if ((0 == $postinfo['parentid'] OR $postinfo['parentid'] == $postinfo['argueid']) AND false !== strpos($postinfo['expression'], '|')) {
			list($magicface_s, $expression) = explode('|', $postinfo['expression']);
		} else {
			$magicface_s = 0;
			$expression = $postinfo['expression'];
		}
		print <<<EOT
			<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center"  style="padding:5px 15px 5px 15px;line-height:150%; border-top:1px solid #A2C6DA; ">
			  <tr>
				<td height="31"><img src="{$imgurl}forum_readme.gif" width="10" height="10" />{$postinfo['title']} <img src="images/topicface/{$expression}" width="22" height="22" />   <font color="#666666">[{$postdate}]</font></td>
				<td align="right">
				 {$contentmanagestr} 	
	           </td>
			  </tr>
			  <tr >
					<td colspan="2" style="line-height:150%;">
					 	{$postinfo['content']}<br />				
						<br />
						<div id="dispargue_eye_main">
							<ul >
								<li style="width:120px;">{$lang['tpl.str31']}{$postinfo['postusername']}</li>
								<li>{$lang['tpl.str32']}<span id="VoteNumber_{$postinfo['argueid']}">{$postinfo['vote']}</span></li>
								<li>{$lang['tpl.str33']}{$postinfo['child']}</li>
							</ul>
						</div>
						<div id="menu_eye_1" style="position:relative;float:right;width:180px;z-index:0; ">
							<div id="menu_eye" style="position:relative;">
								<a href='dispargue.php?action=post_vote&amp;boardid={$boardid}&amp;argueid={$postinfo['argueid']}&amp;id={$postinfo['rootid']}' onclick="return argumentation_post_vote(this)">
									<span class="menu_eye_a" style="CURSOR: hand;"  onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str66']}</span>
								</a>
							</div>					
							<div id="menu_eye" style="position:relative;"><A href="post.php?action=argue_reply&amp;arguetype=1&amp;id={$postinfo['rootid']}&amp;parentid={$postinfo['parentid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}"><span class="menu_eye_a" style="CURSOR: hand;"  id="dvargue_reply_fight_1_id"  onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str67']}</span></A></div>
						</div>	

EOT;
	if (!empty($arrval['ReplyInfo']) AND is_array($arrval['ReplyInfo'])) {
		foreach ($arrval['ReplyInfo'] AS $replyinfo) {
			$replydate = gmdate('Y-m-d H:i:s', $replyinfo['creation_date']+getUserTimeZoneOffset());
			if(false !== strpos($replyinfo['ubblist'],',39,')){
				$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,0);
			} else{
				$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,1);
			}
			$contentmanagestr = getContentManageString($replyinfo);
			print <<<EOT
						<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"  style="padding:5px 15px 5px 15px;line-height:150%;background:#F3F7FB; border:1px solid #A8BCCF; margin:5px 0px; ">
							<tr>
								<td> {$replyinfo['postusername']} {$lang['tpl.str34']} <font color="#666666">[{$replydate}]</font> {$lang['tpl.str35']}&nbsp;&nbsp;&nbsp;&nbsp;{$contentmanagestr}</td>
							</tr>
							<tr>
								<td background="{$imgurl}dot_04.gif" height="1"></td>
							</tr>
							<tr>
								<td bgcolor="#FFFFFF"> {$replyinfo['content']} </td>
							</tr>
						</table>
EOT;
		}
	}
	print <<<EOT
					</td>
				</tr>
			</table>
EOT;
	}//end foreach
}
print <<<EOT
			</div>



			<!-- 正方观点区域结束 -->
			</td>
			<td height="24" width="5" ></td>
			<td  valign="top" style="border:1px solid #C6D2E3;">
			<!-- 反方观点区域开始 -->
				<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center"  style="padding:5px 15px 5px 15px;line-height:150%;background:#F3F7FB; ">
					<tr>
						<td height="60">
							<span style="font-size:14px; font-weight:bold; color: red;">{$arguetopicinfo['title_reversed']}</span><br />
							{$lang['tpl.str29']}{$arguetopicinfo['child_reversed']} {$lang['tpl.str30']}<span id="VoteReversedNumber">{$arguetopicinfo['vote_reversed']}</span></td>
						<td height="60" width="30%">
						<div id="menu_quiz" ><A href="post.php?action=argue_reply&amp;arguetype=2&amp;id={$arguetopicinfo['rootid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}" ><span class="menu_quiz_a" style="CURSOR: hand;"  onMouseOver="this.className='menu_quiz_hover'" onMouseOut="this.className='menu_quiz_a'">{$lang['tpl.str65']}</span></A></div> 
					</tr>
				</table>
				<a name="Anchor_ReversedArea"></a>
				<div id="ReversedArea">

EOT;
	$reversedinfo =& $arguedbinfo[2];
	
	if (!empty($reversedinfo) AND is_array($reversedinfo)) {
		foreach ($reversedinfo AS $parentid => $arrval) {
			$postinfo =& $arrval['PostInfo'][0];
			$postdate = gmdate('Y-m-d H:i:s', $postinfo['creation_date']+getUserTimeZoneOffset());
			if(false !== strpos($postinfo['ubblist'],',39,')){
				$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,0);
			} else{
				$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,1);
			}
			if ((0 == $postinfo['parentid'] OR $postinfo['parentid'] == $postinfo['argueid']) AND false !== strpos($postinfo['expression'], '|')) {
				list($magicface_s, $expression) = explode('|', $postinfo['expression']);
			} else {
				$magicface_s = 0;
				$expression = $postinfo['expression'];
			}
			$contentmanagestr = getContentManageString($postinfo);
			print <<<EOT

				
			<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center"  style="padding:5px 15px 5px 15px;line-height:150%; border-top:1px solid #A2C6DA;">
					<tr>
						<td height="24"><img src="{$imgurl}forum_readme.gif" width="10" height="10" />{$postinfo['title']} <img src="images/topicface/{$expression}" width="22" height="22" />   <font color="#666666">[{$postdate}]</font></td>
						<td align="right" >{$contentmanagestr}</td>
					</tr>
					<tr>
						<td colspan="2" style="line-height:150%;">
							{$postinfo['content']}<br />
							<div id="dispargue_eye_main">
								<ul>
									<li style="width:120px;">{$lang['tpl.str31']}{$postinfo['postusername']}</li>
									<li>{$lang['tpl.str32']}<span id="VoteNumber_{$postinfo['argueid']}">{$postinfo['vote']}</span></li>
									<li>{$lang['tpl.str33']}{$postinfo['child']}</li>
								</ul>
							</div>

							<div id="menu_eye_1" style="position:relative;float:right;width:180px;z-index:0; ">

							<div id="menu_eye" style="position:relative;"><a href='dispargue.php?action=post_vote&amp;boardid={$boardid}&amp;argueid={$postinfo['argueid']}&amp;id={$postinfo['rootid']}' onclick="return argumentation_post_vote(this)"><span class="menu_eye_a" style="CURSOR: hand;"  onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str66']}</span></a></div>					<div id="menu_eye" style="position:relative;"><A href="post.php?action=argue_reply&amp;arguetype=2&amp;id={$postinfo['rootid']}&amp;parentid={$postinfo['parentid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}"><span class="menu_eye_a" style="CURSOR: hand;"   onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str67']}</span></A></div>	
	
							</div>	


EOT;
		if (!empty($arrval['ReplyInfo']) AND is_array($arrval['ReplyInfo'])) {
			foreach ($arrval['ReplyInfo'] AS $replyinfo) {
				$replydate = gmdate('Y-m-d H:i:s', $replyinfo['creation_date']+getUserTimeZoneOffset());
				if(false !== strpos($replyinfo['ubblist'],',39,')){
					$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,0);
				} else{
					$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,1);
				}
				$contentmanagestr = getContentManageString($replyinfo);
				print <<<EOT
							<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"  style="padding:5px 15px 5px 15px;line-height:150%;background:#E1E8EF; border:1px solid #A8BCCF; margin:5px 0px; ">
								<tr>
									<td> {$replyinfo['postusername']} {$lang['tpl.str34']} <font color="#666666">[{$replydate}]</font> {$lang['tpl.str35']}&nbsp;&nbsp;&nbsp;&nbsp;{$contentmanagestr}</td>
								</tr>
								<tr>
									<td background="{$imgurl}dot_04.gif" height="1"></td>
								</tr>
								<tr>
									<td bgcolor="#FFFFFF"> {$replyinfo['content']}</td>
								</tr>
							</table>
EOT;
			}
		}
			print <<<EOT
						</td>
					</tr>
				</table>
EOT;
		}
	}
	print <<<EOT
				</div>
			<!-- 反方观点区域结束 -->
			</td>
		</tr>
	</table>

<BR>
	<!-- 正方、反方观点分页区域开始 -->
	<table class="mainbox" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
EOT;
	if (!empty($obverseinfo) AND is_array($obverseinfo)) {
		print <<<EOT
			<!-- 正方观点分页区域开始 -->
			<td width="50%" height="24" style="color:#ooo;">
				<div id="PagenationUI_Obverse">
EOT;
		print pagenation_UI($arguetopicinfo['child_obverse_post'], count($obverseinfo), $star, PAGE_SIZE, 10, array('pagevar'=>'star', 'url'=>'dispargue.php?action=pagenation&amp;boardid='.$boardid.'&amp;arguetype=1&amp;id='.$arguetopicinfo['rootid'].'&amp;page='.$page, 'target'=>'HiddenIFrame', 'link_other_prop'=>' onclick="this.style.color=\'black\';return true;"'),1);
		print <<<EOT
				</div>
			</td>
			<!-- 正方观点分页区域结束 -->
EOT;
	}
	print <<<EOT
			<td height="24" width="5" bgcolor="#ffffff"></td>
EOT;
	if (!empty($reversedinfo) AND is_array($reversedinfo)) {
		print <<<EOT
			<!-- 反方观点分页区域开始 -->
			<td height="24" >
				<div id="PagenationUI_Reversed">
EOT;
		print pagenation_UI($arguetopicinfo['child_reversed_post'], count($reversedinfo), $star, PAGE_SIZE, 10, array('pagevar'=>'star', 'url'=>'dispargue.php?action=pagenation&amp;boardid='.$boardid.'&amp;arguetype=2&amp;id='.$arguetopicinfo['rootid'].'&amp;page='.$page, 'target'=>'HiddenIFrame'),1);
		print <<<EOT
				</div>
			</td>
			<!-- 反方观点分页区域结束 -->
EOT;
	}
	print <<<EOT
		</tr>
	</table>
	<!-- 正方、反方观点分页区域结束 -->
	<!-- 第三方观点区域开始 -->
	<div id="ThirdArea">
	<table class="mainbox" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#C6D2E3" >
		<tr>
			<th colspan="2" style="border-bottom:0">{$lang['tpl.str36']}</td>
		</tr>
		<tr>
			<td height="30" colspan="2" valign="top" bgcolor="#F3F7FB" style="padding:5px 15px 5px 15px;line-height:150%;">
			<div style="float:left;width:120px;height:20px"><div id="menu_quiz" ><A href="post.php?action=argue_reply&amp;arguetype=3&amp;id={$arguetopicinfo['rootid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}" ><span class="menu_quiz_a" style="CURSOR: hand;"  onMouseOver="this.className='menu_quiz_hover'" onMouseOut="this.className='menu_quiz_a'">{$lang['tpl.str65']}</span></A></div> </div>
	
	 {$lang['tpl.str37']}<img id="VoteImage3" src="{$imgurl}bar3.gif" width="{$vote_width_third}" height="10" />&nbsp;&nbsp;<span id="VoteNumber3">{$arguetopicinfo['vote_third']}</span>{$lang['tpl.str26']}&nbsp;&nbsp;{$arguetopicinfo['child_third']}</td>
		</tr>
EOT;
	$thirdinfo =& $arguedbinfo[3];
	if (!empty($thirdinfo) AND is_array($thirdinfo)) {
		foreach ($thirdinfo AS $parentid => $arrval) {
			$postinfo =& $arrval['PostInfo'][0];
			$postdate = gmdate('Y-m-d H:i:s', $postinfo['creation_date']+getUserTimeZoneOffset());
			if(false !== strpos($postinfo['ubblist'],',39,')){
				$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,0);
			} else{
				$postinfo['content'] =& Dv_CodeProcess($postinfo['content'],$postinfo,$postinfo['ubblist'],1,1);
			}
			if ((0 == $postinfo['parentid'] OR $postinfo['parentid'] == $postinfo['argueid']) AND false !== strpos($postinfo['expression'], '|')) {
				list($magicface_s, $expression) = explode('|', $postinfo['expression']);
			} else {
				$magicface_s = 0;
				$expression = $postinfo['expression'];
			}
			$contentmanagestr = getContentManageString($postinfo);
			print <<<EOT
		<tr>
			<td width="180" height="60px" valign="top" bgcolor="#FFFFFF" style="padding:5px 15px 5px 15px;line-height:150%;"><span style="line-height:150%;">{$lang['tpl.str31']}{$postinfo['postusername']} <br />
				{$lang['tpl.str32']}<span id="VoteNumber_{$postinfo['argueid']}">{$postinfo['vote']}</span><br /> 
				{$lang['tpl.str33']}{$postinfo['child']} <br />
				[{$postdate}]<br />

				<!-- <a href="post.php?action=argue_reply&amp;arguetype=3&amp;id={$postinfo['rootid']}&amp;parentid={$postinfo['parentid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}" onclick="return post_argumentation(this)"><img src="{$imgurl}ping.gif" width="60" height="22" border="0" align="absmiddle" /></a> <a href="dispargue.php?action=post_vote&amp;boardid={$boardid}&amp;argueid={$postinfo['argueid']}&amp;id={$postinfo['rootid']}" onclick="return argumentation_post_vote(this)"><img src="{$imgurl}ding.gif" width="60" height="22" border="0" align="absmiddle" /></a> -->
	

				<div id="menu_eye_1" style="padding : 0px;margin:0px;position:relative;float:right;width:180px;z-index:0; ">

					<div id="menu_eye" style="position:relative;">
						<A href="dispargue.php?action=post_vote&amp;boardid={$boardid}&amp;argueid={$postinfo['argueid']}&amp;id={$postinfo['rootid']}"  ><span class="menu_eye_a" style="CURSOR: hand;"  onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str66']}</span></A></div>					
					<div id="menu_eye" style="position:relative;"><A href="post.php?action=argue_reply&amp;arguetype=3&amp;id={$postinfo['rootid']}&amp;parentid={$postinfo['parentid']}&amp;boardid={$boardid}&amp;star={$GLOBALS['star']}&amp;page={$GLOBALS['page']}"><span class="menu_eye_a" style="CURSOR: hand;"   onMouseOver="this.className='menu_eye_hover'" onMouseOut="this.className='menu_eye_a'">{$lang['tpl.str67']}</span></A>
				</div>	
								
				</span></td>
			<td bgcolor="#FFFFFF" valign="top">
				<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center"  style="padding:5px 15px 5px 15px;line-height:150%;">
					<tr>
						<td height="24"><img src="{$imgurl}forum_readme.gif" width="10" height="10" />{$postinfo['title']} <img src="images/topicface/{$expression}" width="22" height="22" />   <font color="#666666">[{$postdate}]</font></td>
						<td align="right">{$contentmanagestr}</td>
					</tr>
					<tr>
						<td colspan="2" style="line-height:150%;"> {$postinfo['content']}<br />
EOT;
		if (!empty($arrval['ReplyInfo']) AND is_array($arrval['ReplyInfo'])) {
			foreach ($arrval['ReplyInfo'] AS $replyinfo) {
				$replydate = gmdate('Y-m-d H:i:s', $replyinfo['creation_date']+getUserTimeZoneOffset());
				if(false !== strpos($replyinfo['ubblist'],',39,')){
					$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,0);
				} else{
					$replyinfo['content'] =& Dv_CodeProcess($replyinfo['content'],$replyinfo,$replyinfo['ubblist'],1,1);
				}
				$contentmanagestr = getContentManageString($replyinfo);
				print <<<EOT
							<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"  style="padding:5px 15px 5px 15px;line-height:150%;background:#E1E8EF; border:1px solid #A8BCCF; margin:5px 0px; ">
								<tr>
									<td> {$replyinfo['postusername']} {$lang['tpl.str34']} <font color="#666666">[{$replydate}]</font> {$lang['tpl.str35']} &nbsp;&nbsp;&nbsp;&nbsp;{$contentmanagestr}</td>
								</tr>
								<tr>
									<td background="{$imgurl}dot_04.gif" height="1"></td>
								</tr>
								<tr>
									<td bgcolor="#FFFFFF"> {$replyinfo['content']} </td>
								</tr>
							</table>
EOT;
			}
		}
		print <<<EOT
						</td>
					</tr>
				</table>
			</td>
		</tr>
EOT;
		}
	}
	print <<<EOT
	</table>
	</div>
	<!-- 第三方观点区域结束 -->
	
EOT;
	if (!empty($thirdinfo) AND is_array($thirdinfo)) {
		print <<<EOT
	<!-- 第三方观点分页区域开始 -->
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:10px;">
		<tr>
			<td height="24" >
				<div id="PagenationUI_Thrid">
EOT;
		print pagenation_UI($arguetopicinfo['child_third_post'], count($thirdinfo), $star, PAGE_SIZE, 10, array('pagevar'=>'star', 'url'=>'dispargue.php?action=pagenation&amp;boardid='.$boardid.'&amp;arguetype=3&amp;id='.$arguetopicinfo['rootid'].'&amp;page='.$page, 'target'=>'HiddenIFrame'),1);
		print <<<EOT
				</div>
			</td>
		</tr>
	</table>
	<!-- 第三方观点分页区域结束 -->
EOT;
	}
	//$dispargue_js_file = dirname($fsetting['css']).'/dispargue.js';
	$dispargue_js_file = 'templates/lang/'.$GLOBALS['fsetting']['lang'].'/js/dispargue.js';
	print <<<EOT
	<script type="text/JavaScript" src="{$dispargue_js_file}"></script>
	<!-- IFRAME 开始 -->
	<iframe name="HiddenIFrame" src="about:blank" style="border:0px;width:0px;height:0px;"></iframe>
	<!-- IFRAME 结束 -->
	<script type="text/JavaScript">
	<!--
	var nowtime = Date.parse('{$now_time}:00');
	var endtime = Date.parse('{$end_time}:00');
	//-->
	</script>
EOT;
	global $boardmaster,$master;
	if (true === $boardmaster OR true === $master) {
		print <<<EOT
	<div class="bar0" style="height:36px;line-height:36px;">
		<div style="height:36px;float:right;">
			<b>{$lang['tpl.str38']}</b>{$lang['tpl.str64']}
		<a href="admin_postings.php?action=p_special_topic_manage&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str191']}">{$lang['tpl.str39']}</a> 
EOT;
		if( $arguetopicinfo['locktopic'] == 1 ){
			print " | <a href=\"admin_postings.php?action=p_unlock_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}\" title=\"{$lang['tpl.str40']}\">{$lang['tpl.str41']}</a>";
		} else{
			print " | <a href=\"admin_postings.php?action=p_lock_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}\" title=\"{$lang['tpl.str42']}\">{$lang['tpl.str43']}</a>";
		}
		print <<<EOT
			| <a href="admin_postings.php?action=p_exalt_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str44']}">{$lang['tpl.str45']}</a> | <a href="admin_postings.php?action=p_sink_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str46']}">{$lang['tpl.str47']}</a><!-- | <a href="admin_postings.php?action=p_follow_argue_topic_manage&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str48']}">{$lang['tpl.str49']}</a>--> | <a href="admin_postings.php?action=p_delete_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str50']}">{$lang['tpl.str51']}</a> | <a href="admin_postings.php?action=p_move_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}&replyid={$arguetopicinfo['rootid']}" title="{$lang['tpl.str52']}">{$lang['tpl.str53']}</a> | <a href="admin_postings.php?action=p_placed_top_argue_topic&boardid={$arguetopicinfo['boardid']}&id={$arguetopicinfo['rootid']}" title="{$lang['tpl.str54']}">{$lang['tpl.str55']}</a>
		</div>
	</div>
EOT;
	}
} elseif ('pagenation' === $action) {	//	获取分页信息
	if (empty($topicinfo)) {
		$errmsg = format_jscode($lang['err.str0']);
		print <<<EOT
<script type="text/JavaScript">
<!--
alert('{$errmsg}');
//-->
</script>
EOT;
	} else {
		//_debug($argueinfo['options']);
		$jscode = 'var argueinfo = '.var_export2js($argueinfo, true).';';
		print <<<EOT
<script type="text/JavaScript">
<!--
var parentwin = parent.window;
{$jscode}
if (typeof(argueinfo) != 'undefined') {
	parentwin.LoadPageInfo('{$arguetype}', argueinfo);
}
//-->
</script>
EOT;
	}
} elseif ('post_vote' === $action) {	//	执行投票操作
	$execresult = argumentation_post_vote($argueid, $userid, $id, $boardid);
	if (false === $execresult['execflag']) {
		$execresult['execmsg'] = format_jscode($execresult['execmsg']);
		head(0,1,0,$arrNavMenu);
		showmsg($execresult['execmsg']);
		footer();

	} else {
		$topicinfo =& get_argumentation_topicinfo($id, $boardid);
		if (!empty($topicinfo)) {
			$mixedvar = array('vote_personal'=>$execresult['vote_personal'], 'arguetype'=>$execresult['arguetype'], 'argueid'=>$argueid, 'vote'=>$topicinfo['vote'], 'vote_obverse'=>$topicinfo['vote_obverse'], 'vote_reversed'=>$topicinfo['vote_reversed'], 'vote_third'=>$topicinfo['vote_third']);
			$voteinfo_jscode = 'var rebuild_voteinfo = '.var_export2js($mixedvar, true).';';
			print <<<EOT
<script type="text/JavaScript">
<!--
var parentwin = parent.window;
var rebuild_voteinfo = null;
{$voteinfo_jscode}
parent.window.RebuildVoteInfo(rebuild_voteinfo);
//-->
</script>
EOT;
		} else {
		print <<<EOT
<script type="text/JavaScript">
<!--
alert('{$lang['tpl.str56']}');
//-->
</script>
EOT;
		}
	}
}

function getContentManageString(&$contentinfo)	//	获取帖子操作的 HTML 管理字符串
{
	global $master, $superboardmaster, $boardmaster, $lang, $userid, $boardid, $star, $page;
	$adminfunc = '';
	if (true === $master OR USER_ID == $contentinfo['postuserid']) {
		$adminfunc .= '<li><a  href=\'post.php?action=argue_append&amp;arguetype='.$contentinfo['arguetype'].'&amp;id='.$contentinfo['rootid'].'&amp;argueid='.$contentinfo['argueid'].'&amp;parentid='.$contentinfo['parentid'].'&amp;boardid='.$boardid.'&amp;star='.$star.'&amp;page='.$page.'\'>'.$lang['tpl.str57'].'</a>&nbsp;</li>';
	}
	if (true === $master OR true === $superboardmaster OR true === $boardmaster) {
		if (0 == $contentinfo['parentid'] OR $contentinfo['parentid'] == $contentinfo['argueid']) {	//	删除观点
			$adminfunc .= '<li><a  href=\'admin_postings.php?action=p_delete_single_topic&amp;boardid='.$boardid.'&amp;replyid='.$contentinfo['argueid'].'&amp;parentid='.$contentinfo['parentid'].'&amp;id='.$contentinfo['rootid'].'&amp;star='.$star.'&amp;page='.$page.'&amp;destuserid='.$contentinfo['userid'].'\'>'.$lang['tpl.str58'].'</a>&nbsp;</li>';
		} else {	//	删除回复
			$adminfunc .= '<li><a  href=\'admin_postings.php?action=p_delete_single_topic&amp;boardid='.$boardid.'&amp;replyid='.$contentinfo['argueid'].'&amp;parentid='.$contentinfo['parentid'].'&amp;id='.$contentinfo['rootid'].'&amp;star='.$star.'&amp;page='.$page.'&amp;destuserid='.$contentinfo['userid'].'\'>'.$lang['tpl.str59'].'</a>&nbsp;</li>';
		}
		if (2 == $contentinfo['locktopic']) {
			$adminfunc .= '<li><a  href=\'admin_postings.php?action=p_unshield_single_argue_topic&amp;boardid='.$boardid.'&amp;replyid='.$contentinfo['argueid'].'&amp;id='.$contentinfo['rootid'].'&amp;star='.$star.'&amp;page='.$page.'&amp;userid='.$contentinfo['userid'].'\'>'.$lang['tpl.str60'].'</a>&nbsp;</li>';
		} else {
			$adminfunc .= '<li><a href=\'admin_postings.php?action=p_shield_single_topic&amp;boardid='.$boardid.'&amp;replyid='.$contentinfo['argueid'].'&amp;id='.$contentinfo['rootid'].'&amp;star='.$star.'&amp;page='.$page.'&amp;userid='.$contentinfo['userid'].'\'>'.$lang['tpl.str61'].'</a>&nbsp;</li>';
		}
	}
	if ('' === $adminfunc) {
		return '';
	}
	return <<<EOT
<div class="m_li_n" onmouseover="showmenu('ManageMenu_{$contentinfo['argueid']}',0);" style="display:inline;">{$lang['tpl.str62']}<div class="submenu" id="ManageMenu_{$contentinfo['argueid']}" onmouseout="hidemenu(1);hidemenu(0);"><ul>{$adminfunc}</ul></div></div>
EOT;
}//end function getContentManageString
?>

