From: Marcel Werk Date: Wed, 13 Dec 2017 09:35:56 +0000 (+0100) Subject: Fixed visibility of deleted articles X-Git-Tag: 3.1.0_Beta_5~37 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f6d56cae4a83f8428ea3fdfc3683f88d69d30885;p=GitHub%2FWoltLab%2FWCF.git Fixed visibility of deleted articles --- diff --git a/wcfsetup/install/files/lib/data/article/CategoryArticleList.class.php b/wcfsetup/install/files/lib/data/article/CategoryArticleList.class.php index ea1af91532..6715e2fcc4 100644 --- a/wcfsetup/install/files/lib/data/article/CategoryArticleList.class.php +++ b/wcfsetup/install/files/lib/data/article/CategoryArticleList.class.php @@ -1,6 +1,7 @@ getConditionBuilder()->add('article.categoryID IN (?)', [$categoryIDs]); $this->getConditionBuilder()->add('article.publicationStatus = ?', [Article::PUBLISHED]); + + if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) { + $this->getConditionBuilder()->add('article.isDeleted = ?', [0]); + } } } diff --git a/wcfsetup/install/files/lib/data/article/category/ArticleCategoryCache.class.php b/wcfsetup/install/files/lib/data/article/category/ArticleCategoryCache.class.php index dd304fb8be..afa1606f4f 100644 --- a/wcfsetup/install/files/lib/data/article/category/ArticleCategoryCache.class.php +++ b/wcfsetup/install/files/lib/data/article/category/ArticleCategoryCache.class.php @@ -3,6 +3,7 @@ namespace wcf\data\article\category; use wcf\data\article\Article; use wcf\data\category\Category; use wcf\system\category\CategoryHandler; +use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\SingletonFactory; use wcf\system\WCF; @@ -28,12 +29,18 @@ class ArticleCategoryCache extends SingletonFactory { protected function initArticles() { $this->articles = []; + $conditionBuilder = new PreparedStatementConditionBuilder(); + $conditionBuilder->add('publicationStatus = ?', [Article::PUBLISHED]); + if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) { + $conditionBuilder->add('isDeleted = ?', [0]); + } + $sql = "SELECT COUNT(*) AS count, categoryID FROM wcf" . WCF_N . "_article - WHERE publicationStatus = ? + ".$conditionBuilder." GROUP BY categoryID"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute([Article::PUBLISHED]); + $statement->execute($conditionBuilder->getParameters()); $articles = $statement->fetchMap('categoryID', 'count'); $categoryToParent = [];