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; } 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.'); } if (isset($_COOKIE['lam_last_language'])) { $_SESSION['language'] = $_COOKIE['lam_last_language']; } elseif (!empty($_SESSION["config"])) { $_SESSION['language'] = $_SESSION["config"]->get_defaultLanguage(); } else { $_SESSION['language'] = 'en_GB.utf8:UTF-8:English (Great Britain)'; } if (isset($_POST['language'])) { $_SESSION['language'] = htmlspecialchars($_POST['language']); // Write selected language in session } $current_language = explode(":",$_SESSION['language']); $_SESSION['header'] = "\n\n"; $_SESSION['header'] .= "\n
\n"; $_SESSION['header'] .= "\n"; $_SESSION['header'] .= "\n "; /** * Displays the login window. * * @param object $config_object current active configuration */ function display_LoginPage($config_object) { logNewMessage(LOG_DEBUG, "Display login page"); global $error_message; // generate 256 bit key and initialization vector for user/passwd-encryption // check if we can use /dev/urandom otherwise use rand() if(function_exists('mcrypt_create_iv')) { $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM); if (! $key) { srand((double)microtime()*1234567); $key = mcrypt_create_iv(32, MCRYPT_RAND); } $iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM); if (! $iv) { srand((double)microtime()*1234567); $iv = mcrypt_create_iv(32, MCRYPT_RAND); } // save both in cookie setcookie("Key", base64_encode($key), 0, "/"); setcookie("IV", base64_encode($iv), 0, "/"); } // loading available languages from language.conf file $languagefile = "../config/language"; if(is_file($languagefile) == True) { $file = fopen($languagefile, "r"); $i = 0; while(!feof($file)) { $line = fgets($file, 1024); if($line == "" || $line == "\n" || $line[0] == "#") continue; // ignore comment and empty lines $value = explode(":", $line); $languages[$i]["link"] = $value[0] . ":" . $value[1]; $languages[$i]["descr"] = $value[2]; if(trim($line) == trim($_SESSION["language"])) { $languages[$i]["default"] = "YES"; } else { $languages[$i]["default"] = "NO"; } $i++; } fclose($file); } $profiles = getConfigProfiles(); setlanguage(); // setting correct language echo $_SESSION["header"]; ?>LDAP Account Manager |
" . _("Want more features? Get LAM Pro!") . ""; } ?> |