<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?><!--<?php
function filtercodeforjs($code)
{
	return str_replace(array("'", '"', "\r", "\n"), array("\'", '\"', '', ''), $code);
}
$stats = filtercodeforjs($stats);
$startime = filtercodeforjs($startime);
$lastimebk = filtercodeforjs($lastimebk);
$browser0 = filtercodeforjs($browser0);
$browser1 = filtercodeforjs($browser1);
$actCome = filtercodeforjs($actCome);
$ip = filtercodeforjs($ip);
print <<<EOT
-->
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset={$charset}">
		<title>{$fsetting['forumname']} - {$lang['tpl.title']}</title>
		<script language="javascript" type="text/javascript">
		var template=new Array();
		var piclist=new Array();
		var Strings=new Array();
		var mainsetting=new Array();
		var Selectlist;
		var page=1;
		var PageSize=60
		var myid=0
		var Count
		var nowbodarid=0
		var pageCount=0
		var username=''
		var parentDIV=parent.document.getElementById("onlinetr")
		var parentshow=parent.document.getElementById("showstr")
		var master=0
		function reshow(boardid)
		{      
			if(parentDIV.style.display=='none')
			{
				parentDIV.style.display='block';
				parentDIV.innerHTML='<span style="width:240px;margin-left:18px;border:1px solid black;background-color:lightyellow;color:black;padding:2px">{$lang['tpl.str1']}</span>'
				parentshow.innerHTML='<a href="online.php?action=0&boardid='+boardid+'" target="hiddenframe">'+Strings[1]+'</a>';
			}
			else
			{
				parentDIV.style.display='none';	
				parentshow.innerHTML='<a href="online.php?action=1&boardid='+boardid+'" target="hiddenframe">'+Strings[2]+'</a>';
				parentDIV.innerHTML=''
			}
		}
		function showonlist(str)
		{
			var parentstr='<table width="100%" border="0" cellspacing="0" cellpadding="0">'
			var tmpstr=''
			var addlist=Selectlist.split(",")
			var aa=6
			var tmpcount=new Array();
			tmpcount[0]=0
			tmpcount[1]=0
			tmpcount[2]=0
			tmpcount[3]=0
			tmpcount[4]=0
			tmpcount[5]=0
			if(addlist.length>0)
			{
				if(Selectlist.indexOf("stats",1)!=-1){tmpstr+=Strings[5]+'{\$stats}<br>';tmpcount[0]=aa;aa++}
				if(Selectlist.indexOf("startime",1)!=-1){tmpstr+=Strings[6]+'{\$startime}<br>';tmpcount[1]=aa;aa++}
				if(Selectlist.indexOf("lastimebk",1)!=-1){tmpstr+=Strings[7]+'{\$lastimebk}<br>';tmpcount[2]=aa;aa++}
				if(Selectlist.indexOf("browser",1)!=-1){
					tmpstr+=Strings[8]+'{\$browser0}<br>'
					tmpstr+=Strings[9]+'{\$browser1}<br>'
					tmpcount[3]=aa;aa++
				}
				if(Selectlist.indexOf("actCome",1)!=-1){tmpstr+=Strings[11]+'{\$actCome}<br>';tmpcount[5]=aa;aa++}
				if(Selectlist.indexOf("ip",1)!=-1){tmpstr+=Strings[10]+'{\$ip}<br>';tmpcount[4]=aa;aa++}
					
				
			}
			var k=0
			str=str.split("%#!&")
			for (i=0;i<str.length-1;i++)
			{
				k++
				if (k==1)(parentstr+='<tr>')
				str[i]=str[i].split("^&%&")
				var showstring=tmpstr
				if(tmpcount[0]!=0){showstring=showstring.replace(/{\\\$stats}/gi,str[i][tmpcount[0]]);}
				if(tmpcount[1]!=0){showstring=showstring.replace(/{\\\$startime}/gi,str[i][tmpcount[1]]);}
				if(tmpcount[2]!=0){showstring=showstring.replace(/{\\\$lastimebk}/gi,str[i][tmpcount[2]]);}
				if(tmpcount[3]!=0){
				str[i][tmpcount[3]]=str[i][tmpcount[3]].split("|")
				showstring=showstring.replace(/{\\\$browser0}/gi,str[i][tmpcount[3]][0]);
				showstring=showstring.replace(/{\\\$browser1}/gi,str[i][tmpcount[3]][1]);
				}
				if(tmpcount[5]!=0){showstring=showstring.replace(/{\\\$actCome}/gi,str[i][tmpcount[5]]);}
				
				if(tmpcount[4]!=0){showstring=showstring.replace(/{\\\$ip}/gi,str[i][tmpcount[4]]);}
				if ((username!=''&&(str[i][4])!=0&&str[i][3]=='2')||(master==1&&(str[i][4])!=0))
				{
					showstring+='<a href=dispuser.php?name='+str[i][1]+' target=_blank ><b>[</b>{$lang['tpl.str2']}<b>]</b></a>&nbsp;&nbsp;<a href=messanger.php?action=new&touser='+str[i][1]+' target=_blank ><b>[</b>{$lang['tpl.str3']}<b>]</b></a>'
				}
				showstring = "<div class=menuitems>"+showstring+"<\/div>";
				if (((myid)==(str[i][0]) && username=='')||((myid)==0 && username==str[i][1]))
				{
					parentstr+='<td width="14%" colspan="+k+">&nbsp;'+showonline_face((str[i][2]),str[i][5],str[i][3])+'<a  title="{$lang['tpl.str4']}" ><font color="#0000ff">'+str[i][1]+'</font></a></td>'
				}
				else
				{
					if (master==1)
					{	
						parentstr+='<td width="14%" colspan="+k+" >&nbsp;'+showonline_face((str[i][2]),str[i][5],str[i][3])+'<a onmouseover="menushow(event,\''+showstring+'\',0);" onmouseout="delayhidemenu()" class="navlink" style="CURSOR:hand" >'+str[i][1]+'</a></td>'
					}
					else
					{
						if(str[i][3]=='1')
						{parentstr+='<td width="14%" colspan="+k+" >&nbsp;'+showonline_face((str[i][2]),str[i][5],str[i][3])+'<a onmouseover="menushow(event,\''+showstring+'\',0);" onmouseout="delayhidemenu()" class="navlink" style="CURSOR:hand" >'+Strings[3]+'</a></td>'}
						else
						{
							parentstr+='<td width="14%" colspan="+k+" >&nbsp;'+showonline_face((str[i][2]),str[i][5],str[i][3])+'<a onmouseover="menushow(event,\''+showstring+'\',0);" onmouseout="delayhidemenu()" class="navlink" style="CURSOR:hand" >'+str[i][1]+'</a></td>'
						}
						
					}
					
				}
				if(k==6)
				{
					k=0
					parentstr+='</tr>'
				}
			}
			if (k!=0)
			{
				for(i=0;i<6-k;i++)
				{
					parentstr+='<td width="14%" colspan="+(k+i)+">&nbsp;&nbsp;</td>'
				}
				parentstr+='</tr>'
			}
			parentstr+='</table>'
			if (Count>PageSize)	
			{
				parentstr+='<table width="100%" border="0" cellspacing="0" cellpadding="0" >'
				parentstr+='<tr><td><hr size=1 color=#6595D6 >'
				parentstr+='<tr><td>&nbsp;&nbsp;{$lang['tpl.str5']} '+Count+' {$lang['tpl.str6']} '+PageSize+' {$lang['tpl.str7']} '+pageCount+' {$lang['tpl.str8']} '+page+' {$lang['tpl.str9']}'
				if (page!=1)
				{
					parentstr+='<a href="online.php?action=3&boardid='+nowbodarid+'&page=1" target="hiddenframe" >{$lang['tpl.str10']}</a> '
				}
				if (page>2)
				{
					parentstr+='<a href="online.php?action=3&boardid='+nowbodarid+'&page='+(page-1)+'" target="hiddenframe" >{$lang['tpl.str11']}</a> '
				}
				if (page<(pageCount-1))
				{
					parentstr+='<a href="online.php?action=3&boardid='+nowbodarid+'&page='+(page+1)+'" target="hiddenframe" >{$lang['tpl.str12']}</a> '
				}
				if(page!=pageCount)
				{
					parentstr+='<a href="online.php?action=3&boardid='+nowbodarid+'&page='+pageCount+'" target="hiddenframe" >{$lang['tpl.str13']}</a> '
				}
				parentstr+='</td></tr>'
				parentstr+='</table>'
			}
			parentDIV.innerHTML='';
			parentDIV.innerHTML=parentstr;
		}
		function showonline_face(GroupID,Group,hideen)
		{
			
			if (hideen=='1')
			{
				Group=Strings[3]
				return('<img src="'+piclist[4]+'" alt="'+Group+'">&nbsp;&nbsp;')
			}
			else
			{
				
				return('<img src="'+piclist[GroupID]+'" alt="'+Group+'">&nbsp;&nbsp;')
				
			}
		}
		</script>
	</head>
	<body>
<!--
EOT;
$TPL_jscode = '';
$grpsettings =& getGroupSettings();
if (!empty($grpsettings) AND is_array($grpsettings)) {
	$tab = '';
	foreach ($grpsettings AS $currusergroupid => $grouparray) {//取出用户组图标数据
		$imgurl = filtercodeforjs($imgurl);
		$grouparray['titlepic'] = filtercodeforjs($grouparray['titlepic']);
		$TPL_jscode .= "{$tab}piclist[{$currusergroupid}] = '{$imgurl}{$grouparray['titlepic']}';\r\n";
		$tab = "\t\t";
	}
}
if (!empty($lang['tpl.strings']) AND is_array($lang['tpl.strings'])) {
	$tab = "\t\t";
	foreach ($lang['tpl.strings'] AS $val) {//传送字符串变量到JS
		$val = filtercodeforjs($val);
		$TPL_jscode .= "{$tab}Strings[Strings.length] = '{$val}';\r\n";
	}
}
if ($action != 3) {
	$tab = "\t\t";
	$TPL_jscode .= "{$tab}reshow({$boardid});\r\n";
}
if ($action == 1 OR $action == 3) {
	$tab = "\t\t";
	$TPL_jscode .= "{$tab}nowbodarid = {$boardid};\r\n";
	if ($userid != 0) {
		$membername = filtercodeforjs($membername);
		$TPL_jscode .= "{$tab}username = '{$membername}';\r\n";
	} else {
		$TPL_jscode .= "{$tab}myid = '{$userinfo['statuserid']}';\r\n";
	}
	if ($mster === true) {
		$TPL_jscode .= "{$tab}var master=1;\r\n";
	}
	$onlinelist =& getOnlineList();
	if (!empty($onlinelist['ResultSet']) AND is_array($onlinelist['ResultSet'])) {
			$TPL_jscode .= "{$tab}Count = {$onlinelist['RecordCount']};\r\n";
			$TPL_jscode .= "{$tab}pageCount = {$onlinelist['PageCount']};\r\n";
			$TPL_jscode .= "{$tab}PageSize = {$onlinelist['PageSize']};\r\n";
			$TPL_jscode .= "{$tab}page = {$onlinelist['AbsolutePage']};\r\n";
			$tmpdata = '';
			foreach ($onlinelist['ResultSet'] AS $val) {
				foreach ($val AS $fldval) {
					$tmpdata .= "{$fldval}^&%&";
				}
				$tmpdata .= "%#!&";
			}
	}
	$tmpdata = str_replace(array('\\', "'", "\r", "\n"), array('\\\\', "\\'", "\n", "\n"), iHtmlencode($tmpdata));
	$tmpdata = filtercodeforjs($tmpdata);
	$onlinelist['fldlist'] = filtercodeforjs($onlinelist['fldlist']);
	$TPL_jscode .= "{$tab}Selectlist = '{$onlinelist['fldlist']}';\r\n";
	$TPL_jscode .= "{$tab}showonlist('{$tmpdata}');\r\n";
}
print <<<EOT
-->
		<script language="javascript" type="text/javascript">
		{$TPL_jscode}
		</script>
	</body>
</html>
<!--
EOT;
?>-->