Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
indexq.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 global $tic1;
19 
20 $deb = gettimeofday();
21 $tic1 = $deb["sec"] + $deb["usec"] / 1000000;
22 include_once ('WHAT/Lib.Main.php');
23 include_once ('WHAT/Class.AuthenticatorManager.php');
24 include_once ('WHAT/wdebug.php');
25 
26 register_shutdown_function('handleFatalShutdown');
27 
29 global $TSQLDELAY;
30 
31 function sortqdelay($a, $b)
32 {
33  $xa = doubleval($a["t"]);
34  $xb = doubleval($b["t"]);
35  if ($xa > $xb) return -1;
36  else if ($xa < $xb) return 1;
37  return 0;
38 }
39 
40 $status = AuthenticatorManager::checkAccess();
41 switch ($status) {
42  case AuthenticatorManager::AccessOk: // it'good, user is authentified
43  break;
44 
46  // User must change his password
47  AuthenticatorManager::$auth->logout("authent.php?sole=A&app=AUTHENT&action=ERRNO_BUG_639");
48  exit(0);
49  break;
50 
52  default:
53  sleep(1); // for robots
54  // Redirect to authentication
55  global $_POST;
56  AuthenticatorManager::$auth->askAuthentication(array());
57  exit(0);
58 }
59 
60 $_SERVER['PHP_AUTH_USER'] = AuthenticatorManager::$auth->getAuthUser();
61 
63 if ($account === false) {
64  throw new \Dcp\Exception(_("User must be authenticate"));
65 }
67  if ($account->login != 'admin') {
68  include_once ('TOOLBOX/stop.php');
69  exit(0);
70  }
71 }
73 
74 global $action;
75 $deb = gettimeofday();
76 $ticainit = $deb["sec"] + $deb["usec"] / 1000000;
77 $trace = $action->read("trace");
78 $trace["url"] = $_SERVER["REQUEST_URI"];
79 $trace["init"] = sprintf("%.03fs", $ticainit - $tic1);
80 $out = '';
81 $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/tracetime.js");
82 
83 $actionRouter->executeAction($out);
84 //usort($TSQLDELAY, "sortqdelay");
85 addLogMsg($TSQLDELAY);
86 $deb = gettimeofday();
87 $tic4 = $deb["sec"] + $deb["usec"] / 1000000;
88 $trace["app"] = sprintf("%.03fs", $tic4 - $ticainit);
89 $trace["memory"] = sprintf("%dkb", round(memory_get_usage() / 1024));
90 $trace["queries"] = sprintf("%.03fs #%d", $SQLDELAY, count($TSQLDELAY));
91 $trace["server all"] = sprintf("%.03fs", $tic4 - $tic1);
92 $trace["n"] = "-------------";
93 $strace = 'var TTRACE=new Object();' . "\n";
94 
95 foreach ($trace as $k => $v) $strace.= sprintf(" TTRACE['%s']='%s';\n", $k, str_replace("'", " ", $v));
96 
97 $logcode = $action->lay->GenJsCode(true, true);
98 
99 $out = str_replace("<head>", sprintf('<head><script>%s</script>', $strace) , $out);
100 $out = str_replace('</head>', sprintf('<script type="text/javascript">%s</script></head>', $logcode) , $out);
101 echo ($out);
102 $action->unregister("trace");
$deb
Definition: indexq.php:20
global $SQLDEBUG
Definition: indexq.php:28
$account
Definition: indexq.php:62
global $_POST
Definition: chgpasswd.php:17
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
Definition: checklist.php:45
$tic4
Definition: indexq.php:87
static inMaintenance()
global $TSQLDELAY
Definition: indexq.php:29
global $SQLDELAY
Definition: indexq.php:28
if($account===false) if(ActionRouter::inMaintenance()) $actionRouter
Definition: indexq.php:72
$trace
Definition: indexq.php:77
global $action
Definition: indexq.php:74
switch($status) $_SERVER['PHP_AUTH_USER']
Definition: indexq.php:60
sortqdelay($a, $b)
Definition: indexq.php:31
$status
Definition: indexq.php:40
$out
Definition: indexq.php:80
$logcode
Definition: indexq.php:97
switch($command) exit
Definition: checkVault.php:46
$ticainit
Definition: indexq.php:76
global $tic1
Definition: indexq.php:18
$strace
Definition: indexq.php:93
← centre documentaire © anakeen