<!--<?php print <<<EOT
-->
<style type="text/css">
.trbor td{border-bottom:0px;}
.tr2 td{padding:6px 5px;color:#333;border-top:1px solid $tdcolor;border-bottom:1px solid $tdcolor;}
.lh_18{line-height:18px;height:18px;overflow:hidden;}
</style>

<div id="breadCrumb">
<!--
EOT;
if($cachetime){print <<<EOT
-->
<span class="fr mr5">下次更新時間:$cachetime</span>
<!--
EOT;
}print <<<EOT
-->
<img src="$imgpath/$stylepath/thread/home.gif" class="breadHome" /><em class="breadEm"></em><a href="$db_bfn" title="$db_bbsname">$db_bbsname</a><em>&gt;</em><a href="sort.php">統計信息</a>
</div>
<div id="pw_content" class="cc">
<div class="hB mb10">
	<ul class="tabB cc">
<!--
EOT;
${'tmpSort_'.($action ? $action : 'default')} = "class='current'";print <<<EOT
-->
		<li $tmpSort_default ><a href="sort.php">基本統計信息</a></li>
		<li $tmpSort_ipstate ><a href="sort.php?action=ipstate">到訪IP統計</a></li>
		<li $tmpSort_team ><a href="sort.php?action=team">管理團隊</a></li>
		<li $tmpSort_admin ><a href="sort.php?action=admin">管理統計</a></li>
		<li $tmpSort_online ><a href="sort.php?action=online">在線統計</a></li>
		<li $tmpSort_member ><a href="sort.php?action=member">會員排行</a></li>
		<li $tmpSort_forum ><a href="sort.php?action=forum">版塊排行</a></li>
		<li $tmpSort_favor ><a href="sort.php?action=favor">收藏排行Top50</a></li>
		<li $tmpSort_article ><a href="sort.php?action=article">帖子排行</a></li>
	</ul>
</div>
<div class="pd15">
<!--
EOT;
if(empty($action)){print <<<EOT
-->
<div class="t"><table width="100%" cellspacing="0" cellpadding="0">
<tr class="tr3 trbor vt">
<td width="33%">
<p class="mb10"><b>會員統計</b></p>
<p class="mb5">會員總數:$bbsinfo[totalmember]</p>
<p>最新注冊會員:<a href="u.php?username=$bbsinfo[newmember]" target="_blank">$bbsinfo[newmember]</a></p>
</td>

<td width="33%" valign="top">
<p class="mb10"><b>帖子統計</b></p>
<p class="mb5">主題數:$topic</p>
<p class="mb5">帖子數:$article</p>
<p class="mb5">今 日:$tposts</p>
<p class="mb5">昨 日:$bbsinfo[yposts]</p>
<p class="mb5">最高日:$bbsinfo[hposts]</p>
</td>

<td width="33%" valign="top">
<p class="mb10"><b>在線統計</b></p>
<p class="mb5">在線總數:$usertotal</p>
<p class="mb5">會員數:$userinbbs</p>
<p class="mb5">游客數:$guestinbbs</p>
<p class="mb5">最高在線:$bbsinfo[higholnum]</p>
<p class="mb5">發生在:$bbsinfo[higholtime]</p></td></tr></table></div>
<!--
EOT;
}elseif($action=='ipstate'){print <<<EOT
-->
<div class="t">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<!--
EOT;
if($type=='month'){print <<<EOT
-->
<tr class="tr2"><td colspan="2"><b class="mr20">月到訪IP統計</b>
<a href="sort.php?action=ipstate&year=$p_year" class="mr10 s4 b">&lt;</a><span class="mr10">{$c_year}</span><a href="sort.php?action=ipstate&year=$n_year" class="s4 b">&gt;</a>
</td></tr>
<!--
EOT;
foreach($m_ipdb as $key => $ip){
$percent=round($ip[nums]/$summip*100,1);
$imgwidth=floor(500*$ip[nums]/($summip+1));
print <<<EOT
-->
<tr class="tr3 f_one"><th width="90">$ip[month]
<a href="sort.php?action=ipstate&type=day&month=$ip[_month]" class="s4">[查看]</a></th>
<th><img src="$imgpath/post/vote/tab-two.gif" width="$imgwidth" height="10" /> $ip[nums]($percent%)</th></tr>
<!--
EOT;
}}elseif($type=='day'){print <<<EOT
-->
<tr class="tr2"><td colspan="2">
<a href="sort.php?action=ipstate&year=$Y" class="s4 b">月到訪IP統計</a>&nbsp;&gt;&nbsp;<b class="mr20">日到訪IP統計</b>
<a href="sort.php?action=ipstate&type=day&month=$p_month" class="mr10 s4 b">&lt;</a><span class="mr10">{$c_month}</span><a href="sort.php?action=ipstate&type=day&month=$n_month" class="s4 b">&gt;</a>
</td></tr>
<!--
EOT;
foreach($d_ipdb as $key => $ip){
$percent=round($ip[nums]/$sumip*100,1);
$imgwidth=floor(500*$ip[nums]/($sumip+1));
print <<<EOT
-->
<tr class="tr3 f_one"><th width="90">$ip[day]</th>
<th><img src="$imgpath/post/vote/tab-two.gif" width="$imgwidth" height="10" /> $ip[nums]($percent%)</th></tr>
<!--
EOT;
}}print <<<EOT
-->
</table></div>
<!--
EOT;
}elseif($action=='online'){print <<<EOT
-->
<div class="t">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr class="tr2 tac">
<td>用戶名</td>
<td>IP</td>
<td>級別</td>
<td>當前動作</td>
<td>最後活動時間</td>
<td>所在版塊</td>
<td>所在主題</td>
</tr>
<!--
EOT;
$f_class='f_one';
foreach($threaddb as $thread){
if($thread){
$f_class=$f_class=='f_one' ? 'f_two' : 'f_one';
print <<<EOT
-->
<tr class="tr3 tac $f_class">
<td>
<b>
<!--
EOT;
if($thread[9]=='<>' && $groupid==3){
print <<<EOT
-->
<a href="{$db_userurl}$thread[uid]" target="_blank">$thread[username](隱身)</a>
<!--
EOT;
}elseif($thread[9]=='<>' && $groupid!=3){
print <<<EOT
-->
隱身會員
<!--
EOT;
}else{
print <<<EOT
-->
<a href="{$db_userurl}$thread[uid]" target="_blank">$thread[username]</a>
<!--
EOT;
}print <<<EOT
-->
</b></td>
<td>$thread[ip]</td>
<td>$thread[group]</td>
<td>$thread[action]</td>
<td>$thread[lasttime]</td>
<td>$thread[forum]<br /></td>
<td>
<!--
EOT;
if($thread[atc]){print <<<EOT
-->
<a href="read.php?tid=$thread[atc]">進入主題</a>
<!--
EOT;
}print <<<EOT
-->
<br /></td>
</tr>
<!--
EOT;
}}
print <<<EOT
-->
<tr class="f_one"><td style="height:8px;" colspan="7"></td></tr>
</table>{$pages}共{$count}人在線</div>

<!--
EOT;
}elseif($action=='team'){print <<<EOT
-->
<div class="t">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr class="tr2 tac">
<td>用戶名</td>
<td>系統頭餃</td>
<td>會員頭餃</td>
<td>最後發表</td>
<td>離開天數</td>
<td>發帖</td>
<td>本月發帖</td>
<td>{$db_rvrcname}</td>
<td>$db_moneyname</td>
<td>會員的歷史在線時間</td>
<td>本月在線</td>
</tr>
<!--
EOT;
foreach($teamdb as $key => $team){
print <<<EOT
-->
<tr class="tr3 tac f_one">
<td><a href="{$db_userurl}$team[uid]" target="_blank">$team[username]</a></td>
<td>$team[systitle]</td>
<td>$team[memtitle]</td>
<td>$team[lastpost]</td>
<td>$team[leavedays]</td>
<td>$team[postnum]</td>
<td>$team[monthpost]</td>
<td>$team[rvrc]</td>
<td>$team[money]</td>
<td>$team[onlinetime]</td>
<td>$team[monoltime]</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
<tr class="f_one"><td style="height:8px;" colspan="11"></td></tr>
</table></div>
<div class="t"><table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr><td class="h" colspan="12"><b>版主統計</b></td></tr>
<tr class="tr2 tac">
	<td>版塊名稱</td>
	<td>版主</td>
	<td>系統頭餃</td>
	<td>會員頭餃</td>
	<td>最後發表</td>
	<td>離開天數</td>
	<td>本月主題數</td>
	<td>本月發帖</td>
	<td>被點擊數</td>
	<td>本月在線</td>
</tr>
<!--
EOT;
foreach($forum as $key => $value){
if($value['ifcms']=='0' && $forumdb[$key]){
$i=count($forumdb[$key]);
print <<<EOT
-->
<tr class="tr3 tac f_one">
	<td rowspan="$i"><a href="thread.php?fid=$key" target="_blank">$value[name]</a></td>
<!--
EOT;
$j=0;
foreach($forumdb[$key] as $uid=>$member){
$j++;
if($j>1){
print <<<EOT
-->
<tr class="tr3 tac f_one">
<!--
EOT;
}
print <<<EOT
-->
	<td><a href="{$db_userurl}$uid" target="_blank">$member[username]</a></td>
	<td>$member[systitle]</td>
	<td>$member[memtitle]</td>
	<td>$member[lastpost]</td>
	<td>$member[leavedays]</td>
	<td>$member[post]</td>
	<td>$member[monthpost]<br /></td>
	<td>$member[hits]<br /></td>
	<td>$member[monoltime]</td>
</tr>
<!--
EOT;
}}}print <<<EOT
-->
<tr class="f_one"><td style="height:8px;" colspan="10"></td></tr>
</table></div>
<!--
EOT;
} elseif($action=='favor'){ print <<<EOT
-->
<div class="t">
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr class="tr2 tac">
	<td>文章</td>
	<td>作者</td>
	<td>版塊</td>
	<td>發表時間</td>
	<td>收藏次數</td>
	<td>回復/人氣</td>
</tr>
<!--
EOT;
$f_class='f_one';
foreach($_SORTDB as $key => $value){
$f_class = $f_class=='f_one' ? 'f_two' : 'f_one';
print <<<EOT
-->
<tr class="tr3 tac $f_class">
	<td><a href="$value[url]" target="_blank">$value[title]</a></td>
	<td><a href="{$db_userurl}{$value[addition][authorid]}" target="_blank">{$value[addition][author]}</a></td>
	<td><a href="thread.php?fid=$value[fid]" target="_blank">$value[forum]</a></td>
	<td>$value[posttime]</td>
	<td>$value[value]</td>
	<td>{$value[addition][replies]}/{$value[addition][hits]}</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
<tr class="f_one"><td style="height:8px;" colspan="16"></td></tr>
</table></div>
<!--
EOT;
}elseif($action=='admin'){ print <<<EOT
-->
<div class="mb10 cc tar">
	<form action="$baseurl&" method="post">
	<input type="hidden" name="step" value="2">
	搜索︰<select name="postStartDate" class="input mr5" > 
			<option value="">請選擇時間</option>
<!--
EOT;
foreach($dateSelect as $key=>$value){
$startSelected = ($key == $startDate) ? 'selected="selected"' : '';
print <<<EOT
-->
			<option value="$value" $startSelected >$value</option>
<!--
EOT;
}print <<<EOT
-->
		</select>
	<span class="mr5">至</span>
	<select name="postEndDate" class="input mr5" > 
		<option value="">請選擇時間</option>
<!--
EOT;
foreach($dateSelect as $key=>$value){
$endSelected = ($key == $endDate) ? 'selected="selected"' : '';
print <<<EOT
-->
<option value="$value" $endSelected >$value</option>
<!--
EOT;
}print <<<EOT
-->
	</select><input name="adminName" value="$adminName" type="text" size="28" class="input mr5" /><span class="bt2"><span><button type="submit">提 交</button></span></span>
	</form>
</div>
<div class="t">
<table width="100%" cellspacing="0" cellpadding="0" style="table-layout:fixed;">
<tr class="tr2">
	<td width="80" style="padding-left:10px;">用戶名</td>
	<td width="100"><a href="$baseurl$urlAdd" class="link_down"><span>系統頭餃</span></a></td>
	<td class="tac"><a href="$baseurl&type=highlight$urlAdd" $sort_a[highlight]><span>加亮</span></a></td>
	<td class="tac"><a href="$baseurl&type=delete$urlAdd" $sort_a[delete]><span>刪除</span></a></td>
	<td class="tac"><a href="$baseurl&type=credit$urlAdd" $sort_a[credit]><span>評分</span></a></td>
	<td class="tac"><a href="$baseurl&type=topped$urlAdd" {$sort_a[topped]}><span>置頂</span></a></td>
	<td class="tac"><a href="$baseurl&type=edit$urlAdd" {$sort_a[edit]}><span>編輯</span></a></td>
	<td class="tac"><a href="$baseurl&type=digest$urlAdd" {$sort_a[digest]}><span>精華</span></a></td>
	<td class="tac"><a href="$baseurl&type=copy$urlAdd" {$sort_a[copy]}><span>復制</span></a></td>
	<td class="tac"><a href="$baseurl&type=move$urlAdd" {$sort_a[move]}><span>移動</span></a></td>
    <td class="tac"><a href="$baseurl&type=down$urlAdd" {$sort_a[down]}><span>壓帖</span></a></td>
    <td class="tac"><a href="$baseurl&type=banuser$urlAdd" {$sort_a[banuser]}><span>禁言</span></a></td>
	<td class="tac"><a href="$baseurl&type=locked$urlAdd" {$sort_a[locked]}><span>鎖定</span></a></td>
	<td class="tac"><a href="$baseurl&type=push$urlAdd" {$sort_a[push]}><span>提前</span></a></td>
	<td class="tac"><a href="$baseurl&type=unite$urlAdd" {$sort_a[unite]}><span>合並</span></a></td>
	<td class="tac"><a href="$baseurl&type=shield$urlAdd" {$sort_a[shield]}><span>屏蔽</span></a></td>
	<td class="tac"><a href="$baseurl&type=remind$urlAdd" {$sort_a[remind]}><span>提醒</span></a></td>
    <td class="tac" width="60"><a href="$baseurl&type=recycle$urlAdd" {$sort_a[recycle]}><span>還原帖子</span></a></td>
    <td class="tac" width="60"><a href="$baseurl&type=deluser$urlAdd" {$sort_a[deluser]}><span>刪除用戶</span></a></td>
	<td class="tac" width="60"><a href="$baseurl&type=total$urlAdd" {$sort_a[total]}><span>總計</span></a></td>
</tr>
<!--
EOT;
$f_class='f_one';
foreach($admindb as $key => $admin){
$f_class=$f_class=='f_one' ? 'f_one' : 'f_two';
$highlight = $admin[highlight] ? $admin[highlight] : 0;
$delete = $admin[delete] ? $admin[delete] : 0;
$credit = $admin[credit] ? $admin[credit] : 0;
$topped = $admin[topped] ? $admin[topped] : 0;
$edit = $admin[edit] ? $admin[edit] : 0;
$digest = $admin[digest] ? $admin[digest] : 0;
$copy = $admin[copy] ? $admin[copy] : 0;
$move = $admin[move] ? $admin[move] : 0;
$down = $admin[down] ? $admin[down] : 0;
$banuser = $admin[banuser] ? $admin[banuser] : 0;
$locked = $admin[locked] ? $admin[locked] : 0;
$push = $admin[push] ? $admin[push] : 0;
$unite = $admin[unite] ? $admin[unite] : 0;
$shield = $admin[shield] ? $admin[shield] : 0;
$remind = $admin[remind] ? $admin[remind] : 0;
$recycle = $admin[recycle] ? $admin[recycle] : 0;
$deluser = $admin[deluser] ? $admin[deluser] : 0;
$total = $admin[total] ? $admin[total] : 0;
print <<<EOT
-->
<tr class="tr3 $f_class">
	<td style="padding-left:10px;"><a href="{$db_userurl}$admin[uid]" target="_blank">$key</a></td>
	<td>{$ltitle[$admin[gid]]}</td>
	<td class="tac">$highlight</td>
	<td class="tac">$delete</td>
	<td class="tac">$credit</td>
	<td class="tac">$topped</td>
	<td class="tac">$edit</td>
	<td class="tac">$digest</td>
	<td class="tac">$copy</td>
	<td class="tac">$move</td>
    <td class="tac">$down</td>
    <td class="tac">$banuser</td>
	<td class="tac">$locked</td>
	<td class="tac">$push</td>
	<td class="tac">$unite</td>
	<td class="tac">$shield</td>
	<td class="tac">$remind</td>
    <td class="tac">$recycle</td>
    <td class="tac">$deluser</td>
	<td class="tac">$total</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table></div>
<!--
EOT;
} else{print <<<EOT
-->
<div class="t">
<table width="100%" align="center" cellspacing="0" cellpadding="3">
<tr>
<!--
EOT;
$cid=0;
foreach($_SORTDB as $key=>$_SORT){
$type=!is_numeric($key) ? getLangInfo('other','sort_'.$key) : $_CREDITDB[$key][0];
$cid++;
print <<<EOT
-->
<td valign="top" width="33%">
<div class="t3" style="padding:1px;border:1px solid $tablecolor;width:98%;margin:5px auto">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
<tr class="tr2 tac"><td colspan="3"> &nbsp; {$type}排行榜</td></tr>
<!--
EOT;
$id=0;
foreach($_SORT as $id=>$sort){
$id++;
$class=$id%2==0 ? "f_two" : "f_one";
print <<<EOT
-->
<tr class="tr3 $class">
<td style="width:30px;" class="tac s6">$id</td>
<td>
<p class="lh_18"><a href="$show_url=$sort[0]" target="_blank" class="s4">$sort[1]</a></p>
</td>
<!--
EOT;
if($key!='digest'){print <<<EOT
-->
<td style="width:70px;" class="tac">$sort[2]</td>
<!--
EOT;
}print <<<EOT
-->
</tr>
<!--
EOT;
}if($id<$cachenum){
for($i=$id;$i<$cachenum;$i++){
$id++;
$class=$id%2==0 ? "f_two" : "f_one";
print <<<EOT
-->
<tr class="tr3 $class">
<td class="tac s6">$id</td>
<td></td>
<!--
EOT;
if($key!='digest'){print <<<EOT
-->
<td></td>
<!--
EOT;
}print <<<EOT
-->
</tr>
<!--
EOT;
}}print <<<EOT
-->
</table></div></td>
<!--
EOT;
if($cid%3==0){print <<<EOT
-->
</tr><tr>
<!--
EOT;
}}print <<<EOT
-->
</table></div>
<!--
EOT;
}print <<<EOT
-->
</div>
</div>
<!--
EOT;
?>-->
