<?php
if (!defined('USING_SYSTEM')) exit;

class p103_sxExe extends xIExecutor {
	
	public function main() {
		global $_APP;
		$tips = '';
		if(isset($_POST['userRegTxt'])) {
			// --- 写入站点信息 ---
			$appInfo = file_get_contents(__ROOT__.'confs/app.i.php');
			$appInfo = preg_replace('/_APP\\[\'register\'\\].+?\\);/s', "_APP['register'] = array(
'open' => ".(($_POST['userRegTxt']=='1')?'true':'false').",
'closeinfo' => '".$_POST['userRegCloseInfoTxt']."',
'group' => '".$_POST['userRegGroupTxt']."',
'verify' => ".(($_POST['userRegVerTxt']=='1')?'true':'false').",
'vgroup' => '".$_POST['userVerGroupTxt']."'
);", $appInfo);
			file_put_contents(__ROOT__.'confs/app.i.php', $appInfo);
			$tips = '您的设置已经成功被保存';
			// --- 更新 ---
			$_APP['register']['open'] = ($_POST['userRegTxt']=='1')?true:false;
			$_APP['register']['closeinfo'] = $_POST['userRegCloseInfoTxt'];
			$_APP['register']['group'] = $_POST['userRegGroupTxt'];
			$_APP['register']['verify'] = ($_POST['userRegVerTxt']=='1')?true:false;
			$_APP['register']['vgroup'] = $_POST['userVerGroupTxt'];
		}
		include_once(__ROOT__.'admin/ui.p103.php');
	}
	
	public function onError($result) {
		
	}
	
}
