<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?><!--<?php print <<<EOT
-->
<Script Language=JavaScript>
function showpage(page,RecordCount,PageSize,PageCount)
{
	var Tmpstr='<div style="width:100%;height:20;">{$lang['tree.tpl.str16']}{$lang['tree.tpl.str4']}'+page+' / '+PageCount+' {$lang['tree.tpl.str5']}'
	if (page=='1')
	{
		Tmpstr+='<font face=webdings class=redfont>9</font>';
	}else{
		Tmpstr+='<a href="loadtree.php?boardid={$boardid}&id={$id}&replyid={$replyid}&skin=1&openid={$openid}&star=1" title="{$lang['tree.tpl.str6']}" target="hiddenframe"><font face=webdings>9</font></a>';
	}
	var p;
	if ((page-1)%10==0) 
	{
		p=(page-1) /10
	}
	else
	{
		p=(((page-1)-(page-1)%10)/10)
	}
	if (p*10 > 0)
	{
		Tmpstr+='<a href="loadtree.php?boardid={$boardid}&id={$id}&replyid={$replyid}&skin=1&openid={$openid}&star='+p*10+'" title="{$lang['tree.tpl.str7']}" target="hiddenframe" ><font face=webdings>7</font></a> ';
	}
	Tmpstr+='<b>';
	for (var i=p*10+1;i<p*10+11;i++)
	{
		if (i==page)
		{
			Tmpstr+=' <font class=redfont>'+i+'</font> ';
		}
		else
		{
			Tmpstr+=' <a href="loadtree.php?boardid={$boardid}&id={$id}&replyid={$replyid}&skin=1&openid={$openid}&star='+i+'" target="hiddenframe">'+i+'</a> ';
		}
		if (i==PageCount) break;
	}
	Tmpstr+='</b>';
	if (i<PageCount)
	{
		Tmpstr+='<a href="loadtree.php?boardid={$boardid}&id={$id}&replyid={$replyid}&skin=1&openid={$openid}&star='+i+'" title="{$lang['tree.tpl.str8']}" target="hiddenframe"><font face=webdings>8</font></a>   ';
	}
	if (page==PageCount)
	{
		Tmpstr+='<Font face=webdings class=redfont>:</font>';
	}
	else
	{
		Tmpstr+='<a href="loadtree.php?boardid={$boardid}&id={$id}&replyid={$replyid}&skin=1&openid={$openid}&star='+PageCount+'" title="{$lang['tree.tpl.str9']}" target="hiddenframe"><font face=webdings>:</font></a>  ';
	}
	Tmpstr+='</div>';
	return(Tmpstr)
}
var treedata='<table class="mainbox tableborder" cellspacing="0" cellpadding="0"><tr><th colspan="4"><span><a href="#top">{$lang['tree.tpl.str2']}</a></span> {$lang['tree.tpl.str1']}</th></tr>';
<!--
EOT;
while($ts = $db->fetch_array($query)) {
	$blank = '';
	for($i=1; $i<=$ts['layer']; $i++){
		$blank .= '&nbsp;';
	}
	if ( $ts['locktopic'] == 2 ){
		$ts['topic'] = $lang['tree.tpl.str10'];
	}elseif( $ts['locktopic'] == 3 ){
		$ts['topic'] = $lang['tree.tpl.str11'];
	}elseif( $ts['lockuser'] == 1 ){
		$ts['topic'] = $lang['tree.tpl.str12'];
	}elseif( $ts['lockuser'] == 2 ){
		$ts['topic'] = $lang['tree.tpl.str13'];
	}else{
		if ( $ts['topic'] == '' ){
			$ts['topic'] = cutStr(reUBBCode($ts['body']),50);
		}else{
			$ts['topic'] = cutStr($ts['topic'],50);
		}
	}
	$ts['topic'] = i_addslashes($ts['topic']);
	if ( $board_settings[58] == 1 && $ts['signflag'] == 2 ){
		if ( $boardmaster === true ){
			$ts['username'] .= "<font color=gray>{$lang['tree.tpl.str14']}</font>";
		}else{
			$ts['postuserid'] = 0;
			$ts['username'] = $lang['tree.tpl.str15'];
		}
	}
	$ts['username'] = i_addslashes($ts['username']);
	$alertcolor = '';
	if ( $ts['announceid'] == $openid ){
		$alertcolor = ' class="redfont"';
	}
	$ts['dateandtime'] = gmdate("Y-m-d H:i:s",$ts['dateandtime']+getUserTimeZoneOffset());
print <<<EOT
-->
treedata+='<tr><td class="list2">{$blank}<img src="images/topicface/{$ts['expression']}" align="absmiddle" alt="" />&nbsp;<a href="dispbbs.php?boardid={$boardid}&id={$ts['rootid']}&replyid={$ts['announceid']}&skin=1&star={$star}" {$alertcolor}>{$ts['topic']}</a></td><td class="list3"><a href="dispuser.php?id={$ts['postuserid']}" target="_blank">{$ts['username']}</a></td><td class="list4 font10"><span>{$ts['length']}</span></td><td class="list5"><a href="#" class="font10">{$ts['dateandtime']}</a></td></tr>';
<!--
EOT;
}
print <<<EOT
-->
treedata+='<tr><td class=topline colspan=4>'+showpage({$star},{$allnum},{$board_settings[61]},{$pagecount})+'</td></tr>';
treedata+='</table>';
parent.document.getElementById("postlist").innerHTML=treedata;
</script>
<!--
EOT;
?>-->