Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
data.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Main program to activate action in WHAT software
9  *
10  * All HTTP requests call index.php to execute action within application
11  *
12  * @author Anakeen 2000
13  * @version $Id: index.php,v 1.64 2008/12/16 15:51:53 jerome Exp $
14  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
15  * @package FDL
16  * @subpackage
17  */
18 /**
19  */
20 global $DEBUGINFO;
21 $DEBUGINFO["mbstart"] = microtime(true);
22 include_once ('WHAT/Lib.Main.php');
23 include_once ('WHAT/Class.AuthenticatorManager.php');
24 
26 
27 if ($authtype == 'apache') {
28  // Apache has already handled the authentication
29  global $_SERVER;
30  if ($_SERVER['PHP_AUTH_USER'] == "") {
31  header('HTTP/1.0 403 Forbidden');
32  echo _("User must be authenticate");
33  exit();
34  }
35 } else {
36 
37  $status = AuthenticatorManager::checkAccess(null, true);
38  switch ($status) {
39  case 0: // it'good, user is authentified
40  break;
41 
42  case -1:
43  // User must change his password
44  // $action->session->close();
45  $o["error"] = _("not authenticated:ERRNO_BUG_639");
46  print json_encode($o);
47  exit(0);
48  break;
49 
50  default:
51  sleep(2); // wait for robots
52  $o["error"] = _("not authenticated");
53  print json_encode($o);
54  exit(0);
55  }
56  $_SERVER['PHP_AUTH_USER'] = AuthenticatorManager::$auth->getAuthUser();
57 }
58 
59 if (file_exists('maintenance.lock')) {
60  if ($_SERVER['PHP_AUTH_USER'] != 'admin') {
61  header("HTTP/1.0 503 Service Unavailable");
62  $o["error"] = _("maintenance in progress");
63  print json_encode($o);
64  exit(0);
65  }
66 }
67 #
68 # This is the main body of App manager
69 # It is used to launch application and
70 # function giving them all necessary environment
71 # element
72 #
73 #
74 // First control
75 if (!isset($_SERVER['PHP_AUTH_USER'])) {
76  header('HTTP/1.0 403 Forbidden');
77  $o["error"] = _("not authenticated");
78  print json_encode($o);
79  exit();
80 }
81 // ----------------------------------------
82 $DEBUGINFO["mbinit"] = microtime(true);
83 getmainAction(AuthenticatorManager::$auth, $action);
84 $action->debug = true;
85 $DEBUGINFO["mbaction"] = microtime(true);
87 $DEBUGINFO["mbend"] = microtime(true);
88 ?>
← centre documentaire © anakeen - published under CC License - Dynacase