]> git.wh0rd.org - tt-rss.git/blobdiff - api/index.php
api: disable deprecated HTTP parameter support by default
[tt-rss.git] / api / index.php
index 770e09780f7067829b0022a1523b915fd000fae9..2d555678fec25ffb9d523294bbab5b4809ccf17b 100644 (file)
 
        $input = file_get_contents("php://input");
 
-       // Override $_REQUEST with JSON-encoded data if available
-       if ($input) {
+       if (defined('_API_DEBUG_HTTP_ENABLED') && _API_DEBUG_HTTP_ENABLED) {
+               // Override $_REQUEST with JSON-encoded data if available
+               // fallback on HTTP parameters
+               if ($input) {
+                       $input = json_decode($input, true);
+                       if ($input) $_REQUEST = $input;
+               }
+       } else {
+               // Accept JSON only
                $input = json_decode($input, true);
-
-               if ($input) $_REQUEST = $input;
+               $_REQUEST = $input;
        }
 
        if ($_REQUEST["sid"]) {