Core
3.2
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
index.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @package FDL
5
*/
6
/**
7
* Main program to activate action in WHAT software
8
*
9
* All HTTP requests call index.php to execute action within application
10
*
11
* @author Anakeen
12
* @version $Id: index.php,v 1.64 2008/12/16 15:51:53 jerome Exp $
13
* @package FDL
14
* @subpackage
15
*/
16
/**
17
*/
18
19
include_once (
'WHAT/Lib.Main.php'
);
20
include_once (
'WHAT/Class.AuthenticatorManager.php'
);
21
include_once (
'WHAT/Class.ActionRouter.php'
);
22
23
register_shutdown_function(
'handleFatalShutdown'
);
24
25
$guestMode
=
getDbAccessValue
(
"useIndexAsGuest"
);
26
27
$needToBeGuest
=
false
;
28
29
$noAsk
= (
$guestMode
==
true
);
30
$status
= AuthenticatorManager::checkAccess(null,
$noAsk
);
31
switch
(
$status
) {
32
case
AuthenticatorManager::AccessOk
:
// it'good, user is authentified
33
$_SERVER
[
'PHP_AUTH_USER'
] =
AuthenticatorManager::$auth
->getAuthUser();
34
break
;
35
36
case
AuthenticatorManager::AccessBug
:
37
// User must change his password
38
// $action->session->close();
39
AuthenticatorManager::$auth
->logout(
"authent.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639"
);
40
exit
(0);
41
break
;
42
43
case
AuthenticatorManager::NeedAsk
:
44
$needToBeGuest
=
true
;
45
break
;
46
47
default
:
48
sleep(1);
// for robots
49
// Redirect to authentication
50
AuthenticatorManager::$auth
->askAuthentication(array());
51
52
exit
(0);
53
}
54
55
$account
=
AuthenticatorManager::getAccount
();
56
if
(
$account
===
false
) {
57
if
(!
$needToBeGuest
) {
58
throw
new \Dcp\Exception(
"You are not supposed to be here..."
);
59
}
60
}
61
if
(
$needToBeGuest
) {
62
$account
=
new
Account
();
63
if
(
$account
->setLoginName(
"anonymous"
) ===
false
) {
64
throw
new \Dcp\Exception(
"anonymous account not found."
);
65
}
66
}
67
if
(
ActionRouter::inMaintenance
()) {
68
if
(
$account
->login !=
'admin'
) {
69
include_once (
'TOOLBOX/stop.php'
);
70
exit
(0);
71
}
72
}
73
$actionRouter
=
new
ActionRouter
(
$account
,
AuthenticatorManager::$auth
);
74
$actionRouter
->executeAction();
$noAsk
$noAsk
Definition:
index.php:29
AuthenticatorManager\AccessBug
const AccessBug
Definition:
Class.AuthenticatorManager.php:31
$status
$status
Definition:
index.php:30
ActionRouter
Definition:
Class.ActionRouter.php:11
getDbAccessValue
getDbAccessValue($varName)
Definition:
Lib.Common.php:425
AuthenticatorManager\NeedAsk
const NeedAsk
Definition:
Class.AuthenticatorManager.php:38
ActionRouter\inMaintenance
static inMaintenance()
Definition:
Class.ActionRouter.php:32
$needToBeGuest
$needToBeGuest
Definition:
index.php:27
AuthenticatorManager\AccessOk
const AccessOk
Definition:
Class.AuthenticatorManager.php:32
Account
Definition:
Class.Account.php:31
$actionRouter
if($account===false) if($needToBeGuest) if(ActionRouter::inMaintenance()) $actionRouter
Definition:
index.php:73
AuthenticatorManager\getAccount
static getAccount()
Definition:
Class.AuthenticatorManager.php:275
$account
switch($status) $account
Definition:
index.php:55
AuthenticatorManager\$auth
static $auth
Definition:
Class.AuthenticatorManager.php:42
$_SERVER
global $_SERVER
Definition:
cleanContext.php:41
exit
switch($command) exit
Definition:
checkVault.php:46
$guestMode
$guestMode
Definition:
index.php:25
← centre documentaire
© anakeen