-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
84 lines (75 loc) · 2.41 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/*
* @author Anakeen
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License
* @package FDL
*/
/**
* Main program to activate action in WHAT software
*
* All HTTP requests call index.php to execute action within application
*
* @author Anakeen 2000
* @version $Id: index.php,v 1.64 2008/12/16 15:51:53 jerome Exp $
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License
* @package FDL
* @subpackage
*/
/**
*/
include_once ('WHAT/Lib.Main.php');
include_once ('WHAT/Class.AuthenticatorManager.php');
$authtype = getAuthType();
if ($authtype == 'apache') {
// Apache has already handled the authentication
global $_SERVER;
if ($_SERVER['PHP_AUTH_USER'] == "") {
header('HTTP/1.0 403 Forbidden');
echo _("User must be authenticate");
exit;
}
} else {
$status = AuthenticatorManager::checkAccess();
switch ($status) {
case 0: // it'good, user is authentified
break;
case -1:
// User must change his password
// $action->session->close();
AuthenticatorManager::$auth->logout("guest.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639");
exit(0);
break;
default:
sleep(1); // for robots
// Redirect to authentication
AuthenticatorManager::$auth->askAuthentication();
// AuthenticatorManager::$auth->logout("guest.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639");
// AuthenticatorManager::$auth->askAuthentication(array("error" => $status));
// Redirect($action, 'AUTHENT', 'LOGINFORM&error='.$status.'&auth_user='.urlencode($_POST['auth_user']));
exit(0);
}
$_SERVER['PHP_AUTH_USER'] = AuthenticatorManager::$auth->getAuthUser();
}
if (file_exists('maintenance.lock')) {
if ($_SERVER['PHP_AUTH_USER'] != 'admin') {
include_once ('TOOLBOX/stop.php');
exit(0);
}
}
#
# This is the main body of App manager
# It is used to launch application and
# function giving them all necessary environment
# element
#
#
// First control
if (!isset($_SERVER['PHP_AUTH_USER'])) {
$dirname = dirname($_SERVER["SCRIPT_NAME"]);
Header("Location:" . $dirname . "/guest.php");
exit();
}
// ----------------------------------------
getmainAction(AuthenticatorManager::$auth, $action);
executeAction($action);
?>