page: ignore missing accept header in api detection
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 29 Mar 2021 23:21:37 +0000 (01:21 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 27 Apr 2021 00:44:28 +0000 (02:44 +0200)
Silence PHP warnings for some [robot] requests.

page.php

index f9dabf07caf4f7a9e3e2d231a4e67f6efad86da9..c313467ffe3076674dbe31631a0a25ebbcb29e72 100644 (file)
--- 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) {