From a09371dedf0edc8c5e3cd68ceed46ef00b39b3cc Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 30 Jun 2018 09:50:00 +0200 Subject: [PATCH] Improve code readability --- .../files/lib/system/box/BoxHandler.class.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php index c6bece78f9..9293917a0c 100644 --- a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php +++ b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php @@ -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(); -- 2.20.1