diff options
author | Andrew Dolgov <[email protected]> | 2012-08-17 15:16:13 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-17 15:16:13 +0400 |
commit | 6eaf31932003b53737c4cd45a50cd29b06955f3f (patch) | |
tree | 13b9d9dc72ede6dbeeb1ef6224b8709e9ce038dd | |
parent | 369dbc19d6ae35c97a2306ae4821c7812e2f24b2 (diff) |
api: disable deprecated HTTP parameter support by default
-rw-r--r-- | api/index.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/api/index.php b/api/index.php index 770e09780..2d555678f 100644 --- a/api/index.php +++ b/api/index.php @@ -29,11 +29,17 @@ $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"]) { |