<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Admin\Controller;
use User\Api\UserApi as UserApi;

/**
 * 后台首页控制器
 * @author 麦当苗儿 <zuojiazi@vip.qq.com>
 */
class IndexController extends AdminController {

    /**
     * 后台首页
     * @author 麦当苗儿 <zuojiazi@vip.qq.com>
     */
    public function index(){
        $this->meta_title = '管理首页';
        /*
        if(file_exists(realpath(__ROOT__)."\license.lock")){//授权文件存在
        }else{//授权问价不存在，重新生成
        	//验证域名
        	if(substr(gethostbyname($_SERVER["SERVER_NAME"]),0,3) == "127" || substr(gethostbyname($_SERVER["SERVER_NAME"]),0,3) == "192"){//本机测试
        		$this->display();
        	}else{//上线使用，验证域名
        		$domain = $_SERVER['SERVER_NAME'];
        		$url = "http://dayincms.com/index.php?r=DuxCms/Form/api&requesturl={$domain}";
        		$res =  json_decode(file_get_contents($url));
        		if($res->error == 0){//授权通过
        			foreach (explode(",",$res->modules) as $v){
        					if($v == 3) $v = 4;
        					$sum += $v;
        			}
        			$myfile = fopen(realpath(__ROOT__)."\license.lock", "w") or die("Unable to open file!");
        			fwrite($myfile, md5($domain.C("DATA_AUTH_KEY").$sum));
        			fclose($myfile);
        			$this->display();
        		}else{//授权不通过
        			D('Member')->logout();
        			session('[destroy]');
        			$this->error($res->msg,$res->url);
        		}
        	}
        }
        */
        $this->display();
    }

}
