<?php
define('RootPath',dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR);//本模块路径
include_once("htui_header.php");

$scuser_id=$_SESSION["a_uid"];
if ($_GET['do']==1){
	if (check_permission($scuser_id,'clearcache.php',3)){
		foreach(glob(RootPath.'Templates/cache/*.php') as $filename) { 
			unlink($filename); 
		}
		$response_arr = array("status" => 1,"message"  => '操作成功');
	}else{
		$response_arr = array("status" => -1,"message"  => '对不起,您无权限操作!');
	}

	echo json_encode($response_arr);
	exit;
}
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>后台管理中心_飞天素材网</title>
<meta name="author" content="ftsucai.com">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/htstyle.css" rel="stylesheet">
<link href="../css/jquery-confirm.min.css" rel="stylesheet">
</head>
  
<body>

    <!--页面主要内容-->
    <main class="ftdms-layout-content">
      
      <div class="container-fluid" style="margin-bottom:90px;">
        
        <div class="row" style="margin-top:15px;">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-header"><h4>清空站点缓存</h4>
			  </div>
              <div class="card-body" style="padding:5px 20px;height:660px;font-size:16px;text-align:center;">
			    <br><br><br><br><br>
                
                清空站点缓存后，系统会自动重新生成缓存文件,你确定要清空吗？<a id="del" style="cursor:pointer;"> 清空缓存</a>
				
                
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.js"></script>
<script type="text/javascript" src="../js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="../js/main.min.js"></script>
<script type="text/javascript" src="../js/jquery-confirm.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="../js/tips.js"></script>

<script>
$('#del').on('click', function(){
	$.alert({
		title: '你确定要删除吗？',
		content: '',
		buttons: {
			confirm: {
				text: '确认',
				btnClass: 'btn-primary',
				action: function(){
					tips.loading('show');
					$.post('clearcache.php?do=1', function(data) {
						try {
							var ret = eval('('+data+')');
							if (ret.status == 1) {
								//alert(ret.msg);
								tips.loading('hide');
								tips.notify(ret.message, 'success', 3000);
							}else {
								tips.notify(ret.message, 'danger', 1000);
							}
						} catch (e) {
							tips.notify('网络异常,操作失败！', 'danger', 1000);
						}
					});
				}
			},
			cancel: {
				text: '取消',
				action: function () {
					//$.alert('你点击了取消!');
				}
			}
		}
	});	
});
</script>
</body>
</html>