X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/0ddf79607092e0aaaa69e46e3f2d4160117da495..c9b54617b5fc2583c548913a65e1f521fa7852f0:/page.php diff --git a/page.php b/page.php index dae5081..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'; } @@ -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();