Improve code readability
authorMatthias Schmidt <gravatronics@live.com>
Sat, 30 Jun 2018 07:50:00 +0000 (09:50 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 30 Jun 2018 07:50:00 +0000 (09:50 +0200)
wcfsetup/install/files/lib/system/box/BoxHandler.class.php

index c6bece78f9e2238243e04bbb6786eb362516db2f..9293917a0cd0650b64051b33a958106233cc0d42 100644 (file)
@@ -224,8 +224,27 @@ class BoxHandler extends SingletonFactory {
        public static function loadBoxes($pageID, $forDisplay) {
                // load box layout for active page
                $boxList = new BoxList();
-               if ($pageID) $boxList->getConditionBuilder()->add('(box.visibleEverywhere = ? AND boxID NOT IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)) OR boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)', [1, $pageID, 0, $pageID, 1]);
-               else $boxList->getConditionBuilder()->add('box.visibleEverywhere = ?', [1]);
+               if ($pageID) {
+                       $boxList->getConditionBuilder()->add('
+                               (box.visibleEverywhere = ?
+                               AND boxID NOT IN (
+                                       SELECT  boxID
+                                       FROM    wcf'.WCF_N.'_box_to_page
+                                       WHERE   pageID = ?
+                                               AND visible = ?
+                               )) OR
+                               boxID IN (
+                                       SELECT  boxID
+                                       FROM    wcf'.WCF_N.'_box_to_page
+                                       WHERE   pageID = ?
+                                               AND visible = ?
+                               )',
+                               [1, $pageID, 0, $pageID, 1]
+                       );
+               }
+               else {
+                       $boxList->getConditionBuilder()->add('box.visibleEverywhere = ?', [1]);
+               }
                
                if ($forDisplay) $boxList->enableContentLoading();