From 85b6c60d07276653f742cd2cf1e107fd790f2bc1 Mon Sep 17 00:00:00 2001 From: Carsten Rose <carsten.rose@math.uzh.ch> Date: Fri, 13 May 2016 19:05:23 +0200 Subject: [PATCH] Variables.php: fixed access to variables without apache --- extension/qfq/qfq/report/Variables.php | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/extension/qfq/qfq/report/Variables.php b/extension/qfq/qfq/report/Variables.php index 839417039..4f3bcf5b6 100644 --- a/extension/qfq/qfq/report/Variables.php +++ b/extension/qfq/qfq/report/Variables.php @@ -108,10 +108,23 @@ class Variables { public function collectGlobalVariables() { $arr = array(); - //TODO: Variablen sollten vom STORE_TYPO3 genommen werden - $arr["REMOTE_ADDR"] = $_SERVER["REMOTE_ADDR"]; - $arr["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; - $arr["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; + if (isset($_SERVER["REMOTE_ADDR"])) { + //TODO: Variablen sollten vom STORE_TYPO3 genommen werden + $arr["REMOTE_ADDR"] = $_SERVER["REMOTE_ADDR"]; + $arr["HTTP_HOST"] = $_SERVER["HTTP_HOST"]; + $arr["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; + + $protocol = 'http'; + if (isset($_SERVER['HTTPS'])) { + if ($_SERVER["HTTPS"] != "off") + $protocol = 'https'; + } + $arr["url"] = $protocol . "://" . $_SERVER["HTTP_HOST"]; + if ($_SERVER["SERVER_PORT"] != 80) + $arr["url"] .= ":" . $_SERVER["SERVER_PORT"]; + $arr["url"] .= $arr["REQUEST_URI"]; + } + if (isset($GLOBALS["TSFE"]->fe_user)) { $arr["fe_user_uid"] = $GLOBALS["TSFE"]->fe_user->user["uid"] ?: '-'; $arr["fe_user"] = $GLOBALS["TSFE"]->fe_user->user["username"] ?: '-'; @@ -125,15 +138,6 @@ class Variables { $arr["page_type"] = $GLOBALS["TSFE"]->type; $arr["page_language_uid"] = $GLOBALS["TSFE"]->sys_language_uid; $arr["ttcontent_uid"] = $this->tt_content_uid; - $protocol = 'http'; - if (isset($_SERVER['HTTPS'])) { - if ($_SERVER["HTTPS"] != "off") - $protocol = 'https'; - } - $arr["url"] = $protocol . "://" . $_SERVER["HTTP_HOST"]; - if ($_SERVER["SERVER_PORT"] != 80) - $arr["url"] .= ":" . $_SERVER["SERVER_PORT"]; - $arr["url"] .= $arr["REQUEST_URI"]; // Add all variables from ext_localconf // database aliases can be used in form sql queries (e.g. select * from "{{global.t3_name}}".fe_users...) -- GitLab