diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2017-07-09 01:24:53 -0400 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2017-07-09 01:24:53 -0400 |
| commit | f898db8a422966d63785594c4bd0767d67167114 (patch) | |
| tree | 4834c19b2952c2f5d0923a5c52c6421645e39057 | |
| parent | 67b14220de0b532e9a6f8746f5e65be02251621e (diff) | |
| download | august-offensive-f898db8a422966d63785594c4bd0767d67167114.tar.gz august-offensive-f898db8a422966d63785594c4bd0767d67167114.tar.bz2 august-offensive-f898db8a422966d63785594c4bd0767d67167114.zip | |
Fix compat issues with Apache and PHP7.0
| -rw-r--r-- | .htaccess | 2 | ||||
| -rw-r--r-- | private/View/Main.php | 35 |
2 files changed, 21 insertions, 16 deletions
@@ -1,3 +1,3 @@ RewriteEngine On -RewriteRule ^/api/ index.php +RewriteRule ^api/(.*)$ index.php/api/$1 RedirectMatch 403 ^/private/.*$ diff --git a/private/View/Main.php b/private/View/Main.php index b693979..c51e91f 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. */ - public const TYPE = "json"; + const TYPE = "json"; /** * Prepares the output and environment for the front end of the service. @@ -65,20 +65,25 @@ class Main */ public function generateResult (): string { - 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; + $path = $this->query->getPath(); + if (count($path) >= 1 && $path[0] === "api" && count($path) >= 2) { + switch (strtolower($path[1])) { + case "callback": + $this->result = Controller\Controller::createResult( + "CALLBACK", + array( + "path" => $path, + "request" => $this->query->getRequest(), + "content" => $this->query->getContent() + ) + ); + break; + default: + $this->result = Controller\Controller::createResult("NOT_UNDERSTOOD", array($path)); + break; + } + } else { + $this->result = Controller\Controller::createResult("NOT_UNDERSTOOD", array($path)); } return self::generateOutput($this->result); |
