/** * @see Form::save() */ public function save() { parent::save(); // save require_once WCF_DIR . 'lib/data/user/group/GroupApplicationEditor.class.php'; $this->applicationID = GroupApplicationEditor::create(WCF::getUser()->userID, $this->groupID, $this->reason, $this->enableNotification); $application = new GroupApplicationEditor($this->applicationID); $application->sendLeaderNotification(); $this->saved(); HeaderUtil::redirect('index.php?page=UserGroups' . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); if (!MODULE_MODERATED_USER_GROUP || !MODULE_PM) { throw new IllegalLinkException(); } if (isset($_POST['groupID'])) { $this->groupID = intval($_POST['groupID']); } $this->group = new Group($this->groupID); if (!$this->group->groupID) { throw new IllegalLinkException(); } // check permission if (!GroupApplicationEditor::isGroupLeader(WCF::getUser(), $this->groupID)) { throw new PermissionDeniedException(); } if (isset($_POST['subject'])) { $this->subject = StringUtil::trim($_POST['subject']); } if (isset($_POST['text'])) { $this->text = StringUtil::trim($_POST['text']); } if (empty($this->subject) || empty($this->text)) { throw new IllegalLinkException(); } }
/** * @see Action::execute() */ public function execute() { AbstractAction::execute(); // check permission if (!GroupApplicationEditor::isGroupLeader(WCF::getUser(), $this->groupID)) { throw new PermissionDeniedException(); } if (MODULE_MODERATED_USER_GROUP != 1) { throw new IllegalLinkException(); } // remove users if (count($this->userIDs)) { $sql = "DELETE FROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\t\tuserID IN (" . implode(',', $this->userIDs) . ")\n\t\t\t\t\t\tAND groupID = " . $this->groupID; WCF::getDB()->sendQuery($sql); // reset sessions Session::resetSessions($this->userIDs); } $this->executed(); HeaderUtil::redirect('index.php?form=UserGroupAdministrate&groupID=' . $this->groupID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Page::readParameters() */ public function readParameters() { AbstractForm::readParameters(); // get application if (isset($_REQUEST['applicationID'])) { $this->applicationID = intval($_REQUEST['applicationID']); } $this->application = new GroupApplicationEditor($this->applicationID); if (!$this->application->applicationID) { throw new IllegalLinkException(); } // get group $this->group = new Group($this->application->groupID); $this->groupID = $this->group->groupID; if ($this->application->applicationStatus > 0) { $this->reason = $this->application->reason; } // check permission if (!GroupApplicationEditor::isGroupLeader(WCF::getUser(), $this->application->groupID)) { throw new PermissionDeniedException(); } }
/** * @see Action::execute() */ public function execute() { AbstractAction::execute(); // check permission if (!WCF::getUser()->userID || $this->group->groupType != 5 && $this->group->groupType != 6 || !in_array($this->group->groupID, WCF::getUser()->getGroupIDs())) { throw new PermissionDeniedException(); } if (MODULE_MODERATED_USER_GROUP != 1) { throw new IllegalLinkException(); } // remove user $editor = WCF::getUser()->getEditor(); $editor->removeFromGroup($this->group->groupID); // reset session WCF::getSession()->resetUserData(); // delete application if existing if ($application = GroupApplicationEditor::getApplication(WCF::getUser()->userID, $this->group->groupID)) { $application->delete(); } $this->executed(); HeaderUtil::redirect('index.php?page=UserGroups' . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Page::show() */ public function show() { // check permission if (!WCF::getUser()->userID || !GroupApplicationEditor::isGroupLeader(WCF::getUser(), $this->groupID)) { throw new PermissionDeniedException(); } if (MODULE_MODERATED_USER_GROUP != 1) { throw new IllegalLinkException(); } // set active tab UserCPMenu::getInstance()->setActiveMenuItem('wcf.user.usercp.menu.link.userGroups'); parent::show(); }