[xoops-cvslog 3415] CVS update: xoops2jp/html/modules/pm/actions

Back to archive index

Minahito minah****@users*****
2006年 7月 4日 (火) 18:48:05 JST


Index: xoops2jp/html/modules/pm/actions/PmReadAction.class.php
diff -u xoops2jp/html/modules/pm/actions/PmReadAction.class.php:1.1.2.4 xoops2jp/html/modules/pm/actions/PmReadAction.class.php:removed
--- xoops2jp/html/modules/pm/actions/PmReadAction.class.php:1.1.2.4	Tue Mar 28 22:30:49 2006
+++ xoops2jp/html/modules/pm/actions/PmReadAction.class.php	Tue Jul  4 18:48:05 2006
@@ -1,101 +0,0 @@
-<?php
-
-if (!defined('XOOPS_ROOT_PATH')) exit();
-
-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/ReadAction.class.php
diff -u /dev/null xoops2jp/html/modules/pm/actions/ReadAction.class.php:1.1.2.1
--- /dev/null	Tue Jul  4 18:48:05 2006
+++ xoops2jp/html/modules/pm/actions/ReadAction.class.php	Tue Jul  4 18:48:05 2006
@@ -0,0 +1,127 @@
+<?php
+/**
+ * @package Pm
+ * @version $Id: ReadAction.class.php,v 1.1.2.1 2006/07/04 09:48:05 minahito Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+/**
+ * [Notice]
+ * This class has been checked in Alpha4. But, this class doesn't go along the
+ * latest cubson style. And some problems (using core handler, naming rule and
+ * etc) are there. Pm module is one of the most old code in Legacy.
+ */
+class Pm_ReadAction extends Pm_AbstractAction
+{
+	/**
+	 * A instance of the current private-message.
+	 * 
+	 * @var XoopsPrivmessage
+	 */
+	var $mPrivMessage = null;
+	
+	/**
+	 * A instance of the user that has sent the current private-message.
+	 * 
+	 * @var XoopsUser
+	 */
+	var $mSendUser = null;
+
+	/**
+	 * A instance of previous private-message form the current private-message.
+	 * 
+	 * @var XoopsPrivmessage
+	 */
+	var $mPreviousMessage = null;
+	
+	/**
+	 * A instance of next private-message form the current private-message.
+	 * 
+	 * @var XoopsPrivmessage
+	 */
+	var $mNextMessage = null;
+	
+	function getDefaultView(&$controller,&$xoopsUser)
+	{
+		//
+		// Request Check without ActionForm
+		//
+		$msg_id = intval(xoops_getrequest('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');
+		$t_objArr =& $pmHandler->getObjects($criteria);
+		if (count($t_objArr) > 0 && is_object($t_objArr[0])) {
+			$this->mPreviousMessage =& $t_objArr[0];
+		}
+		unset($t_objArr);
+		unset($criteria);
+
+		$criteria =& new CriteriaCompo();
+		$criteria->add(new Criteria('msg_id', $this->mPrivMessage->getVar('msg_id'), ">"));
+		$criteria->setLimit(1);
+		$criteria->setSort('msg_time');
+		$t_objArr =& $pmHandler->getObjects($criteria);
+		if (count($t_objArr) > 0 && is_object($t_objArr[0])) {
+			$this->mNextMessage =& $t_objArr[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, &$render)
+	{
+		XCube_Utils::redirectHeader("./index.php", 1, _MD_PM_ERROR_ACCESS);
+	}
+
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("readpmsg.html");
+		$render->setAttribute("thisUser", $xoopsUser);
+		if ($this->mSendUser->isActive()) {
+			$render->setAttribute("sendUser", $this->mSendUser);
+		}
+		$render->setAttribute("privMessage", $this->mPrivMessage);
+		$render->setAttribute("previousMessage", $this->mPreviousMessage);
+		$render->setAttribute("nextMessage", $this->mNextMessage);
+		$render->setAttribute("anonymous", $controller->getConfig('anonymous'));
+	}
+}
+
+?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Back to archive index