Small code optimization
authorMarcel Werk <burntime@woltlab.com>
Wed, 19 Jul 2017 15:28:47 +0000 (17:28 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 19 Jul 2017 15:28:57 +0000 (17:28 +0200)
wcfsetup/install/files/lib/system/label/LabelHandler.class.php

index 79d0ba8e3f39d06d3257697d2b9008931f2736eb..faf84501492468425cdcc158bf19965f9ba1fc6a 100644 (file)
@@ -169,12 +169,12 @@ class LabelHandler extends SingletonFactory {
                $accessibleLabelIDs = $this->getAccessibleLabelIDs();
                
                // delete previous labels
-               $conditions = new PreparedStatementConditionBuilder();
-               if ($validatePermissions) $conditions->add("labelID IN (?)", [$accessibleLabelIDs]);
-               $conditions->add("objectTypeID = ?", [$objectTypeID]);
-               $conditions->add("objectID = ?", [$objectID]);
-               
                if (!$validatePermissions || ($validatePermissions && !empty($accessibleLabelIDs))) {
+                       $conditions = new PreparedStatementConditionBuilder();
+                       if ($validatePermissions) $conditions->add("labelID IN (?)", [$accessibleLabelIDs]);
+                       $conditions->add("objectTypeID = ?", [$objectTypeID]);
+                       $conditions->add("objectID = ?", [$objectID]);
+                       
                        $sql = "DELETE FROM     wcf".WCF_N."_label_object
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);