Removed export of hidden options
authorMarcel Werk <burntime@woltlab.com>
Sat, 25 Aug 2012 15:00:11 +0000 (17:00 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sat, 25 Aug 2012 15:00:11 +0000 (17:00 +0200)
wcfsetup/install/files/lib/acp/action/OptionExportAction.class.php
wcfsetup/install/files/lib/data/option/Option.class.php
wcfsetup/install/files/lib/data/option/OptionEditor.class.php

index 5ca6e50f850de7c4d583d9c071ab48bbf9cb4a93..fce9c7bd6dc4f03abb48f8852ee92748db20d164 100644 (file)
@@ -41,9 +41,11 @@ class OptionExportAction extends AbstractAction {
                
                $options = Option::getOptions();
                foreach ($options as $option) {
+                       if ($option->hidden) continue; // ignore hidden options
+                       
                        echo "\t<option>\n";
-                       echo "\t\t<name><![CDATA[".StringUtil::escapeCDATA($option['optionName'])."]]></name>\n";
-                       echo "\t\t<value><![CDATA[".StringUtil::escapeCDATA($option['optionValue'])."]]></value>\n";
+                       echo "\t\t<name><![CDATA[".StringUtil::escapeCDATA($option->optionName)."]]></name>\n";
+                       echo "\t\t<value><![CDATA[".StringUtil::escapeCDATA($option->optionValue)."]]></value>\n";
                        echo "\t</option>\n";
                }
                
index 1498d2b4b1610695ecefc1c47f8bec58b8fb4520..f31a2b2ae401c53c019cb6d8beeb4f95e3be4295 100644 (file)
@@ -51,7 +51,7 @@ class Option extends DatabaseObject {
         * Returns a list of options.
         *
         * @param       integer         $packageID
-        * @return      array
+        * @return      array<wcf\data\option\Option>
         */
        public static function getOptions($packageID = PACKAGE_ID) {
                $sql = "SELECT          optionName, optionID
@@ -74,14 +74,14 @@ class Option extends DatabaseObject {
                        $conditions = new PreparedStatementConditionBuilder();
                        $conditions->add("optionID IN (?)", array($optionIDs));
                        
-                       $sql = "SELECT          optionName, optionValue, optionType
+                       $sql = "SELECT          *
                                FROM            wcf".WCF_N."_option
                                ".$conditions."
                                ORDER BY        optionName";
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
                        while ($row = $statement->fetchArray()) {
-                               $options[StringUtil::toUpperCase($row['optionName'])] = $row;
+                               $options[StringUtil::toUpperCase($row['optionName'])] = new Option(null, $row);
                        }
                }
                
index d40f81f69cc7949ff9935034af8c2a75b5d4be9c..2f094f025f26baaaabc3730c5aba31d87a009904 100644 (file)
@@ -120,7 +120,7 @@ class OptionEditor extends DatabaseObjectEditor implements IEditableCachedObject
                // get all options
                $options = Option::getOptions($packageID);
                foreach ($options as $optionName => $option) {
-                       $buffer .= "if (!defined('".$optionName."')) define('".$optionName."', ".(($option['optionType'] == 'boolean' || $option['optionType'] == 'integer') ? intval($option['optionValue']) : "'".addcslashes($option['optionValue'], "'\\")."'").");\n";
+                       $buffer .= "if (!defined('".$optionName."')) define('".$optionName."', ".(($option->optionType == 'boolean' || $option->optionType == 'integer') ? intval($option->optionValue) : "'".addcslashes($option->optionValue, "'\\")."'").");\n";
                }
                unset($options);