1: <?php
2: if (!defined('XOOPS_ROOT_PATH')) exit();
3:
4: class deleteallAction extends AbstractAction
5: {
6: private $inout = 'inbox';
7:
8: public function __construct()
9: {
10: parent::__construct();
11: }
12:
13: public function execute()
14: {
15: if ( $this->root->mContext->mRequest->getRequest('inout') == 'in' ) {
16: $this->inout = 'inbox';
17: $this->setUrl('index.php?action=index');
18: } else {
19: $this->inout = 'outbox';
20: $this->setUrl('index.php?action=send');
21: }
22:
23: $delid = $this->root->mContext->mRequest->getRequest('delmsg');
24: if ( !is_array($delid) || count($delid) == 0 ) {
25: $this->setErr(_MD_MESSAGE_DELETEMSG2);
26: return;
27: }
28:
29: $modHand = xoops_getmodulehandler($this->inout);
30:
31: foreach ( $delid as $boxid ) {
32: $modObj = $modHand->get(intval($boxid));
33: if ( !is_object($modObj) ) {
34: $this->setErr(_MD_MESSAGE_ACTIONMSG1);
35: return;
36: }
37:
38: if ( $modObj->get('uid') != $this->root->mContext->mXoopsUser->get('uid') ) {
39: $this->setErr(_MD_MESSAGE_ACTIONMSG2);
40: return;
41: }
42: if ( $modHand->delete($modObj) ) {
43: $this->setErr(_MD_MESSAGE_ACTIONMSG3);
44: } else {
45: $this->setErr(_MD_MESSAGE_ACTIONMSG4);
46: return;
47: }
48: }
49: }
50:
51: public function executeView(&$render)
52: {
53: }
54: }
55: ?>
56: