X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fauth%2FAuth_ldap.class.php;h=23ea127e6b692aa416b0843c2a7b9ed6dd051de9;hb=bacdf3405307cfc27832db00b09bbf52d4b9f72c;hp=0001f296ddb701eadf57382b7b8de56f4996c7a8;hpb=40c8b0474bb4204ee1c843398c86b8adecaedb14;p=timetracker.git
diff --git a/WEB-INF/lib/auth/Auth_ldap.class.php b/WEB-INF/lib/auth/Auth_ldap.class.php
index 0001f296..23ea127e 100644
--- a/WEB-INF/lib/auth/Auth_ldap.class.php
+++ b/WEB-INF/lib/auth/Auth_ldap.class.php
@@ -53,10 +53,9 @@ class Auth_ldap extends Auth {
function __construct($params)
{
+ global $smarty;
$this->params = $params;
- if (isset($GLOBALS['smarty'])) {
- $GLOBALS['smarty']->assign('Auth_ldap_params', $this->params);
- }
+ $smarty->assign('Auth_ldap_params', $this->params);
}
function ldap_escape($str){
@@ -97,7 +96,7 @@ class Auth_ldap extends Auth {
$lc = ldap_connect($this->params['server']);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '
';
echo '$lc='; var_dump($lc); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
@@ -107,7 +106,7 @@ class Auth_ldap extends Auth {
ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($lc, LDAP_OPT_REFERRALS, 0);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
ldap_set_option($lc, LDAP_OPT_DEBUG_LEVEL, 7);
}
@@ -120,13 +119,13 @@ class Auth_ldap extends Auth {
$login .= '@' . $this->params['default_domain'];
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$login='; var_dump($login); echo '
';
}
$lb = @ldap_bind($lc, $login, $password);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$lb='; var_dump($lb); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -140,10 +139,10 @@ class Auth_ldap extends Auth {
// Get groups the user is a member of from AD LDAP server.
$filter = 'userPrincipalName='.Auth_ldap::ldap_escape($login);
- $fields = array('samaccountname', 'mail', 'memberof', 'department', 'displayname', 'telephonenumber', 'primarygroupid');
+ $fields = array('memberof');
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$sr='; var_dump($sr); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -155,7 +154,7 @@ class Auth_ldap extends Auth {
$entries = @ldap_get_entries($lc, $sr);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$entries='; var_dump($entries); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -174,7 +173,7 @@ class Auth_ldap extends Auth {
$groups[] = substr($grp_fields[0], 3);
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$member_of'; var_dump($member_of); echo '
';
};
@@ -196,7 +195,7 @@ class Auth_ldap extends Auth {
// Assuming OpenLDAP server.
$login_oldap = 'uid='.$login.','.$this->params['base_dn'];
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$login_oldap='; var_dump($login_oldap); echo '
';
}
@@ -208,7 +207,7 @@ class Auth_ldap extends Auth {
$lb = @ldap_bind($lc, $login_oldap, $password);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$lb='; var_dump($lb); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -226,7 +225,7 @@ class Auth_ldap extends Auth {
$fields = array('samaccountname', 'mail', 'memberof', 'department', 'displayname', 'telephonenumber', 'primarygroupid');
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$sr='; var_dump($sr); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -239,7 +238,7 @@ class Auth_ldap extends Auth {
$entries = @ldap_get_entries($lc, $sr);
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$entries='; var_dump($entries); echo '
';
echo 'ldap_error()='; echo ldap_error($lc); echo '
';
}
@@ -259,7 +258,7 @@ class Auth_ldap extends Auth {
$groups[] = substr($grp_fields[0], 3);
}
- if (defined('AUTH_DEBUG') && isTrue(AUTH_DEBUG)) {
+ if (isTrue(AUTH_DEBUG)) {
echo '$member_of'; var_dump($member_of); echo '
';
}