summaryrefslogtreecommitdiff
path: root/lib/kolab_client_task.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-16 09:16:55 (GMT)
committerAleksander Machniak <alec@alec.pl>2012-02-16 09:16:55 (GMT)
commit6664b058c428e86511c5330f735df3d7752b6fe8 (patch)
treef8230098602e644e88ef01376479f7abe927bbdd /lib/kolab_client_task.php
parent620c4bf621f607b21904f590e4e676f396d40362 (diff)
downloadkolab-wap-6664b058c428e86511c5330f735df3d7752b6fe8.tar.gz
Added proxy functionality - allows direct API calls
Diffstat (limited to 'lib/kolab_client_task.php')
-rw-r--r--lib/kolab_client_task.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 5a3218e..9ab856d 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -108,6 +108,13 @@ class kolab_client_task
private function api_init()
{
$url = $this->config_get('api_url', '');
+
+ if (!$url) {
+ $url = 'https://' . $_SERVER['SERVER_NAME'];
+ $url .= preg_replace('/\?.*$/', '', $_SERVER['REQUEST_URI']);
+ $url .= '/api';
+ }
+
$this->api = new kolab_client_api($url);
}
@@ -206,7 +213,7 @@ class kolab_client_task
}
// CSRF prevention
- $token = $ajax ? kolab_utils::get_request_header('X-KAP-Request') : $this->get_input('token');
+ $token = $ajax ? kolab_utils::get_request_header('X-Session-Token') : $this->get_input('token');
$task = $this->get_task();
if ($task != 'main' && $token != $_SESSION['user']['token']) {