page: allow remote access for xml requests
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 28 Dec 2020 02:41:50 +0000 (03:41 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Jan 2021 05:02:36 +0000 (06:02 +0100)
Made for inclusion from scripts such as dashboard page.

page.php

index 0c101f8026e78dfe226e0350c56198c8f7e30136..3e3f4cc10e4db38f995f195a8023e3138c2130d4 100644 (file)
--- a/page.php
+++ b/page.php
@@ -83,7 +83,10 @@ else {
        }
 }
 
-if (!$Page->api and $_SERVER['HTTP_ACCEPT'] !== 'application/xml') {
+if ($_SERVER['HTTP_ACCEPT'] === 'application/xml') {
+       header('Access-Control-Allow-Origin: *');
+}
+elseif (!$Page->api) {
        include_once 'page.inc.php';
 }
 print $Page->render();