diff --git a/lam/lib/account.inc b/lam/lib/account.inc index b895b35d..cac31cd4 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -76,7 +76,7 @@ class cache { if (strpos($_SESSION['ldap']->objectClasses[$i], "NAME '$objectClass'")) $line = $i; } // Return error if objectClass isn't found - if ($line==-1) trigger_error (_("objectClass objectClass required but not defined in ldap."), E_USER_WARNING); + if ($line==-1) trigger_error (_("objectClass $objectClass required but not defined in ldap."), E_USER_WARNING); // Everything seems to be OK, start processing data $this->refresh_cache(); if ($singlescope == '*') $scopes = $allowed_types; @@ -84,7 +84,7 @@ class cache { foreach ($scopes as $scope) { $DNs = array_keys($this->ldapcache[$scope]); foreach ($DNs as $dn) { - if (isset($this->ldapcache[$scope][$dn][$attribute])) { + if (isset($this->ldapcache[$scope][$dn][$attribute]) && in_array($objectClass, $this->ldapcache[$scope][$dn]['objectClass'])) { // return string if only attribute exists only once if (count($this->ldapcache[$scope][$dn][$attribute])==1) $return[$dn] = $this->ldapcache[$scope][$dn][$attribute][0]; else { @@ -153,8 +153,8 @@ class cache { $scopes = array_keys($this->attributes); foreach ($scopes as $scope) { // Get Scope - $function = 'get_'.ucfirst($scope).'Suffix()'; - If ($scope != '*') $suffix = $this->config->get_UserSuffix(); // fixme *** how to call function? $function; + $function = '$suffix = $this->config->get_'.ucfirst($scope).'Suffix();'; + If ($scope != '*') eval($function); else $suffix = ''; // Get Data from ldap $search = $this->attributes[$scope]; diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index 48514b31..5f230f8c 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -758,6 +758,10 @@ if (is_array($errors)) // print_r($account_new); //print_r($account_old); +//$temp = new cache(); +//$temp->add_cache(array( 'user' => array('uid', 'cn' ) )); +//print_r($temp->get_cache('uid', 'posixAccount', 'user')); +//print_r($temp->ldapcache); switch ($select_local) { /* Select which part of page should be loaded and check values