<?php
class AdminsysAction extends AdmincomAction{
	public function index(){
		$this->redirect('public/admlogin');
    }
	public function _empty()
	{
		$this->show();
	}
	private function show()
	{
		$site=M('site');
		$rs=$site->find();
		if($rs)
		{
			$this->assign('rs',$rs);
		}
		$this->display();
	}
	public function savesite()
	{
		$ok=$s=FALSE;
		$site=M('site');
		$s=$site->create();
		if($s)
		{
			$id=$_POST['id'];
			if($id)
			{
				$ok=$site->save();
			}
			else
			{
				$ok=$site->add();
			}
			if($ok)
			{
				//缓存网站配置信息
				$catchSite=$site->find();
				F('site',null);
				F('site',$catchSite);
				//
				$this->success('保存成功');	
			}
			else
				$this->error('发生错误');
		}
		
	}
	public function logout()
	{
		$_SESSION['isadmin']=null;
		//Session::destroy();
		$this->redirect('index/index');
	}
	public function sysinfo()
	{
        $info = array(
            '操作系统'=>PHP_OS,
            '运行环境'=>$_SERVER["SERVER_SOFTWARE"],
            'PHP运行方式'=>php_sapi_name(),
            'ThinkPHP版本'=>THINK_VERSION.' [ <a href="http://thinkphp.cn" target="_blank">查看最新版本</a> ]',
            '上传附件限制'=>ini_get('upload_max_filesize'),
            '执行时间限制'=>ini_get('max_execution_time').'秒',
            '服务器时间'=>date("Y年n月j日 H:i:s"),
            '北京时间'=>gmdate("Y年n月j日 H:i:s",time()+8*3600),
            '服务器域名/IP'=>$_SERVER['SERVER_NAME'].' [ '.gethostbyname($_SERVER['SERVER_NAME']).' ]',
            '剩余空间'=>round((@disk_free_space(".")/(1024*1024)),2).'M',
            'register_globals'=>get_cfg_var("register_globals")=="1" ? "ON" : "OFF",
            'magic_quotes_gpc'=>(1===get_magic_quotes_gpc())?'YES':'NO',
            'magic_quotes_runtime'=>(1===get_magic_quotes_runtime())?'YES':'NO',
			'mysql数据库'=>showResult(function_exists("mysql_close")),
			'odbc数据库'=>showResult(function_exists("odbc_close")),
			'SQL Server数据库'=>showResult(function_exists("mssql_close")),
			'msql数据库'=>showResult(function_exists("msql_close")),
			'SMTP'=>showResult(get_magic_quotes_gpc("smtp")),
			'GD Library'=>showResult(function_exists("imageline")),
			'XML'=>showResult(get_magic_quotes_gpc("XML Support")),
			'FTP'=>showResult(get_magic_quotes_gpc("FTP support")),
			'站点物理路径'=>realpath("../"),
			'Sendmail'=>showResult(get_magic_quotes_gpc("Internal Sendmail Support for Windows 4")),
			'上传文件大小限制'=>get_cfg_var("upload_max_filesize")?get_cfg_var("upload_max_filesize"):"不允许上传附件",
			'显示错误信息'=>showResult(get_cfg_var("display_errors")),
			'POST提交内容限制'=>get_cfg_var("post_max_size"),
			'allow_url_fopen'=>showResult(get_cfg_var("allow_url_fopen")),
			'Zlib'=>showResult(function_exists("gzclose")),
			'内存限制'=>get_cfg_var("memory_limit")?get_cfg_var("memory_limit"):"无",
			'Zend支持'=>showResult(function_exists("zend_version")),
			'服务器端口'=>$_SERVER["SERVER_PORT"],
			'官方网站'=>'<a href="http://www.dadeng.org" target="_blank">大嶝网</a>'
            );
        $this->assign('info',$info);
		$this->display();
	}
	public function delcatah()
	{
		import("ORG.Io.Dir");
		$type=$_GET['id'];
		if($type==1)
		{
			Dir::del(CACHE_PATH);
		}
		else if($type==2)
		{
			Dir::del(TEMP_PATH);
			Dir::del(DATA_PATH);
		}
		else if($type==3)
		{
			Dir::del(LOG_PATH);
		}
		$this->success('缓存删除完成');
	}
}
?>