Minahito
minah****@users*****
2006年 1月 17日 (火) 16:00:08 JST
Index: xoops2jp/html/modules/pm/actions/PmPmliteAction.class.php diff -u xoops2jp/html/modules/pm/actions/PmPmliteAction.class.php:1.1.2.4 xoops2jp/html/modules/pm/actions/PmPmliteAction.class.php:1.1.2.5 --- xoops2jp/html/modules/pm/actions/PmPmliteAction.class.php:1.1.2.4 Wed Nov 16 19:11:32 2005 +++ xoops2jp/html/modules/pm/actions/PmPmliteAction.class.php Tue Jan 17 16:00:08 2006 @@ -1,98 +1,98 @@ -<?php - -require_once XOOPS_MODULE_PATH."/pm/forms/PmliteEditForm.class.php"; -require_once XOOPS_MODULE_PATH."/pm/kernel/PrivateMessage.class.php"; // Wmm.. - -class PmPmliteAction extends PmAction -{ - var $mActionForm=null; - - function isSecure() - { - return true; - } - - function getDefaultView(&$controller,&$xoopsUser) - { - $this->_processActionForm(); - - // - // Fetch request only (no validate). - // - $this->mActionForm->fetch(); - - return PM_FRAME_VIEW_INPUT; - } - - function execute(&$controller,&$xoopsUser) - { - $this->_processActionForm(); - - // - // Fetch request and validate. - // - $this->mActionForm->fetch(); - $this->mActionForm->validate(); - - // - // If error, go to re-input. - // - if($this->mActionForm->hasError()) - return PM_FRAME_VIEW_INPUT; - - // - // Send PM - // - $pmManager=new PrivateMessageManager(); //< TODO - $pm=&$pmManager->create(); - - $this->mActionForm->update($pm); - $pm->setFromUsers($xoopsUser); - if($pm->send()) { - return PM_FRAME_VIEW_SUCCESS; - } - else { - return PM_FRAME_VIEW_ERROR; - } - } - - function _processActionForm() - { - // - // Create action form object by reply mode? or not? - // - $this->mActionForm=($this->mConfig['send_type']==0) ? new PmliteComboEditForm() : new PmliteDirectEditForm(); - if(isset($_GET['reply'])&&$_GET['reply']==1) - $this->mActionForm->changeStateReply(); - - $this->mActionForm->prepare(); - } - - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) - { - $renderSystem->setTemplateName("pm_pmlite_success.html"); - } - - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) - { - XCube_Utils::redirectHeader("pmlite.php",3,_MD_PM_ERROR_MESSAGE_SEND); - } - - function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) - { - $renderSystem->setTemplateName("pmlite.html"); - $renderSystem->setAttribute("actionForm",$this->mActionForm); - $renderSystem->setAttribute("send_type",$this->mConfig['send_type']); - - // - // If the request doesn't have uid, list up users to template. - // - if($this->mConfig['send_type']==0 && $this->mActionForm->getVar('to_userid')==0) { - $userHandler=&xoops_gethandler('user'); - $userObjects=&$userHandler->getObjectsByLevel(0); - $renderSystem->setAttribute("userList",$userObjects); - } - } -} - +<?php + +require_once XOOPS_MODULE_PATH."/pm/forms/PmliteEditForm.class.php"; +require_once XOOPS_MODULE_PATH."/pm/kernel/PrivateMessage.class.php"; // Wmm.. + +class PmPmliteAction extends PmAction +{ + var $mActionForm=null; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + $this->_processActionForm(); + + // + // Fetch request only (no validate). + // + $this->mActionForm->fetch(); + + return PM_FRAME_VIEW_INPUT; + } + + function execute(&$controller,&$xoopsUser) + { + $this->_processActionForm(); + + // + // Fetch request and validate. + // + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + // + // If error, go to re-input. + // + if($this->mActionForm->hasError()) + return PM_FRAME_VIEW_INPUT; + + // + // Send PM + // + $pmManager=new PrivateMessageManager(); //< TODO + $pm=&$pmManager->create(); + + $this->mActionForm->update($pm); + $pm->setFromUsers($xoopsUser); + if($pm->send()) { + return PM_FRAME_VIEW_SUCCESS; + } + else { + return PM_FRAME_VIEW_ERROR; + } + } + + function _processActionForm() + { + // + // Create action form object by reply mode? or not? + // + $this->mActionForm=($this->mConfig['send_type']==0) ? new PmliteComboEditForm() : new PmliteDirectEditForm(); + if(isset($_GET['reply'])&&$_GET['reply']==1) + $this->mActionForm->changeStateReply(); + + $this->mActionForm->prepare(); + } + + function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("pm_pmlite_success.html"); + } + + function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("pmlite.php",3,_MD_PM_ERROR_MESSAGE_SEND); + } + + function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("pmlite.html"); + $renderSystem->setAttribute("actionForm",$this->mActionForm); + $renderSystem->setAttribute("send_type",$this->mConfig['send_type']); + + // + // If the request doesn't have uid, list up users to template. + // + if($this->mConfig['send_type']==0 && $this->mActionForm->getVar('to_userid')==0) { + $userHandler=&xoops_gethandler('user'); + $userObjects=&$userHandler->getObjectsByLevel(0); + $renderSystem->setAttribute("userList",$userObjects); + } + } +} + ?> \ No newline at end of file Index: xoops2jp/html/modules/pm/actions/PmReadAction.class.php diff -u xoops2jp/html/modules/pm/actions/PmReadAction.class.php:1.1.2.2 xoops2jp/html/modules/pm/actions/PmReadAction.class.php:1.1.2.3 --- xoops2jp/html/modules/pm/actions/PmReadAction.class.php:1.1.2.2 Sun Nov 13 14:17:34 2005 +++ xoops2jp/html/modules/pm/actions/PmReadAction.class.php Tue Jan 17 16:00:08 2006 @@ -1,99 +1,99 @@ -<?php - -require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; - -class PmReadAction extends PmAction -{ - var $mPrivMessage=null; - var $mSendUser=null; - - var $mPreviousMessage=null; - var $mNextMessage=null; - - function isSecure() - { - return true; - } - - function getDefaultView(&$controller,&$xoopsUser) - { - // - // Request Check without ActionForm - // - $msg_id=intval($_REQUEST['msg_id']); - - - // - // Load private message object - // - $pmHandler=&xoops_gethandler('privmessage'); - $this->mPrivMessage=&$pmHandler->get($msg_id); - - if(!is_object($this->mPrivMessage)) - return PM_FRAME_VIEW_ERROR; - - - // - // Check read permission and the sender. - // - if($this->mPrivMessage->getVar('to_userid')!=$xoopsUser->getVar('uid')) - return PM_FRAME_VIEW_ERROR; - - $this->mSendUser=&$this->mPrivMessage->getFromUser(); - if(!is_object($this->mSendUser)) - return PM_FRAME_VIEW_ERROR; - - - // - // Get previous and next message - // - $criteria=new CriteriaCompo(); - $criteria->add(new Criteria('msg_id',$this->mPrivMessage->getVar('msg_id'),"<")); - $criteria->setLimit(1); - $criteria->setSort('msg_time'); - $criteria->setOrder('DESC'); - $tm=&$pmHandler->getObjects($criteria); - if(count($tm)>0 && is_object($tm[0])) - $this->mPreviousMessage=&$tm[0]; - unset($tm); - unset($criteria); - - $criteria=new CriteriaCompo(); - $criteria->add(new Criteria('msg_id',$this->mPrivMessage->getVar('msg_id'),">")); - $criteria->setLimit(1); - $criteria->setSort('msg_time'); - $tm=&$pmHandler->getObjects($criteria); - if(count($tm)>0 && is_object($tm[0])) - $this->mNextMessage=&$tm[0]; - - - // - // If this message is unread, Raise read flag. - // - if(!$this->mPrivMessage->isRead()) - $pmHandler->setRead($this->mPrivMessage); - - - return PM_FRAME_VIEW_INDEX; - } - - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) - { - XCube_Utils::redirectHeader("./index.php",1,_MD_PM_ERROR_ACCESS); - } - - function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) - { - $renderSystem->setTemplateName("readpmsg.html"); - $renderSystem->setAttribute("thisUser",$xoopsUser); - if($this->mSendUser->isActive()) { - $renderSystem->setAttribute("sendUser",$this->mSendUser); - } - $renderSystem->setAttribute("privMessage",$this->mPrivMessage); - $renderSystem->setAttribute("previousMessage",$this->mPreviousMessage); - $renderSystem->setAttribute("nextMessage",$this->mNextMessage); - $renderSystem->setAttribute("anonymous",$controller->getConfig('anonymous')); - } -} - +<?php + +require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; + +class PmReadAction extends PmAction +{ + var $mPrivMessage=null; + var $mSendUser=null; + + var $mPreviousMessage=null; + var $mNextMessage=null; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + // + // Request Check without ActionForm + // + $msg_id=intval($_REQUEST['msg_id']); + + + // + // Load private message object + // + $pmHandler=&xoops_gethandler('privmessage'); + $this->mPrivMessage=&$pmHandler->get($msg_id); + + if(!is_object($this->mPrivMessage)) + return PM_FRAME_VIEW_ERROR; + + + // + // Check read permission and the sender. + // + if($this->mPrivMessage->getVar('to_userid')!=$xoopsUser->getVar('uid')) + return PM_FRAME_VIEW_ERROR; + + $this->mSendUser=&$this->mPrivMessage->getFromUser(); + if(!is_object($this->mSendUser)) + return PM_FRAME_VIEW_ERROR; + + + // + // Get previous and next message + // + $criteria=new CriteriaCompo(); + $criteria->add(new Criteria('msg_id',$this->mPrivMessage->getVar('msg_id'),"<")); + $criteria->setLimit(1); + $criteria->setSort('msg_time'); + $criteria->setOrder('DESC'); + $tm=&$pmHandler->getObjects($criteria); + if(count($tm)>0 && is_object($tm[0])) + $this->mPreviousMessage=&$tm[0]; + unset($tm); + unset($criteria); + + $criteria=new CriteriaCompo(); + $criteria->add(new Criteria('msg_id',$this->mPrivMessage->getVar('msg_id'),">")); + $criteria->setLimit(1); + $criteria->setSort('msg_time'); + $tm=&$pmHandler->getObjects($criteria); + if(count($tm)>0 && is_object($tm[0])) + $this->mNextMessage=&$tm[0]; + + + // + // If this message is unread, Raise read flag. + // + if(!$this->mPrivMessage->isRead()) + $pmHandler->setRead($this->mPrivMessage); + + + return PM_FRAME_VIEW_INDEX; + } + + function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("./index.php",1,_MD_PM_ERROR_ACCESS); + } + + function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("readpmsg.html"); + $renderSystem->setAttribute("thisUser",$xoopsUser); + if($this->mSendUser->isActive()) { + $renderSystem->setAttribute("sendUser",$this->mSendUser); + } + $renderSystem->setAttribute("privMessage",$this->mPrivMessage); + $renderSystem->setAttribute("previousMessage",$this->mPreviousMessage); + $renderSystem->setAttribute("nextMessage",$this->mNextMessage); + $renderSystem->setAttribute("anonymous",$controller->getConfig('anonymous')); + } +} + ?> \ No newline at end of file Index: xoops2jp/html/modules/pm/actions/PmDefaultAction.class.php diff -u xoops2jp/html/modules/pm/actions/PmDefaultAction.class.php:1.1.2.3 xoops2jp/html/modules/pm/actions/PmDefaultAction.class.php:1.1.2.4 --- xoops2jp/html/modules/pm/actions/PmDefaultAction.class.php:1.1.2.3 Sun Nov 13 15:59:20 2005 +++ xoops2jp/html/modules/pm/actions/PmDefaultAction.class.php Tue Jan 17 16:00:08 2006 @@ -1,43 +1,43 @@ -<?php - -require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php"; -require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; - -class PmDefaultAction extends PmAction -{ - var $mActionForm=null; - - var $mPmObjects=array(); - - var $mPageNavi=null; - - function isSecure() - { - return true; - } - - function getDefaultView(&$controller,&$xoopsUser) - { - $pmHandler=&xoops_gethandler('privmessage'); - $total = $pmHandler->getCountByFromUid($xoopsUser->uid()); - - $this->mPageNavi=new XCube_PageNavigator("./index.php",$total,XCUBE_PAGENAVI_START); - $this->mPageNavi->fetch(); - - $this->mPmObjects =& $pmHandler->getObjectsByFromUid($xoopsUser->uid(),$this->mPageNavi->getStart()); - - return PM_FRAME_VIEW_INDEX; - } - - function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) - { - $renderSystem->setTemplateName("viewpmsg.html"); - $renderSystem->setAttribute("pmObjects",$this->mPmObjects); - $renderSystem->setAttribute("total_messages",count($this->mPmObjects)); - $renderSystem->setAttribute("currentUser",$xoopsUser); - $renderSystem->setAttribute("anonymous",$controller->getConfig('anonymous')); - $renderSystem->setAttribute("pageNavi",$this->mPageNavi); - } -} - +<?php + +require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php"; +require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; + +class PmDefaultAction extends PmAction +{ + var $mActionForm=null; + + var $mPmObjects=array(); + + var $mPageNavi=null; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + $pmHandler=&xoops_gethandler('privmessage'); + $total = $pmHandler->getCountByFromUid($xoopsUser->uid()); + + $this->mPageNavi=new XCube_PageNavigator("./index.php",$total,XCUBE_PAGENAVI_START); + $this->mPageNavi->fetch(); + + $this->mPmObjects =& $pmHandler->getObjectsByFromUid($xoopsUser->uid(),$this->mPageNavi->getStart()); + + return PM_FRAME_VIEW_INDEX; + } + + function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("viewpmsg.html"); + $renderSystem->setAttribute("pmObjects",$this->mPmObjects); + $renderSystem->setAttribute("total_messages",count($this->mPmObjects)); + $renderSystem->setAttribute("currentUser",$xoopsUser); + $renderSystem->setAttribute("anonymous",$controller->getConfig('anonymous')); + $renderSystem->setAttribute("pageNavi",$this->mPageNavi); + } +} + ?> \ No newline at end of file Index: xoops2jp/html/modules/pm/actions/PmDeleteAction.class.php diff -u xoops2jp/html/modules/pm/actions/PmDeleteAction.class.php:1.1.2.1 xoops2jp/html/modules/pm/actions/PmDeleteAction.class.php:1.1.2.2 --- xoops2jp/html/modules/pm/actions/PmDeleteAction.class.php:1.1.2.1 Sun Nov 13 13:34:38 2005 +++ xoops2jp/html/modules/pm/actions/PmDeleteAction.class.php Tue Jan 17 16:00:08 2006 @@ -1,69 +1,69 @@ -<?php - -require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; - -class PmDeleteAction extends PmAction -{ - var $mActionForm=null; - - function isSecure() - { - return true; - } - - function getDefaultView(&$controller,&$xoopsUser) - { - return PM_FRAME_VIEW_ERROR; - } - - function execute(&$controller,&$xoopsUser) - { - $this->_processActionForm(); - - // - // 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 - // - $pmHandler=&xoops_gethandler('privmessage'); - foreach($this->mActionForm->getVar('msg_id') as $msg_id) { - $pm=&$pmHandler->get($msg_id); - if(is_object($pm)&&($pm->getVar('to_userid')==$xoopsUser->getVar('uid'))) - $pmHandler->delete($pm); - unset($pm); - } - - return PM_FRAME_VIEW_SUCCESS; - } - - function _processActionForm() - { - // - // Create action form object by reply mode? or not? - // - $this->mActionForm=new DeletePmsgForm(); - $this->mActionForm->prepare(); - } - - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) - { - XCube_Utils::redirectHeader("./index.php",1,_PM_DELETED); - } - - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) - { - XCube_Utils::redirectHeader("./index.php",1,_MD_PM_ERROR_ACCESS); - } -} - +<?php + +require_once XOOPS_MODULE_PATH."/pm/forms/DeletePmsgForm.class.php"; + +class PmDeleteAction extends PmAction +{ + var $mActionForm=null; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + return PM_FRAME_VIEW_ERROR; + } + + function execute(&$controller,&$xoopsUser) + { + $this->_processActionForm(); + + // + // 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 + // + $pmHandler=&xoops_gethandler('privmessage'); + foreach($this->mActionForm->getVar('msg_id') as $msg_id) { + $pm=&$pmHandler->get($msg_id); + if(is_object($pm)&&($pm->getVar('to_userid')==$xoopsUser->getVar('uid'))) + $pmHandler->delete($pm); + unset($pm); + } + + return PM_FRAME_VIEW_SUCCESS; + } + + function _processActionForm() + { + // + // Create action form object by reply mode? or not? + // + $this->mActionForm=new DeletePmsgForm(); + $this->mActionForm->prepare(); + } + + function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("./index.php",1,_PM_DELETED); + } + + function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("./index.php",1,_MD_PM_ERROR_ACCESS); + } +} + ?> \ No newline at end of file