<?php
if (!defined('IN_59MIAO'))
{
	exit('Access Defined');
}
//系统设置控制器
class SettingbasicAction extends Action {
	public function __construct() {
		parent::__construct();
	}	
	public function index() {	
		$_setting=$this->_model->findOne();
		if($_setting[0]->login_checkcode==1){
			$_setting[0]->login_checkcode='是<input type="radio" name="login_checkcode" value="1" checked="checked" />&nbsp;&nbsp;&nbsp;否<input type="radio" name="login_checkcode" value="0" />';
		}
		else{
			$_setting[0]->login_checkcode='是<input type="radio" name="login_checkcode" value="1" />&nbsp;&nbsp;&nbsp;否<input type="radio" name="login_checkcode" value="0" checked="checked" />';
		}
		$this->_tpl->assign('Setting', $_setting);
		$this->_tpl->display(SMARTY_ADMIN.'setting/basic_show.tpl');
	}	
	//修改系统设置
	public function update() {	
		if (isset($_POST['send'])) $this->_model->update()?$this->_redirect->succ(Tool::getPrevPage(), '修改系统设置成功！') : $this->_redirect->error('修改系统设置失败！');		
	}
	//文件上传
	
	public function upload(){
		$upload_obj=new UploadAction('?a=settingbasic','?a=settingbasic&m=upload', '100', '100', '0');
		$upload_obj->index();
	}
	
	//系统检测
	public function check(){
		$str=$this->_model->check();		
		$this->_tpl->assign('check', $str);
		//检测文件是否存在的数组
		$this->_tpl->display(SMARTY_ADMIN.'setting/check.tpl');
	}
	//
	public function high(){
		if(isset($_POST['send'])&&isset($_POST['high'])){
			$this->_model->high()?$this->_redirect->succ(Tool::getPrevPage(), '修改系统高级设置成功！') : $this->_redirect->error('对不起,修改系统高级设置失败！,请检查配置是否正确');
		}
		$this->_tpl->assign('page_size',PAGE_SIZE);
		$this->_tpl->assign('front_page_num',FRONT_PAGE_SIZE);	
		$this->_tpl->assign('upload_dir',UPDIR);
		$this->_tpl->assign('upload_max',MAX_FILE_SIZE/1024);
		$this->_tpl->assign('is_cache',SMARTY_CACHING);
		$this->_tpl->assign('cache_time',SMARTY_CACHE_LIFETIME/3600);		
		$this->_tpl->display(SMARTY_ADMIN.'setting/high_show.tpl');
	}	
}
?>