/**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     $this->userGroups = UserGroup::getGroupsByType(array(), array(UserGroup::EVERYONE, UserGroup::GUESTS, UserGroup::USERS));
     foreach ($this->userGroups as $key => $userGroup) {
         if (!$userGroup->isAccessible()) {
             unset($this->userGroups[$key]);
         }
     }
     uasort($this->userGroups, function (UserGroup $groupA, UserGroup $groupB) {
         return strcmp($groupA->getName(), $groupB->getName());
     });
     $this->conditions = UserGroupAssignmentHandler::getInstance()->getGroupedObjectTypes('com.woltlab.wcf.condition.userGroupAssignment');
     parent::readData();
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->userGroups = UserGroup::getGroupsByType(array(), array(UserGroup::EVERYONE, UserGroup::GUESTS, UserGroup::USERS));
     foreach ($this->userGroups as $key => $group) {
         if ($group->isAdminGroup()) {
             unset($this->userGroups[$key]);
         }
     }
     $sql = "SELECT\tCOUNT(*)\n\t\t\tFROM\twcf" . WCF_N . "_user";
     $statement = \wcf\system\WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     $this->userCount = $statement->fetchColumn();
 }
	/**
	 * @see	wcf\system\option\IOptionType::validate()
	 */
	public function validate(Option $option, $newValue) {
		// get all groups
		$groups = UserGroup::getGroupsByType();
		
		// get new value
		if (!is_array($newValue)) $newValue = array();
		$selectedGroups = ArrayUtil::toIntegerArray($newValue);
		
		// check groups
		foreach ($selectedGroups as $groupID) {
			if (!isset($groups[$groupID])) {
				throw new UserInputException($option->optionName, 'validationFailed');
			}
		}
	}
 /**
  * @see	\wcf\system\option\OptionHandler::validateOption()
  */
 protected function validateOption(Option $option)
 {
     parent::validateOption($option);
     if (!$this->isAdmin()) {
         // get type object
         $typeObj = $this->getTypeObject($option->optionType);
         if ($typeObj->compare($this->optionValues[$option->optionName], WCF::getSession()->getPermission($option->optionName)) == 1) {
             throw new UserInputException($option->optionName, 'exceedsOwnPermission');
         }
     } else {
         if ($option->optionName == 'admin.user.accessibleGroups' && $this->group !== null && $this->group->isAdminGroup()) {
             $hasOtherAdminGroup = false;
             foreach (UserGroup::getGroupsByType() as $userGroup) {
                 if ($userGroup->groupID != $this->group->groupID && $userGroup->isAdminGroup()) {
                     $hasOtherAdminGroup = true;
                     break;
                 }
             }
             // prevent users from dropping their own admin state
             if (!$hasOtherAdminGroup) {
                 // get type object
                 $typeObj = $this->getTypeObject($option->optionType);
                 if ($typeObj->compare($this->optionValues[$option->optionName], WCF::getSession()->getPermission($option->optionName)) == -1) {
                     throw new UserInputException($option->optionName, 'cannotDropPrivileges');
                 }
             }
         }
     }
 }
Esempio n. 5
0
 /**
  * Returns a list of the users online markings.
  * 
  * @return	array
  */
 public function getUsersOnlineMarkings()
 {
     if ($this->usersOnlineMarkings === null) {
         $this->usersOnlineMarkings = $priorities = array();
         // get groups
         foreach (UserGroup::getGroupsByType() as $group) {
             if ($group->userOnlineMarking != '%s') {
                 $priorities[] = $group->priority;
                 $this->usersOnlineMarkings[] = str_replace('%s', StringUtil::encodeHTML(WCF::getLanguage()->get($group->groupName)), $group->userOnlineMarking);
             }
         }
         // sort list
         array_multisort($priorities, SORT_DESC, $this->usersOnlineMarkings);
     }
     return $this->usersOnlineMarkings;
 }
Esempio n. 6
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     I18nHandler::getInstance()->assignVariables();
     WCF::getTPL()->assign(array('action' => 'add', 'availableCssClassNames' => $this->availableCssClassNames, 'cssClassName' => $this->cssClassName, 'customCssClassName' => $this->customCssClassName, 'groupID' => $this->groupID, 'rankTitle' => $this->rankTitle, 'availableGroups' => UserGroup::getGroupsByType(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE)), 'requiredPoints' => $this->requiredPoints, 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender));
 }