/* Check if we need to run setup */ if (!file_exists(CONFIG_DIR . '/' . CONFIG_FILE)) { header('location:setup.php'); exit; } /* Check if fusiondirectory.conf (.CONFIG_FILE) is accessible */ if (!is_readable(CONFIG_DIR . '/' . CONFIG_FILE)) { msg_dialog::display(_('Configuration error'), sprintf(_('FusionDirectory configuration %s/%s is not readable. Please run fusiondirectory-setup --check-config to fix this.'), CONFIG_DIR, CONFIG_FILE), FATAL_ERROR_DIALOG); exit; } /* Parse configuration file */ $config = new config(CONFIG_DIR . '/' . CONFIG_FILE, $BASE_DIR); if ($_SERVER['REQUEST_METHOD'] == 'POST') { session::global_set('DEBUGLEVEL', 0); } else { session::global_set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL')); @DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config'); } /* Set template compile directory */ $smarty->compile_dir = $config->get_cfg_value('templateCompileDirectory', SPOOL_DIR); /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { msg_dialog::display(_('Smarty error'), sprintf(_('Directory "%s" specified as compile directory is not accessible!'), $smarty->compile_dir), FATAL_ERROR_DIALOG); exit; } /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); initLanguage(); $smarty->assign('nextfield', 'username'); if (isset($_POST['server'])) { $server = $_POST['server'];
} elseif (isset($_GET['directory'])) { $directory = $_GET['directory']; } else { $directory = $config->data['MAIN']['DEFAULT']; if (!isset($servers[$directory])) { $directory = key($servers); } } // Set location and reload the configRegistry - we've now access to the ldap. if (isset($servers[$directory])) { $config->set_current($directory); $config->check_and_reload(); $config->configRegistry->reload(TRUE); } session::global_set('plist', new pluglist($config, $ui)); session::global_set('debugLevel', $config->get_cfg_value("core", "debugLevel")); if ($_SERVER["REQUEST_METHOD"] != "POST") { @DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } /* Set template compile directory */ $smarty->compile_dir = $config->get_cfg_value("core", "templateCompileDirectory"); /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { msg_dialog::display(_("Configuration error"), sprintf(_("Compile directory %s is not accessible!"), bold($smarty->compile_dir)), FATAL_ERROR_DIALOG); exit; } /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); /* Language setup */ if ($config->get_cfg_value("core", "language") == "") { $lang = get_browser_language();
header("location:setup.php"); exit; } /* Reset errors */ session::set('errors', ""); /* Check if fusiondirectory.conf (.CONFIG_FILE) is accessible */ if (!is_readable(CONFIG_DIR . "/" . CONFIG_FILE)) { msg_dialog::display(_("Configuration error"), sprintf(_("FusionDirectory configuration %s/%s is not readable. Please run fusiondirectory-setup --check-config to fix this."), CONFIG_DIR, CONFIG_FILE), FATAL_ERROR_DIALOG); exit; } /* Parse configuration file */ $config = new config(CONFIG_DIR . "/" . CONFIG_FILE, $BASE_DIR); if ($_SERVER["REQUEST_METHOD"] == "POST") { session::global_set('DEBUGLEVEL', 0); } else { session::global_set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL')); @DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } /* Set template compile directory */ $smarty->compile_dir = $config->get_cfg_value("templateCompileDirectory", SPOOL_DIR); /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { msg_dialog::display(_("Smarty error"), sprintf(_("Directory '%s' specified as compile directory is not accessible!"), $smarty->compile_dir), FATAL_ERROR_DIALOG); exit; } /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); initLanguage(); $smarty->assign('nextfield', 'username'); if (isset($_POST['server'])) { $server = $_POST['server'];
$smarty->assign("version", get_gosa_version()); $smarty->display(get_template_path('login.tpl')); exit; } /***************************************************************************** * M A I N * *****************************************************************************/ /* Check if gosa.conf (.CONFIG_FILE) is accessible */ if (!is_readable(CONFIG_DIR . "/" . CONFIG_FILE)) { msg_dialog::display(_("Configuration error"), sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR, CONFIG_FILE), FATAL_ERROR_DIALOG); exit; } /* Parse configuration file */ $config = new config(CONFIG_DIR . "/" . CONFIG_FILE, $BASE_DIR); /* Set template compile directory */ $smarty->compile_dir = $config->get_cfg_value("core", "templateCompileDirectory"); $smarty->error_unassigned = true; /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { msg_dialog::display(_("Smarty error"), sprintf(_("Compile directory %s is not accessible!"), $smarty->compile_dir), FATAL_ERROR_DIALOG); exit; } /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); /* Language setup */ $lang = get_browser_language(); putenv("LANGUAGE="); putenv("LANG={$lang}"); setlocale(LC_ALL, $lang); $GLOBALS['t_language'] = $lang; $GLOBALS['t_gettext_message_dir'] = $BASE_DIR . '/locale/';