<?php
include("header.tpl.php");
include("bodytop.tpl.php"); 
?>
    <div class="clear"></div>
	<!-- 菜单部分 -->
	<div id="articlemenu">
		<div class="menuhead"></div>
		<div class="menucontent">
			<ul class="articlemenu_ul">
			<li class="logo"></li>
			<?php foreach($maincategory as $key => $val){?>
			<li class="category"><img src="./images/common/arrow_03.gif"> <a href="articledisplay.php?pid=<?php echo $val['pid']?>&categoryid=<?php echo $key?>"><?php echo $val['categorytitle']?></a>
			</li>
			<?php if($displayway){?>
			<?php if(isset($subcategory[$key])){?>
				<?php foreach($subcategory[$key] as $subkey => $subval){?>
				<li class="sub"><img src="./images/common/arrow_03.gif"> <a class="font_12" href="articledisplay.php?pid=<?php echo $subval['pid']?>&categoryid=<?php echo $subkey?>">
				<?php echo $subval['categorytitle']?></a>
				</li>
				<?php }?>
			<?php }?>
			<?php }else{?>
			<?php if($subcategory){?>
				<?php foreach($subcategory as $subkey => $subval){?>
				<li class="sub"><img src="./images/common/arrow_03.gif"> <a class="font_12" href="viewarticle.php?aid=<?php echo $subkey?>">
				<?php echo $subval?></a>
				</li>
				<?php }?>
			<?php }?>
			<?php }?>
			<?php }?>
			</ul>
			<div class="menubottom"></div>
		</div>
	</div>
<!-- 文章内容部分 -->
	<div id="articlebody">
	<table>
		<tr>
		<td width="30">	<img src="<?php echo $templatedir?>images/ico_1.gif"></td>
		<td align="left"> <a href="index.php">网站首页</a> >> <a href="articledisplay.php?pid=<?php echo $pid?>&categoryid=<?php echo $categoryid?>"><?php echo $articlecategory[$categoryid]['categorytitle']?></a> >> <?php echo $allarticle['articletitle']?>
		</td>
		</tr>
        </table>
		<hr />
			<ul class="articlebody_ul">
			<li class="title"><?php echo $allarticle['articletitle']?></li>
				<li class="articletag">
					发布时间:<?php echo gmdate('Y-n-j H:i',$allarticle['subtime']+8*3600)?>
<?php if($pervalue{17}){?>
[ <a href="post.php?ipost=modifyarticle&mid=<?php echo $allarticle['aid']?>">修改</a> ]
<?php }?>

				</li>
				<li id="articlemessage" class="a_msgfont">
				<?php echo $message?>
				</li>
			</ul>
			<div class="clear"></div>
	</div>
	<?php if($downattachs){?>
			<ul class="attach_ul">
				<li class="name title">附件名</li>
				<li class="title">点击下载</li>	
				<li class="title">下载次数</li>
				<?php	foreach($downattachs as $key => $val){ ?>
				<li class="name"><?php echo $val['icon']?> <?php echo $val['name']?></li>	
				<li><a href="download.php?fid=<?php echo $key?>">点击下载</a></li>	
				<li><?php echo $val['downtimes']?></li>
				<?php }?>
			</ul>
			<div class="clear"></div>
	<?}?>


<div id="articlereply">
<?php foreach($replys as $val){?>
<table class="posttab">
  <tr>
       <td valign="top" class="postauthor">
	   			 	   <?php if($val['reply_uid']&&!$val['uid']){?>
					<cite><s><?php echo $val['postname']?>(<?php echo $val['ip']?>)</s></cite>
				  <div class="authorface"><img src="images/userface/<?php echo $val['userface']?>"></div>
				   <center><div> 该用户已经被删除 </div></center>
				  <?}else{?>
	   			<cite><?php echo $val['userid']?>(<?php echo $val['ip']?>)</cite>
				  <div class="authorface"><img src="images/userface/<?php echo $val['userface']?>"></div>
				  <?php }?>
	   			    <ul>
				       <li> 用户组：<?php echo $groupnames[$val['gid']][0]?></li>
					   <?php if($val['uid']){?>
					   <li>帖子数：<?php echo $val['postcount']?></li>
					   <li>注册时间：<?php echo gmdate('Y-n-j',$val['registertime']+28800)?></li>	
					   <?php }?>			   
					</ul>
      </td>
    <td class="reply_r" valign="top">
	  <div class="postinfo">
	 <cite><?php echo $val['floor']?>楼</cite>
	  <em onclick="$('postmessage_<?php echo $val['rid']?>').className='t_bigfont'">大</em>
	  <em onclick="$('postmessage_<?php echo $val['rid']?>').className='t_msgfont'">中</em>
	  <em onclick="$('postmessage_<?php echo $val['rid']?>').className='t_smallfont'">小</em>
	  回复时间：<?php echo gmdate('Y-n-j H:i',$val['subtime']+28800)?>
	    </div>

       <div id="postmessage_<?php echo $val['rid']?>" class="t_msgfont"> <?php  echo $val['content']?></div>
	   <?php  if(!empty($replydownattachs[$val['rid']])){?>
	  <div class="reply_downtitle">附件下载</div>
	  <?php foreach($replydownattachs[$val['rid']] as $v){
		   ?>
		 <div class="reply_down font_12"><?php  echo $v['icon'].' <a href="download.php?fid='.$v['fid'].'">'.$v['name'].'</a> '.' ('.sizecount($v['size']).') (下载次数:'.$v['downtimes'].')'; ?></div>
	  <?php  } }?>
   </td>
  </tr>
  <tr>
			 <td class="postauthor"></td>
			  <td class="thread_r"><div class="postaction">   <a href="###" onclick="window.scrollTo(0,0);">TOP</a>
			 <?php if(($pervalue{1} && $val['reply_uid']==$uid) || $pervalue{17}){?>
			    <a href="post.php?ipost=modifyreply&mid=<?php echo $val['rid']?>">修改</a>
			  <?php }?>
			  <?php if(($pervalue{0} && $val['reply_uid']==$uid) || $pervalue{17}){?>
			  <a href="###" onclick="delreply(<?php echo $val['rid']?>)">删除</a>
			  <?php }?>
			  </div>
			</td>
  </tr>
</table>
<?php }?>
<?php	if($multipage){?>
<div class="pages_btns font_14"><?php echo $multipage?></div>
<?php	}?>

<?php if($pervalue{14}){?>
<form enctype="multipart/form-data" method="post" action="post.php?action=savereply&typeid=1&bid=<?php echo $aid?>" onsubmit="parseurl()" >
	<div id="msglist">
			<h2>发表评论</h2>
				<ul>
				<li><?php include("editor.tpl.php");?></li>						
				<li>
				<?php if($allowedauthcode{1}){ ?>
				<div style="margin-top:5px;"></div>
				<input type="text" name="replyarticleauthcode" class="authcode" style="margin-left:5px;"> 
				<div id="iauthcodediv" ></div>
				<SCRIPT LANGUAGE="JavaScript">
				changeauthcode();
				</SCRIPT>
		    	<?php }?>
				<div class="clear"></div>
				<input type="submit" value="发表评论" class="postmsgbtn">
				</li>
				</ul>
	</div>
	</form>
<?php }?>

</div>


	<div class="clear"></div>

<?php
include("tail.tpl.php"); 
?>

