NobuNobu
nobun****@users*****
2006年 12月 3日 (日) 16:44:53 JST
Index: xoops2jp/html/modules/user/actions/UserDeleteAction.class.php diff -u xoops2jp/html/modules/user/actions/UserDeleteAction.class.php:1.1.2.2.2.5 xoops2jp/html/modules/user/actions/UserDeleteAction.class.php:1.1.2.2.2.6 --- xoops2jp/html/modules/user/actions/UserDeleteAction.class.php:1.1.2.2.2.5 Sun Dec 3 13:52:17 2006 +++ xoops2jp/html/modules/user/actions/UserDeleteAction.class.php Sun Dec 3 16:44:53 2006 @@ -1,125 +1,125 @@ -<?php -/** - * @package user - * @version $Id$ - */ - -if (!defined('XOOPS_ROOT_PATH')) exit(); - -require_once XOOPS_MODULE_PATH . "/user/forms/UserDeleteForm.class.php"; - -/** - * This action is for self delete function. - * - * Site owner want various procedure to this action. Therefore, this action may - * have to implement main logic with Delegate only. - */ -class User_UserDeleteAction extends User_Action -{ - var $mActionForm = null; - var $mObject = null; - - var $mSelfDelete = false; - var $mSelfDeleteConfirmMessage = ""; - - function prepare(&$controller, &$xoopsUser, $moduleConfig) - { - $this->mSelfDelete = $moduleConfig['self_delete']; - $this->mSelfDeleteConfirmMessage = $moduleConfig['self_delete_confirm']; - - $this->mActionForm =& new User_UserDeleteForm(); - $this->mActionForm->prepare(); - - // - // pre condition check - // - if (!$this->mSelfDelete) { - $controller->executeForward(XOOPS_URL . '/'); - } - - if (is_object($xoopsUser)) { - $handler =& xoops_getmodulehandler('users', 'user'); - $this->mObject =& $handler->get($xoopsUser->get('uid')); - } - } - - function isSecure() - { - return true; - } - - function hasPermission(&$controller, &$xoopsUser, $moduleConfig) - { - if ($xoopsUser->get('uid') == 1) { - return false; - } - - return true; - } - - function getDefaultView(&$controller, &$xoopsUser) - { - return USER_FRAME_VIEW_INPUT; - } - - /** - * FIXME: Need FORCE LOGOUT here? - */ - function execute(&$controller, &$xoopsUser) - { - $this->mActionForm->fetch(); - $this->mActionForm->validate(); - - if ($this->mActionForm->hasError()) { - return $this->getDefaultView($controller, $xoopsUser); - } - - if ($this->_doDelete($controller, $xoopsUser)) { - XCube_DelegateUtils::call('Legacy.Event.UserDelete', new XCube_Ref($this->mObject)); - - return USER_FRAME_VIEW_SUCCESS; - } - - return USER_FRAME_VIEW_ERROR; - } - - /** - * Exection deleting. - * - * @return bool - */ - function _doDelete(&$controller, &$xoopsUser) - { - $handler =& xoops_gethandler('member'); - if ($handler->deleteUser($xoopsUser)) { - $handler =& xoops_gethandler('online'); - $handler->destroy($this->mObject->get('uid')); - xoops_notification_deletebyuser($this->mObject->get('uid')); - - return true; - } - - return false; - } - - function executeViewInput(&$controller, &$xoopsUser, &$render) - { - $render->setTemplateName("user_delete.html"); - $render->setAttribute('object', $this->mObject); - $render->setAttribute('actionForm', $this->mActionForm); - $render->setAttribute('self_delete_message', $this->mSelfDeleteConfirmMessage); - } - - function executeViewSuccess(&$controller, &$xoopsUser, &$render) - { - $render->setTemplateName("user_delete_success.html"); - $render->setAttribute("object", $this->mObject); - } - - function executeViewError(&$controller, &$xoopsUser, &$render) - { - $controller->executeRedirect(XOOPS_URL . '/', 3, _MD_USER_ERROR_DBUPDATE_FAILED); - } -} - +<?php +/** + * @package user + * @version $Id$ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/user/forms/UserDeleteForm.class.php"; + +/** + * This action is for self delete function. + * + * Site owner want various procedure to this action. Therefore, this action may + * have to implement main logic with Delegate only. + */ +class User_UserDeleteAction extends User_Action +{ + var $mActionForm = null; + var $mObject = null; + + var $mSelfDelete = false; + var $mSelfDeleteConfirmMessage = ""; + + function prepare(&$controller, &$xoopsUser, $moduleConfig) + { + $this->mSelfDelete = $moduleConfig['self_delete']; + $this->mSelfDeleteConfirmMessage = $moduleConfig['self_delete_confirm']; + + $this->mActionForm =& new User_UserDeleteForm(); + $this->mActionForm->prepare(); + + // + // pre condition check + // + if (!$this->mSelfDelete) { + $controller->executeForward(XOOPS_URL . '/'); + } + + if (is_object($xoopsUser)) { + $handler =& xoops_getmodulehandler('users', 'user'); + $this->mObject =& $handler->get($xoopsUser->get('uid')); + } + } + + function isSecure() + { + return true; + } + + function hasPermission(&$controller, &$xoopsUser, $moduleConfig) + { + if ($xoopsUser->get('uid') == 1) { + return false; + } + + return true; + } + + function getDefaultView(&$controller, &$xoopsUser) + { + return USER_FRAME_VIEW_INPUT; + } + + /** + * FIXME: Need FORCE LOGOUT here? + */ + function execute(&$controller, &$xoopsUser) + { + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return $this->getDefaultView($controller, $xoopsUser); + } + + if ($this->_doDelete($controller, $xoopsUser)) { + XCube_DelegateUtils::call('Legacy.Event.UserDelete', new XCube_Ref($this->mObject)); + + return USER_FRAME_VIEW_SUCCESS; + } + + return USER_FRAME_VIEW_ERROR; + } + + /** + * Exection deleting. + * + * @return bool + */ + function _doDelete(&$controller, &$xoopsUser) + { + $handler =& xoops_gethandler('member'); + if ($handler->deleteUser($xoopsUser)) { + $handler =& xoops_gethandler('online'); + $handler->destroy($this->mObject->get('uid')); + xoops_notification_deletebyuser($this->mObject->get('uid')); + + return true; + } + + return false; + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_delete.html"); + $render->setAttribute('object', $this->mObject); + $render->setAttribute('actionForm', $this->mActionForm); + $render->setAttribute('self_delete_message', $this->mSelfDeleteConfirmMessage); + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_delete_success.html"); + $render->setAttribute("object", $this->mObject); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + $controller->executeRedirect(XOOPS_URL . '/', 3, _MD_USER_ERROR_DBUPDATE_FAILED); + } +} + ?> \ No newline at end of file Index: xoops2jp/html/modules/user/actions/MiscOnlineAction.class.php diff -u xoops2jp/html/modules/user/actions/MiscOnlineAction.class.php:1.1.2.1.2.6 xoops2jp/html/modules/user/actions/MiscOnlineAction.class.php:1.1.2.1.2.7 --- xoops2jp/html/modules/user/actions/MiscOnlineAction.class.php:1.1.2.1.2.6 Sun Dec 3 13:52:17 2006 +++ xoops2jp/html/modules/user/actions/MiscOnlineAction.class.php Sun Dec 3 16:44:53 2006 @@ -1,50 +1,50 @@ -<?php -/** - * @package Legacy - * @version $Id: MiscOnlineAction.class.php,v 1.1.2.2 2006/08/05 13:21:06 minahito Exp $ - */ - -if (!defined('XOOPS_ROOT_PATH')) exit(); - -require_once XOOPS_MODULE_PATH . "/user/class/AbstractListAction.class.php"; -require_once XOOPS_MODULE_PATH . "/user/forms/OnlineFilterForm.class.php"; - -class User_MiscOnlineAction extends User_AbstractListAction -{ - function prepare(&$controller, &$xoopsUser, &$moduleConfig) - { - $controller->mRoot->mLanguageManager->loadModuleMessageCatalog('user'); - } - - function &_getHandler() - { - $handler =& xoops_getmodulehandler('online', 'user'); - return $handler; - } - - function &_getFilterForm() - { - $filter =& new User_OnlineFilterForm($this->_getPageNavi(), $this->_getHandler()); - return $filter; - } - - function _getBaseUrl() - { - return "./misc.php?type=Online"; - } - - function executeViewIndex(&$controller, &$xoopsUser, &$render) - { - $render->setTemplateName("user_misc_online.html"); - - foreach (array_keys($this->mObjects) as $key) { - $this->mObjects[$key]->loadModule(); - } - - $render->setAttribute("objects", $this->mObjects); - $render->setAttribute("pageNavi", $this->mFilter->mNavi); - $render->setAttribute('enableViewIP', $controller->mRoot->mContext->mUser->isInRole('Module.user.Admin')); - } -} - -?> +<?php +/** + * @package Legacy + * @version $Id: MiscOnlineAction.class.php,v 1.1.2.2 2006/08/05 13:21:06 minahito Exp $ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/user/class/AbstractListAction.class.php"; +require_once XOOPS_MODULE_PATH . "/user/forms/OnlineFilterForm.class.php"; + +class User_MiscOnlineAction extends User_AbstractListAction +{ + function prepare(&$controller, &$xoopsUser, &$moduleConfig) + { + $controller->mRoot->mLanguageManager->loadModuleMessageCatalog('user'); + } + + function &_getHandler() + { + $handler =& xoops_getmodulehandler('online', 'user'); + return $handler; + } + + function &_getFilterForm() + { + $filter =& new User_OnlineFilterForm($this->_getPageNavi(), $this->_getHandler()); + return $filter; + } + + function _getBaseUrl() + { + return "./misc.php?type=Online"; + } + + function executeViewIndex(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("user_misc_online.html"); + + foreach (array_keys($this->mObjects) as $key) { + $this->mObjects[$key]->loadModule(); + } + + $render->setAttribute("objects", $this->mObjects); + $render->setAttribute("pageNavi", $this->mFilter->mNavi); + $render->setAttribute('enableViewIP', $controller->mRoot->mContext->mUser->isInRole('Module.user.Admin')); + } +} + +?>