<?php
class admin_sitesControl extends skymvc{
	
	public function __construct(){
		parent::__construct();
		$this->loadModel(array("site"));
	}
	
	public function onDefault(){
		$this->onAdd();
	}
	
	public function onAdd(){
		if(!$data=$this->site->selectRow(array())){
			$this->site->insert(array("sitename"=>"默认网站"));
		}
		$this->smarty->assign(array(
			"data"=>$data
		));
		$this->smarty->display("sites/add.html");
	}
	
	public function onSave(){
		$data['sitename']=post('sitename','h');
		$data['logo']=post('logo','h');
		$data['title']=post('title','h');
		$data['keywords']=post('keywords');
		$data['description']=post('description');
		$data['icp']=post('icp');
		$data['statjs']=$_POST['statjs'];
		$this->site->update($data,"1=1");
		$this->gomsg("保存成功");
		
	}
}
?>