From: cajus Date: Mon, 9 Jul 2007 08:21:32 +0000 (+0000) Subject: Added non working password.php X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=420e0288287bdb1218482d1ad5c1d2547ad83176;p=gosa.git Added non working password.php git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6773 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/password.php b/html/password.php new file mode 100644 index 000000000..4520af895 --- /dev/null +++ b/html/password.php @@ -0,0 +1,181 @@ +display(get_template_path('passwords.tpl')); + exit(); +} + +/* Load required includes */ +require_once ("../include/php_setup.inc"); +require_once ("functions.inc"); +header("Content-type: text/html; charset=UTF-8"); + +session_start(); + +/* Destroy old session if exists. + Else you will get your old session back, if you not logged out correctly. */ +if(is_array($_SESSION) && count($_SESSION)){ + session_destroy(); + session_start(); +} + +/* Reset errors */ +$_SESSION['errors'] = ""; +$_SESSION['errorsAlreadyPosted']= array(); +$_SESSION['LastError'] = ""; + +/* Check if CONFIG_FILE is accessible */ +if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ + echo sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE); + exit(); +} + +/* Parse configuration file */ +$config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); +$_SESSION['DEBUGLEVEL']= $config->data['MAIN']['DEBUGLEVEL']; +if ($_SERVER["REQUEST_METHOD"] != "POST"){ + @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); +} + +/* Set template compile directory */ +if (isset ($config->data['MAIN']['COMPILE'])){ + $smarty->compile_dir= $config->data['MAIN']['COMPILE']; +} else { + $smarty->compile_dir= '/var/spool/gosa'; +} + +/* Check for compile directory */ +if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ + echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"), + $smarty->compile_dir); + exit(); +} + +/* Check for old files in compile directory */ +clean_smarty_compile_dir($smarty->compile_dir); + +/* Language setup */ +if ($config->data['MAIN']['LANG'] == ""){ + $lang= get_browser_language(); +} else { + $lang= $config->data['MAIN']['LANG']; +} +$lang.=".UTF-8"; +putenv("LANGUAGE="); +putenv("LANG=$lang"); +setlocale(LC_ALL, $lang); +$GLOBALS['t_language']= $lang; +$GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/'; + +/* Set the text domain as 'messages' */ +$domain = 'messages'; +bindtextdomain($domain, "$BASE_DIR/locale"); +textdomain($domain); + + +if ($_SERVER["REQUEST_METHOD"] != "POST"){ + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); +} + + +/* Check for SSL connection */ +$ssl= ""; +if (!isset($_SERVER['HTTPS']) || + !stristr($_SERVER['HTTPS'], "on")) { + + if (empty($_SERVER['REQUEST_URI'])) { + $ssl= "https://".$_SERVER['HTTP_HOST']. + $_SERVER['PATH_INFO']; + } else { + $ssl= "https://".$_SERVER['HTTP_HOST']. + $_SERVER['REQUEST_URI']; + } +} + +/* If SSL is forced, just forward to the SSL enabled site */ +if ($config->data['MAIN']['FORCESSL'] == 'true' && $ssl != ''){ + header ("Location: $ssl"); + exit; +} + +/* Got a formular answer, validate and try to log in */ +if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){ + + /* Reset error messages */ + $message= ""; + + /* Destroy old sessions, they cause a successfull login to relog again ...*/ + if(isset($_SESSION['_LAST_PAGE_REQUEST'])){ + $_SESSION['_LAST_PAGE_REQUEST'] = time(); + } + + echo "Well - I'm lazy..."; +} + +/* Fill template with required values */ +$smarty->assign ('date', gmdate("D, d M Y H:i:s")); +$smarty->assign ('username', $username); +$smarty->assign ('password_img', get_template_path('images/password.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").":<\/b> "._("Session will not be encrypted.")." "._("Enter SSL session")."<\/b>!"); +} else { + $smarty->assign ("ssl", ""); +} + +/* show login screen */ +$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", ""); +} + +/* Set focus to the error button if we've an error message */ +$focus= ""; +if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){ + $focus= ''; +} +$smarty->assign("focus", $focus); + +displayPWchanger(); + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> + + +