<?php
# CmsEasy Enterprise Content Management System
# Copyright (C) CmsEasy Co.,Ltd (https://www.CmsEasy.cn). All rights reserved.
if (!defined('ROOT')) exit('Can\'t Access !');

class table_special extends table_mode {
	function save_before() {
		front::$post['specialcontent'] = stripcslashes(htmlspecialchars_decode(front::$post['specialcontent']));
		front::$post['adddate'] = time();
		front::$post['listorder'] = 0;
		front::$post['disabled'] = 0;
	}

    function save_after($specialid = '')
    {
        //保存之后 自动生成
        cache_make::get_make_special($specialid,false);
    }

    function delete_before($specialid = '')
    {
        /* $typeid = intval(front::$get['id']);
         $where = "typeid = '$typeid'";
         $arc = new archive();
         $arc->rec_delete($where);*/
        if (config::get("cache_make_open")){
            $special = special::getInstance()->getrow("spid=".$specialid);
            $cache_path = special::url($special['spid'],$special['ishtml'],front::$get['page'] > 1 ? front::$get['page'] : 1,$special['htmldir'],false);
            $cache_path = special::url_rule($cache_path);
            $cache_path=dirname($cache_path);
            if ($cache_path!=ROOT){
                front::remove($cache_path);
            }
        }


    }

    function edit_before(){
        //修改模板触发清空可视化缓存
        if (front::post('template') && front::get('id')) {
            $special = new special();
            $special_data = $special->getrow(array("spid"=>front::get('id')));
            if($special_data['template']!=front::post('template')){
                front::remove(ROOT.'/cache/template_admin');
            }
        }
    }

}
# This program is an open source system, commercial use, please consciously to purchase commercial license.
# Copyright (C) CmsEasy Co., Ltd. (https://www.CmsEasy.cn). All rights reserved.