<?php
/**
 * @version        Somao_Search X1.0 9:23 2012-1-1 Somao $
 * @package        Somao_Search.Site
 * @copyright      Copyright (c) 2009 - 2012, Somao, Inc.
 * @license        http://www.somao123.com/
 * @link           http://www.somao.cc/
**/
require "global.php";
CheckPurview('sys_skin',$authoritys,$rank);
$rst=$db->get_one("select * from ve123_skin");
if(!$rst){
	 $array=array('id'=>1,'names'=>"default",'times'=>time());
	 $db->insert("ve123_skin",$array); 
}
$action=trim(HtmlReplace($_GET["action"]));
if($action=="set"){
	 $names=trim(HtmlReplace($_GET["names"]));
	 $array=array('names'=>$names,'times'=>time());
	 $db->update("ve123_skin",$array,"id=1");
	 jsalert("设置风格成功");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<meta http-equiv="x-ua-compatible" content="ie=7" />
<link href="css/admincp.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
  <div class="floattop">
    <div class="itemtitle"><h3>风格列表</h3>
      <ul class="tab1">
        <li class="current"><a href="skin.php"><span>风格列表</span></a></li>
      </ul>
     </div>
   </div>
 <div class="floattopempty"></div>
<table class="tb tb2 ">
  <tr class="header">
    <th style="text-align: center">ID</th>
    <th>风格名称</th>
    <th>目录创建时间</th>
    <th>操作</th>
  </tr>
  <?php
	   $dir="../templates";
       $dp = opendir($dir);
       while ($file = readdir($dp)) { 
	      
               if ($file!='.' && $file!='..') {
                   $path = $dir ."/". $file;
				   $i++; 
                   if (is_dir($path)) {
  ?>
  <tr>
    <td height="30" align="center"><?php echo $i;?></td>
    <td height="30"><?php echo $file;?></td>
    <td height="30"><?php echo date('Y-h-d', filectime($path));?></td>
    <td><?php if($rst["names"]==$file){echo "默认风格";}else{echo "<a href='?action=set&names=".$file."'>设为默认</a>";}?></td>
  </tr>
  <?php
             }
          }             
       }
    closedir($dp);
  ?>
</table>
</div>
</body>
</html>