<?php

class indexMod extends commonMod
{
    public function __construct()
    {
        parent::__construct();
    }
    
    // 显示管理后台首页
    public function index()
    {
		$config = $this->config;
		$group=$this->model->table('admin_group')->where('id='.$_SESSION[$config['spot'] . 'admin_gid'])->find();
		$admin_name=$_SESSION[$config['spot'] . 'admin_name'];
		$lang_list = $this->model->table('lang')->order('id asc')->select();
		$this->assign('group',$group['name']);
		$this->assign('lang_list',$lang_list);
		$this->assign('admin_name',$admin_name);
        $this->display();
    }
    // 显示管理后台欢迎页
    public function home()
    {
        $config = $this->config;
        $condition['uid'] = $_SESSION[$config['spot'] . 'admin_uid'];
        $user_info = $this->model->table('login_data')->where($condition)->limit('1,1')->order('id desc')->select();
        $condition2['id'] = $_SESSION[$config['spot'] . 'admin_uid'];
        $user_info_ext = $this->model->table('admin')->where($condition2)->order('id desc')->find();
        $this->assign('user_info', $user_info);
        $this->assign('user_info_ext', $user_info_ext);	
		
        $this->display();
		
    }
	
	
	public function getver()
	{
		$opts = array(
		'http'=>array(
		'method'=>"GET",
		'timeout'=>10,
		)
		);
		$context = stream_context_create($opts);
		$config = $this->config;
		$html =@file_get_contents('http://patch.dlcms.net/ver.xml',false, $context);
        $ver = Xml::decode($html);		
		$ver = $ver['dlcms']['dlcms_'.$config['ver_date']];
		$ver=$ver[0];
		//print_r($ver);
		echo json_encode($ver);
		
	}
	
	public function getdomain()
	{
		$opts = array(
		'http'=>array(
		'method'=>"GET",
		'timeout'=>5,
		)
		);
		$context = stream_context_create($opts);
		$config = $this->config;
		
		$ServerName = strtolower($_SERVER['SERVER_NAME']?$_SERVER['SERVER_NAME']:$_SERVER['HTTP_HOST']); 
		$get_domain_info =@file_get_contents('http://www.dlcms.net/certification/info?domain='.$ServerName,false, $context);
		$domain_info = Xml::decode($get_domain_info);
		echo json_encode($domain_info['inquiry']['info'][0]);
		
	}




}

?>