validateAndRedirect('config/mainlogin.php?invalidLicense=1', 'config/mainlogin.php?invalidLicense=2'); } /** Upgrade functions */ include_once(__DIR__ . "/../lib/upgrade.inc"); // set session save path if (strtolower(session_module_name()) == 'files') { session_save_path(dirname(__FILE__) . '/../sess'); } // start empty session and change ID for security reasons lam_start_session(); session_destroy(); lam_start_session(); session_regenerate_id(true); $profiles = getConfigProfiles(); // save last selected login profile if (isset($_GET['useProfile'])) { if (in_array($_GET['useProfile'], $profiles)) { setcookie("lam_default_profile", $_GET['useProfile'], time() + 365*60*60*24, '/', null, null, true); } else { unset($_GET['useProfile']); } } // save last selected language if (isset($_POST['language'])) { setcookie('lam_last_language', htmlspecialchars($_POST['language']), time() + 365*60*60*24, '/', null, null, true); } // init some session variables $default_Config = new LAMCfgMain(); $_SESSION["cfgMain"] = $default_Config; setSSLCaCert(); $default_Profile = $default_Config->default; if(isset($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], $profiles)) { $default_Profile = $_COOKIE["lam_default_profile"]; } // Reload loginpage after a profile change if(isset($_GET['useProfile']) && in_array($_GET['useProfile'], $profiles)) { logNewMessage(LOG_DEBUG, "Change server profile to " . $_GET['useProfile']); $_SESSION['config'] = new LAMConfig($_GET['useProfile']); // Recreate the config object with the submited } // Load login page elseif (!empty($default_Profile) && in_array($default_Profile, $profiles)) { $_SESSION["config"] = new LAMConfig($default_Profile); // Create new Config object } else if (sizeof($profiles) > 0) { // use first profile as fallback $_SESSION["config"] = new LAMConfig($profiles[0]); } else { $_SESSION["config"] = null; } $error_message = null; if (!isset($default_Config->default) || !in_array($default_Config->default, $profiles)) { $error_message = _('No default profile set. Please set it in the server profile configuration.'); } $possibleLanguages = getLanguages(); $encoding = 'UTF-8'; if (isset($_COOKIE['lam_last_language'])) { foreach ($possibleLanguages as $lang) { if (strpos($_COOKIE['lam_last_language'], $lang->code) === 0) { $_SESSION['language'] = $lang->code; $encoding = $lang->encoding; break; } } } elseif (!empty($_SESSION["config"])) { $defaultLang = $_SESSION["config"]->get_defaultLanguage(); foreach ($possibleLanguages as $lang) { if (strpos($defaultLang, $lang->code) === 0) { $_SESSION['language'] = $lang->code; $encoding = $lang->encoding; break; } } } else { $_SESSION['language'] = 'en_GB.utf8'; } if (isset($_POST['language'])) { foreach ($possibleLanguages as $lang) { if (strpos($_POST['language'], $lang->code) === 0) { $_SESSION['language'] = $lang->code; $encoding = $lang->encoding; break; } } } $_SESSION['header'] = "\n\n"; $_SESSION['header'] .= "\n
\n"; $_SESSION['header'] .= "\n"; $_SESSION['header'] .= "\n "; /** * Displays the login window. * * @param \LAM\ENV\LAMLicenseValidator $licenseValidator license validator * @param string $error_message error message to display */ function display_LoginPage($licenseValidator, $error_message) { $config_object = $_SESSION['config']; $cfgMain = $_SESSION["cfgMain"]; logNewMessage(LOG_DEBUG, "Display login page"); // generate 256 bit key and initialization vector for user/passwd-encryption if(function_exists('openssl_random_pseudo_bytes') && ($cfgMain->encryptSession == 'true')) { $key = openssl_random_pseudo_bytes(32); $iv = openssl_random_pseudo_bytes(16); // save both in cookie setcookie("Key", base64_encode($key), 0, "/", null, null, true); setcookie("IV", base64_encode($iv), 0, "/", null, null, true); } $profiles = getConfigProfiles(); setlanguage(); // setting correct language echo $_SESSION["header"]; printHeaderContents('LDAP Account Manager', '..'); ?> 0) { StatusMessage('ERROR', 'Unable to migrate configuration files. Please allow write access to these paths:', implode('LAM |
|
|