/** * @before _secured, _admin */ public function settings() { $view = $this->getActionView(); $config = Config::all(); $view->set('config', $config); if (RequestMethods::post('submitEditSet')) { if ($this->checkCSRFToken() !== true) { self::redirect('/admin/'); } $errors = array(); foreach ($config as $conf) { $oldVal = $conf->getValue(); $conf->value = RequestMethods::post($conf->getXkey(), ''); if ($conf->validate()) { Event::fire('admin.log', array('success', $conf->getXkey() . ': ' . $oldVal . ' - ' . $conf->getValue())); $conf->save(); } else { Event::fire('admin.log', array('fail', $conf->getXkey() . ': ' . $conf->getValue())); $errors[$conf->xkey] = array_shift($conf->getErrors()); } } if (empty($errors)) { $view->successMessage(self::SUCCESS_MESSAGE_2); self::redirect('/admin/system/'); } else { $view->set('errors', $errors); } } }
/** * Extends configuration loaded from config file for configuration loaded * form database */ public function extendForDbConfig() { $ca = Config::all(); if ($ca !== null) { foreach ($ca as $key => $value) { $this->_configArrMerged[$value->xkey] = $value->value; } $this->_parsed = ArrayMethods::toObject($this->_configArrMerged); Registry::set('configuration', $this->_parsed); } }