From: Joshua Rüsweg Date: Fri, 9 Jun 2017 10:42:17 +0000 (+0200) Subject: add article sitemap X-Git-Tag: 3.1.0_Alpha_1~391 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea1e0056022fc004fcee43b0ed7511fc2b2b37e9;p=GitHub%2FWoltLab%2FWCF.git add article sitemap See #2286 --- diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 22a7c9e4e8..e3bfd42259 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1267,6 +1267,14 @@ weekly 2592000 + + com.woltlab.wcf.sitemap.object.article + com.woltlab.wcf.sitemap.object + wcf\system\sitemap\object\ArticleSitemapObject + 0.5 + monthly + 259200 + diff --git a/wcfsetup/install/files/lib/system/sitemap/object/ArticleSitemapObject.class.php b/wcfsetup/install/files/lib/system/sitemap/object/ArticleSitemapObject.class.php new file mode 100644 index 0000000000..77ed7c3214 --- /dev/null +++ b/wcfsetup/install/files/lib/system/sitemap/object/ArticleSitemapObject.class.php @@ -0,0 +1,39 @@ + + * @package WoltLabSuite\Core\Sitemap\Object + * @since 3.1 + */ +class ArticleSitemapObject extends AbstractSitemapObjectObjectType { + /** + * @inheritDoc + */ + public function getObjectClass() { + return ArticleContent::class; + } + + /** + * @inheritDoc + */ + public function canView(DatabaseObject $object) { + /** @var $object ArticleContent */ + if ($object->getArticle()->publicationStatus != Article::PUBLISHED) { + return false; + } + + if ($object->getArticle()->getCategory()) { + return $object->getArticle()->getCategory()->isAccessible(self::getGuestUserProfile()->getDecoratedObject()); + } + + return self::getGuestUserProfile()->getPermission('user.article.canRead'); + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4590be15cc..7657abe5e0 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1600,6 +1600,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 0d4cd1b9cd..70a8683d88 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1551,6 +1551,7 @@ +