From 3128357553f8eb8f8a782f7e197f6d74465a90e8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 29 Nov 2005 09:18:28 +0000 Subject: [PATCH] Fix one fixme git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2120 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/index.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/html/index.php b/html/index.php index dc788d494..74591d847 100644 --- a/html/index.php +++ b/html/index.php @@ -135,6 +135,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ if (is_null($ldap) || (is_int($ldap) && $ldap == 0)){ print_red (_("Can't bind to LDAP. Please contact the system administrator.")); echo $_SESSION['errors']; + $smarty->display(get_template_path('login.tpl')); exit(); } @@ -168,10 +169,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST"){ $ldap->cd($config->current['BASE']); $ldap->search("(&(objectClass=gosaObject)(gosaSubtreeACL=:all))"); if ($ldap->count() < 1){ -#FIXME: -> ldapsetup.tpl would be better print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!")); - echo $_SESSION['errors']; - exit; + displayLogin(); + exit(); } /* Check for valid input */ @@ -255,6 +255,71 @@ if ($error_collector != ""){ } $smarty->display (get_template_path('login.tpl')); + + + + + + +function displayLogin() +{ + global $smarty,$message,$config,$ssl,$error_collector; + error_reporting(E_ALL); + /* Fill template with required values */ + $username = ""; + if(isset($_POST["username"])){ + $username= $_POST["username"]; + } + $smarty->assign ('date', gmdate("D, d M Y H:i:s")); + $smarty->assign ('username', $username); + $smarty->assign ('personal_img', get_template_path('images/personal.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->data['MAIN']['WARNSSL'] == 'true'){ + $smarty->assign ("ssl", ""._("Warning").": "._("Session will not be encrypted.")." "._("Enter SSL session")."!"); + } else { + $smarty->assign ("ssl", ""); + } + + /* Generate server list */ + $servers= array(); + if (isset($_POST['server'])){ + $selected= validate($_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->display (get_template_path('headers.tpl')); + $smarty->assign ("PHPSESSID", session_id()); + if (isset($_SESSION['errors'])){ + $smarty->assign("errors", $_SESSION['errors']); + } + if ($error_collector != ""){ + $smarty->assign("php_errors", $error_collector.""); + } else { + $smarty->assign("php_errors", ""); + } + + $smarty->display(get_template_path('login.tpl')); + exit(); +} + + + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2