Minahito
minah****@users*****
2006年 7月 19日 (水) 19:20:33 JST
Index: xoops2jp/html/modules/user/actions/EditUserAction.class.php diff -u xoops2jp/html/modules/user/actions/EditUserAction.class.php:1.1.2.8 xoops2jp/html/modules/user/actions/EditUserAction.class.php:1.1.2.9 --- xoops2jp/html/modules/user/actions/EditUserAction.class.php:1.1.2.8 Tue Apr 11 19:03:53 2006 +++ xoops2jp/html/modules/user/actions/EditUserAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,26 +1,39 @@ <?php +/** + * @package user + * @version $Id: EditUserAction.class.php,v 1.1.2.9 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); require_once XOOPS_MODULE_PATH . "/user/class/AbstractEditAction.class.php"; require_once XOOPS_MODULE_PATH . "/user/forms/EditUserForm.class.php"; +/** + * @see User_EditUserForm + */ class User_EditUserAction extends User_AbstractEditAction { function _getId() { - return isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; + return isset($_REQUEST['uid']) ? intval(xoops_getrequest('uid')) : 0; } function &_getHandler() { - $handler =& xoops_gethandler('user'); + $handler =& xoops_getmodulehandler('users'); return $handler; } + /** + * Because editable fields are decided by the module config, this member + * function hands the config to the constructor of the action form. + * + * @see User_AbstractUserEditForm + */ function _setupActionForm() { - $this->mActionForm=new EditUserForm(); + $this->mActionForm =& new User_EditUserForm($this->mConfig); $this->mActionForm->prepare(); } @@ -34,7 +47,13 @@ return true; } - function hasPerm(&$controller, &$xoopsUser, &$moduleConfig) + /** + * Allow Conditions: + * + * 1) The current user is the target user. + * 2) The current user is administrators. + */ + function hasPerm(&$controller, &$xoopsUser, $moduleConfig) { if ($this->mObject != null) { return ($this->mObject->get('uid') == $xoopsUser->get('uid') || $xoopsUser->isAdmin()); @@ -43,22 +62,62 @@ return false; } - function executeViewInput(&$controller,&$xoopsUser,&$render) + function executeViewInput(&$controller, &$xoopsUser, &$render) { $render->setTemplateName("user_edituser.html"); - $render->setAttribute("actionForm",$this->mActionForm); - $render->setAttribute("thisUser",$this->mObject); - $render->setAttribute("currentUser",$xoopsUser); + $render->setAttribute("actionForm", $this->mActionForm); + $render->setAttribute("thisUser", $this->mObject); + $render->setAttribute("currentUser", $xoopsUser); + $render->setAttribute("allow_chgmail", $this->mConfig['allow_chgmail']); + + $handler =& xoops_gethandler('timezone'); + $timezoneArr =& $handler->getObjects(); + $render->setAttribute('timezones', $timezoneArr); + + // + // umode option + // + $umodeOptions = array("nest" => _NESTED, "flat" => _FLAT, "thread" => _THREADED); + $render->setAttribute('umodeOptions', $umodeOptions); + + // + // uorder option + // + $uorderOptions = array(0 => _OLDESTFIRST, 1 => _NEWESTFIRST); + $render->setAttribute('uorderOptions', $uorderOptions); + + // + // notify option + // + + // + // TODO Because abstract message catalog style is not decided, we load directly. + // + $root =& XCube_Root::getSingleton(); + require_once XOOPS_ROOT_PATH . "/language/" . $root->mController->getConfig('language') . "/notification.php"; + require_once XOOPS_ROOT_PATH . "/include/notification_constants.php"; + + $methodOptions = array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, + XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, + XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL + ); + $render->setAttribute('notify_methodOptions', $methodOptions); + + $modeOptions = array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, + XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, + XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN + ); + $render->setAttribute('notify_modeOptions', $modeOptions); } - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + function executeViewSuccess(&$controller,&$xoopsUser,&$render) { $controller->executeForward('./index.php?action=UserInfo&uid=' . $this->mObject->get('uid')); } - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + function executeViewError(&$controller, &$xoopsUser, &$render) { - redirect_header(XOOPS_URL, 1, _MD_USER_ERROR_DBUPDATE_FAILED); + $controller->executeRedirect(XOOPS_URL, 1, _MD_USER_ERROR_DBUPDATE_FAILED); } } Index: xoops2jp/html/modules/user/actions/AvatarSelectAction.class.php diff -u xoops2jp/html/modules/user/actions/AvatarSelectAction.class.php:1.1.2.5 xoops2jp/html/modules/user/actions/AvatarSelectAction.class.php:1.1.2.6 --- xoops2jp/html/modules/user/actions/AvatarSelectAction.class.php:1.1.2.5 Tue Apr 11 19:03:53 2006 +++ xoops2jp/html/modules/user/actions/AvatarSelectAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,4 +1,8 @@ <?php +/** + * @package user + * @version $Id: AvatarSelectAction.class.php,v 1.1.2.6 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -8,6 +12,8 @@ /** * When the request is POST, this class fetches avatar_id and set it to user * object. This class always kicks out GET request. + * + * @see User_AvatarSelectForm */ class User_AvatarSelectAction extends User_AbstractEditAction { @@ -27,12 +33,12 @@ function _getId() { - return isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; + return isset($_REQUEST['uid']) ? intval(xoops_getrequest('uid')) : 0; } function &_getHandler() { - $handler =& xoops_gethandler('user'); + $handler =& xoops_getmodulehandler('user'); return $handler; } @@ -122,7 +128,6 @@ function getDefaultView(&$controller, &$xoopsUser) { $controller->executeForward("./index.php?action=AvatarUpload&uid=" . $this->mObject->get('uid')); - return USER_FRAME_VIEW_NONE; } function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) @@ -132,7 +137,7 @@ function executeViewError(&$controller,&$xoopsUser,&$renderSystem) { - redirect_header("./index.php?action=UserInfo&uid=" . $this->mActionForm->get('uid'), 1, _MD_ERROR_DBUPDATE_FAILED); + $controller->executeRedirect("./index.php?action=UserInfo&uid=" . $this->mActionForm->get('uid'), 1, _MD_ERROR_DBUPDATE_FAILED); } } Index: xoops2jp/html/modules/user/actions/AvatarEditAction.class.php diff -u xoops2jp/html/modules/user/actions/AvatarEditAction.class.php:1.1.2.5 xoops2jp/html/modules/user/actions/AvatarEditAction.class.php:1.1.2.6 --- xoops2jp/html/modules/user/actions/AvatarEditAction.class.php:1.1.2.5 Tue Apr 11 19:03:53 2006 +++ xoops2jp/html/modules/user/actions/AvatarEditAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,4 +1,8 @@ <?php +/** + * @package user + * @version $Id: AvatarEditAction.class.php,v 1.1.2.6 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -9,20 +13,52 @@ require_once XOOPS_MODULE_PATH . "/user/class/PageNavigator.class.php"; /** - * When the request is GET, shows two forms to changing a avatar for specified - * user. One of form shows upload-form. Other form shows the list of preset - * avatar (system avatar) and its page navigator. + * This action handles the uploaded avatar image file. + * + * Users who are allowed to upload, can upload custom avatars and select system + * avatars. So this action has to implement both of uploading and selecting. + * In the case of GET request, this action shows two forms to changing a avatar + * for specified user. One of form shows upload-form. Anther form shows the list + * of system avatars and the page navigator of the list. + * + * @see User_AvatarEditForm + * @see User_AvatarSelectForm */ class User_AvatarEditAction extends User_AbstractEditAction { + /** + * @var int + */ var $mAvatarWidth = 0; + + /** + * @var int + */ var $mAvatarHeight = 0; + + /** + * @var int + */ var $mAvatarMaxfilesize = 0; + /** + * @var int + */ var $_mMinPost = 0; + + /** + * @var bool + */ var $_mAllowUpload = false; + /** + * @var User_PageNavigator + */ var $mNavi; + + /** + * @var User_AvatarFilterForm + */ var $mFilter; /** @@ -32,14 +68,18 @@ /** * Other action form for AvatarSelect. + * @var User_AvatarSelectForm */ var $mAvatarSelectForm = null; /** - * Set up own properties by $moduleConfig. We must know uploading conditions - * and control user upload by it. The limit may be not completed, yet. + * Fetch conditions from $moduleConfig and set these to member properties. + * And, by the member property mConfig of the base class, any member + * functions of this class can access $moduleConfig. + * + * @todo The limit may be not completed, yet. */ - function prepare(&$controller, &$xoopsUser, &$moduleConfig) + function prepare(&$controller, &$xoopsUser, $moduleConfig) { $this->mAvatarWidth = $moduleConfig['avatar_width']; $this->mAvatarHeight = $moduleConfig['avatar_height']; @@ -53,38 +93,34 @@ function _getId() { - return isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; + return isset($_REQUEST['uid']) ? intval(xoops_getrequest('uid')) : 0; } function &_getHandler() { - $handler =& xoops_gethandler('user'); + $handler =& xoops_getmodulehandler('users'); return $handler; } /** - * This class uses AvatarUploadForm class. It requests three condition which - * are width limit, height limit and filesize limit. We send own properties to - * AvatarUploadForm::prepare() + * This class uses AvatarUploadForm class. It requests three condition + * which are width limit, height limit and filesize limit. + * + * @todo We may have to hand three parameters to constructor. */ function _setupActionForm() { - $this->mActionForm=new User_AvatarEditForm(); + $this->mActionForm =& new User_AvatarEditForm(); $this->mActionForm->prepare($this->mAvatarWidth, $this->mAvatarHeight, $this->mAvatarMaxfilesize); } - /** - * Return false. - * If a user requests dummy uid, kick out him! - */ function isEnableCreate() { return false; } /** - * Return true. - * This action should not be used by a guest user. + * Return true. This action should not be used by a guest user. */ function isSecure() { @@ -92,7 +128,7 @@ } /** - * Check whether a current user can access this action. + * Check whether a current user can access this action. * 1) A specified user has to exist. * 2) A current user has to equal the specified user, or a current user has * to be a administrator. @@ -114,7 +150,7 @@ } /** - * This override method looks like the same method of ListAction, and tries + * This override method looks like the same method of ListAction, and tries * to get system avatars. After, it will call base class. */ function getDefaultView(&$controller, &$xoopsUser) @@ -190,27 +226,27 @@ function executeViewInput(&$controller,&$xoopsUser,&$render) { $render->setTemplateName("user_avatar_edit.html"); - $render->setAttribute("actionForm",$this->mActionForm); - $render->setAttribute("thisUser",$this->mObject); + $render->setAttribute("actionForm", $this->mActionForm); + $render->setAttribute("thisUser", $this->mObject); $render->setAttribute("allowUpload", $this->_mAllowUpload); - $render->setAttribute("avatarWidth",$this->mAvatarWidth); - $render->setAttribute("avatarHeight",$this->mAvatarHeight); - $render->setAttribute("avatarMaxfilesize",$this->mAvatarMaxfilesize); + $render->setAttribute("avatarWidth", $this->mAvatarWidth); + $render->setAttribute("avatarHeight", $this->mAvatarHeight); + $render->setAttribute("avatarMaxfilesize", $this->mAvatarMaxfilesize); $render->setAttribute("pageNavi", $this->mNavi); $render->setAttribute("systemAvatars", $this->mSystemAvatars); $render->setAttribute("avatarSelectForm", $this->mAvatarSelectForm); } - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + function executeViewSuccess(&$controller, &$xoopsUser, $render) { $controller->executeForward("./index.php?action=UserInfo&uid=" . $this->mActionForm->get('uid')); } - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + function executeViewError(&$controller,&$xoopsUser,&$render) { - redirect_header("./index.php?action=UserInfo&uid=" . $this->mActionForm->get('uid'), 1, _MD_ERROR_DBUPDATE_FAILED); + $controller->executeRedirect("./index.php?action=UserInfo&uid=" . $this->mActionForm->get('uid'), 1, _MD_ERROR_DBUPDATE_FAILED); } } Index: xoops2jp/html/modules/user/actions/UserRegister_confirmAction.class.php diff -u xoops2jp/html/modules/user/actions/UserRegister_confirmAction.class.php:1.1.2.7 xoops2jp/html/modules/user/actions/UserRegister_confirmAction.class.php:1.1.2.8 --- xoops2jp/html/modules/user/actions/UserRegister_confirmAction.class.php:1.1.2.7 Tue Mar 28 22:31:02 2006 +++ xoops2jp/html/modules/user/actions/UserRegister_confirmAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,51 +1,62 @@ <?php +/** + * @package user + * @version $Id: UserRegister_confirmAction.class.php,v 1.1.2.8 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); -require_once XOOPS_MODULE_PATH."/user/forms/UserConfirmForm.class.php"; -require_once XOOPS_MODULE_PATH."/user/forms/UserRegisterEditForm.class.php"; -require_once XOOPS_MODULE_PATH."/user/class/RegistMailBuilder.class.php"; - +require_once XOOPS_MODULE_PATH . "/user/forms/UserConfirmForm.class.php"; +require_once XOOPS_MODULE_PATH . "/user/forms/UserRegisterEditForm.class.php"; +require_once XOOPS_MODULE_PATH . "/user/class/RegistMailBuilder.class.php"; + +/** + * This action uses the special technic to realize confirming. It gets the + * register action form which has been inputted in UserRegister, through + * unserialize(). And, it uses a simple action form to confirm lastly. + */ class User_UserRegister_confirmAction extends User_Action { - var $mActionForm=null; - var $mRegistForm=null; - var $mConfig=array(); + var $mActionForm = null; + var $mRegistForm = null; + var $mConfig = null; - var $mNewUser=null; + var $mNewUser = null; - var $mRedirectMessage=null; + var $mRedirectMessage = null; - function prepare(&$controller, &$xoopsUser, &$moduleConfig) + /** + * TODO this member function uses the old style delegate. + */ + function prepare(&$controller, &$xoopsUser, $moduleConfig) { - $this->mConfig=&$moduleConfig; + $this->mConfig = $moduleConfig; $controller->mRoot->mEventManager->add("Module.User.Regist.Success", - new XCube_InstanceDelegate($this,"eventNotifyMail")); + new XCube_InstanceDelegate($this, "eventNotifyMail")); + + $this->_getRegistForm($controller); + $this->_processActionForm(); } - function execute(&$controller,&$xoopsUser) + function execute(&$controller, &$xoopsUser) { - // confirmForm - $this->_getRegistForm($controller); - $this->_processActionForm($controller); - - $memberHandler=&xoops_gethandler('member'); - $this->mNewUser=&$memberHandler->createUser(); + $memberHandler =& xoops_gethandler('member'); + $this->mNewUser =& $memberHandler->createUser(); $this->mRegistForm->update($this->mNewUser); - $this->mNewUser->setVar('uorder',$controller->getConfig('com_order'),true); - $this->mNewUser->setVar('umode',$controller->getConfig('com_mode'),true); - if($this->mConfig['activation_type'] == 1) { - $this->mNewUser->setVar('level',1,true); + $this->mNewUser->set('uorder', $controller->getConfig('com_order'), true); + $this->mNewUser->set('umode', $controller->getConfig('com_mode'), true); + if ($this->mConfig['activation_type'] == 1) { + $this->mNewUser->setVar('level', 1, true); } - if(!$memberHandler->insertUser($this->mNewUser)) { - $this->mRedirectMessage=_US_REGISTERNG; + if (!$memberHandler->insertUser($this->mNewUser)) { + $this->mRedirectMessage = _US_REGISTERNG; return USER_FRAME_VIEW_ERROR; } - if(!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS,$this->mNewUser->getVar('uid'))) { - $this->mRedirectMessage=_US_REGISTERNG; + if (!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS, $this->mNewUser->get('uid'))) { + $this->mRedirectMessage = _US_REGISTERNG; return USER_FRAME_VIEW_ERROR; } @@ -53,32 +64,31 @@ $this->_processMail($controller); $eventArgs = array(); - $controller->mRoot->mEventManager->raiseEvent("Module.User.Regist.Success",$controller,$eventArgs); + $controller->mRoot->mEventManager->raiseEvent("Module.User.Regist.Success", $controller, $eventArgs); return USER_FRAME_VIEW_SUCCESS; } - function getDefaultView(&$controller,&$xoopsUser) + function getDefaultView(&$controller, &$xoopsUser) { - $this->_getRegistForm($controller); - $this->_processActionForm($controller); - return USER_FRAME_VIEW_INPUT; } /** * Get regist actionform from Session and set it to the member property. + * @access private */ function _getRegistForm(&$controller) { - $this->mRegistForm=& unserialize($_SESSION['user_register_actionform']); - if(!is_object($this->mRegistForm)) { + $this->mRegistForm =& unserialize($_SESSION['user_register_actionform']); + if (!is_object($this->mRegistForm)) { $controller->executeForward('./index.php?action=UserRegister'); } } /** - * clear session + * Clear session. + * @access private */ function _clearRegistForm(&$controller) { @@ -87,61 +97,73 @@ function _processMail(&$controller) { - $activationType=$this->mConfig['activation_type']; + $activationType = $this->mConfig['activation_type']; - if($activationType==1) + if($activationType == 1) { return; + } // Wmm.. - $builder = ($activationType==0) ? new RegistUserActivateMailBuilder() - : new RegistUserAdminActivateMailBuilder(); + $builder = ($activationType == 0) ? new User_RegistUserActivateMailBuilder() + : new User_RegistUserAdminActivateMailBuilder(); - $director=new UserRegistMailDirector($this->mNewUser,$controller->getConfig(),$this->mConfig); - $director->contruct($builder); - $mailer=&$builder->getResult(); + $director =& new User_UserRegistMailDirector($builder, $this->mNewUser, $controller->getConfig(), $this->mConfig); + $director->contruct(); + $mailer =& $builder->getResult(); - $mailer->send(); // CHECKS + $mailer->send(); // TODO CHECKS } function eventNotifyMail(&$controller,&$eventArgs) { if($this->mConfig['new_user_notify'] == 1 && !empty($this->mConfig['new_user_notify_group'])) { - $director=new UserRegistMailDirector($this->mNewUser,$controller->getConfig(),$this->mConfig); - $builder = new RegistUserNotifyMailBuilder(); + $director =& new User_UserRegistMailDirector($this->mNewUser, $controller->getConfig(), $this->mConfig); + $builder =& new User_RegistUserNotifyMailBuilder(); $director->contruct($builder); - $mailer=&$builder->getResult(); + $mailer =& $builder->getResult(); $mailer->send(); } } - function _processActionForm(&$controller) + function _processActionForm() { - $this->mActionForm=new UserConfirmForm(); + $this->mActionForm =& new User_UserConfirmForm(); + $this->mActionForm->prepare(); } - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + function executeViewError(&$controller, &$xoopsUser, &$render) { - XCube_Utils::redirectHeader(XOOPS_URL,1,$this->mRedirectMessage); + $execute->executeRedirect(XOOPS_URL, 1, $this->mRedirectMessage); } - function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) + function executeViewInput(&$controller,&$xoopsUser,&$render) { - $renderSystem->setTemplateName("user_register_confirm.html"); - $renderSystem->setAttribute("actionForm",$this->mActionForm); - $renderSystem->setAttribute("registForm",$this->mRegistForm); + $render->setTemplateName("user_register_confirm.html"); + $render->setAttribute("actionForm", $this->mActionForm); + $render->setAttribute("registForm", $this->mRegistForm); } - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) { - $activationType=$this->mConfig['activation_type']; + $activationType = $this->mConfig['activation_type']; - if($activationType==0) { - $renderSystem->setTemplateName("user_register_finish.html"); - $renderSystem->setAttribute("complete_message",_US_YOURREGISTERED); - } else if($activationType==1) { - XCube_Utils::redirectHeader(XOOPS_URL,4,_US_ACTLOGIN); - } else if($activationType==2) { - $renderSystem->setTemplateName("user_register_finish.html"); - $renderSystem->setAttribute("complete_message",_US_YOURREGISTERED2); + if ($activationType == 0) { + $render->setTemplateName("user_register_finish.html"); + $render->setAttribute("complete_message", _US_YOURREGISTERED); + } + elseif ($activationType == 1) { + $controller->executeRedirect(XOOPS_URL, 4, _US_ACTLOGIN); + } + elseif($activationType == 2) { + $render->setTemplateName("user_register_finish.html"); + $render->setAttribute("complete_message", _US_YOURREGISTERED2); + } + else { + // + // This case is never. + // + $render->setTemplateName("user_register_finish.html"); + $render->setAttribute("complete_message", _US_YOURREGISTERED2); } } } Index: xoops2jp/html/modules/user/actions/UserRegisterAction.class.php diff -u xoops2jp/html/modules/user/actions/UserRegisterAction.class.php:1.1.2.7 xoops2jp/html/modules/user/actions/UserRegisterAction.class.php:1.1.2.8 --- xoops2jp/html/modules/user/actions/UserRegisterAction.class.php:1.1.2.7 Tue Mar 28 22:31:02 2006 +++ xoops2jp/html/modules/user/actions/UserRegisterAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,39 +1,51 @@ <?php +/** + * @package user + * @version $Id: UserRegisterAction.class.php,v 1.1.2.8 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); -require_once XOOPS_MODULE_PATH."/user/forms/UserRegisterEditForm.class.php"; +require_once XOOPS_MODULE_PATH . "/user/forms/UserRegisterEditForm.class.php"; +/** + * This action uses the special technic to realize confirming. It set the + * register action form to Session through serialize(), then forward to the + * confirm action. Because the confirm action can't work without the register + * action form which it fetches from Session, the confim action doesn't need + * to check the permission to register. + */ class User_UserRegisterAction extends User_Action { - var $mActionForm=null; + var $mActionForm = null; var $mConfig; - var $mEnableAgreeFlag=false; + var $mEnableAgreeFlag = false; - function prepare(&$controller, &$xoopsUser, &$moduleConfig) + function prepare(&$controller, &$xoopsUser, $moduleConfig) { - $this->mConfig=&$moduleConfig; + $this->mConfig = $moduleConfig; if(is_object($xoopsUser)) { + // // If user is registered, kick to his information page. - $controller->executeForward(XOOPS_URL."/user.php"); + // + $controller->executeForward(XOOPS_URL . "/user.php"); } if (empty($this->mConfig['allow_register'])) { - redirect_header(XOOPS_URL.'/', 6, _US_NOREGISTER); - exit(); + $controller->executeRedirect(XOOPS_URL, 6, _US_NOREGISTER); } } - function execute(&$controller,&$xoopsUser) + function execute(&$controller, &$xoopsUser) { $this->_processActionForm(); $this->mActionForm->fetch(); $this->mActionForm->validate(); - if($this->mActionForm->hasError()) { + if ($this->mActionForm->hasError()) { return USER_FRAME_VIEW_INPUT; } else { - $_SESSION['user_register_actionform']=serialize(&$this->mActionForm); + $_SESSION['user_register_actionform'] = serialize(&$this->mActionForm); $controller->executeForward('./index.php?action=UserRegister_confirm'); } } @@ -46,11 +58,11 @@ function _processActionForm() { - if($this->mConfig['reg_dispdsclmr']!=0 && $this->mConfig['reg_disclaimer']!=null) { - $this->mEnableAgreeFlag=true; - $this->mActionForm=new UserRegisterAgreeEditForm(); + if ($this->mConfig['reg_dispdsclmr'] != 0 && $this->mConfig['reg_disclaimer'] != null) { + $this->mEnableAgreeFlag = true; + $this->mActionForm =& new User_RegisterAgreeEditForm(); } else { - $this->mActionForm=new UserRegisterEditForm(); + $this->mActionForm =& new User_RegisterEditForm(); } $this->mActionForm->prepare($this->mConfig); @@ -59,14 +71,16 @@ function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) { $renderSystem->setTemplateName("user_register_form.html"); + // // Get some objects for input form. + // $tzoneHandler =& xoops_gethandler('timezone'); $timezones =& $tzoneHandler->getObjects(); $renderSystem->setAttribute('timezones', $timezones); - $renderSystem->setAttribute("actionForm",$this->mActionForm); - $renderSystem->setAttribute("enableAgree",$this->mEnableAgreeFlag); + $renderSystem->setAttribute("actionForm", $this->mActionForm); + $renderSystem->setAttribute("enableAgree", $this->mEnableAgreeFlag); if($this->mEnableAgreeFlag) { - $renderSystem->setAttribute("disclaimer",$this->mConfig['reg_disclaimer']); + $renderSystem->setAttribute("disclaimer", $this->mConfig['reg_disclaimer']); } } } Index: xoops2jp/html/modules/user/actions/UserInfoAction.class.php diff -u xoops2jp/html/modules/user/actions/UserInfoAction.class.php:1.1.2.3 xoops2jp/html/modules/user/actions/UserInfoAction.class.php:1.1.2.4 --- xoops2jp/html/modules/user/actions/UserInfoAction.class.php:1.1.2.3 Tue Mar 28 22:31:02 2006 +++ xoops2jp/html/modules/user/actions/UserInfoAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,9 +1,20 @@ <?php +/** + * @package user + * @version $Id: UserInfoAction.class.php,v 1.1.2.4 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); /** - * Receive $_GET['uid'] + * This action shows a information of the target user which is specified by + * $uid. And display posts of the user with the global search service. + * + * [Warning] + * Now, the global search service can't work because the design of XCube is + * changed. + * + * @todo The global search service can't work. */ class User_UserInfoAction extends User_Action { @@ -18,7 +29,7 @@ function getDefaultView(&$controller, &$xoopsUser) { - $uid = isset($_GET['uid']) ? intval($_GET['uid']) : 0; + $uid = isset($_GET['uid']) ? intval(xoops_getrequest('uid')) : 0; $handler =& xoops_gethandler('user'); $this->mObject =& $handler->get($uid); @@ -31,7 +42,7 @@ $this->mRankObject =& $rankHandler->get($this->mObject->get('rank')); $root =& $controller->mRoot; - $service =& $root->mServiceManager->searchXCubeService("LegacySearch"); + $service =& $root->mServiceManager->getService("LegacySearch"); if ($service) { $current_uid = is_object($xoopsUser) ? $xoopsUser->get('uid') : 0; @@ -44,6 +55,11 @@ return USER_FRAME_VIEW_SUCCESS; } + /** + * [Notice] + * Because XCube_Service class group are changed now, this member function + * can't get the result of user posts. + */ function executeViewSuccess(&$controller, &$xoopsUser, &$render) { $render->setTemplateName("user_userinfo.html"); Index: xoops2jp/html/modules/user/actions/UserActivateAction.class.php diff -u xoops2jp/html/modules/user/actions/UserActivateAction.class.php:1.1.2.2 xoops2jp/html/modules/user/actions/UserActivateAction.class.php:1.1.2.3 --- xoops2jp/html/modules/user/actions/UserActivateAction.class.php:1.1.2.2 Tue Mar 28 22:31:02 2006 +++ xoops2jp/html/modules/user/actions/UserActivateAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,22 +1,27 @@ <?php +/** + * @package user + * @version $Id: UserActivateAction.class.php,v 1.1.2.3 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); -require_once XOOPS_MODULE_PATH."/user/class/AbstractEditAction.class.php"; -require_once XOOPS_MODULE_PATH."/user/class/RegistMailBuilder.class.php"; +require_once XOOPS_MODULE_PATH . "/user/class/AbstractEditAction.class.php"; +require_once XOOPS_MODULE_PATH . "/user/class/RegistMailBuilder.class.php"; class User_UserActivateAction extends User_AbstractEditAction { function _getId() { - return isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; + return isset($_REQUEST['uid']) ? intval(xoops_getrequest('uid')) : 0; } function &_getHandler() { - $handler =& xoops_gethandler('user'); + $handler =& xoops_getmodulehandler('user'); return $handler; } + /** * Return false. * If a user requests dummy uid, kick out him! @@ -38,34 +43,36 @@ function getDefaultView(&$controller, &$xoopsUser) { if ((!isset($_REQUEST['actkey'])) || (!$this->mObject)) { - $controller->executeForward(XOOPS_URL.'/'); - exit(); + $controller->executeForward(XOOPS_URL . '/'); } - if ($this->mObject->get('actkey') != $_REQUEST['actkey']) { - redirect_header(XOOPS_URL, 3, _US_ACTKEYNOT); - exit(); + + if ($this->mObject->get('actkey') != xoops_getrequest('actkey')) { + $controller->executeRedirect(XOOPS_URL, 3, _US_ACTKEYNOT); } + if ($this->mObject->get('level') > 1) { - redirect_header(XOOPS_URL.'/user.php', 3, _US_ACONTACT); - exit(); + $controller->executeRedirect(XOOPS_URL . '/user.php', 3, _US_ACONTACT); } - $this->mObject->setVar('level','1'); + $this->mObject->set('level', '1'); + + // // Force update with GET request - $this->mObjectHandler->insert($this->mObject,true); + // + $this->mObjectHandler->insert($this->mObject, true); if ($this->mConfig['activation_type'] == 2) { - $builder = new RegistAdminCommitMailBuilder(); - $director=new UserRegistMailDirector($this->mObject,$controller->getConfig(),$this->mConfig); + $builder =& new RegistAdminCommitMailBuilder(); + $director =& new UserRegistMailDirector($this->mObject, $controller->getConfig(), $this->mConfig); $director->contruct($builder); $mailer=&$builder->getResult(); if ($mailer->send()) { - redirect_header(XOOPS_URL.'/' ,5, sprintf(_US_ACTVMAILOK, $this->mObject->getVar('uname'))); + $controller->executeRedirect(XOOPS_URL, 5, sprintf(_US_ACTVMAILOK, $this->mObject->get('uname'))); } else { - redirect_header(XOOPS_URL.'/' ,5, sprintf(_US_ACTVMAILNG, $this->mObject->getVar('uname'))); + $controller->executeRedirect(XOOPS_URL, 5, sprintf(_US_ACTVMAILNG, $this->mObject->get('uname'))); } } else { - redirect_header(XOOPS_URL.'/user.php' ,5,_US_ACTLOGIN); + $controller->executeRedirect(XOOPS_URL . '/user.php', 5, _US_ACTLOGIN); } } } Index: xoops2jp/html/modules/user/actions/DefaultAction.class.php diff -u xoops2jp/html/modules/user/actions/DefaultAction.class.php:1.1.2.2 xoops2jp/html/modules/user/actions/DefaultAction.class.php:1.1.2.3 --- xoops2jp/html/modules/user/actions/DefaultAction.class.php:1.1.2.2 Tue Mar 28 22:31:02 2006 +++ xoops2jp/html/modules/user/actions/DefaultAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,9 +1,14 @@ <?php +/** + * @package legacy + * @version $Id: DefaultAction.class.php,v 1.1.2.3 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); /** - * Receive $_GET['uid'] + * This action shows two forms for login and lostpass. If the current user is + * logined, forward to the userinfo page. */ class User_DefaultAction extends User_Action { Index: xoops2jp/html/modules/user/actions/LostPassAction.class.php diff -u xoops2jp/html/modules/user/actions/LostPassAction.class.php:1.1.2.3 xoops2jp/html/modules/user/actions/LostPassAction.class.php:1.1.2.4 --- xoops2jp/html/modules/user/actions/LostPassAction.class.php:1.1.2.3 Tue Apr 11 19:03:53 2006 +++ xoops2jp/html/modules/user/actions/LostPassAction.class.php Wed Jul 19 19:20:33 2006 @@ -1,4 +1,8 @@ <?php +/** + * @package user + * @version $Id: LostPassAction.class.php,v 1.1.2.4 2006/07/19 10:20:33 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -7,11 +11,14 @@ class User_LostPassAction extends User_Action { + /** + * @var User_LostPassEditForm + */ var $mActionForm = null; - function prepare(&$controller, &$xoopsUser) + function prepare(&$controller, &$xoopsUser, $moduleConfig) { - $this->mActionForm =& new LostPassEditForm(); + $this->mActionForm =& new User_LostPassEditForm(); $this->mActionForm->prepare(); } @@ -20,23 +27,27 @@ return false; } - function hasPerm(&$controller, &$xoopsUser) + /** + * Allow anonymous users only. + */ + function hasPerm(&$controller, &$xoopsUser, $moduleConfig) { return !is_object($xoopsUser); } - function getDefaultView(&$controller, &$xoopsUser) + function getDefaultView(&$controller, &$xoopsUser, $moduleConfig) { - if ((!isset($_REQUEST['code']))||(!isset($_REQUEST['email']))) { + if ((!isset($_REQUEST['code'])) || (!isset($_REQUEST['email']))) { return USER_FRAME_VIEW_INPUT; } else { return $this->_updatePassword($controller); } } + function _updatePassword(&$controller) { $this->mActionForm->fetch(); - $userHandler =& xoops_gethandler('user'); + $userHandler =& xoops_getmodulehandler('users'); $lostUserArr =& $userHandler->getObjects(new Criteria('email', $this->mActionForm->get('email'))); if (is_array($lostUserArr) && count($lostUserArr) > 0) { $lostUser =& $lostUserArr[0]; @@ -47,15 +58,15 @@ $newpass = xoops_makepass(); $extraVars['newpass'] = $newpass; - $builder =& new LostPass2MailBuilder(); - $director =& new LostPassMailDirector($builder, $lostUser, $controller->mConfig, $extraVars); + $builder =& new User_LostPass2MailBuilder(); + $director =& new User_LostPassMailDirector($builder, $lostUser, $controller->mConfig, $extraVars); $director->contruct(); $xoopsMailer =& $builder->getResult(); if (!$xoopsMailer->send()) { // $xoopsMailer->getErrors(); return USER_FRAME_VIEW_ERROR; } - $lostUser->setVar('pass',md5($newpass), true); + $lostUser->set('pass',md5($newpass), true); $userHandler->insert($lostUser, true); return USER_FRAME_VIEW_SUCCESS; @@ -70,7 +81,7 @@ return USER_FRAME_VIEW_INPUT; } - $userHandler =& xoops_gethandler('user'); + $userHandler =& xoops_getmodulehandler('users'); $lostUserArr =& $userHandler->getObjects(new Criteria('email', $this->mActionForm->get('email'))); if (is_array($lostUserArr) && count($lostUserArr) > 0) { @@ -80,8 +91,8 @@ return USER_FRAME_VIEW_SUCCESS; } - $builder =& new LostPass1MailBuilder(); - $director =& new LostPassMailDirector($builder, $lostUser, $controller->mConfig); + $builder =& new User_LostPass1MailBuilder(); + $director =& new User_LostPassMailDirector($builder, $lostUser, $controller->mConfig); $director->contruct(); $xoopsMailer =& $builder->getResult(); @@ -101,11 +112,12 @@ function executeViewSuccess(&$controller, &$xoopsUser, &$render) { + $controller->executeRedirect(XOOPS_URL, 3, _MD_MESSAGE_SEND_PASSWORD); } function executeViewError(&$controller, &$xoopsUser, &$render) { - redirect_header(XOOPS_URL, 3, _MD_ERROR_SEND_MAIL); + $controller->executeRedirect(XOOPS_URL, 3, _MD_ERROR_SEND_MAIL); } }