X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/af5d5f4037aabc493afa60a5394ab3f8f6134917..d9e768059d2a10c2c5eb5b908a998fb496b4e4cf:/page.php diff --git a/page.php b/page.php index 0c101f8..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; } @@ -56,7 +56,7 @@ $Page->place += [ 'url' => htmlspecialchars($_SERVER['REQUEST_URI']), ]; -if ($User->admin("edit {$Page->link}")) { +if ($Page->editable = $User->admin("edit {$Page->link}")) { include_once 'edit/head.inc.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();