From f22b41da55b25236237d540eae39027ed0eee420 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Sat, 10 Jun 2023 18:21:10 +0800 Subject: [PATCH] * Reduce the PHP Fatal error: Uncaught EndResponseException. --- module/common/model.php | 10 +++++----- www/index.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 27c126786f..a5191fa482 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -2525,13 +2525,13 @@ EOF; * 忽略如下情况:非 HTML 请求、Ajax 请求、特殊 GET 参数 _single。 * Ignore the following situations: non-HTML request, Ajax request, special GET parameter _single. */ - if($this->app->getViewType() != 'html' || helper::isAjaxRequest() || isset($_GET['_single'])) return; + if($this->app->getViewType() != 'html' || helper::isAjaxRequest() || isset($_GET['_single'])) return true; /** * 忽略无请求头 HTTP_SEC_FETCH_DEST 或者 HTTP_SEC_FETCH_DEST 为 iframe 的请求,较新的浏览器在启用 https 的情况下才会正确发送该请求头。 * Ignore the request without HTTP_SEC_FETCH_DEST or HTTP_SEC_FETCH_DEST is iframe, the latest browser will send this request header correctly when enable https. */ - if(!isset($_SERVER['HTTP_SEC_FETCH_DEST']) || $_SERVER['HTTP_SEC_FETCH_DEST'] == 'iframe') return; + if(!isset($_SERVER['HTTP_SEC_FETCH_DEST']) || $_SERVER['HTTP_SEC_FETCH_DEST'] == 'iframe') return true; /** * 当有 HTTP_REFERER 请求头时,忽略 safari 浏览器,因为 safari 浏览器不会正确发送 HTTP_SEC_FETCH_DEST 请求头。 @@ -2540,7 +2540,7 @@ EOF; if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) { $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); - if(strpos($userAgent, 'chrome') === false && strpos($userAgent, 'safari') !== false) return; + if(strpos($userAgent, 'chrome') === false && strpos($userAgent, 'safari') !== false) return true; } /** @@ -2550,7 +2550,7 @@ EOF; $module = $this->app->getModuleName(); $method = $this->app->getMethodName(); $whitelist = '|index|tutorial|install|upgrade|sso|cron|misc|user-login|user-deny|user-logout|user-reset|user-forgetpassword|user-resetpassword|my-changepassword|my-preference|file-read|file-download|file-uploadimages|file-ajaxwopifiles|report-annualdata|misc-captcha|execution-printkanban|traincourse-ajaxuploadlargefile|traincourse-playvideo|'; - if(strpos($whitelist, "|{$module}|") !== false || strpos($whitelist, "|{$module}-{$method}|") !== false) return; + if(strpos($whitelist, "|{$module}|") !== false || strpos($whitelist, "|{$module}-{$method}|") !== false) return true; /** * 如果以上条件都不满足,则视为当前页面必须在 iframe 中打开,使用 302 跳转实现。 @@ -2560,7 +2560,7 @@ EOF; $redirectUrl = helper::createLink('index', 'index'); $redirectUrl .= strpos($redirectUrl, '?') === false ? "?open=$url" : "&open=$url"; header("location: $redirectUrl"); - helper::end(); + return false; } /** diff --git a/www/index.php b/www/index.php index b6be89b234..af3f4985e6 100644 --- a/www/index.php +++ b/www/index.php @@ -71,7 +71,7 @@ if(!empty($_GET['display']) && $_GET['display'] == 'card') $config->default->vie $app->parseRequest(); if(!$app->setParams()) return; $common->checkPriv(); -$common->checkIframe(); +if(!$common->checkIframe()) return; $app->loadModule(); /* Flush the buffer. */