<?php
/**
 *	Generated by miceCMS
 *	http://www.miceCMS.com/
 */
class config_updateAction extends security_login {
	function action(){
		ModuleLimit(__CLASS__);
		global $conn;
		$config_id=$_POST['config_id'];
		if($config_id){
			$config=new model_Config();
			$config->setSubsection('WHERE config_id='.$config_id);
			$results=$config->doSelectOne();
		}
		
		$tag=$_POST['tag'];
		$isuse=$_POST['isuse'];
		$value=$_POST['value'];
		$addedvalue=$_POST['addedvalue'];
		$intro=$_POST['intro'];

		if($tag==""){
			$jsstring='Dialog.alert("标记不能为空",function(){history.back(-1);});';
			MessageBox($jsstring);
			exit;
		}

		if($results)
		{
			$ins='内容已存在';
			$config->setTag($tag);
			$config->setIsuse($isuse);
			$config->setValue($value);
			$config->setAddedvalue($addedvalue);
			$config->setIntro($intro);
			$results=$config->doUpdate();
			if($results)
				$exeresult='更新成功';
			else
				$exeresult='更新失败';
		}else{
			$ins='内容已不存在';
			$config=new model_Config();
			$config->setTag($tag);
			$config->setIsuse($isuse);
			$config->setValue($value);
			$config->setAddedvalue($addedvalue);
			$config->setIntro($intro);
			$results=$config->doInsert();
			if($results)
				$exeresult='插入成功';
			else
				$exeresult='插入失败';
		}

		if($_POST['goon']==1){
			$jsstring='Dialog.alert(\''.$exeresult.'\',function(){window.location.href="'.MICE_URL.'admin.php/config/edit";window.event.returnValue = false;},300,100,"继续添加系统参数");';
			MessageBox($jsstring);
		}else{
			$jsstring='Dialog.alert(\''.$exeresult.'\',function(){window.location.href="'.MICE_URL.'admin.php/config";window.event.returnValue = false;},300,100,"跳转到系统参数列表");';
			MessageBox($jsstring);
		}
		exit;
	}
}
?>