summaryrefslogtreecommitdiffstats
path: root/lib/kolab_api_controller.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-09-22 13:04:40 +0200
committerAleksander Machniak <alec@alec.pl>2014-09-22 13:04:40 +0200
commit051ae9273df5ac9985188a87d8574b97b8a3c9c6 (patch)
tree6c9ed40226f03bd1c273f441e3d739969d589930 /lib/kolab_api_controller.php
parent281cb9f4ef6a5f7a3e3fb707510dc2ad225ef3ef (diff)
downloadwebadmin-051ae9273df5ac9985188a87d8574b97b8a3c9c6.tar.gz
Fix unhandled exception when GET does not contain service or method
Diffstat (limited to 'lib/kolab_api_controller.php')
-rw-r--r--lib/kolab_api_controller.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/kolab_api_controller.php b/lib/kolab_api_controller.php
index a735a68..db7a842 100644
--- a/lib/kolab_api_controller.php
+++ b/lib/kolab_api_controller.php
@@ -41,21 +41,6 @@ class kolab_api_controller
$this->output = new kolab_json_output();
$this->config = Conf::get_instance();
- if (!empty($_GET['service'])) {
- if (!empty($_GET['method'])) {
- $this->request = array(
- 'service' => $_GET['service'],
- 'method' => $_GET['method']
- );
- }
- else {
- throw new Exception("Unknown method " . $_GET['method'], 400);
- }
- }
- else {
- throw new Exception("Unknown service " . $_GET['service'], 400);
- }
-
// TODO: register services based on config or whatsoever
$this->add_service('domain', 'kolab_api_service_domain');
$this->add_service('domain_types', 'kolab_api_service_domain_types');
@@ -135,6 +120,21 @@ class kolab_api_controller
*/
public function dispatch($postdata)
{
+ if (!empty($_GET['service'])) {
+ if (!empty($_GET['method'])) {
+ $this->request = array(
+ 'service' => $_GET['service'],
+ 'method' => $_GET['method']
+ );
+ }
+ else {
+ throw new Exception("Unknown method " . $_GET['method'], 400);
+ }
+ }
+ else {
+ throw new Exception("Unknown service " . $_GET['service'], 400);
+ }
+
// Use proxy
if (empty($_GET['proxy']) && ($url = $this->config->get('kolab_wap', 'api_url'))) {
$this->proxy($postdata, $url);