<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
global $imgurl,$ForumUrl;
?>
<table cellpadding=2 cellspacing=0 align=center class="mainbox tableborder">
<tr>
<td width="200"  valign="top" class="tablebody2">
<table cellpadding=0 cellspacing=0  class="mainbox tableborder">
<tr>
<th align=center height=20><?=$lang['tmp.info1']?></th>
</tr>
<?
require_once INC_PATH.'DV_Encoding.class.php';
$objEnc = DV_Encoding::GetEncoding($GLOBALS['charset']);
if(!empty($forumshowcache['forumshow_cache_1'])){
	if(is_array($forumshowcache['forumshow_cache_1'])){
		foreach($forumshowcache['forumshow_cache_1'] as $hot_vol){
			$dian1=($objEnc->StrLength($hot_vol['freadme'])>12)? '...':'';
			$title=htmlspecialchars($objEnc->SubString($hot_vol['freadme'],0,12));
?>
<!--show.php##热门排行循环部分-->
<tr><td valign=top class="tablebody5">
<font face=Webdings>4</font><a href="fileshow.php?boardid=<?=$hot_vol['fboardid']?>&id=<?=$hot_vol['fid']?>" target="_blank" title="<?=$lang['tmp.info2']?><?=$hot_vol['freadme']?>">
<? echo $title.$dian1 ?>
</a></td>
</tr>
<?
		}
	}
}
?>
</table>
<br>
<table cellpadding=0 cellspacing=0  class="mainbox tableborder">
<tr>
<th height=20 align=center><?=$lang['tmp.info3']?></th>
</tr>
<?
if(!empty($forumshowcache['forumshow_cache_2'])){
	if(is_array($forumshowcache['forumshow_cache_2'])){
		foreach($forumshowcache['forumshow_cache_2'] as $new_vol){
			$dian2=($objEnc->StrLength($new_vol['freadme'])>12)? '...':'';
			$title=htmlspecialchars($objEnc->SubString($new_vol['freadme'],0,12));				
?>
<!--show.php##热门排行循环部分-->
<tr><td valign=top class=tablebody5>
<font face=Webdings>4</font><a href="fileshow.php?boardid=<?=$new_vol['fboardid']?>&id=<?=$new_vol['fid']?>"  target="_blank" title="<?=$lang['tmp.info2']?>">
<? echo $title.$dian2?>
</a></td>
</tr>
<?
		}
	}
}
?>
</table>
</td>
<td width="*" valign="top" align="right">
<table cellpadding=0 cellspacing=0 border="0" width="100%">
<form method="POST" action="?" name="showform">
<tr><td align=right style="border:none;" width="*">
<? echo $userinfo ?>
</td>
<td align="right" style="border:none;">
<SELECT NAME="boardid" ID="boardid" onchange="javascript:submit();">
<?
print boardjumplist($boardid,$lang['tmp.info4']);
?>
</SELECT>
<input type="text" name="username" size="20" value="<?=$username?>">&nbsp;<button onMousemove="button_move(this)" onMouseout="button_out(this)"  type="submit" name="Submit"><?=$lang['tmp.info5']?></button>
</td> 
<td  width="50" align="right" style="border:none;"> 
<select name="filetype" onchange="javascript:submit()">
<option value=""><?=$lang['tmp.info6']?></option>
<option value="0" <?if(intval($filetype)===0) echo "selected"?>><?=$lang['tmp.info7']?></option>
 <option value="1" <?if(intval($filetype)==1) echo "selected"?>><?=$lang['tmp.info8']?></option>
 <option value="2" <?if(intval($filetype)==2) echo "selected"?>><?=$lang['tmp.info9']?></option>
 <option value="3" <?if(intval($filetype)==3) echo "selected"?>><?=$lang['tmp.info10']?></option>
  <option value="4" <?if(intval($filetype)==4) echo "selected"?>><?=$lang['tmp.info11']?></option>
</select></td>
<td width=10 style="border:none;">
<select name="tab" onchange='javascript:submit()'>
<option value="" ><?=$lang['tmp.info12']?></option>
 <option value="2" ><?=$lang['tmp.info13']?></option>
 <option value="3" ><?=$lang['tmp.info14']?></option>
 <option value="4" ><?=$lang['tmp.info15']?></option>
</select>
</td>
</tr>
</form>
</table>
<table cellpadding="0" cellspacing="0" border="0" class="mainbox tableborder">
<tr>
<table width="100%">
<tr>
<?
	$j=1;
	$alertcolor=$lang['Dvbbs.mainsetting1'];
	$limitednum=12;
	if(empty($pagelistnum)){
?>
		<!--show.php##展区内容为空-->
		<td height="26" class="tablebody2 table_noright" align="center">
			<font color="<?=$alertcolor?>"><? echo $lang['Error.information']?></font>
		</td>
<?
	}
	else{
		if(is_array($file_list)){
			foreach($file_list as $file_vol){
				//管理员，版主，超级管理员，用户自己;
				if($vipuser or $boardmaster or $superboardmaster or $master){
					$useraction="<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td valign=top align=left><a href=myfile.php?action=edit&editid=".$file_vol['f_id']." title=".$lang['tpl.str1']."><img src=".str_filter_xss($imgurl)."editfile.gif border=0 width=10 height=10></a>&nbsp;<a href=myfile.php?action=fdel&delid=".$file_vol['f_id']." title=\"".$lang['tpl.str2']."\"><img src=".str_filter_xss($imgurl)."delete.gif border=0 width=10 height=10></a></td><td valign=top align=right><a href=fileshow.php?action=send&id=".$file_vol['f_id']."><img border=0 width=28 height=11 src=".$imgurl.$lang['template.pic1']."></a></td></tr></table>";
				}
				elseif($userid==$membername){
					$useraction="<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td valign=top align=left><a href=myfile.php?action=edit&editid=".$file_vol['f_id']." title=".$lang['tpl.str1']."><img src=".str_filter_xss($imgurl)."editfile.gif border=0 width=10 height=10></a>&nbsp;<a href=myfile.php?action=fdel&delid=".$file_vol['f_id']." title=".$lang['tpl.str2']."><img src=".str_filter_xss($imgurl)."delete.gif  border=0 width=10 height=10></a></td><td valign=top align=right><a href=fileshow.php?action=send&id=".$file_vol['f_id']."><img border=0 width=28 height=11 src=".$imgurl.$lang['template.pic1']."></a></td></tr></table>";
				}
				$fid=$file_vol['f_id'];
				$filetype=$file_vol['f_type'];
				$exp=explode("|",$file_vol['f_announceid']);
				$f_filename=explode('||',$lang['dvbbs.lanstr5']);
				if(strpos($file_vol['f_filename'],'//')!==false or strpos($file_vol['f_filename'],':')!==false){//判断是不是本论坛的信息;
					$showfile="<img border=0 width=100 height=100 src=".$file_vol['f_filename'].">";
				}
				else{
					switch ($file_vol['f_type']){
						case 0:
							$typename=$f_filename[0];
							switch ($file_vol['f_filetype']){
								case 'zip_':
									$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic5'].">".$typename;
									break;
								case 'rar_':
									$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic3'].">".$typename;
									break;
								case 'txt_':
									$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic6'].">".$typename;
									break;
							}
							$typenum=$file_vol['f_downnum'];
							break;
						case 1:
							$typename=$f_filename[1];
							$pic_url=($file_vol['f_viewname']!='')? $file_vol['f_viewname']:$file_vol['f_filename'];
							$nextdir=$_SERVER["SCRIPT_NAME"];
							$nextdir=explode("/",$nextdir);
							if($nextdir[1]!=''){
								$next_dir=(strpos($nextdir[1],'php')===false)? $nextdir[1]."/":'';
							}
							$getimagesize_info=@getimagesize($ForumUrl.$next_dir.$upload_url.$pic_url);
							$picwidth=(intval($getimagesize_info[0])>120 || intval($getimagesize_info[0])==0)? 100:intval($getimagesize_info[0]);
							$picheight=(intval($getimagesize_info[1])>100 || intval($getimagesize_info[1])==0)? 100:$getimagesize_info[1];
							$showfile="<img border=0 src=".$upload_url.$file_vol['f_filename']." width=".$picwidth." height=".$picheight.">";
							$typenum=$file_vol['f_viewnum'].'';
							break;
						case 2:
							$typename=$f_filename[2];
							$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic7'].">".$typename;	
							$typenum=$file_vol['f_downnum'];
							break;
						case 3:
							$typename=$f_filename[3];
							$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic8'].">".$typename;
							$typenum=$file_vol['f_downnum'];
							break;
						case 4:
							$typename=$f_filename[4];
							$showfile="<img border=0 src=".$lang['template.pic2']."><br><img border=0 src=".$lang['template.pic9'].">".$typename;
							$typenum=$file_vol['f_downnum'];
							break;
					}
				}
				$filereadme=$file_vol['f_readme'];	
				if(strpos($file_vol['f_announceid'],'|')!==false){
					$idarr=explode('|',$file_vol['f_announceid']);
					$linkfid=$idarr[0];
				}
				else{
					$linkfid=$file_vol['f_announceid'];
				}
				$golist="<a href=dispbbs.php?boardid=".$file_vol['f_boardid']."&id=".$linkfid."&page=1 >".$lang['template2']."</a>";
				if(empty($typenum)){
					$typenum='0';
				}
				if($tab==2){$f_viewme=mb_substrs($filereadme,0,36);$f_width="50%";}
				if($tab==3){$f_viewme=mb_substrs($filereadme,0,28);$f_width="33.3%";}
				if($tab==4){$f_viewme=mb_substrs($filereadme,0,20);$f_width="25%";}
				$f_viewme=($objEnc->StrLength($f_viewme)>12)? mb_substrs($f_viewme,0,12).'...':$f_viewme;

?>
<!--show.php##展区内容循环部分-->
<td height="200" align="center" width="<?=$f_width?>" style="border:none;">
	<table width="100%" cellpadding="0" cellspacing="0" class="mainbox tableborder">
		<tr>
			<td height="130" align="center" valign="top">
				<? echo $useraction ?>
				<br><a href="fileshow.php?boardid=<?=$boardid?>&id=<?=$fid?>" target="_blank" title="<?=$lang['tpl.str3']?>"><?=$showfile ?></a><br>
			</td>
		</tr>
		<tr>
			<td align="left"><?=$lang['tmp.info16']?><a href="dispuser.php?name=<?=$file_vol['f_username']?>"><?=$file_vol['f_username']?></a>
				<br><?=$lang['tmp.info17']?><a href="show.php?filetype=<?=$filetype?>"><?=$typename?> [<font color="<?=$alertcolor?>"><?=$typenum?></font>]</a><br><?=$lang['tmp.info18']?><?=$f_viewme?><br><?=$golist?>
			</td>
		</tr>
	</table>
</td>
<?
	if($j%$tab==0){
		echo $lang['page.tr'];
	}
	$j+=1;
			}
		}
	}
?>
</tr></table>
<BR>
<!--show.php##分页部分JS-->
<SCRIPT LANGUAGE="JavaScript">
	var Pcount=<?=$Pcount?>;
	var star=<?=$star?>;
	document.write ('<table cellpadding=0 cellspacing=0 border=0 style="border:none;width:100%;" align=left ><form method=post action=""?boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?>>');
	document.write ('<tr><td align="left" style="border:none;" valign=middle><?=$lang['tmp.info19']?><b><?=$pagelistnum?></b><?=$lang['tmp.info20']?><?=$limitednum?><?=$lang['tmp.info21']?><b><font color=red>'+Pcount+'</font></b><?=$lang['tmp.info22']?>');
	document.write ('</td><td style="border:none;" align=left>');
	if (star!='1')
	{
		document.write ('<a href="?star='+((star*1)-1)+'&boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?>" ><?=$lang['tmp.info23']?></A> ');
	}
	else
	{
		document.write ('<font color=#996633><?=$lang['tmp.info23']?></font>');
		
	}
	document.write (' <a href="?star='+((star*1)+1)+'&boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?> "><?=$lang['tmp.info24']?></a>');
	document.write ('</td><td  style="border:none;" align=Right>');
	var vendpage;
	if ((star*1)>4)
	{
		document.write (' <a href="?star=1&boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?>">[1]</a> ...');
	}
	if ((Pcount*1)>(star*1)+3)
	{
		vendpage=(star*1)+3
	}
	else
	{
		vendpage=(Pcount*1)
	}
	for (vv=star*1-3;vv <vendpage+1;vv++ )
	{
		if (vv>0)
		{
			if (vv==star*1)
			{
				document.write ('&nbsp;<font color=red>['+vv+']</font>&nbsp;');
			}
			else
			{
				document.write (' <a href="?star='+vv+'&boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?>">['+vv+']</a>');
			}		
		}			
	}
	if (((star*1)+3)<(Pcount*1))
	{
		document.write ('... <a href="?star='+Pcount+'&boardid=<?=$boardid?>&filetype=<?=$filetype?>&username=<?=$username?>&tab=<?=$tab?>">['+Pcount+']</a>&nbsp;');
	}
	document.write ('&nbsp;&nbsp;<?=$lang['tmp.info25']?>&nbsp;<input type=text name=star size=3 maxlength=10  value="'+star+'"><button onMousemove="button_move(this)" onMouseout="button_out(this)" type="submit" name="button1">Go</button>');
	document.write ('</td></tr></form></table>');
</SCRIPT>
</td></tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
function ChkSelected(Obj,Val)
{
	if (Obj)
	{
	for (i=0;i<Obj.length;i++){
		if (Obj.options[i].value==Val){
		Obj.options[i].selected=true;
		break;
		}
	}
	}
}
<!--
ChkSelected(showform.filetype,'<?=$filetype?>');
ChkSelected(showform.tab,<?=$tab?>);
-->
</SCRIPT>
