20 private string $inout =
'inbox';
22 public function __construct()
24 if (method_exists(
'AbstractAction',
'__construct')) {
25 parent::__construct();
29 public function execute()
31 $isAjax = $this->root->mContext->mRequest->getRequest(
'ajax') == 1;
33 if (
'in' == $this->root->mContext->mRequest->getRequest(
'inout')) {
34 $this->inout =
'inbox';
36 $this->inout =
'outbox';
40 $modHand = xoops_getmodulehandler($this->inout, _MY_DIRNAME);
41 $boxid = (int)$this->root->mContext->mRequest->getRequest($this->inout);
42 $modObj = $modHand->get($boxid);
45 if (!is_object($modObj)) {
47 header(
'Content-Type: application/json');
48 echo json_encode([
'success' =>
false,
'error' => _MD_MESSAGE_ACTIONMSG1]);
51 $this->setErr(_MD_MESSAGE_ACTIONMSG1);
55 if ($modObj->get(
'uid') != $this->root->mContext->mXoopsUser->get(
'uid')) {
57 header(
'Content-Type: application/json');
58 echo json_encode([
'success' =>
false,
'error' => _MD_MESSAGE_ACTIONMSG2]);
61 $this->setErr(_MD_MESSAGE_ACTIONMSG2);
66 if ($modHand->delete($modObj)) {
68 header(
'Content-Type: application/json');
71 'message' => _MD_MESSAGE_ACTIONMSG3,
72 'deleted_id' => $boxid,
73 'inout' => $this->inout
77 $this->setErr(_MD_MESSAGE_ACTIONMSG3);
80 header(
'Content-Type: application/json');
81 echo json_encode([
'success' =>
false,
'error' => _MD_MESSAGE_ACTIONMSG4]);
84 $this->setErr(_MD_MESSAGE_ACTIONMSG4);