AdministratorAction::saveConfigData PHP Method

saveConfigData() public method

保存配置页面详细数据
public saveConfigData ( )
    public function saveConfigData()
    {
        if (empty($_POST['systemdata_list']) || empty($_POST['systemdata_key'])) {
            $this->error(L('PUBLIC_SAVE_FAIL'));
            // 保存失败
        }
        $key = t($_POST['systemdata_list']) . ':' . t($_POST['systemdata_key']);
        $title = t($_POST['pageTitle']);
        unset($_POST['systemdata_list'], $_POST['systemdata_key'], $_POST['pageTitle']);
        //rewrite验证.
        if (isset($_POST['site_rewrite_on']) && $_POST['site_rewrite_on'] == 1) {
            $rewrite_test_content = file_get_contents(SITE_URL . '/rewrite');
            if ($rewrite_test_content != 'thinksns') {
                $this->error('服务器设置不支持Rewrite,请检查配置');
            }
        }
        if (isset($_POST['site_analytics_code'])) {
            $_POST['site_analytics_code'] = base64_encode($_POST['site_analytics_code']);
        }
        if (isset($_POST['site_theme_name']) && $_POST['site_theme_name'] != C('THEME_NAME')) {
            $res = $this->_switchTheme(t($_POST['site_theme_name']));
        }
        if ($key == 'admin_Config:attach') {
            $exts = explode(',', $_POST['attach_allow_extension']);
            $objext = array('gif', 'png', 'jpeg', 'zip', 'rar', 'doc', 'xls', 'ppt', 'docx', 'xlsx', 'pptx', 'pdf', 'jpg', 'mp3');
            $_POST['attach_allow_extension'] = implode(',', array_intersect($exts, $objext));
        }
        $result = model('Xdata')->put($key, $_POST);
        LogRecord('admin_config', 'editDetail', array('name' => $title, 'k1' => L('PUBLIC_ADMIN_EDIT_EDTAIL_PEIZHI')), true);
        // 保存修改编辑详细数据
        if ($res === false) {
            $this->error(L('PUBLIC_SWITCH_THEME_FAIL'));
            // 写config.inc.php文件失败
        } elseif ($result) {
            $this->success();
        } else {
            $this->error(L('PUBLIC_SAVE_FAIL'));
            // 保存失败
        }
    }