if (!file_exists(WEBROOT . 'includes/autoconf.php')) { header('Location: installer/index.php'); exit; } ini_set('display_errors', '0'); require_once WEBROOT . 'libraries/autoload.php'; require_once WEBROOT . 'includes/func.php'; // The $kga (formerly Kimai Global Array) is initialized here // It was replaced by an proxy object, but until refactored it is still used as array in a lot of places require_once WEBROOT . 'includes/autoconf.php'; $kga = new Kimai_Config(array('server_prefix' => $server_prefix, 'server_hostname' => $server_hostname, 'server_database' => $server_database, 'server_username' => $server_username, 'server_password' => $server_password, 'server_charset' => $server_charset, 'defaultTimezone' => $defaultTimezone, 'password_salt' => isset($password_salt) ? $password_salt : '')); // will inject the version variables into the Kimai_Config object include WEBROOT . 'includes/version.php'; // write vars from autoconf.php into kga if (isset($language)) { $kga->setLanguage($language); } if (isset($authenticator)) { $kga->setAuthenticator($authenticator); } if (isset($billable)) { $kga->setBillable($billable); } if (isset($skin)) { $kga->setSkin($skin); } date_default_timezone_set($defaultTimezone); Kimai_Registry::setConfig($kga); // ============ global namespace cleanup ============ // remove some variables from the global namespace, that should either be // not accessible or which are available through the kga config object
/** * Prefills the Config (and inherited settings) object with configuration data. * * @param Kimai_Config $config */ public function initializeConfig(Kimai_Config $config) { $config->setStatuses($this->getStatuses()); $allConf = $this->getConfigurationData(); if (empty($allConf)) { return; } foreach ($allConf as $key => $value) { switch ($key) { case 'language': if (!empty($value)) { $config->setLanguage($value); } break; // TODO move to Kimai_Config as they are NOT user specific! // the following system settings are still used in ['conf'] array syntax // TODO move to Kimai_Config as they are NOT user specific! // the following system settings are still used in ['conf'] array syntax case 'decimalSeparator': case 'durationWithSeconds': case 'roundTimesheetEntries': case 'roundMinutes': case 'roundSeconds': $config->getSettings()->set($key, $value); // break is not here on purpose! // break is not here on purpose! case 'adminmail': case 'loginTries': case 'loginBanTime': case 'currency_name': case 'currency_sign': case 'currency_first': case 'show_update_warn': case 'check_at_startup': case 'show_daySeperatorLines': case 'show_gabBreaks': case 'show_RecordAgain': case 'show_TrackingNr': case 'date_format_0': case 'date_format_1': case 'date_format_2': case 'date_format_3': case 'table_time_format': case 'roundPrecision': case 'exactSums': case 'defaultVat': case 'editLimit': case 'allowRoundDown': case 'defaultStatusID': $config->set($key, $value); break; case 'openAfterRecorded': case 'showQuickNote': case 'quickdelete': case 'autoselection': case 'noFading': case 'showIDs': case 'sublistAnnotations': case 'user_list_hidden': case 'project_comment_flag': case 'flip_project_display': case 'hideClearedEntries': case 'defaultLocation': default: $config->getSettings()->set($key, $value); break; } } }