<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
if(intval($action)==1){
?>
<table cellpadding="0" cellspacing="0" align="center" class="mainbox tableborder">
<form name="theForm" method="post" action="">
<tr><th  align="center" colspan="6"><?=$lang['head.info1']?></th></tr>
<tr>
<?
if(!empty($file_list)){
	if(is_array($file_list)){
		$record_start=intval($_GET['page'])*$page_size;
		$record_end=intval($_GET['page']*$page_size);
		if($_GET['page']<=0 or $_GET['page']==1){
			$record_start=0;
			$record_end=$page_size;
		}
		if($record_start>0){$record_start-=$page_size;}
		$i=0;
		for($j=$record_start;$j<$record_end;$j++){
			if($file_list[$j]=="" or empty($file_list[$j])){break;}
?>
	<td align="center" bgcolor="#ffffff"><img src="<?=$lang['dir'].$file_list[$j]?>" border="0" onclick="insertface('<?=$lang['dir'].$file_list[$j]?>',this.width,this.height)" style="CURSOR: hand"></td>
<?
			$i+=1;
			if($i==6){
				$i=0;
				echo "</tr>";
			}
		}
	}
}
?>
<tr><td height="1" bgcolor="#0000ff"></td></tr>
<?
if($page_count>0){
	$next = $page+1;
	$pre = $page-1;
	if($next==1){$next=2;}
	if($pre==-1){$pre=0;}
	if($next>$page_count){$next=$page_count;}
	if($_GET['page']==0 or $_GET['page']==""){
		if($ten_page=="" or $ten_page==0){$page_str=1;}
		else{$page_str=$_GET['ten_page']*10-10+1;}
	}
	else{$page_str=$_GET['page'];}
	$pageinfo1=$lang['tmp.info24'].$total.$lang['tmp.info25'].$page_size.$lang['tmp.info26'];
	$pageinfo2=$lang['tmp.info27'].ceil($total/$page_size).$lang['tmp.info28']."<font color=\"#ff0000\">".$page_str."</font>/".ceil($total/$page_size)."";
	$pageinfo3=$lang['tmp.info29']."&nbsp;&nbsp;";
}
?>
  <tr>
    <td colspan="6" bgcolor="#ffffff" style="text-align:right;">
<?
	echo $pageinfo1;
?>
	</td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#ffffff" style="text-align:center;">
<?
	echo $pageinfo2;
?>
	</td>
    <td colspan="2"  bgcolor="#ffffff" style="text-align:left;"></td>
    <td colspan="2"  bgcolor="#ffffff" style="text-align:right;height:30px;">
<?
	echo $pageinfo3;
	if($page_count>10){$ten_num=ceil($page_count/10);}//page_count得到多少页;
	//进入十页开始ten_start;
	if(intval($_GET['ten_page'])==1 or $_GET['ten_page']=="" or intval($_GET['ten_page'])==0){$ten_start=1;}
	else{$ten_start=$_GET['ten_page']*10+1-10;}
	//进入十页结束ten_end;
	$ten_end=$_GET['ten_page']*10;
	if($ten_end==0 or $ten_end==""){$ten_end=10;}
	if($ten_end>$page_count){$ten_end=$page_count;}
	$pre_ten=$_GET['ten_page']-1;
	$next_ten=$_GET['ten_page']+1;
	if($next_ten>$ten_num){$next_ten=$ten_num;}
	if($ten_num>1 and $next_ten==1){$next_ten=2;}
	if($_GET['ten_page']=="" or $_GET['ten_page']==0){$_GET['ten_page']=1;}
	if($_GET['ten_page']>1){
		echo "<a href=\"?t=1&ten_page=".$pre_ten."\" title=\"".$lang['tmp.info32']."".($_GET['ten_page']*10-10)."".$lang['tmp.info33']."\"><font color=\"#990000\">[<<]</font></a>&nbsp;";
	}
	for($i=$ten_start;$i<=$ten_end;$i++){
		if($page_str==$i){$color_str="<font color=\"#ff0000\">";}
		else{$color_str="<font color=\"#0000FF\">";}
		echo "<a href=\"?t=1&ten_page=".$_GET['ten_page']."&page=".$i."\" title=\"".$lang['tmp.info32']."".$i."".$lang['tmp.info33']."\">".$color_str."[".$i."]</font></a>&nbsp;";
	}
	if($ten_end==$page_count){echo "";}
	else{echo "<a href=\"?t=1&ten_page=".$next_ten."\" title=\"".$lang['tmp.info32']."".($_GET['ten_page']*10+10)."".$lang['tmp.info33']."\"><font color=\"#990000\">[>>]</font></a>";}
?>&nbsp;&nbsp;
  </td>
  </tr>
<tr>
<td class="tablebody2" valign="middle" colspan="6" align="center">
<button type="button" class="button" name="submit" onclick="window.close();" onmousemove="button_move(this)" onmouseout="button_out(this)"><?=$lang['head.info2']?></button></td></tr>
<tr>
  </form>
</table>
<script language="javascript">
function insertface(userface,width,height){
	self.opener.theForm.myface.value=userface;
	self.opener.theForm.face.value=userface;
	self.opener.theForm.width.value=width;
	self.opener.theForm.height.value=height;
	self.opener.document.images['face'].src=userface;
	self.opener.document.images['face'].width=width;
	self.opener.document.images['face'].height=height;
}
</script>
<?
}
else{
?>

<table cellpadding="0" cellspacing="0" height="100%" class="mainbox tableborder">
<form name="the_form" method="post" action="">
<tr>
	<td>
	<table cellpadding="0" cellspacing="0" class="mainbox tableborder">
	<tr>
		<td width="100%">
		<input name="smilestar" value="1" type="hidden">
		<table class="mainbox tableborder" cellpadding="0" cellspacing="0" align="center">
			<tr>
<?
if(!empty($file_list)){
	if(is_array($file_list)){
		$record_start=intval($_GET['page'])*$page_size;
		$record_end=intval($_GET['page']*$page_size);
		if($_GET['page']<=0 or $_GET['page']==1){
			$record_start=0;
			$record_end=$page_size;
		}
		if($record_start>0){$record_start-=$page_size;}
		$i=0;
		for($j=$record_start;$j<$record_end;$j++){
			if($file_list[$j]=="" or empty($file_list[$j])){break;}
			$face_sign=explode(".",$file_list[$j]);
			$face_sign="[".$face_sign[0]."]";
?>
	<td align="center" bgcolor="#ffffff" height="80"><img src="<?=$lang['dir1'].$file_list[$j]?>" border="0" onclick="insertsmilie('<?=$face_sign?>');" style="CURSOR: hand"></td>
<?
			$i+=1;
			if($i==6){
				$i=0;
				echo "</tr>";
			}
		}
	}
}
?>
<tr><td height="1" bgcolor="#0000ff"></td></tr>
</table>
<div id=code></div>
</td>
</tr>
<tr>
	<td align="center" height="30" class="tablebody2" height=1><button type="button" onclick="window.close();" onmousemove="button_move(this)" onmouseout="button_out(this)"><?=$lang['head.info2']?></button></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<script language="javascript">
<!--
var n;
function insertsmilie(smilieface){
	if (self.opener.Dvbbs_Composition){
		self.opener.Dvbbs_Composition.document.body.innerHTML+=smilieface;
	}
	else if (self.opener.frmAnnounce.body){
		self.opener.frmAnnounce.body.value+=smilieface;
	}
}
function CloseWindow(){
	window.returnValue = null ;
	window.close() ;
}
//-->
</script>
<?
}
?>