From c9b54617b5fc2583c548913a65e1f521fa7852f0 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 30 Mar 2021 01:21:37 +0200 Subject: [PATCH] page: ignore missing accept header in api detection Silence PHP warnings for some [robot] requests. --- page.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/page.php b/page.php index f9dabf0..c313467 100644 --- a/page.php +++ b/page.php @@ -26,7 +26,7 @@ elseif (file_exists("$request/index.html")) { require_once('article.inc.php'); $Page = new ArchiveArticle($staticpage); -if ($_SERVER['HTTP_ACCEPT'] === 'text/plain') { +if (@$_SERVER['HTTP_ACCEPT'] === 'text/plain') { $Page->api = TRUE; } @@ -83,7 +83,7 @@ else { } } -if ($_SERVER['HTTP_ACCEPT'] === 'application/xml') { +if (@$_SERVER['HTTP_ACCEPT'] === 'application/xml') { header('Access-Control-Allow-Origin: *'); } elseif (!$Page->api) { -- 2.30.0