refactoring

This commit is contained in:
Roland Gruber 2017-05-25 11:00:58 +02:00
parent e6dd937f32
commit 129338dfa6
2 changed files with 26 additions and 4 deletions

View File

@ -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.
*

View File

@ -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;
}
/**