[xoops-cvslog 3616] CVS update: xoops2jp/html/modules/user/class

Zurück zum Archiv-Index

Minahito minah****@users*****
2006年 7月 19日 (水) 19:21:16 JST


Index: xoops2jp/html/modules/user/class/RegistMailBuilder.class.php
diff -u xoops2jp/html/modules/user/class/RegistMailBuilder.class.php:1.1.2.5 xoops2jp/html/modules/user/class/RegistMailBuilder.class.php:1.1.2.6
--- xoops2jp/html/modules/user/class/RegistMailBuilder.class.php:1.1.2.5	Tue Mar 28 22:32:03 2006
+++ xoops2jp/html/modules/user/class/RegistMailBuilder.class.php	Wed Jul 19 19:21:16 2006
@@ -1,50 +1,82 @@
 <?php
+/**
+ * @package user
+ * @version $Id: RegistMailBuilder.class.php,v 1.1.2.6 2006/07/19 10:21:16 minahito Exp $
+ */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
 
-class UserRegistMailDirector
+/**
+ * This class commands a builder to build mail. It's a kind of builder pattern,
+ * and made for separating the building logic and the business logic.
+ */
+class User_UserRegistMailDirector
 {
+	/**
+	 * @var User_RegistUserActivateMailBuilder
+	 */
 	var $mBuilder;
+	
+	/**
+	 * @var XoopsUser
+	 */
 	var $mUser;
+	
 	var $mXoopsConfig;
+	
 	var $mUserConfig;
 
-	function UserRegistMailDirector(&$user,$xoopsConfig,$userConfig)
+	function User_UserRegistMailDirector(&$builder, &$user, $xoopsConfig, $userConfig)
 	{
-		$this->mUser=&$user;
-		$this->mXoopsConfig=$xoopsConfig;
-		$this->mUserConfig=$userConfig;
-	}
-	
-	function contruct(&$builder)
-	{
-		$builder->setTemplate();
-		$builder->setToUsers($this->mUser,$this->mUserConfig);
-		$builder->setFromEmail($this->mXoopsConfig);
-		$builder->setSubject($this->mUser,$this->mXoopsConfig);
-		$builder->setBody($this->mUser,$this->mXoopsConfig);
+		$this->mBuilder =& $builder;
+		
+		$this->mUser =& $user;
+		$this->mXoopsConfig =$xoopsConfig;
+		$this->mUserConfig = $userConfig;
+	}
+	
+	/**
+	 * With setting variables to a builder, triggers building the mail of a
+	 * builder.
+	 */
+	function contruct()
+	{
+		$this->mBuilder->setTemplate();
+		$this->mBuilder->setToUsers($this->mUser, $this->mUserConfig);
+		$this->mBuilder->setFromEmail($this->mXoopsConfig);
+		$this->mBuilder->setSubject($this->mUser, $this->mXoopsConfig);
+		$this->mBuilder->setBody($this->mUser, $this->mXoopsConfig);
 	}
 }
 
-class RegistUserActivateMailBuilder
+/**
+ * This class is a builder for User_UserRegistMailDirector and the base class,
+ * and the base class for other builders. Use register.tpl as the template.
+ * That's the first mail at procedure of the user registration, and written
+ * about the special URL which activates the registration application.
+ */
+class User_RegistUserActivateMailBuilder
 {
 	var $mMailer;
 	
-	function RegistUserActivateMailBuilder()
+	function User_RegistUserActivateMailBuilder()
 	{
-		$this->mMailer=&getMailer();
+		$this->mMailer =& getMailer();
 		$this->mMailer->useMail();
 	}
 
+	/**
+	 * Set the template itself.
+	 */
 	function setTemplate()
 	{
 		$root=&XCube_Root::getSingleton();
 		$language = $root->mController->getConfig('language');
-		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/user/language/'.$language.'/mail_template/');
+		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/user/language/' . $language . '/mail_template/');
 		$this->mMailer->setTemplate('register.tpl');
 	}
 
-	function setToUsers($user,$userConfig)
+	function setToUsers($user, $userConfig)
 	{
 		$this->mMailer->setToUsers($user);
 	}
@@ -55,17 +87,17 @@
 		$this->mMailer->setFromName($xoopsConfig['sitename']);
 	}
 	
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
-		$this->mMailer->setSubject(@sprintf(_US_USERKEYFOR,$user->getVar('uname')));
+		$this->mMailer->setSubject(@sprintf(_US_USERKEYFOR, $user->getShow('uname')));
 	}
 
 	function setBody($user,$xoopsConfig)
 	{
-		$this->mMailer->assign('SITENAME',$xoopsConfig['sitename']);
-		$this->mMailer->assign('ADMINMAIL',$xoopsConfig['adminmail']);
-		$this->mMailer->assign('SITEURL',XOOPS_URL.'/');
-		$this->mMailer->assign('USERACTLINK', XOOPS_URL.'/modules/user/index.php?action=UserActivate&uid='.$user->getVar('uid').'&actkey='.$user->getVar('actkey'));
+		$this->mMailer->assign('SITENAME', $xoopsConfig['sitename']);
+		$this->mMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
+		$this->mMailer->assign('SITEURL', XOOPS_URL . '/');
+		$this->mMailer->assign('USERACTLINK', XOOPS_URL . '/modules/user/index.php?action=UserActivate&uid=' . $user->getVar('uid') . '&actkey=' . $user->getShow('actkey'));
 	}
 	
 	function &getResult()
@@ -74,17 +106,22 @@
 	}
 }
 
-class RegistUserAdminActivateMailBuilder extends RegistUserActivateMailBuilder
+/**
+ * This class is a builder which uses adminactivate.tpl as the template. The
+ * mail which this class builds, requests activating the new registration for
+ * administrators.
+ */
+class User_RegistUserAdminActivateMailBuilder extends RegistUserActivateMailBuilder
 {
 	function setTemplate()
 	{
 		$root=&XCube_Root::getSingleton();
 		$language = $root->mController->getConfig('language');
-		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/user/language/'.$language.'/mail_template/');
+		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/user/language/' . $language . '/mail_template/');
 		$this->mMailer->setTemplate('adminactivate.tpl');
 	}
 
-	function setToUsers($user,$userConfig)
+	function setToUsers($user, $userConfig)
 	{
 		$memberHandler=&xoops_gethandler('member');
 		$this->mMailer->setToGroups($memberHandler->getGroup($userConfig['activation_group']));
@@ -97,56 +134,66 @@
 		$this->mMailer->setFromName($xoopsConfig['sitename']);
 	}
 	
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
 		$this->mMailer->setSubject(@sprintf(_US_USERKEYFOR,$user->getVar('uname')));
 	}
 
-	function setBody($user,$xoopsConfig)
+	function setBody($user, $xoopsConfig)
 	{
 		parent::setBody($user,$xoopsConfig);
 		$this->mMailer->assign('USERNAME', $user->getVar('uname'));
 		$this->mMailer->assign('USEREMAIL', $user->getVar('email'));
-		$this->mMailer->assign('USERACTLINK', XOOPS_URL.'/modules/user/index.php?action=UserActivate&uid='.$user->getVar('uid').'&actkey='.$user->getVar('actkey'));
+		$this->mMailer->assign('USERACTLINK', XOOPS_URL . '/modules/user/index.php?action=UserActivate&uid=' . $user->getVar('uid') . '&actkey=' . $user->getVar('actkey'));
 	}
 }
 
-class RegistUserNotifyMailBuilder extends RegistUserActivateMailBuilder
+/**
+ * [Notice]
+ * Uncompleted?
+ * 
+ * @todo Implement setTemplate()
+ */
+class User_RegistUserNotifyMailBuilder extends RegistUserActivateMailBuilder
 {
 	function setTemplate()
 	{
 	}
 
-	function setToUsers($user,$userConfig)
+	function setToUsers($user, $userConfig)
 	{
 		$memberHandler=&xoops_gethandler('member');
 		$this->mMailer->setToGroups($memberHandler->getGroup($userConfig['new_user_notify_group']));
 	}
 	
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
-		$this->mMailer->setSubject(@sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
+		$this->mMailer->setSubject(@sprintf(_US_NEWUSERREGAT, $xoopsConfig['sitename']));
 	}
 
-	function setBody($user,$xoopsConfig)
+	function setBody($user, $xoopsConfig)
 	{
 		$this->mMailer->setBody(@sprintf(_US_HASJUSTREG, $user->getVar('uname')));
 	}
 }
 
-class RegistAdminCommitMailBuilder extends RegistUserActivateMailBuilder
+/**
+ * This class is a builder which uses activated.tpl as the template. The mail
+ * which this class builds, reports completed activation for a new user.
+ */
+class User_RegistAdminCommitMailBuilder extends RegistUserActivateMailBuilder
 {
 	function setTemplate()
 	{
 		$root=&XCube_Root::getSingleton();
 		$language = $root->mController->getConfig('language');
-		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/user/language/'.$language.'/mail_template/');
+		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/user/language/' . $language . '/mail_template/');
 		$this->mMailer->setTemplate('activated.tpl');
 	}
 	
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
-		$this->mMailer->setSubject(@sprintf(_US_YOURACCOUNT,$xoopsConfig['sitename']));
+		$this->mMailer->setSubject(@sprintf(_US_YOURACCOUNT, $xoopsConfig['sitename']));
 	}
 }
 
Index: xoops2jp/html/modules/user/class/AbstractEditAction.class.php
diff -u xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.6 xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.7
--- xoops2jp/html/modules/user/class/AbstractEditAction.class.php:1.1.2.6	Thu Jul 13 19:53:42 2006
+++ xoops2jp/html/modules/user/class/AbstractEditAction.class.php	Wed Jul 19 19:21:16 2006
@@ -9,18 +9,30 @@
 	var $mActionForm = null;
 	var $mConfig;
 
+	/**
+	 * @access protected
+	 */
 	function _getId()
 	{
 	}
 
+	/**
+	 * @access protected
+	 */
 	function &_getHandler()
 	{
 	}
 
+	/**
+	 * @access protected
+	 */
 	function _setupActionForm()
 	{
 	}
 
+	/**
+	 * @access protected
+	 */
 	function _setupObject()
 	{
 		$id = $this->_getId();
@@ -34,14 +46,17 @@
 		}
 	}
 
+	/**
+	 * @access protected
+	 */
 	function isEnableCreate()
 	{
 		return true;
 	}
 
-	function prepare(&$controller, &$xoopsUser, &$moduleConfig)
+	function prepare(&$controller, &$xoopsUser, $moduleConfig)
 	{
-		$this->mConfig=&$moduleConfig;
+		$this->mConfig = $moduleConfig;
 
 		$this->_setupActionForm();
 		$this->_setupObject();
@@ -83,6 +98,9 @@
 		                                         : USER_FRAME_VIEW_ERROR;
 	}
 
+	/**
+	 * @access protected
+	 */
 	function _doExecute()
 	{
 		return $this->mObjectHandler->insert($this->mObject);
Index: xoops2jp/html/modules/user/class/LostPassMailBuilder.class.php
diff -u xoops2jp/html/modules/user/class/LostPassMailBuilder.class.php:1.1.2.2 xoops2jp/html/modules/user/class/LostPassMailBuilder.class.php:1.1.2.3
--- xoops2jp/html/modules/user/class/LostPassMailBuilder.class.php:1.1.2.2	Tue Mar 28 22:32:03 2006
+++ xoops2jp/html/modules/user/class/LostPassMailBuilder.class.php	Wed Jul 19 19:21:16 2006
@@ -1,62 +1,80 @@
 <?php
+/**
+ * @package user
+ * @version $Id: LostPassMailBuilder.class.php,v 1.1.2.3 2006/07/19 10:21:16 minahito Exp $
+ */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
 
-class LostPassMailDirector
+/**
+ * This class commands a builder to build mail. It's a kind of builder pattern,
+ * and made for separating the building logic and the business logic.
+ */
+class User_LostPassMailDirector
 {
 	var $mBuilder;
 	var $mXoopsUser;
 	var $mXoopsConfig;
 	var $mExtraVars;
 	
-	function LostPassMailDirector(&$builder,&$user,&$xoopsConfig,$extraVars=array())
+	function User_LostPassMailDirector(&$builder, &$user, &$xoopsConfig, $extraVars = array())
 	{
-		$this->mBuilder=&$builder;
-		$this->mXoopsUser=&$user;
-		$this->mXoopsConfig=&$xoopsConfig;
-		$this->mExtraVars=$extraVars;
+		$this->mBuilder =& $builder;
+		$this->mXoopsUser =& $user;
+		$this->mXoopsConfig =& $xoopsConfig;
+		$this->mExtraVars = $extraVars;
 	}
 	
 	function contruct()
 	{
-		$this->mBuilder->setToUsers($this->mXoopsUser,$this->mXoopsConfig);
-		$this->mBuilder->setFromEmail($this->mXoopsUser,$this->mXoopsConfig);
-		$this->mBuilder->setSubject($this->mXoopsUser,$this->mXoopsConfig);
+		$this->mBuilder->setToUsers($this->mXoopsUser, $this->mXoopsConfig);
+		$this->mBuilder->setFromEmail($this->mXoopsUser, $this->mXoopsConfig);
+		$this->mBuilder->setSubject($this->mXoopsUser, $this->mXoopsConfig);
 		$this->mBuilder->setTemplate();
-		$this->mBuilder->setBody($this->mXoopsUser,$this->mXoopsConfig,$this->mExtraVars);
+		$this->mBuilder->setBody($this->mXoopsUser, $this->mXoopsConfig,$this->mExtraVars);
 	}
 }
-class LostPass1MailBuilder
+
+/**
+ * This class is a builder for User_LostPassMailDirector and the base class,
+ * and the base class for other builders. Use lostpass1.tpl as the template.
+ * That's the first mail at procedure of the password regenerated, and written
+ * about the special URL which generates new password.
+ */
+class User_LostPass1MailBuilder
 {
 	var $mMailer;
 	
-	function LostPass1MailBuilder()
+	function User_LostPass1MailBuilder()
 	{
-		$this->mMailer=&getMailer();
+		$this->mMailer =& getMailer();
 		$this->mMailer->useMail();
 	}
 
-	function setToUsers($user,$xoopsConfig)
+	function setToUsers($user, $xoopsConfig)
 	{
 		$this->mMailer->setToUsers($user);
 	}
 
-	function setFromEmail($user,$xoopsConfig)
+	function setFromEmail($user, $xoopsConfig)
 	{
 		$this->mMailer->setFromEmail($xoopsConfig['adminmail']);
 		$this->mMailer->setFromName($xoopsConfig['sitename']);
 	}
 	
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
-		$this->mMailer->setSubject(sprintf(_US_NEWPWDREQ,$xoopsConfig['sitename']));
+		$this->mMailer->setSubject(sprintf(_US_NEWPWDREQ, $xoopsConfig['sitename']));
 	}
 
+	/**
+	 * Set template file itself.
+	 */
 	function setTemplate()
 	{
-		$root=&XCube_Root::getSingleton();
+		$root =& XCube_Root::getSingleton();
 		$language = $root->mController->getConfig('language');
-		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/user/language/'.$language.'/mail_template/');
+		$this->mMailer->setTemplateDir(XOOPS_MODULE_PATH . '/user/language/' . $language . '/mail_template/');
 		$this->mMailer->setTemplate("lostpass1.tpl");
 	}
 	
@@ -64,9 +82,9 @@
 	{
 		$this->mMailer->assign("SITENAME", $xoopsConfig['sitename']);
 		$this->mMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
-		$this->mMailer->assign("SITEURL", XOOPS_URL."/");
+		$this->mMailer->assign("SITEURL", XOOPS_URL . "/");
 		$this->mMailer->assign("IP", $_SERVER['REMOTE_ADDR']);
-		$this->mMailer->assign("NEWPWD_LINK", XOOPS_URL."/modules/user/index.php?action=LostPass&email=".$user->get('email')."&code=".substr($user->get("pass"), 0, 5));
+		$this->mMailer->assign("NEWPWD_LINK", XOOPS_URL . "/modules/user/index.php?action=LostPass&email=" . $user->getShow('email') . "&code=" . substr($user->get("pass"), 0, 5));
 	}
 		
 	function &getResult()
@@ -74,26 +92,32 @@
 		return $this->mMailer;
 	}
 }
-class LostPass2MailBuilder extends LostPass1MailBuilder
+
+/**
+ * This class is a builder which uses lostpass2.tpl as the template. That's the
+ * second mail at procedure of the password regenerated, and written about the
+ * new generated password of the user.
+ */
+class User_LostPass2MailBuilder extends LostPass1MailBuilder
 {
 	function setTemplate()
 	{
 		$root=&XCube_Root::getSingleton();
 		$language = $root->mController->getConfig('language');
-		$this->mMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/user/language/'.$language.'/mail_template/');
+		$this->mMailer->setTemplateDir(XOOPS_MODULE_PATH . '/user/language/' . $language . '/mail_template/');
 		$this->mMailer->setTemplate("lostpass2.tpl");
 	}
 
-	function setSubject($user,$xoopsConfig)
+	function setSubject($user, $xoopsConfig)
 	{
 		$this->mMailer->setSubject(sprintf(_US_NEWPWDREQ,XOOPS_URL));
 	}
 
-	function setBody($user,$xoopsConfig,$extraVars)
+	function setBody($user, $xoopsConfig, $extraVars)
 	{
 		$this->mMailer->assign("SITENAME", $xoopsConfig['sitename']);
 		$this->mMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
-		$this->mMailer->assign("SITEURL", XOOPS_URL."/");
+		$this->mMailer->assign("SITEURL", XOOPS_URL . "/");
 		$this->mMailer->assign("IP", $_SERVER['REMOTE_ADDR']);
 		$this->mMailer->assign("NEWPWD", $extraVars['newpass']);
 	}


xoops-cvslog メーリングリストの案内
Zurück zum Archiv-Index