public function delete($id) { try { $msg = new Msg($id); if (UserHelper::getProfileId() != $msg->getReceiver() and !UserHelper::isEditor()) { throw new fValidationException('not allowed'); } $msg->delete(); $this->ajaxReturn(array('result' => 'success')); } catch (fException $e) { $this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage())); } }