示例#1
0
 public function action_remove_contact_tag()
 {
     $this->noGuest();
     $contact = new ContactObj($_REQUEST["cid"]);
     if (!$contact->loaded) {
         return print "Contact could not be found.";
     }
     $tags = array_flip(explode(",", $contact->tags));
     unset($tags[$_REQUEST["tag"]]);
     $contact->tags = implode(",", array_keys($tags));
     if (!$contact->save()) {
         $name = $contact->firstname . " " . $contact->lastname;
         $log = new LogObj();
         $log->type = "error";
         $log->log_message = "Attempting to update tags of contact (" . $contact->cid . ") \"{$name}\" bio.\n";
         $log->log_message .= $contact->get_error();
         if (!$log->save()) {
             die($log->get_error());
         }
         return print $log->log_message;
     }
     return print 1;
 }