header('Content-Type: text/html; charset=utf-8');
-if($_REQUEST['taglookup']){
+if(!empty($_REQUEST['taglookup'])){
ajax_taglookup($_REQUEST['taglookup']);
-}elseif($_REQUEST['addnote']){
+}elseif(!empty($_REQUEST['addnote'])){
ajax_addnote($_REQUEST['addnote'],$_REQUEST['note']);
-}elseif($_REQUEST['settags']){
+}elseif(!empty($_REQUEST['settags'])){
ajax_settags($_REQUEST['settags'],$_REQUEST['tags']);
}
function ajax_settags($dn,$tags){
global $conf;
global $LDAP_CON;
- if(!$conf[extended]) return;
+ if(!$conf['extended']) return;
$tags = explode(',',$tags);
$tags = array_map('trim',$tags);
$tags = array_unique($tags);
+ $tags = array_diff($tags, array('')); //strip empty ones
$entry['marker'] = $tags;
- ldap_modify($LDAP_CON,$dn,$entry);
+ ldap_mod_replace($LDAP_CON,$dn,$entry);
foreach ($tags as $tag){
print '<a href="index.php?marker=';
function ajax_taglookup($tag){
global $conf;
global $LDAP_CON;
- if(!$conf[extended]) return;
+ if(!$conf['extended']) return;
$search = ldap_filterescape($tag);
$filter = "(&(objectClass=contactPerson)(marker=$search*))";