diff --git a/lam/lib/account.inc b/lam/lib/account.inc index ef139921..f6634089 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -727,14 +727,34 @@ function searchLDAPByFilter($filter, $attributes, $scopes, $attrsOnly = false) { * @return array list of found entries */ function searchLDAP($suffix, $filter, $attributes) { - $return = searchLDAPPaged($_SESSION['ldap']->server(), escapeDN($suffix), $filter, $attributes, - 0, $_SESSION['config']->get_searchLimit()); - if (ldap_errno($_SESSION['ldap']->server()) == 4) { + $limit = 0; + if (!empty($_SESSION['config'])) { + $limit = $_SESSION['config']->get_searchLimit(); + } + $return = searchLDAPPaged(getLDAPServerHandle(), escapeDN($suffix), $filter, $attributes, + 0, $limit); + if (ldap_errno(getLDAPServerHandle()) == 4) { logNewMessage(LOG_WARNING, 'LDAP size limit exeeded. Please increase the limit on your server.'); } return $return; } +/** + * Returns the LDAP server handle. + * + * @return handle LDAP handle + */ +function getLDAPServerHandle() { + if (!empty($_SESSION['ldap'])) { + // admin pages + return $_SESSION['ldap']->server(); + } + else { + // self service + return $_SESSION['ldapHandle']; + } +} + /** * Runs an LDAP search and uses paging if configured. * diff --git a/lam/lib/html.inc b/lam/lib/html.inc index a04f3a9b..f96ddaf5 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -798,11 +798,13 @@ class htmlTableExtendedInputField extends htmlInputField { * @param String $fieldName unique field name * @param String $fieldValue value of input field (optional) * @param String $helpID help ID (optional) + * @param boolean $required input required */ - function __construct($label, $fieldName, $fieldValue = null, $helpID = null) { + function __construct($label, $fieldName, $fieldValue = null, $helpID = null, $required = false) { parent::__construct($fieldName, $fieldValue); $this->label = htmlspecialchars($label); $this->helpID = $helpID; + $this->required = $required; } /**