Minahito
minah****@users*****
2006年 1月 17日 (火) 19:34:23 JST
Index: xoops2jp/html/modules/user/actions/LostpassAction.class.php diff -u /dev/null xoops2jp/html/modules/user/actions/LostpassAction.class.php:1.1.2.1 --- /dev/null Tue Jan 17 19:34:23 2006 +++ xoops2jp/html/modules/user/actions/LostpassAction.class.php Tue Jan 17 19:34:23 2006 @@ -0,0 +1,84 @@ +<?php + +require_once XOOPS_MODULE_PATH . "/user/forms/LostpassEditForm.class.php"; +require_once XOOPS_MODULE_PATH . "/user/class/LostpassMailBuilder.class.php"; +require_once XOOPS_MODULE_PATH . "/user/class/LostpassMailDirector.class.php"; + +class User_LostpassAction extends User_Action +{ + var $mActionForm = null; + + function prepare(&$controller, &$xoopsUser) + { + $this->mActionForm =& new LostpassEditForm(); + $this->mActionForm->prepare(); + } + + function isSecure() + { + return false; + } + + function isPerm(&$controller, &$xoopsUser) + { + return !is_object($xoopsUser); + } + + function getDefaultView(&$controller, &$xoopsUser) + { + return USER_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) + { + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return USER_FRAME_VIEW_INPUT; + } + + $userHandler =& xoops_gethandler('user'); + $lostUserArr =& $userHandler->getObjects(new Criteria('email', $this->mActionForm->get('email'))); + + if (is_array($lostUserArr) && count($lostUserArr) > 0) { + $lostUser =& $lostUserArr[0]; + } + else { + return USER_FRAME_VIEW_SUCCESS; + } + + $builder =& new LostpassMailBuilder(); + $director =& new LostpassMailDirector($builder, $lostUser, $controller->mConfig); + $director->contruct(); + $xoopsMailer =& $builder->getResult(); + + if (!$xoopsMailer->send()) { + // $xoopsMailer->getErrors(); + return USER_FRAME_VIEW_ERROR; + } + + return USER_FRAME_VIEW_SUCCESS; + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_lostpass.html"); + $render->setAttribute("actionForm", $this->mActionForm); + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + // + // + // + die("TODO"); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + redirect_header(XOOPS_URL, 3, _MD_ERROR_SEND_MAIL); + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/actions/EditUserAction.class.php diff -u /dev/null xoops2jp/html/modules/user/actions/EditUserAction.class.php:1.1.2.4 --- /dev/null Tue Jan 17 19:34:23 2006 +++ xoops2jp/html/modules/user/actions/EditUserAction.class.php Tue Jan 17 19:34:23 2006 @@ -0,0 +1,52 @@ +<?php + +require_once XOOPS_MODULE_PATH . "/user/class/AbstractEditAction.class.php"; +require_once XOOPS_MODULE_PATH . "/user/forms/EditUserForm.class.php"; + +class User_EditUserAction extends User_AbstractEditAction +{ + function _getId() + { + return isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; + } + + function &_getHandler() + { + $handler =& xoops_gethandler('user'); + return $handler; + } + + function _setupActionForm() + { + $this->mActionForm=new EditUserForm(); + $this->mActionForm->prepare(); + } + + function isEnableCreate() + { + return false; + } + + function isSecure() + { + return true; + } + + function isPerm(&$controller, &$xoopsUser) + { + if ($this->mObject != null) { + return ($this->mObject->get('uid') == $xoopsUser->get('uid') || $xoopsUser->isAdmin()); + } + + return false; + } + + function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("user_edituser.html"); + $renderSystem->setAttribute("actionForm",$this->mActionForm); + $renderSystem->setAttribute("thisUser",$this->mObject); + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/actions/DefaultAction.class.php diff -u /dev/null xoops2jp/html/modules/user/actions/DefaultAction.class.php:1.1.2.1 --- /dev/null Tue Jan 17 19:34:23 2006 +++ xoops2jp/html/modules/user/actions/DefaultAction.class.php Tue Jan 17 19:34:23 2006 @@ -0,0 +1,29 @@ +<?php + +/** + * Receive $_GET['uid'] + */ +class User_DefaultAction extends User_Action +{ + function isSecure() + { + return false; + } + + function getDefaultView(&$controller, &$xoopsUser) + { + return is_object($xoopsUser) ? USER_FRAME_VIEW_ERROR : USER_FRAME_VIEW_INPUT; + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_default.html"); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + $controller->executeForward("index.php?action=UserInfo&uid=" . $xoopsUser->get('uid')); + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/actions/UserInfoAction.class.php diff -u /dev/null xoops2jp/html/modules/user/actions/UserInfoAction.class.php:1.1.2.1 --- /dev/null Tue Jan 17 19:34:23 2006 +++ xoops2jp/html/modules/user/actions/UserInfoAction.class.php Tue Jan 17 19:34:23 2006 @@ -0,0 +1,65 @@ +<?php + +/** + * Receive $_GET['uid'] + */ +class User_UserInfoAction extends User_Action +{ + var $mObject = null; + var $mRankObject = null; + var $mSearchResults = null; + + function isSecure() + { + return false; + } + + function getDefaultView(&$controller, &$xoopsUser) + { + $uid = isset($_GET['uid']) ? intval($_GET['uid']) : 0; + + $handler =& xoops_gethandler('user'); + $this->mObject =& $handler->get($uid); + + if (!is_object($this->mObject)) { + return USER_FRAME_VIEW_ERROR; + } + + $rankHandler =& xoops_getmodulehandler('rank'); + $this->mRankObject =& $rankHandler->get($this->mObject->get('rank')); + + $root =& $controller->mRoot; + $service =& $root->mServiceManager->searchXCubeService("LegacySearch"); + if ($service) { + $current_uid = is_object($xoopsUser) ? $xoopsUser->get('uid') : 0; + + $client =& new XCube_ServiceClient($service); + + $parameters = array("uid" => $uid, 'current_uid' => $current_uid); + $this->mSearchResults = $client->call("getItems", $parameters); + } + + return USER_FRAME_VIEW_SUCCESS; + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_userinfo.html"); + $render->setAttribute("thisUser", $this->mObject); + $render->setAttribute("rank", $this->mRankObject); + + $myts =& MyTextSanitizer::getInstance(); + $userSignature = $myts->makeTareaData4Show($this->mObject->get('user_sig'), 0, 1, 1); + + $render->setAttribute('user_signature', $userSignature); + + $render->setAttribute("searchResults", $this->mSearchResults); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + $controller->executeForward("./index.php"); + } +} + +?> \ No newline at end of file