summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-30 11:35:44 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-30 11:35:44 (GMT)
commitdf76f949cbc592a3b58079ace738b3d16e0f323d (patch)
tree85afb3fba305015bc2562b28d41200daf8e3ca67
parente39ec68a94c12786d7ec6648ed253e90c62ae07c (diff)
downloadkolab-wap-dev/configuration-handling.tar.gz
Only use $_SESSION['user']->get_domain() if the method actually existsdev/configuration-handling
-rw-r--r--lib/Conf.php15
-rw-r--r--lib/kolab_client_task.php6
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/Conf.php b/lib/Conf.php
index 7c35baf..d333e42 100644
--- a/lib/Conf.php
+++ b/lib/Conf.php
@@ -106,10 +106,17 @@ class Conf {
// and we can try and iterate over it.
// First, try the most exotic.
- if (isset($_SESSION['user'])) {
- $domain_section_name = $_SESSION['user']->get_domain();
- if (isset($this->_conf[$domain_section_name][$key1])) {
- return $this->_conf[$domain_section_name][$key1];
+ if (isset($_SESSION['user']) && method_exists($_SESSION['user'], 'get_domain')) {
+ try {
+ $domain_section_name = $_SESSION['user']->get_domain();
+ if (isset($this->_conf[$domain_section_name][$key1])) {
+ return $this->_conf[$domain_section_name][$key1];
+ }
+ } catch (Exception $e) {
+ $domain_section_name = $this->get('kolab', 'primary_domain');
+ if (isset($this->_conf[$domain_section_name][$key1])) {
+ return $this->_conf[$domain_section_name][$key1];
+ }
}
}
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index d454215..54a5c2d 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -107,7 +107,7 @@ class kolab_client_task
$url = $this->config_get('api_url', '');
// TODO: Debug logging
- console($url);
+ //console($url);
if (!$url) {
$url = kolab_utils::https_check() ? 'https://' : 'http://';
@@ -117,7 +117,7 @@ class kolab_client_task
}
// TODO: Debug logging
- console($url);
+ //console($url);
$this->api = new kolab_client_api($url);
}
@@ -173,6 +173,8 @@ class kolab_client_task
if ($login['username']) {
$result = $this->api->login($login['username'], $login['password']);
+ //console($result);
+
if ($token = $result->get('session_token')) {
$user = array('token' => $token, 'domain' => $result->get('domain'));