lib/kolab_api_controller.php
Aleksander Machniak
machniak at kolabsys.com
Mon Sep 22 13:05:21 CEST 2014
lib/kolab_api_controller.php | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
New commits:
commit 051ae9273df5ac9985188a87d8574b97b8a3c9c6
Author: Aleksander Machniak <alec at alec.pl>
Date: Mon Sep 22 13:04:40 2014 +0200
Fix unhandled exception when GET does not contain service or method
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);
More information about the commits
mailing list