foreach (session::global_get('LOCK_VARS_USED_REQUEST') as $name => $value) { $_REQUEST[$name] = $value; } } } } /* Load plugin */ if (is_file("{$plugin_dir}/main.inc")) { $display = ""; require "{$plugin_dir}/main.inc"; } else { msg_dialog::display(_("Plugin"), sprintf(_("Fatal error: Cannot find any plugin definitions for plugin '%s' ('%s' is not a file)!"), $plug, "{$plugin_dir}/main.inc"), FATAL_ERROR_DIALOG); exit; } /* Print_out last ErrorMessage repeated string. */ $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("contents", $display); $smarty->assign("sessionLifetime", $config->get_cfg_value("sessionLifetime", 60 * 60 * 2)); /* If there's some post, take a look if everything is there... */ if (isset($_POST) && count($_POST)) { if (!isset($_POST['php_c_check'])) { msg_dialog::display(_("Configuration Error"), sprintf(_("Fatal error: not all POST variables have been transfered by PHP - please inform your administrator!")), FATAL_ERROR_DIALOG); exit; } } /* Assign errors to smarty */ if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>");
function displayLogin() { global $smarty, $message, $config, $ssl, $error_collector, $error_collector_mailto; $lang = session::global_get('lang'); error_reporting(E_ALL | E_STRICT); /* Fill template with required values */ $username = ''; if (isset($_POST['username'])) { $username = trim($_POST['username']); } $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('username', $username); $smarty->assign('personal_img', "geticon.php?context=types&icon=user&size=48"); $smarty->assign('password_img', "geticon.php?context=status&icon=dialog-password&size=48"); $smarty->assign('directory_img', "geticon.php?context=places&icon=network-server&size=48"); $smarty->append('css_files', get_template_path('login.css')); /* Some error to display? */ if (!isset($message)) { $message = ""; } $smarty->assign("message", $message); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value('warnSSL') == 'TRUE') { $smarty->assign("ssl", _("Warning") . ": <a style=\"color:red;\" href=\"{$ssl}\">" . _("Session is not encrypted!") . "</a>"); } else { $smarty->assign("ssl", ""); } if (!$config->check_session_lifetime()) { $smarty->assign("lifetime", _("Warning") . ": " . _("The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.")); } else { $smarty->assign("lifetime", ""); } /* Generate server list */ $servers = array(); if (isset($_POST['server'])) { $selected = $_POST['server']; } else { $selected = $config->data['MAIN']['DEFAULT']; } foreach ($config->data['LOCATIONS'] as $key => $ignored) { $servers[$key] = $key; } $smarty->assign("server_options", $servers); $smarty->assign("server_id", $selected); /* show login screen */ $smarty->assign("PHPSESSID", session_id()); if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("usePrototype", "false"); $smarty->assign("date", date("l, dS F Y H:i:s O")); $smarty->assign("lang", preg_replace('/_.*$/', '', $lang)); $smarty->assign("rtl", language_is_rtl($lang)); $smarty->display(get_template_path('headers.tpl')); $smarty->assign("version", FD_VERSION); $smarty->display(get_template_path('login.tpl')); exit; }
/** * Display the login page and exit(). * */ function displayLogin() { global $smarty, $message, $config, $ssl, $error_collector, $BASE_DIR; error_reporting(E_ALL | E_STRICT); /* Check theme compatibility */ $theme = $config->get_cfg_value("core", 'theme'); if (file_exists("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist")) { $blocks = file("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist"); foreach ($blocks as $block) { if (preg_match('/' . preg_quote($block) . '/', $_SERVER['HTTP_USER_AGENT'])) { die(sprintf(_("Your browser (%s) is blacklisted for the current theme!"), $block)); } } } /* Fill template with required values */ $username = ""; if (isset($_POST["username"])) { $username = get_post("username"); } $smarty->assign("title", "GOsa - " . $_SERVER['SERVER_NAME']); $smarty->assign("logo", image(get_template_path("images/logo.png"))); $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('username', $username); $smarty->assign('personal_img', get_template_path('images/login-head.png')); $smarty->assign('password_img', get_template_path('images/password.png')); $smarty->assign('directory_img', get_template_path('images/ldapserver.png')); /* Some error to display? */ if (!isset($message)) { $message = ""; } $smarty->assign("message", $message); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value("core", 'warnSSL') == 'true') { $smarty->assign("ssl", sprintf(_("This session is not encrypted. Click %s to enter an encrypted session."), "<a href=\"{$ssl}\">" . bold(_("here")) . "</a>")); } else { $smarty->assign("ssl", ""); } if (!$config->check_session_lifetime()) { $smarty->assign("lifetime", _("The configured session lifetime will be overridden by php.ini settings!")); } else { $smarty->assign("lifetime", ""); } /* Generate server list */ $servers = array(); if (isset($_POST['server'])) { $selected = get_post('server'); } else { $selected = $config->data['MAIN']['DEFAULT']; } foreach ($config->data['LOCATIONS'] as $key => $ignored) { $servers[$key] = $key; } $smarty->assign("server_options", $servers); $smarty->assign("server_id", $selected); /* show login screen */ $smarty->assign("PHPSESSID", session_id()); if (session::is_set('errors')) { $smarty->assign("errors", session::get('errors')); } if ($error_collector != "") { $smarty->assign("php_errors", $error_collector . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->display(get_template_path('headers.tpl')); $smarty->assign("version", get_gosa_version()); $smarty->display(get_template_path('login.tpl')); exit; }