Пример #1
0
                    $s = new Setting($key);
                    if ($s->getValue() != $settings[$key]) {
                        $s->setValue($value);
                        if (!$s->save()) {
                            throw new \Exception('Unable to save the new value for ' . $key . '.');
                        }
                    }
                }
                $message_success = true;
            } catch (\Exception $e) {
                $this->assign('form_error', $e->getMessage());
            }
        } else {
            $this->assign('form_data', array('app_name' => (new Setting('app_name'))->getValue(), 'app_title' => (new Setting('app_title'))->getValue(), 'app_copyright' => (new Setting('app_copyright'))->getValue(), 'app_description' => (new Setting('app_description'))->getValue(), 'app_robots' => Setting::GetRobots((new Setting('app_robots'))->getValue()), 'conf_email_sender' => (new Setting('conf_email_sender'))->getValue(), 'api_display_doc' => (new Setting('api_display_doc'))->getValue(), 'api_requests' => (new Setting('api_requests'))->getValue()));
        }
        if (isset($message_success)) {
            $this->assign('message', 'Settings have been updated.');
        }
        $this->page('manage/settings');
        $this->assign('settings_app_details', true);
        $this->assign('default_app_name', Setting::DefaultSetting('app_name'));
        $this->assign('default_app_title', Setting::DefaultSetting('app_title'));
        $this->assign('default_app_copyright', Setting::DefaultSetting('app_copyright'));
        $this->assign('default_app_description', Setting::DefaultSetting('app_description'));
        $this->getToken();
        break;
    case NULL:
        $this->requireAuth();
        $this->page('manage/index');
        break;
}