<?php
namespace wcf\data\article;
use wcf\data\article\category\ArticleCategory;
+use wcf\system\WCF;
/**
* Represents a list of articles in a specific category.
$this->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]);
+ }
}
}
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;
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 = [];