Minahito
minah****@users*****
2006年 7月 4日 (火) 18:47:23 JST
Index: xoops2jp/html/modules/pm/actions/DeleteAction.class.php diff -u /dev/null xoops2jp/html/modules/pm/actions/DeleteAction.class.php:1.1.2.1 --- /dev/null Tue Jul 4 18:47:23 2006 +++ xoops2jp/html/modules/pm/actions/DeleteAction.class.php Tue Jul 4 18:47:23 2006 @@ -0,0 +1,63 @@ +<?php +/** + * @package Pm + * @version $Id: DeleteAction.class.php,v 1.1.2.1 2006/07/04 09:47:23 minahito Exp $ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/pm/class/AbstractDeleteAction.class.php"; +require_once XOOPS_MODULE_PATH . "/pm/forms/PmDeleteForm.class.php"; + +class Pm_DeleteAction extends Pm_AbstractAction +{ + var $mActionForm = null; + + function prepare(&$controller, &$xoopsUser, &$moduleConfig) + { + $this->mActionForm =& new Pm_PmDeleteForm(); + $this->mActionForm->prepare(); + } + + function execute(&$controller, &$xoopsUser) + { + // + // Fetch request and validate. + // + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + // + // If error, go to re-input. + // + if($this->mActionForm->hasError()) { + return PM_FRAME_VIEW_ERROR; + } + + // + // Delete PM + // + $handler =& xoops_gethandler('privmessage'); + foreach ($this->mActionForm->getVar('msg_id') as $msg_id) { + $pm =& $handler->get($msg_id); + if (is_object($pm) && ($pm->get('to_userid') == $xoopsUser->get('uid'))) { + $handler->delete($pm); + } + unset($pm); + } + + return PM_FRAME_VIEW_SUCCESS; + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + XCube_Utils::redirectHeader("./index.php", 1, _PM_DELETED); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + XCube_Utils::redirectHeader("./index.php", 1, _MD_PM_ERROR_ACCESS); + } +} + +?>