예제 #1
0
파일: Contacts.php 프로젝트: Kuzat/kofradia
 /**
  * Delete selected contacts
  */
 public function action_delete_many()
 {
     $removed = array();
     if (validate_sid(false) && isset($_POST['id']) && is_array($_POST['id'])) {
         foreach ($_POST['id'] as $id) {
             $contact = Contact::getContactById($id);
             if (!$contact || $contact->getOwnerUserID() != $this->user->id) {
                 break;
             }
             if ($contact->delete()) {
                 $removed[] = '<user id="' . $contact->getTargetPlayerID() . '" />';
             }
         }
     }
     if ($removed) {
         \ess::$b->page->add_message('Du fjernet ' . sentences_list($removed) . ' fra listen.');
     }
     return \redirect::handle("/kontakter", \redirect::ROOT);
 }