<?php
namespace imcat\base;

//use imcat\basReq;

class homeCtrl{

    public $ucfg = array();
    public $vars = array();
    public $start = '/root/tools/adbug/start.php';

    //function __destory(){  }
    function __construct($ucfg=array(), $vars=array()){ 
        $this->ucfg = $ucfg;
        $this->vars = $vars;
        $this->check();
    }

    // home检查
    function check(){
        // 检查路径
        $npath = \imcat\devRun::prootGet();
        if($npath!=PATH_PROJ){
            header('Location:'.$npath.$this->start.'?FixProot');
            die('<!--FixProot-->');
        }
        // 检查关闭
        $hclose = empty($_cbase['close_home']) ? 'index' : $_cbase['close_home'];
        if($hclose=='close'){
            \imcat\vopTpls::cinc("stpl/close_info",1);
            die();
        }elseif(substr($hclose,0,4)=='dir-'){
            $tpl = substr($hclose,4);
            $cfg = read('vopcfg.tpl','sy'); 
            header('Location:'.PATH_PROJ.$cfg[$tpl][1]); 
            die('<!--close/dir-->');
        }
    }

    function homeAct(){
        header('Location:'.(surl('comm:0'))); // 直接跳转
        #return array('newtpl'=>"home/mhome"); // 设置模板
    }

    function startAct(){
        header('Location:'.PATH_PROJ.$this->start);
        die('<!--startAct-->');
    }

}
