page: only html body on application/xml requests
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 28 Dec 2020 02:33:21 +0000 (03:33 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 1 Jan 2021 17:30:40 +0000 (18:30 +0100)
page.inc.php
page.php

index 6ffd9cc6321cd0c05c07d8669137b61c9633068a..23a7106c1d470e1705d6d830a263b8802c84c5d0 100644 (file)
@@ -23,8 +23,6 @@ $nav = preg_replace_callback('{<a href="([^"]+)">(.*?)</a>}', function ($m) {
 print $nav;
 print "</header>\n\n";
 
-print $Page->render();
-
 register_shutdown_function(function () {
        print '<footer>';
        @include 'footer.inc.html';
index 95fd01fdb716d99c98c3e71485df69926a3dbaf6..dae508103159e3518fab45a6334ba14255a95710 100644 (file)
--- a/page.php
+++ b/page.php
@@ -83,5 +83,8 @@ else {
        }
 }
 
-include_once 'page.inc.php';
+if (!$Page->api and $_SERVER['HTTP_ACCEPT'] !== 'application/xml') {
+       include_once 'page.inc.php';
+}
+print $Page->render();