]> git.wh0rd.org - tt-rss.git/commitdiff
api: disable deprecated HTTP parameter support by default
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 17 Aug 2012 11:16:13 +0000 (15:16 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 17 Aug 2012 11:16:13 +0000 (15:16 +0400)
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"]) {