added escape-function for ldap-queries - will be used by contacts soon

This commit is contained in:
Carsten Wolff 2004-05-12 09:55:30 +00:00
parent 5cb848c8d6
commit bc140271bc

View File

@ -225,6 +225,19 @@
return $retValue; return $retValue;
} }
/*!
@function ldap_addslashes
@abstract escapes a string for use in searchfilters meant for ldap_search.
Escaped Characters are: '*', '(', ')', ' ', '\', NUL
It's actually a PHP-Bug, that we have to escape space.
For all other Characters, refer to RFC2254.
@param $string string to be escaped
*/
function ldap_addslashes($string='')
{
return str_replace(array('\\','*','(',')','\0',' '),array('\\\\','\*','\(','\)','\\0','\20'),$string);
}
// connect to the ldap server and return a handle // connect to the ldap server and return a handle
/*! /*!
@function ldapConnect @function ldapConnect