<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?>
<table cellpadding=0 cellspacing=0 align="center" class="mainbox tableborder">
	<tr align="center">
		<th width="16%"><a href="?boardid=<?=$boardid?>"><?=$lang['tpl.str1']?></a></th>
		<th width="16%"><a href="?action=lasttopicnum&amp;boardid=<?=$boardid?>"><?=$lang['tpl.str2']?></a></th>
		<th width="16%"><a href="?action=lastbbsnum&amp;boardid=<?=$boardid?>"><?=$lang['tpl.str3']?></a></th>
		<th width="16%"><a href="?action=online&amp;boardid=<?=$boardid?>"><?=$lang['tpl.str4']?></a></th>
		<th width="16%"><a href="?action=onlineinfo&amp;boardid=<?=$boardid?>"><?=$lang['tpl.str5']?></a></th>
		<th width="17%"><a href="?action=onlineUserinfo&amp;boardid=<?=$boardid?>"><?=$lang['tpl.str6']?></a></th></tr>
		<tr><td align="center" colSpan="6" height="20">
		<?=$statobj->boardinfolist?>
		</td>
	</tr>
</table>
<br>
 <table cellpadding=0 cellspacing=0 align=center class="mainbox tableborder">
<?
if($action=="onlineinfo"){  //在线情况
?>
  <tr align=center>
    <th width="5%"><?=$lang['tpl.str7']?></th>
    <th width="13%"><?=$lang['tpl.str8']?></th>
    <th width="35%"><?=$lang['tpl.str9']?></th>
    <th width="20%"><?=$lang['tpl.str10']?></th>
    <th width="12%"><?=$lang['tpl.str11']?></th>
    <th width="20%"><?=$lang['tpl.str12']?></th>
  </tr>
<?
	if(!empty($oninfo_list)){
		if(is_array($oninfo_list)){
			foreach($oninfo_list as $in_list){
				$titlepic=$statobj->get_titlepic($in_list['titlepic']);
				$onlinename=($in_list['userhidden']==1)? '<a href="dispuser.php?name='.$in_list['username'].'" target=_blank>'.$in_list['username'].'</a>':$in_list['username'];
				$onlinestat=$in_list['stats'];
				$sys_info=explode('|',$in_list['browser']);
				$ie=substr($sys_info[1],-3);
				$onlinesys=$sys_info[0];
				$onlineip=($groupsetting[30]==1)? '<a href="topicother.php?t=1&action=lookip&ip='.$in_list['ip'].'">'.$in_list['ip'].'</a>':$lang['template.strings15'];		
				$s_h=substr(gmdate('Y-m-d H:i:s', $in_list['startime']+getUserTimeZoneOffset()),11,2);//在线时间
				$l_h=substr(gmdate('Y-m-d H:i:s', $in_list['lastimebk']+getUserTimeZoneOffset()),11,2);
				$s_m=substr(gmdate('Y-m-d H:i:s', $in_list['startime']+getUserTimeZoneOffset()),14,2);
				$l_m=substr(gmdate('Y-m-d H:i:s', $in_list['lastimebk']+getUserTimeZoneOffset()),14,2);	
				$view_h=($l_h-$s_h>0)? $l_h-$s_h.'<font class=redfont>h:</font>':$view_h='';				
				$view_m=$l_m-$s_m;
				$d_h=gmdate('H');//不活动时间;
				$d_m=gmdate('i');
				$no_action_h=($d_h-$l_h>0)? $d_h-$l_h.'<font class=redfont>h:</font>':$no_action_h='';
				$on_action_m=$d_m-$l_m;
				$onlinetime=$view_h.$view_m.'<font class=redfont>m</font>&nbsp;|&nbsp;'.$no_action_h.$on_action_m.'<font class=redfont>m</font>';
	
?>
			  <tr>
				<td height="25" align="middle"><?=$maslink1?><img border=0 src="<?=$titlepic?>"><?=$maslink2?></td>
				<td  align="middle"><?=$onlinename?></td>
				<td  align="middle"><?=$onlinestat?></td>
				<td  align="middle"><?=$onlinesys?></td>
				<td  align="middle"><?=$onlineip?></td>
				<td align="middle"><?=$onlinetime?></td>
			  </tr>
<?
			}
		}
	}
?>
<tr><td valign="middle" colspan=6>
</td></tr>
<?
}elseif($action=="onlineUserinfo"){ //用户组在线图例
?>
  <tr>
    <th width="20%"><?=$Stattitle1?></th>
    <th width="70%"><?=$Stattitle2?></th>
    <th width="10%"><?=$Stattitle3?></th>
  </tr>
<?
global $allonline;
$allonline=str_replace($lang['tpl.str25'],'',str_replace($lang['tpl.str26'],'',$statobj->boardinfolist));
$allonline=str_replace('<b>','',str_replace('</b>','',$allonline));
settype($allonline, "integer");   
$allonline=(int) $allonline;
global $usergroupid;
	if(!empty($user_list)){//计算用户组在线人数;
		if(is_array($user_list)){
			foreach( $user_list as $u_arr ){
				$boardtype=$statobj->get_boardtype($u_arr['parentgid']).' >> '.'-'.$u_arr['usertitle'];
				$selboard=($usergroupid==$u_arr['usergroupid'])? $selboard=5:$selboard=6;
				$statnum=$u_arr['id_num'];
				$statwidth=ceil(intval($statnum/$allonline*100));
				$u_pic_num=rand(12, 21);
				$statpic=$lang['template.pic'.$u_pic_num];

?>
  <tr>
    <td height="25" align="middle" ><?=$boardtype?></td>
    <td class="tablebody<?=$selboard?>" align="left"><img height="8" src="<?=$statpic?>" width="<?=$statwidth?>"></td>
    <td align="middle"><?=$statnum?></td>
  </tr>
<?
			}
		}
	}
}else{//今日帖数图例  //主题数图例  //总帖数图例   //在线图例
?> 
  <tr>
    <th width="20%" align="center"><?=$statobj->Stattitle1?></th>
    <th width="70%" align="center"><?=$statobj->Stattitle2?></th>
    <th width="10%" align="center"><?=$statobj->Stattitle3?></th>
  </tr>
<?
global $allonline;
$allonline=str_replace($lang['tpl.str25'],'',str_replace($lang['tpl.str26'],'',$statobj->boardinfolist));
$allonline=str_replace('<b>','',str_replace('</b>','',$allonline));
settype($allonline, "integer");   
$allonline=(int) $allonline;
if(!empty($other_list)){//计算其它在线人数;
	if(is_array($other_list)){
		foreach( $other_list as $vol ){			
			$boardtype =$other_type;
			$statnum=$vol['o_num'];
			$statwidth=$statnum;
			$selboard=6;
			$pic_num=rand(12, 21);
			$statpic=$lang['template.pic'.$pic_num];
			$statwidth=ceil(intval($statnum/$allonline*100));

?>
  <tr>
    <td  height="25"  align="center"><?=$boardtype?></td>
    <td class="tablebody<?=$selboard?>" align="left"><img height="8" src="<?=$statpic?>" width="<?=$statwidth?>"><?=$userid?></td>
    <td align="center"><?=$statnum?></td>
  </tr>
<?
		}
	}
}
	$postallnum=$statobj->get_postnum($action);
	if( !empty($_infoList) ){
		if( is_array($_infoList) ){
			foreach( $_infoList as $val ){
				$boardtype ='<a href="index.php?boardid='.$val['boardid'].'">'.$val['boardtype'].'</a>';
				$statnum=$statobj->get_statnum($val['todaynum'],$val['topicnum'],$val['postnum'],$val['id_num']);
				$selboard=($board_title==$val['boardtype'])?4:6;
				$statwidth=ceil($statnum/$postallnum*100);
				$pic_num=rand(12, 21);
				$statpic=$lang['template.pic'.$pic_num];	
?>
  <tr>
    <td  height="25"  align="center"><?=$boardtype?></td>
    <td  align="left"><img height="8" src="<?=$statpic?>" width="<?=$statwidth?>"></td>
    <td align="center" style="border-right:none;"><?=$statnum?></td>
  </tr>
<?
				}
			}
		}
	}
?>
</table>
<?if($action=='onlineinfo'){//在线情况分页?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="mainbox">
  <tr>
    <td style="height:30px;">
<?
		if($statobj->total!=0){
			$p = new page;
			$p->setall($statobj->page,$statobj->total,$statobj->page_size,$lang['tpl.str23'],$lang['tpl.str24'],'100%','center','biz');
			echo $p->printpage(null,1);
		}
?>
	</td>
  </tr>
</table>
<?}?>