data = $data; } public function apply() { $config = array(); foreach ($this->data['generalConfig'] as $sectionAndPropertyName => $value) { list($section, $property) = explode('_', $sectionAndPropertyName); $config[$section][$property] = $value; } $config['preferences']['store'] = $this->data['preferencesStore']; if (isset($this->data['preferencesResource'])) { $config['preferences']['resource'] = $this->data['preferencesResource']; } try { Config::fromArray($config) ->setConfigFile(Config::resolvePath('config.ini')) ->saveIni(); } catch (Exception $e) { $this->error = $e; return false; } $this->error = false; return true; } public function getSummary() { $pageTitle = '

' . mt('setup', 'Application Configuration', 'setup.page.title') . '

'; $generalTitle = '

' . t('General', 'app.config') . '

'; $loggingTitle = '

' . t('Logging', 'app.config') . '

'; $generalHtml = '' . ''; $type = $this->data['generalConfig']['logging_log']; if ($type === 'none') { $loggingHtml = '

' . mt('setup', 'Logging will be disabled.') . '

'; } else { $level = $this->data['generalConfig']['logging_level']; $loggingHtml = '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . ($type === 'syslog' ? ( '' . '' ) : ( '' . '' )) . '' . '' . '
' . t('Type', 'app.config.logging') . '' . ($type === 'syslog' ? 'Syslog' : t('File', 'app.config.logging.type')) . '
' . t('Level', 'app.config.logging') . '' . ($level === Logger::$levels[Logger::ERROR] ? t('Error', 'app.config.logging.level') : ( $level === Logger::$levels[Logger::WARNING] ? t('Warning', 'app.config.logging.level') : ( $level === Logger::$levels[Logger::INFO] ? t('Information', 'app.config.logging.level') : ( t('Debug', 'app.config.logging.level') ) ) )) . '
' . t('Application Prefix') . '' . $this->data['generalConfig']['logging_application'] . '' . t('Filepath') . '' . $this->data['generalConfig']['logging_file'] . '
'; } return $pageTitle . '
' . $generalTitle . $generalHtml . '
' . '
' . $loggingTitle . $loggingHtml . '
'; } public function getReport() { if ($this->error === false) { $message = mt('setup', 'General configuration has been successfully written to: %s'); return '

' . sprintf($message, Config::resolvePath('config.ini')) . '

'; } elseif ($this->error !== null) { $message = mt('setup', 'General configuration could not be written to: %s; An error occured:'); return '

' . sprintf($message, Config::resolvePath('config.ini')) . '

' . '

' . $this->error->getMessage() . '

'; } } }