diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2017-07-08 14:37:41 -0400 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2017-07-08 14:37:41 -0400 |
| commit | 67b14220de0b532e9a6f8746f5e65be02251621e (patch) | |
| tree | 7c5e2a7dd8a4ffca63f190b2de5454d00cec1130 | |
| parent | 4b0a7c07e3de186d93b2a48b50eee2f9ddcec142 (diff) | |
| download | august-offensive-67b14220de0b532e9a6f8746f5e65be02251621e.tar.gz august-offensive-67b14220de0b532e9a6f8746f5e65be02251621e.tar.bz2 august-offensive-67b14220de0b532e9a6f8746f5e65be02251621e.zip | |
Provide callback mechanism
| -rw-r--r-- | index.php | 2 | ||||
| -rw-r--r-- | private/Model/Query.php | 2 | ||||
| -rw-r--r-- | private/View/Main.php | 21 |
3 files changed, 18 insertions, 7 deletions
@@ -24,7 +24,7 @@ use AugustOffensive\View; use AugustOffensive\Controller; // configure content type before anything is output -header("Content-Type: application/" + View\Main::TYPE); +header("Content-Type: application/" . View\Main::TYPE); try { // initiate connection and build front-end diff --git a/private/Model/Query.php b/private/Model/Query.php index df05b24..7eca836 100644 --- a/private/Model/Query.php +++ b/private/Model/Query.php @@ -54,7 +54,7 @@ class Query * * @return string */ - public function get_request (): string + public function getRequest (): string { return $this->request; } diff --git a/private/View/Main.php b/private/View/Main.php index 746c2bb..b693979 100644 --- a/private/View/Main.php +++ b/private/View/Main.php @@ -19,7 +19,7 @@ class Main private $result; /** @var string TYPE The type of output the client should receive. */ - private const TYPE = "json"; + public const TYPE = "json"; /** * Prepares the output and environment for the front end of the service. @@ -65,10 +65,21 @@ class Main */ public function generateResult (): string { - $this->result = Controller\Controller::createResult( - "", - array() - ); + switch (strtolower($this->query->getPath()[1])) { + case "callback": + $this->result = Controller\Controller::createResult( + "CALLBACK", + array( + "path" => $this->query->getPath(), + "request" => $this->query->getRequest(), + "content" => $this->query->getContent() + ) + ); + break; + default: + $this->result = Controller\Controller::createResult("", array()); + break; + } return self::generateOutput($this->result); } |
