protected function resetKga() { if (null === $this->kgaLast) { return; } global $kga; $kga = $this->kgaLast; \Kimai_Registry::setConfig($kga); }
* Create the autoconf.php file. */ case "write_config": include "../includes/func.php"; // special characters " and $ are escaped $database = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $charset = 'utf8'; $prefix = addcslashes($_REQUEST['prefix'], '"$'); $lang = $_REQUEST['lang']; $salt = createPassword(20); $timezone = $_REQUEST['timezone']; $kimaiConfig = new Kimai_Config(array('server_prefix' => $server_prefix, 'server_hostname' => $hostname, 'server_database' => $database, 'server_username' => $username, 'server_password' => $password, 'server_charset' => $charset, 'defaultTimezone' => $timezone, 'password_salt' => $salt)); Kimai_Registry::setConfig($kimaiConfig); write_config_file($database, $hostname, $username, $password, $charset, $prefix, $lang, $salt, $timezone); break; /** * Create the database. */ /** * Create the database. */ case 'make_database': $databaseName = $_REQUEST['database']; $hostname = $_REQUEST['hostname']; $username = $_REQUEST['username']; $password = $_REQUEST['password']; $db_error = false; $result = false;
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 $cleanup = array('server_prefix', 'server_hostname', 'server_database', 'server_username', 'server_password', 'server_charset', 'language', 'password_salt', 'authenticator', 'defaultTimezone', 'billable', 'skin'); foreach ($cleanup as $varName) { if (isset(${$varName})) { unset(${$varName}); } } unset($cleanup); // ============ setup database ============ // we do not unset the $database variable // as it is historically referenced in many places from the global namespace $database = new Kimai_Database_Mysql($kga, true); if (!$database->isConnected()) {