]> git.wh0rd.org - tt-rss.git/blobdiff - api/index.php
api: add workaround to disable OTP
[tt-rss.git] / api / index.php
index 770e09780f7067829b0022a1523b915fd000fae9..c3199857be63d859d279492f6d9c57e8d353b158 100644 (file)
@@ -14,6 +14,8 @@
        require_once "db-prefs.php";
        require_once "functions.php";
 
+       define('AUTH_DISABLE_OTP', true);
+
        if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT &&
                        function_exists("ob_gzhandler")) {
 
 
        $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"]) {