From 2fe45e041ecaabc42ba1205b01a25cb41ba242cc Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 2 Jun 2013 16:44:06 +0200 Subject: [PATCH] Removed obsolete code --- wcfsetup/install/files/acp/js/WCF.ACP.User.js | 4 +- .../data/user/ExtendedUserAction.class.php | 95 ------------------- .../files/lib/data/user/UserAction.class.php | 73 ++++++++++++++ .../lib/form/RegisterActivationForm.class.php | 4 +- 4 files changed, 77 insertions(+), 99 deletions(-) delete mode 100644 wcfsetup/install/files/lib/data/user/ExtendedUserAction.class.php diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.User.js b/wcfsetup/install/files/acp/js/WCF.ACP.User.js index 0ab753289d..7f597c6963 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.User.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.User.js @@ -59,7 +59,7 @@ WCF.ACP.User.EnableHandler = { disable: function(userIDs) { this._proxy.setOption('data', { actionName: 'disable', - className: 'wcf\\data\\user\\ExtendedUserAction', + className: 'wcf\\data\\user\\UserAction', objectIDs: userIDs }); this._proxy.sendRequest(); @@ -73,7 +73,7 @@ WCF.ACP.User.EnableHandler = { enable: function(userIDs) { this._proxy.setOption('data', { actionName: 'enable', - className: 'wcf\\data\\user\\ExtendedUserAction', + className: 'wcf\\data\\user\\UserAction', objectIDs: userIDs }); this._proxy.sendRequest(); diff --git a/wcfsetup/install/files/lib/data/user/ExtendedUserAction.class.php b/wcfsetup/install/files/lib/data/user/ExtendedUserAction.class.php deleted file mode 100644 index b73e80dc49..0000000000 --- a/wcfsetup/install/files/lib/data/user/ExtendedUserAction.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @package com.woltlab.wcf.user - * @subpackage data.user - * @category Community Framework - */ -class ExtendedUserAction extends AbstractDatabaseObjectAction { - /** - * @see wcf\data\AbstractDatabaseObjectAction::$className - */ - public $className = 'wcf\data\user\UserEditor'; - - /** - * Validates the enable action. - */ - public function validateEnable() { - WCF::getSession()->checkPermissions(array('admin.user.canEnableUser')); - } - - /** - * Validates the disable action. - */ - public function validateDisable() { - $this->validateEnable(); - } - - /** - * Enables users. - */ - public function enable() { - if (empty($this->objects)) $this->readObjects(); - - $action = new UserAction($this->objects, 'update', array( - 'data' => array( - 'activationCode' => 0 - ), - 'groups' => array( - UserGroup::USERS - ), - 'removeGroups' => array( - UserGroup::GUESTS - ) - )); - $action->executeAction(); - - // update user rank - if (MODULE_USER_RANK) { - $action = new UserProfileAction($this->objects, 'updateUserRank'); - $action->executeAction(); - } - // update user online marking - $action = new UserProfileAction($this->objects, 'updateUserOnlineMarking'); - $action->executeAction(); - } - - /** - * Disables users. - */ - public function disable() { - if (empty($this->objects)) $this->readObjects(); - - $action = new UserAction($this->objects, 'update', array( - 'data' => array( - 'activationCode' => UserRegistrationUtil::getActivationCode() - ), - 'removeGroups' => array( - UserGroup::USERS - ), - 'groups' => array( - UserGroup::GUESTS - ) - )); - $action->executeAction(); - - // update user rank - if (MODULE_USER_RANK) { - $action = new UserProfileAction($this->objects, 'updateUserRank'); - $action->executeAction(); - } - // update user online marking - $action = new UserProfileAction($this->objects, 'updateUserOnlineMarking'); - $action->executeAction(); - } -} diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index a96d19efdd..fe83e8ed38 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -13,6 +13,7 @@ use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\util\StringUtil; +use wcf\util\UserRegistrationUtil; /** * Executes user-related actions. @@ -428,4 +429,76 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio ClipboardHandler::getInstance()->unmark($userIDs, ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user')); } } + + /** + * Validates the enable action. + */ + public function validateEnable() { + WCF::getSession()->checkPermissions(array('admin.user.canEnableUser')); + } + + /** + * Validates the disable action. + */ + public function validateDisable() { + $this->validateEnable(); + } + + /** + * Enables users. + */ + public function enable() { + if (empty($this->objects)) $this->readObjects(); + + $action = new UserAction($this->objects, 'update', array( + 'data' => array( + 'activationCode' => 0 + ), + 'groups' => array( + UserGroup::USERS + ), + 'removeGroups' => array( + UserGroup::GUESTS + ) + )); + $action->executeAction(); + + // update user rank + if (MODULE_USER_RANK) { + $action = new UserProfileAction($this->objects, 'updateUserRank'); + $action->executeAction(); + } + // update user online marking + $action = new UserProfileAction($this->objects, 'updateUserOnlineMarking'); + $action->executeAction(); + } + + /** + * Disables users. + */ + public function disable() { + if (empty($this->objects)) $this->readObjects(); + + $action = new UserAction($this->objects, 'update', array( + 'data' => array( + 'activationCode' => UserRegistrationUtil::getActivationCode() + ), + 'removeGroups' => array( + UserGroup::USERS + ), + 'groups' => array( + UserGroup::GUESTS + ) + )); + $action->executeAction(); + + // update user rank + if (MODULE_USER_RANK) { + $action = new UserProfileAction($this->objects, 'updateUserRank'); + $action->executeAction(); + } + // update user online marking + $action = new UserProfileAction($this->objects, 'updateUserOnlineMarking'); + $action->executeAction(); + } } diff --git a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php index a2dd27d15f..7b8eb1299d 100644 --- a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php @@ -1,7 +1,7 @@ objectAction = new ExtendedUserAction(array($this->user), 'enable'); + $this->objectAction = new UserAction(array($this->user), 'enable'); $this->objectAction->executeAction(); $this->saved(); -- 2.20.1