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

class p102_sxExe extends xIExecutor {
	
	public function main() {
		$tips = '';
		if(isset($_POST['siteTitleTxt'])) {
			// --- 写入站点信息 ---
			$slexInfo = file_get_contents(__ROOT__.'confs/slex.i.php');
			$slexInfo = preg_replace('/_SLEX\[\'site\'\].+?\);/s', "_SLEX['site'] = array(
'title' => '".$_POST['siteTitleTxt']."',
'app' => '".$_ENV->site->app."',
'open' => ".(($_POST['siteOpenTxt']=='1')?'true':'false').",
'lang' => 'zh-cn',
'icp' => '".$_POST['siteIcpTxt']."',
'cpy' => 'MAIYUN.NET',
'statcode' => '".addcslashes($_POST['siteStatcodeTxt'], '\'\\')."',
'closeinfo' => '".addcslashes($_POST['siteCloseinfoTxt'], '\'\\')."'
);", $slexInfo);
			file_put_contents(__ROOT__.'confs/slex.i.php', $slexInfo);
			$tips = '您的设置已经成功被保存';
			// --- 更新 ---
			$_ENV->site->title = $_POST['siteTitleTxt'];
			$_ENV->site->open = ($_POST['siteOpenTxt']=='1')?true:false;
			$_ENV->site->icp = $_POST['siteIcpTxt'];
			$_ENV->site->statcode = $_POST['siteStatcodeTxt'];
			$_ENV->site->closeinfo = $_POST['siteCloseinfoTxt'];
		}
		include_once(__ROOT__.'admin/ui.p102.php');
	}
	
	public function onError($result) {
		
	}
	
}
