page: allow remote access for xml requests
[minimedit.git] / page.php
index dae508103159e3518fab45a6334ba14255a95710..3e3f4cc10e4db38f995f195a8023e3138c2130d4 100644 (file)
--- a/page.php
+++ b/page.php
@@ -69,7 +69,7 @@ if (isset($Page->raw)) {
 include_once 'format.inc.php';
 
 ob_start();
-if ($Page->handler and !require("./{$Page->handler}/index.php")) {
+if ($Page->handler and !$Page->index($Page->api)) {
        # replace contents by code output on false return
        $Page->raw = ob_get_clean();
 }
@@ -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();