page: text/plain request triggers api mode
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 27 Dec 2020 18:46:06 +0000 (19:46 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 1 Jan 2021 17:30:40 +0000 (18:30 +0100)
page.php
upload.inc.php

index a9607c0cf9ab49d60d7dc78aaca2cba629cedbc3..95fd01fdb716d99c98c3e71485df69926a3dbaf6 100644 (file)
--- a/page.php
+++ b/page.php
@@ -26,6 +26,10 @@ elseif (file_exists("$request/index.html")) {
 require_once('article.inc.php');
 $Page = new ArchiveArticle($staticpage);
 
+if ($_SERVER['HTTP_ACCEPT'] === 'text/plain') {
+       $Page->api = TRUE;
+}
+
 # user login and control
 
 include_once 'auth.inc.php'; // sets global $User
index f79600f892de3ee018377e1ab9adf460b3ce3646..6175fe20a685b1b1df707ccba8e74f4bad2564f1 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-$Page->api = $_SERVER['HTTP_ACCEPT'] == 'text/plain';
-
 function userupload($input, $target = NULL, $filename = NULL)
 {
        switch ($input['error']) {