LSldap : added methode isValidFilter()

This commit is contained in:
Benjamin Renard 2010-02-03 03:07:30 +01:00
parent bc1a92ec35
commit 9eb547d20d

View file

@ -429,6 +429,29 @@ class LSldap {
return $filter; 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; return;
} }