From: Matthias Schmidt Date: Sat, 13 Aug 2011 06:44:34 +0000 (+0200) Subject: GroupOptions are now UserGroupOptions X-Git-Tag: 2.0.0_Beta_1~1858^2^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c278f7a01578ad343c367c38e05e3ec22b0b82f4;p=GitHub%2FWoltLab%2FWCF.git GroupOptions are now UserGroupOptions While the database objects have already been renamed from Group to UserGroup, the options weren't. --- diff --git a/XSD/groupoptions.xsd b/XSD/groupoptions.xsd deleted file mode 100644 index ecac13f0d3..0000000000 --- a/XSD/groupoptions.xsd +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/XSD/usergroupoptions.xsd b/XSD/usergroupoptions.xsd new file mode 100644 index 0000000000..ecac13f0d3 --- /dev/null +++ b/XSD/usergroupoptions.xsd @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/com.woltlab.wcf/groupoptions.xml b/com.woltlab.wcf/groupoptions.xml deleted file mode 100644 index ffdf9c1c78..0000000000 --- a/com.woltlab.wcf/groupoptions.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - admin - - - admin - - - admin.system - - - admin.system - - - admin.system - - - admin - - - admin.user - - - admin.user - - - - admin - - - admin - - - admin.display - - - admin.display - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.woltlab.wcf/usergroupoptions.xml b/com.woltlab.wcf/usergroupoptions.xml new file mode 100644 index 0000000000..aa0ca09f40 --- /dev/null +++ b/com.woltlab.wcf/usergroupoptions.xml @@ -0,0 +1,200 @@ + + + + + + + + + admin + + + admin + + + admin.system + + + admin.system + + + admin.system + + + admin + + + admin.user + + + admin.user + + + + admin + + + admin + + + admin.display + + + admin.display + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wcfsetup/install/files/lib/system/option/group/BooleanGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/BooleanGroupOptionType.class.php deleted file mode 100644 index 44b122f413..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/BooleanGroupOptionType.class.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class BooleanGroupOptionType extends BooleanOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - foreach ($values as $value) { - if ($value) return true; - } - - return false; - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/GroupsGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/GroupsGroupOptionType.class.php deleted file mode 100644 index ffae580206..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/GroupsGroupOptionType.class.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class GroupsGroupOptionType extends AbstractOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\IOptionType::getFormElement() - */ - public function getFormElement(Option $option, $value) { - // get selected group - $selectedGroups = explode(',', $value); - - // get all groups - $groups = UserGroup::getGroupsByType(); - - // generate html - $html = ''; - foreach ($groups as $group) { - $html .= ''; - } - - return $html; - } - - /** - * @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\IOptionType::getData() - */ - public function getData(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); - $newValue = ArrayUtil::toIntegerArray($newValue); - sort($newValue, SORT_NUMERIC); - return implode(',', $newValue); - } - - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - $result = array(); - foreach ($values as $value) { - $value = explode(',', $value); - $result = array_merge($result, $value); - } - - $result = array_unique($result); - - return implode(',', $result); - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/IGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/IGroupOptionType.class.php deleted file mode 100644 index 77a64cb6c6..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/IGroupOptionType.class.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -interface IGroupOptionType extends IOptionType { - /** - * Merges the different values of an option to a single value. - * - * @param array $values - * @return mixed - */ - public function merge(array $values); -} diff --git a/wcfsetup/install/files/lib/system/option/group/InfiniteIntegerGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/InfiniteIntegerGroupOptionType.class.php deleted file mode 100644 index c88b2b2eee..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/InfiniteIntegerGroupOptionType.class.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class InfiniteIntegerGroupOptionType extends IntegerGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - if (in_array(-1, $values)) return -1; - return parent::merge($values); - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/InfiniteInverseIntegerGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/InfiniteInverseIntegerGroupOptionType.class.php deleted file mode 100644 index 18d24fbff6..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/InfiniteInverseIntegerGroupOptionType.class.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class InfiniteInverseIntegerGroupOptionType extends InverseIntegerGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - foreach ($values as $key => $value) { - if ($value == -1) unset($values[$key]); - } - - if (count($values) == 0) return -1; - return min($values); - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/IntegerGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/IntegerGroupOptionType.class.php deleted file mode 100644 index c618038225..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/IntegerGroupOptionType.class.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class IntegerGroupOptionType extends IntegerOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - return max($values); - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/InverseIntegerGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/InverseIntegerGroupOptionType.class.php deleted file mode 100644 index 5f0192ad5f..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/InverseIntegerGroupOptionType.class.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class InverseIntegerGroupOptionType extends IntegerOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - return min($values); - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/TextGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/TextGroupOptionType.class.php deleted file mode 100644 index c33c385e78..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/TextGroupOptionType.class.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class TextGroupOptionType extends TextOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - $result = ''; - - foreach ($values as $value) { - if (!empty($result)) $result .= "\n"; - $result .= $value; - } - - return $result; - } -} diff --git a/wcfsetup/install/files/lib/system/option/group/TextareaGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/group/TextareaGroupOptionType.class.php deleted file mode 100644 index 5c35a90370..0000000000 --- a/wcfsetup/install/files/lib/system/option/group/TextareaGroupOptionType.class.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.option.group - * @category Community Framework - */ -class TextareaGroupOptionType extends TextareaOptionType implements IGroupOptionType { - /** - * @see wcf\system\option\group\IGroupOptionType::merge() - */ - public function merge(array $values) { - $result = ''; - - foreach ($values as $value) { - if (!empty($result)) $result .= "\n"; - $result .= $value; - } - - return $result; - } -} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/BooleanUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/BooleanUserGroupOptionType.class.php new file mode 100644 index 0000000000..82e30199cd --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/BooleanUserGroupOptionType.class.php @@ -0,0 +1,27 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class BooleanUserGroupOptionType extends BooleanOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + foreach ($values as $value) { + if ($value) return true; + } + + return false; + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/IUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/IUserGroupOptionType.class.php new file mode 100644 index 0000000000..1700ca5abc --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/IUserGroupOptionType.class.php @@ -0,0 +1,23 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +interface IUserGroupOptionType extends IOptionType { + /** + * Merges the different values of an option to a single value. + * + * @param array $values + * @return mixed + */ + public function merge(array $values); +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/InfiniteIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/InfiniteIntegerUserGroupOptionType.class.php new file mode 100644 index 0000000000..317541682f --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/InfiniteIntegerUserGroupOptionType.class.php @@ -0,0 +1,25 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class InfiniteIntegerUserGroupOptionType extends IntegerUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + if (in_array(-1, $values)) return -1; + return parent::merge($values); + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/InfiniteInverseIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/InfiniteInverseIntegerUserGroupOptionType.class.php new file mode 100644 index 0000000000..33a1543610 --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/InfiniteInverseIntegerUserGroupOptionType.class.php @@ -0,0 +1,28 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class InfiniteInverseIntegerUserGroupOptionType extends InverseIntegerUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + foreach ($values as $key => $value) { + if ($value == -1) unset($values[$key]); + } + + if (count($values) == 0) return -1; + return min($values); + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/IntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/IntegerUserGroupOptionType.class.php new file mode 100644 index 0000000000..4ff7b8fa1d --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/IntegerUserGroupOptionType.class.php @@ -0,0 +1,23 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class IntegerUserGroupOptionType extends IntegerOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + return max($values); + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/InverseIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/InverseIntegerUserGroupOptionType.class.php new file mode 100644 index 0000000000..e05c19e86e --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/InverseIntegerUserGroupOptionType.class.php @@ -0,0 +1,23 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class InverseIntegerUserGroupOptionType extends IntegerOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + return min($values); + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/TextUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/TextUserGroupOptionType.class.php new file mode 100644 index 0000000000..03a2e21ed0 --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/TextUserGroupOptionType.class.php @@ -0,0 +1,30 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class TextUserGroupOptionType extends TextOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + $result = ''; + + foreach ($values as $value) { + if (!empty($result)) $result .= "\n"; + $result .= $value; + } + + return $result; + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/TextareaUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/TextareaUserGroupOptionType.class.php new file mode 100644 index 0000000000..87bd510a93 --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/TextareaUserGroupOptionType.class.php @@ -0,0 +1,31 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class TextareaUserGroupOptionType extends TextareaOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + $result = ''; + + foreach ($values as $value) { + if (!empty($result)) $result .= "\n"; + $result .= $value; + } + + return $result; + } +} diff --git a/wcfsetup/install/files/lib/system/option/userGroup/UserGroupsUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/userGroup/UserGroupsUserGroupOptionType.class.php new file mode 100644 index 0000000000..7d6e00a1a7 --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/userGroup/UserGroupsUserGroupOptionType.class.php @@ -0,0 +1,82 @@ + + * @package com.woltlab.wcf + * @subpackage system.option.userGroup + * @category Community Framework + */ +class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserGroupOptionType { + /** + * @see wcf\system\option\IOptionType::getFormElement() + */ + public function getFormElement(Option $option, $value) { + // get selected group + $selectedGroups = explode(',', $value); + + // get all groups + $groups = UserGroup::getGroupsByType(); + + // generate html + $html = ''; + foreach ($groups as $group) { + $html .= ''; + } + + return $html; + } + + /** + * @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\IOptionType::getData() + */ + public function getData(Option $option, $newValue) { + if (!is_array($newValue)) $newValue = array(); + $newValue = ArrayUtil::toIntegerArray($newValue); + sort($newValue, SORT_NUMERIC); + return implode(',', $newValue); + } + + /** + * @see wcf\system\option\userGroup\IUserGroupOptionType::merge() + */ + public function merge(array $values) { + $result = array(); + foreach ($values as $value) { + $value = explode(',', $value); + $result = array_merge($result, $value); + } + + $result = array_unique($result); + + return implode(',', $result); + } +} diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionsPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionsPackageInstallationPlugin.class.php new file mode 100644 index 0000000000..16d2147334 --- /dev/null +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionsPackageInstallationPlugin.class.php @@ -0,0 +1,164 @@ + + * @package com.woltlab.wcf + * @subpackage system.package.plugin + * @category Community Framework + */ +class UserGroupOptionsPackageInstallationPlugin extends AbstractOptionPackageInstallationPlugin { + /** + * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName + */ + public $tableName = 'user_group_option'; + + public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'admindefaultvalue', 'validationpattern', 'showorder', 'categoryname', 'selectoptions', 'enableoptions', 'permissions', 'options', 'attrs', 'cdata'); + + /** + * Deletes group-option-categories and/or group-options which where installed by the package. + */ + public function uninstall() { + // Delete value-entries using categories or options + // which will be deleted. + $sql = "DELETE FROM wcf".WCF_N."_user_group_option_value + WHERE optionID IN ( + SELECT optionID + FROM wcf".WCF_N."_user_group_option + WHERE packageID = ? + )"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->installation->getPackageID())); + + parent::uninstall(); + } + + /** + * @see wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveOption() + */ + protected function saveOption($option, $categoryName, $existingOptionID = 0) { + // default values + $optionName = $optionType = $defaultValue = $adminDefaultValue = $validationPattern = $enableOptions = $permissions = $options = ''; + $showOrder = null; + + // get values + if (isset($option['name'])) $optionName = $option['name']; + if (isset($option['optiontype'])) $optionType = $option['optiontype']; + if (isset($option['defaultvalue'])) $defaultValue = $option['defaultvalue']; + if (isset($option['admindefaultvalue'])) $adminDefaultValue = $option['admindefaultvalue']; + if (isset($option['validationpattern'])) $validationPattern = $option['validationpattern']; + if (!empty($option['showorder'])) $showOrder = intval($option['showorder']); + $showOrder = $this->getShowOrder($showOrder, $categoryName, 'categoryName'); + if (isset($option['enableoptions'])) $enableOptions = $option['enableoptions']; + if (isset($option['permissions'])) $permissions = $option['permissions']; + if (isset($option['options'])) $options = $option['options']; + + // check if optionType exists + $className = 'wcf\system\option\userGroup\\'.StringUtil::toUpperCase($optionType).'UserGroupOptionType'; + if (!class_exists($className)) { + throw new SystemException("unable to find class '".$className."'"); + } + + // collect additional tags and their values + $additionalData = array(); + foreach ($option as $tag => $value) { + if (!in_array($tag, self::$reservedTags)) $additionalData[$tag] = $value; + } + + // check if the otion exist already and was installed by this package + $sql = "SELECT optionID + FROM wcf".WCF_N."_user_group_option + WHERE optionName = ? + AND packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + $optionName, + $this->installation->getPackageID() + )); + $row = $statement->fetchArray(); + + $data = array( + 'categoryName' => $categoryName, + 'optionType' => $optionType, + 'defaultValue' => $defaultValue, + 'adminDefaultValue' => $adminDefaultValue, + 'validationPattern' => $validationPattern, + 'showOrder' => $showOrder, + 'enableOptions' => $enableOptions, + 'permissions' => $permissions, + 'options' => $options, + 'additionalData' => serialize($additionalData) + ); + + if (!empty($row['optionID'])) { + // update existing option + $optionID = $row['optionID']; + + $groupOption = new UserGroupOption(null, $row); + $groupOptionEditor = new UserGroupOptionEditor($groupOption); + $groupOptionEditor->update($data); + } + else { + // add new option + $data['packageID'] = $this->installation->getPackageID(); + $data['optionName'] = $optionName; + + $groupOptionEditor = UserGroupOptionEditor::create($data); + $optionID = $groupOptionEditor->optionID; + + // get default group ("everyone") + $sql = "SELECT groupID + FROM wcf".WCF_N."_user_group + WHERE groupType = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array(UserGroup::EVERYONE)); + $row = $statement->fetchArray(); + + // save default value + $sql = "INSERT INTO wcf".WCF_N."_user_group_option_value + (groupID, optionID, optionValue) + VALUES (?, ?, ?)"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($row['groupID'], $optionID, $defaultValue)); + + if ($adminDefaultValue && $defaultValue != $adminDefaultValue) { + $sql = "SELECT groupID + FROM wcf".WCF_N."_user_group_option_value + WHERE optionID = ( + SELECT optionID + FROM wcf".WCF_N."_user_group_option + WHERE optionName = ? + ) + AND optionValue = '1'"; + $statement2 = WCF::getDB()->prepareStatement($sql); + $statement2->execute(array('admin.general.canUseAcp')); + + $acpGroups = array(); + while ($row = $statement2->fetchArray()) { + $acpGroups[] = $row['groupID']; + } + + $statement2->execute(array('admin.user.canEditGroup')); + while ($row = $statement2->fetchArray()) { + if (!in_array($row['groupID'], $acpGroups)) { + continue; + } + + $statement->execute(array( + $row['groupID'], + $optionID, + $adminDefaultValue + )); + } + } + } + } +}