$GLOBALS['current_config']['encryptkey'] = md5(time() . $_SERVER['HTTP_HOST']); // random enough $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions(); $newsettings = phpgw::get_var('newsettings', 'string', 'POST'); $files_in_docroot = isset($newsettings['files_dir']) ? in_docroot($newsettings['files_dir']) : false; if (phpgw::get_var('submit', 'string', 'POST') && is_array($newsettings) && !$files_in_docroot) { phpgw::import_class('phpgwapi.datetime'); switch (intval($newsettings['daytime_port'])) { case 13: $newsettings['tz_offset'] = phpgwapi_datetime::getntpoffset(); break; case 80: $newsettings['tz_offset'] = phpgwapi_datetime::gethttpoffset(); break; default: $newsettings['tz_offset'] = phpgwapi_datetime::getbestguess(); break; } $GLOBALS['phpgw_setup']->db->transaction_begin(); foreach ($newsettings as $setting => $value) { // echo '<br />Updating: ' . $setting . '=' . $value; $setting = $GLOBALS['phpgw_setup']->db->db_addslashes($setting); /* Don't erase passwords, since we also do not print them below */ if ($value || !preg_match('/passwd/', $setting) && !preg_match('/password/', $setting) && !preg_match('/root_pw/', $setting)) { $GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_config WHERE config_name='{$setting}'", __LINE__, __FILE__); } if ($value) { $value = $GLOBALS['phpgw_setup']->db->db_addslashes($value); $GLOBALS['phpgw_setup']->db->query("INSERT INTO phpgw_config (config_app,config_name, config_value) VALUES ('phpgwapi', '{$setting}','{$value}')", __LINE__, __FILE__); } }