From 9eb547d20d5b609be5a179ec8e89331668c0f82a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 3 Feb 2010 03:07:30 +0100 Subject: [PATCH] LSldap : added methode isValidFilter() --- public_html/includes/class/class.LSldap.php | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/public_html/includes/class/class.LSldap.php b/public_html/includes/class/class.LSldap.php index 4db02c6c..3f3e1843 100644 --- a/public_html/includes/class/class.LSldap.php +++ b/public_html/includes/class/class.LSldap.php @@ -429,6 +429,29 @@ class LSldap { return $filter; } } + else { + LSerror :: addErrorCode(0,$filter -> getMessage()); + } + } + return; + } + + /** + * Check LDAP Filters String + * + * @params string A LDAP filter as string + * + * @retval boolean True only if the filter could be parsed + **/ + public static function isValidFilter($filter) { + if (is_string($filter) && !empty($filter)) { + $filter=Net_LDAP2_Filter::parse($filter); + if (!Net_LDAP2::isError($filter)) { + return true; + } + else { + LSerror :: addErrorCode(0,$filter -> getMessage()); + } } return; }