Update uri.php

This commit is contained in:
Namhyeon Go 2020-05-21 14:15:05 +09:00 committed by GitHub
parent f9db90f031
commit fb1e4bf37a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
/** /**
* @file uri.php * @file uri.php
* @created_on 2018-04-13 * @created_on 2018-04-13
* @updated_on 2020-04-12 * @updated_on 2020-05-21
* @author Go Namhyeon <gnh1201@gmail.com> * @author Go Namhyeon <gnh1201@gmail.com>
* @brief URI module * @brief URI module
*/ */
@ -103,6 +103,7 @@ if(!is_fn("read_requests")) {
"_RAW" => file_get_contents("php://input"), "_RAW" => file_get_contents("php://input"),
"_JSON" => false, "_JSON" => false,
"_SEAL" => false, "_SEAL" => false,
"_YAML" => false,
"_CSPT" => false, "_CSPT" => false,
"_SERVER" => array_map("make_safe_argument", get_array($_SERVER)), "_SERVER" => array_map("make_safe_argument", get_array($_SERVER)),
); );
@ -120,7 +121,7 @@ if(!is_fn("read_requests")) {
} }
} }
// check if `JSONData` request (referenced from NHBank API competition) // check if `JSONData` request (referenced from `2018 NHBank-KISA-TheLoop API competition`)
$jsondata = false; $jsondata = false;
if(!array_key_empty("JSONData", $requests['_ALL'])) { if(!array_key_empty("JSONData", $requests['_ALL'])) {
$options['json'] = true; $options['json'] = true;
@ -129,7 +130,7 @@ if(!is_fn("read_requests")) {
// check if json request // check if json request
if(array_key_equals("json", $options, true)) { if(array_key_equals("json", $options, true)) {
$jsondata = ($jsondata !== false) ? $jsondata : $requests['_RAW']; $jsondata = ($jsondata !== false) ? $js ondata : $requests['_RAW'];
$requests['_JSON'] = json_decode($jsondata); $requests['_JSON'] = json_decode($jsondata);
} }
@ -138,6 +139,13 @@ if(!is_fn("read_requests")) {
$requests['_SEAL'] = unserialize($requests['_RAW']); $requests['_SEAL'] = unserialize($requests['_RAW']);
} }
// check if yaml request
if(array_key_equals("yaml", $options, true)) {
if(is_fn("yaml_parse")) {
$requests['_YAML'] = yaml_parse($requests['_RAW']);
}
}
// check if cspt(catsplit) request // check if cspt(catsplit) request
if(array_key_equals("catsplit", $options, true)) { if(array_key_equals("catsplit", $options, true)) {
if(loadHelper("catsplit.format")) { if(loadHelper("catsplit.format")) {