<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_label.php");
include_once("../loginstate.php");
SystemPer('7_1');
$f=CS_Request("f");
$activepath=CS_Request("activepath");
?>
<!doctype html>
<html>
<head>
<meta charset="gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>chshdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<script type="text/javascript" src="../../public/js/jquery.js"></script>
<script type="text/javascript">
function ReturnValue(k){
	window.parent.document.form.CS_Template.value=k;
	this.parent.$('.webox').css({display:'none'});
	this.parent.$('.background').css({display:'none'});
}
</script>
</head>
<body leftmargin='0' topmargin='0'>
<table width='97%' border='0' cellpadding='0' cellspacing='1' align="center">
   <tr bgcolor='#FFFFFF'>
      <td colspan='3'>
<!-- 开始文件列表  -->
           <table width='100%' border='0' cellspacing='0' cellpadding='2'>
                <tr bgcolor="#CCCCCC">
			<td width="38%"><strong>点击名称选择文件</strong></td>
			<td width="18%"><strong>模版名称</strong></td>
			<td width="14%"><strong>文件大小</strong></td>
			<td width="30%" align="center"><strong>最后修改时间</strong></td>
                </tr>

                <tr>
			<td colspan='3' class="td_title">&nbsp;<img src=../res/images/dir2.gif border=0 width=16 height=16 align=absmiddle>当前目录: <?php echo CS_WebPath.CS_Templateurl?></td>
                </tr>
<?php
		$path = "../../".CS_Templateurl;
		if(file_exists($path) && is_dir($path))
		{
			$d = dir($path); 
			while(false !== ($v = $d->read()))
			{
				if($v == "." || $v == "..")
				{
					continue; 
				}
				$file = $d->path."\\".$v; 
				if(is_dir($file))
				{
   				echo "<a href='?action=templist&path=".$path."&dir=$v'>[$v]</a><br />";
				}
			}
			$d->rewind();
?>
	
<?php		
			while(false !== ($v = $d->read()))
			{
				
				if($v == "." || $v == "..")
				{
					continue; 
				}
				$file = $d->path . $v; 
				if(is_dir($file))
				{
					continue;
				}
				if(is_file($file))
				{
?>
                <tr>
			<td height="25">&nbsp;<a href="javascript:ReturnValue('<?php echo $v?>');"><?php echo $v?></a></td>
			<td><?php echo getTemplateType($v);?></td>
			<td><?php echo round(filesize($file)/1204,2)."Kb"?></td>
			<td align='center'><?php echo date('Y-m-d H:i:s',filemtime($file))?></td>
                </tr>
<?php					
				}
			}
?>
           </table>
<?php	
		$d->close();
		}
function getTemplateType($filename){
	switch(strtolower($filename)){
		case 'cs-index.html':
			$getTemplateType="网站首页";
			break;
		case "cs-head.html":
			$getTemplateType="网站顶部";
			break;
		case "cs-bottom.html":
			$getTemplateType="网站底部";
			break;
		case "so-dance.html":
			$getTemplateType="歌曲搜索";
			break;
		case "so-dance-tags.html":
			$getTemplateType="歌曲标签";
			break;
		case "so-topic.html":
			$getTemplateType="专集搜索";
			break;
		case "so-topic-tags.html":
			$getTemplateType="专集标签";
			break;
		case "so-news.html":
			$getTemplateType="文章搜索";
			break;
		case "topic-dance.html":
			$getTemplateType="音乐专集列表";
			break;
		case "topic-news-show.html":
			$getTemplateType="文章专题内容";
			break;
		case "topic-dance-show.html":
			$getTemplateType="音乐专集内容";
			break;
		case "news-list.html":
			$getTemplateType="文章列表";
			break;
		case "dance-list.html":
			$getTemplateType="歌曲列表";
			break;
		case "news-show.html":
			$getTemplateType="文章内容";
			break;
		case "dance-play.html":
			$getTemplateType="歌曲播放";
			break;
		case "dance-sp-play.html":
			$getTemplateType="视频播放";
			break;
		case "cs-gbook.html":
			$getTemplateType="留言模板";
			break;
		case "cs-ulogin.html":
			$getTemplateType="会员登陆";
			break;	
		case "cs-uinfo.html":
			$getTemplateType="会员信息";
			break;	
		Case "dance-down.html";
			$getTemplateType="下载页面";
			break;	
		Case "dance-sp-list.html";
			$getTemplateType="视频栏目";
			break;	
		Case "dance-playsong.html";
			$getTemplateType="连播页面";
			break;	
		default:
			if(stristr($filename,'.gif') or stristr($filename,'.jpg') or stristr($filename,'.png')){
				$getTemplateType="图片文件";
				}
			elseif(stristr($filename,'.css')){
				 $getTemplateType="样式文件";
				}
			elseif(stristr($filename,'.js')){
				$getTemplateType="脚本文件";
				}	
			else{
				$getTemplateType="其它文件";
				}
	}
	return $getTemplateType;
}	
?>
      </td>
   </tr>
</table>
</body>
</html>