From 601229248d3129dea5b36a81d76769af61a7138f Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 14 Oct 2021 12:20:36 +0800 Subject: [PATCH 1/2] * Code for task#43168. --- lib/base/front/front.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index dc2297ca6b..c972930c66 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -492,11 +492,12 @@ class baseHTML global $lang, $app, $config; if(empty($label)) $label = $lang->goback; - if(!isset($_SERVER['HTTP_REFERER'])) return "{$label}";; - $tab = $_COOKIE['tab']; - $referer = strtolower($_SERVER['HTTP_REFERER']); + $referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''; $refererParts = parse_url($referer); + + if(empty($refererParts) or !isset($refererParts['query'])) return "{$label}"; + $refererLink = $config->requestType == 'PATH_INFO' ? $refererParts['path'] : $refererParts['query']; $currentModule = $app->getModuleName(); $currentMethod = $app->getMethodName(); From 63248e8f8fa58faeb93f85654ff5f7c71d32e8e1 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 14 Oct 2021 13:47:13 +0800 Subject: [PATCH 2/2] * Code for task#43168. --- lib/base/front/front.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index c972930c66..4779559811 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -492,11 +492,13 @@ class baseHTML global $lang, $app, $config; if(empty($label)) $label = $lang->goback; - $tab = $_COOKIE['tab']; - $referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''; - $refererParts = parse_url($referer); + $gobackLink = "{$label}"; + $tab = $_COOKIE['tab']; + $referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : ''; + $refererParts = parse_url($referer); - if(empty($refererParts) or !isset($refererParts['query'])) return "{$label}"; + if($config->requestType == 'PATH_INFO' and empty($refererParts)) return $gobackLink; + if($config->requestType == 'GET' and !isset($refererParts['query'])) return $gobackLink; $refererLink = $config->requestType == 'PATH_INFO' ? $refererParts['path'] : $refererParts['query']; $currentModule = $app->getModuleName();