X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/0da9e6e7d82b2cb758626d1ee4eb6b3297d667b1..refs/heads/master:/lib/utils.inc.php?ds=inline
diff --git a/lib/utils.inc.php b/lib/utils.inc.php
index de2cbfc..6e8f624 100644
--- a/lib/utils.inc.php
+++ b/lib/utils.inc.php
@@ -22,7 +22,54 @@ class Utils {
';
+
+
+
+
';
private $footer = '
';
@@ -174,6 +221,8 @@ class Utils {
}
private function getRestTicket($username, $password) {
+ global $CFG;
+
$result = false;
$url = $CFG->wblistadm_url . '/ticket';
@@ -190,9 +239,11 @@ class Utils {
}
public function makeRestCall($method, $data = null) {
+ global $CFG;
+
$result;
- $url = $CFG->wblistadm_url . "/$method";
+ $url = $CFG->wblistadm_url . "$method";
$token = $this->getCSRFPreventionToken($_SESSION['ticket']);
$response = $this->RESTCall($url, $data, $_SESSION['cookies'], $token);
@@ -203,7 +254,11 @@ class Utils {
} else {
// HTTP GET
$data = json_decode($response['content']);
- $result = $data->data;
+ if (is_object($data)) {
+ $result = $data->data;
+ } else {
+ $result = array('No result');
+ }
}
} else {
$result = ($data) ? false : array();
@@ -309,14 +364,18 @@ class Utils {
} else {
$domain = $p[1];
$dn = "mail=$user,ou=Users,domainName=$domain,$CFG->ldap_base_dn";
+ $this->log('dn: '.var_export($dn, true), 4);
$filter = "(&(objectclass=mailUser)(accountStatus=active)(mail=$user))";
+ $this->log('filter: '.var_export($filter, true), 4);
$ds = @ldap_connect($CFG->ldap_dsn);
if ($ds) {
@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$r = @ldap_bind($ds, $dn, $pw);
if ($r) {
$sr = @ldap_search($ds, $CFG->ldap_base_dn, $filter, array('mail','domainglobaladmin'));
+ $this->log('sr: '.var_export($sr, true), 4);
$info = @ldap_get_entries($ds, $sr); // array
+ $this->log('info: '.var_export($info, true), 4);
if ($info['count'] > 0) {
// Log in to wblistadm server and get CSRFPreventionToken
if ($this->getRestTicket($user, $pw)) {
@@ -330,7 +389,7 @@ class Utils {
}
$this->settings['admin'] = ($admin == 'YES') ? true : false;
} else {
- $this->settings['loginStatus'] = 'Login failed';
+ $this->settings['loginStatus'] = 'Login to wblistadm REST server failed';
}
} else {
$this->settings['loginStatus'] = 'Login failed';