From 8151741faef28d62578eb092a4d856703e55662e Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 17 Mar 2016 19:25:55 +0100 Subject: [PATCH] Added traits --- .../files/lib/data/page/Page.class.php | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/wcfsetup/install/files/lib/data/page/Page.class.php b/wcfsetup/install/files/lib/data/page/Page.class.php index 5bb8d49206..f61ea17a6c 100644 --- a/wcfsetup/install/files/lib/data/page/Page.class.php +++ b/wcfsetup/install/files/lib/data/page/Page.class.php @@ -2,6 +2,8 @@ namespace wcf\data\page; use wcf\data\application\Application; use wcf\data\DatabaseObject; +use wcf\data\TDatabaseObjectOptions; +use wcf\data\TDatabaseObjectPermissions; use wcf\system\application\ApplicationHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\request\LinkHandler; @@ -19,6 +21,9 @@ use wcf\system\WCF; * @since 2.2 */ class Page extends DatabaseObject { + use TDatabaseObjectOptions; + use TDatabaseObjectPermissions; + /** * @inheritDoc */ @@ -170,33 +175,8 @@ class Page extends DatabaseObject { * @return boolean false if the page should be hidden from menus */ public function isVisible() { - // check the options of this page - $hasEnabledOption = true; - if ($this->options) { - $hasEnabledOption = false; - $options = explode(',', strtoupper($this->options)); - foreach ($options as $option) { - if (defined($option) && constant($option)) { - $hasEnabledOption = true; - break; - } - } - } - if (!$hasEnabledOption) return false; - - // check the permission of this page for the active user - $hasPermission = true; - if ($this->permissions) { - $hasPermission = false; - $permissions = explode(',', $this->permissions); - foreach ($permissions as $permission) { - if (WCF::getSession()->getPermission($permission)) { - $hasPermission = true; - break; - } - } - } - if (!$hasPermission) return false; + if (!$this->validateOptions()) return false; + if (!$this->validatePermissions()) return false; return true; } -- 2.20.1