<?php

/**
 * board.php
 *
 * @version       v0.01
 * @create time   2011-5-30
 * @update time   
 * @author        wiipu
 * @copyright     Copyright (c) 寰櫘绉戞妧 WiiPu Tech Inc. ( http://www.wiipu.com)
 * @informaition  

 * Update Record:
 *
 */

	define('THISPATHROOT', str_replace('ui/color/board.php', '', str_replace('\\', '/', __FILE__)));
	require_once(THISPATHROOT.'include/db_conn.php');
	$session->data['setUrl']=getUrl();
	require_once('usercheck.php');
	$session->data['setSkipUrl']=getUrl();
	$key=(empty($_GET["key"]))?"":sqlReplace($_GET['key']);
	If($key=="good"){
		$title = "&gt;&gt;".$_['text_good'];
		$title1 = " - ".$_['text_good'];
		$good = 1;
	}Else{
		$title ="";
		$good = "";
		$title1='';
	} 
	$header_title= $bdName.$title1;
	require_once('htmltop.php');
?>
 <body>
	<div id='container'>
		<?php require_once('header.php');?>
		<?php require_once('noticeinc.php');?>
		<?php require_once('logininc.php');?>
	
		<div class='hf'><a href="index.php"><?php echo $_['text_index']?></a>&gt;&gt;<?php echo $bdName.$title?></div>
		<h1><?php echo $_['text_moderator']?>锛??php $board->getUsergroup($bd)?><br/><br/><a href='topicpost.php?bd=<?php echo $bd?>&amp;key=post'>[<?php echo $_['text_postTopic']?>]</a>  <?php if (empty($key)) {?><a href='board.php?key=good&amp;bd=<?php echo $bd?>'>[<?php echo $_['text_good']?>]</a><?php }else{?>[<a href="board.php?bd=<?php echo $bd?>"><?php echo $_['text_all']?></a>]<?php }?> <?php if($bdCheck=="1" && ($userGroup || $manager)) echo " <a href='topicchecklist.php?bd=".$bd."'>[".$_['text_check']."]</a>";?></h1>
		<?php
			if (empty($key)){
				$page=(empty($_GET['page']))?"":$_GET['page'];
				if (empty($page)||!is_numeric($page))$page=1;
				If($page==1){
					//鎬荤疆椤跺笘瀛?
					$allTop=$topic->getAllTopTopic_r();
					//缃《甯栧瓙
					$top=$topic->getTopTopic($bd);
				}
				//鏌ヨ骞冲父甯栧瓙
				$pagesize=15;
				$startRow=0;
				$startRow=($page-1)*$pagesize;
				$rscount=$topic->getTopicCount($bd,0);
				if ($rscount%$pagesize==0)
					$pagecount=$rscount/$pagesize;
				else
					$pagecount=ceil($rscount/$pagesize);
				$topicList=$topic->getTopic($bd,0,$startRow,$pagesize,$page);
				if ($pagecount>1){

					echo showPage1('board.php?bd='.$bd,$page,$pagesize,$rscount,$pagecount);
				}
			
			}else{   //绮惧崕甯?
				$page=(empty($_GET['page']))?"":$_GET['page'];
				if (empty($page)||!is_numeric($page))$page=1;
				$pagesize=15;
				$startRow=0;
				$startRow=($page-1)*$pagesize;
				$rscount=$topic->getTopicCount($bd,'',0,1);
				if ($rscount%$pagesize==0)
					$pagecount=$rscount/$pagesize;
				else
					$pagecount=ceil($rscount/$pagesize);
				$topicList=$topic->getTopic($bd,'',$startRow,$pagesize,$page,$key,'topic_updatetime','desc','0',1,$keyword='');
				if ($pagecount>1){
					echo showPage1('board.php?key='.$key.'&amp;bd='.$bd,$page,$pagesize,$rscount,$pagecount);
				}
			}
		
		?>
		<?php require_once('boardswitch.php');?>
		<?php require_once('bottom.php');?>
	</div>
 </body>
<?php
	require_once(ROOT_PATH.'include/htmlbottom.php');
?>