From ed1d212ae2daea5e4bd043417610177093e99f19 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 16 Jan 2016 03:03:51 -0500
Subject: [PATCH] Improved SVG cleanup code
---
program/lib/Roundcube/rcube_ldap_generic.php | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/program/lib/Roundcube/rcube_ldap_generic.php b/program/lib/Roundcube/rcube_ldap_generic.php
index 40adbed..d0b3576 100644
--- a/program/lib/Roundcube/rcube_ldap_generic.php
+++ b/program/lib/Roundcube/rcube_ldap_generic.php
@@ -1,6 +1,6 @@
<?php
-/*
+/**
+-----------------------------------------------------------------------+
| Roundcube/rcube_ldap_generic.php |
| |
@@ -57,12 +57,13 @@
* Get a specific LDAP entry, identified by its DN
*
* @param string $dn Record identifier
+ * @param array $attributes Attributes to return
*
* @return array Hash array
*/
- function get_entry($dn)
+ function get_entry($dn, $attributes = array())
{
- return parent::get_entry($dn, $this->attributes);
+ return parent::get_entry($dn, !empty($attributes) ? $attributes : $this->attributes);
}
/**
@@ -284,10 +285,11 @@
* Turn an LDAP entry into a regular PHP array with attributes as keys.
*
* @param array $entry Attributes array as retrieved from ldap_get_attributes() or ldap_get_entries()
+ * @param bool $flat Convert one-element-array values into strings (not implemented)
*
* @return array Hash array with attributes as keys
*/
- public static function normalize_entry($entry)
+ public static function normalize_entry($entry, $flat = false)
{
if (!isset($entry['count'])) {
return $entry;
@@ -336,7 +338,8 @@
}
$groups = array();
- $words = rcube_utils::tokenize_string($value, 1);
+ $value = str_replace('*', '', $value);
+ $words = $mode == 0 ? rcube_utils::tokenize_string($value, 1) : array($value);
// set wildcards
$wp = $ws = '';
@@ -354,7 +357,7 @@
$groups[] = '(|' . join('', $parts) . ')';
}
- return empty($groups) ? '' : '(&' . join('', $groups) . ')';
+ return count($groups) > 1 ? '(&' . join('', $groups) . ')' : join('', $groups);
}
}
--
Gitblit v1.9.1