Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
loginform.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * PHP Authentification control
8  *
9  * @author Anakeen
10  * @version $Id: loginform.php,v 1.17 2008/10/10 07:16:07 eric Exp $
11  * @package FDL
12  * @subpackage CORE
13  * @deprecated since HTTP Authentification
14  */
15 /**
16  */
17 include_once ('Lib.Http.php');
18 /**
19  * PHP Authentification control
20  *
21  */
23 {
24  $action->parent->AddCssRef("AUTHENT:loginform.css", true);
25  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/resizeimg.js");
26  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/geometry.js");
27  $action->parent->addJsRef("AUTHENT:loginform.js", true);
28  $ulang = GetHttpVars("lang");
29  if ($ulang) {
30  setLanguage($ulang);
31  //$action->setparamu("CORE_LANG",$ulang);
32 
33  } else {
34  $ulang = getParam('CORE_LANG');
35  }
36  $action->lay->set("isEnglish", substr($ulang, 0, 2) == "en");
37  $error = GetHttpVars("error", 0);
38  $merr = "";
39  if ($error > 0) {
40  switch ($error) {
41  case 2:
42  $merr = _("Too many incorrect password attempts.") . _(" Please, see your manager");
43  break;
44 
45  case 3:
46  $merr = _("This account is deactivated.") . _(" Please, see your manager");
47  break;
48 
49  case 4:
50  $merr = _("This account has expired.") . _(" Please, see your manager");
51  break;
52 
53  default:
54  $merr = _("auth_failure");
55  }
56  }
57  $auth_user = GetHttpVars("auth_user");
58  $app_redir = GetHttpVars("appd", "CORE");
59  $act_redir = GetHttpVars("actd", "");
60  $arg_redir = GetHttpVars("argd", ""); // redirect url
61  $redirect_uri = GetHttpVars("redirect_uri", "");
62 
63  $action->lay->eset("app_redir", $app_redir);
64  $action->lay->eset("act_redir", $act_redir);
65  $action->lay->eset("arg_redir", $arg_redir);
66  $action->lay->set("title", _("welcome"));
67  $action->lay->eset("auth_user", $auth_user);
68  $action->lay->set("passfocus", ($auth_user !== "" ? true : false));
69  $action->lay->set("error", $merr);
70  $action->lay->eset("redirect_uri", $redirect_uri);
71  $action->lay->set("baseurl", htmlspecialchars(getParam("CORE_BASEURL")));
72 
73  $action->lay->set('authent_show_reqpasswd', $action->getParam('AUTHENT_SHOW_REQPASSWD') != 'no');
74 
75  $action->lay->set('authent_show_lang_selection', $action->getParam('AUTHENT_SHOW_LANG_SELECTION') != 'no');
76 
77  $lang = array();
78  include_once ('CORE/lang.php');
79  $lang_block = array();
80 
81  foreach ($lang as $k => $v) {
82  $lang_block[$k]['LANG_VALUE'] = $k;
83  $lang_block[$k]['LANG_LABEL'] = $lang[$k]['label'];
84  $lang_block[$k]['LANG_IS_SELECTED'] = ($ulang == $k);
85  }
86  $action->lay->setBlockData('LANG', $lang_block);
87  $action->lay->set("ulang", urlencode($ulang));
88  $action->parent->short_name = sprintf(_("%s Authentification") , $action->getParam("CORE_CLIENT"));
89 
90  header('HTTP/1.1 401 Authentication Required');
91  header('WWW-Authenticate: html-form');
92 }
93 ?>
global $action
loginform(Action &$action)
Definition: loginform.php:22
$lang
Definition: lang.php:18
getParam($name, $def="")
must be in core or global type
Definition: Lib.Common.php:193
setLanguage($lang)
Definition: Lib.Common.php:886
getParam($name, $def="")
← centre documentaire © anakeen