summaryrefslogtreecommitdiffstats
path: root/application/core
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-07-13 21:47:56 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-13 21:47:56 +0200
commit3bd289a3c14f377c3c689f97cf20366571f6add9 (patch)
tree9b523be2327def5e18c6a22e6084bbae570f5277 /application/core
parentf67a3cf212a774945a0d10143e93071e19dc40f4 (diff)
Throw public exception when accessing CLI only functions
We actually don't need to hide this from the user. The error should be shown rather than a blank page being returned. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/core')
-rw-r--r--application/core/MY_Controller.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php
index 79d258c37..ede6577da 100644
--- a/application/core/MY_Controller.php
+++ b/application/core/MY_Controller.php
@@ -105,4 +105,11 @@ class MY_Controller extends CI_Controller {
$this->data["user_logged_in"] = $this->muser->logged_in();
$this->data['redirect_uri'] = $this->uri->uri_string();
}
+
+ protected function _require_cli_request()
+ {
+ if (!$this->input->is_cli_request()) {
+ throw new \exceptions\PublicApiException("api/cli-only", "This function can only be accessed via the CLI interface");
+ }
+ }
}