function pagesetting($inPath) { $modelObj = new base_m(); $mc = memcache_init(); if (!$_POST) { $system_name = $mc->get($_SERVER['HTTP_APPVERSION'] . "head_title"); $this->params['system_name'] = $system_name ? $system_name : base_Constant::DEFAULT_TITLE; //$this->params ['rewrite'] =(int)base_Constant::REWRITE; //$this->params ['cookie_key'] =base_Constant::COOKIE_KEY; //$this->params ['temp_dir'] =base_Constant::TEMP_DIR; } else { //$this->showMsg("SAE平台暂不提供修改功能!"); if ($_POST['cleartable'] == 1) { $tableArr = array("category", "goods", "member", "purchase", "sales", "log"); if (!$modelObj->clearTable($tableArr)) { $this->showMsg("清空数据出错!原因:" . $modelObj->getError()); } } $system_name = base_Utils::getStr($_POST['system_name']); $modelObj->_db->delete(base_Constant::TABLE_PREFIX . "system"); $modelObj->_db->insert(base_Constant::TABLE_PREFIX . "system", array("sysname" => $system_name, "options" => "")); $mc->set($_SERVER['HTTP_APPVERSION'] . "head_title", $system_name); $this->showMsg("修改成功", $this->createUrl("/system/setting"), 2, 1); exit; $constant = file_get_contents(ROOT_APP . "/base/Constant.class.php"); $system_name = base_Utils::getStr($_POST['system_name']); if ($system_name) { $constant = str_replace(base_Constant::DEFAULT_TITLE, $system_name, $constant); } $cookie_key = base_Utils::getStr($_POST['cookie_key']); if ($cookie_key != base_Constant::COOKIE_KEY) { $cookie_key = md5($cookie_key); $constant = str_replace(base_Constant::COOKIE_KEY, $cookie_key, $constant); } $rewrite = base_Utils::getStr($_POST['rewrite'], 'int'); if ($rewrite == 1) { $constant = str_replace("FALSE", "TRUE", $constant); } else { $constant = str_replace("TRUE", "FALSE", $constant); } $f = @fopen(ROOT_APP . "/base/Constant.class.php", "r+"); if ($f) { fwrite($f, $constant); fclose($f); } else { $this->ShowMsg("没有写权限"); } $this->showMsg("修改成功", $this->createUrl("/system/setting"), 2, 1); //$this->redirect($this->createUrl("/system/setting")); } return $this->render('system/setting.html', $this->params); }
function pagesetting($inPath) { $modelObj = new base_m(); if (!$_POST) { $this->params['system_name'] = base_Constant::DEFAULT_TITLE; $this->params['rewrite'] = (int) base_Constant::REWRITE; $this->params['cookie_key'] = base_Constant::COOKIE_KEY; $this->params['temp_dir'] = base_Constant::TEMP_DIR; } else { if ($_POST['cleartable'] == 1) { $tableArr = array("category", "goods", "member", "purchase", "sales", "log"); if (!$modelObj->clearTable($tableArr)) { $this->showMsg("清空数据出错!原因:" . $modelObj->getError()); } } $constant = file_get_contents(ROOT_APP . "/base/Constant.class.php"); $system_name = base_Utils::getStr($_POST['system_name']); if ($system_name) { $constant = str_replace(base_Constant::DEFAULT_TITLE, $system_name, $constant); } $cookie_key = base_Utils::getStr($_POST['cookie_key']); if ($cookie_key != base_Constant::COOKIE_KEY) { $cookie_key = md5($cookie_key); $constant = str_replace(base_Constant::COOKIE_KEY, $cookie_key, $constant); } $rewrite = base_Utils::getStr($_POST['rewrite'], 'int'); if ($rewrite == 1) { $constant = str_replace("FALSE", "TRUE", $constant); } else { $constant = str_replace("TRUE", "FALSE", $constant); } $f = @fopen(ROOT_APP . "/base/Constant.class.php", "r+"); if ($f) { fwrite($f, $constant); fclose($f); } else { $this->ShowMsg("没有写权限"); } $this->showMsg("修改成功", $this->createUrl("/system/setting"), 2, 1); //$this->redirect($this->createUrl("/system/setting")); } return $this->render('system/setting.html', $this->params); }