Ejemplo n.º 1
0
 /**
  * User deletes a message
  *
  * @return array data sent to client as JSON
  */
 public function action_del()
 {
     $message_id = $this->request->variable('message_id', 0);
     if (!$message_id || !check_form_key('mchat', -1)) {
         throw new \phpbb\exception\http_exception(403, 'MCHAT_NOACCESS');
     }
     $author = $this->functions_mchat->mchat_author_for_message($message_id);
     if (!$author || !$this->auth_message('u_mchat_delete', $author['user_id'], $author['message_time'])) {
         throw new \phpbb\exception\http_exception(403, 'MCHAT_NOACCESS');
     }
     /**
      * Event render_helper_delete
      *
      * @event dmzx.mchat.core.render_helper_delete
      * @since 0.1.4
      */
     $this->dispatcher->dispatch('dmzx.mchat.core.render_helper_delete');
     $this->functions_mchat->mchat_action('del', null, $message_id, $author['username']);
     return array('del' => true);
 }