$attachment = $this->getAttachment($attachmentID);
if ($attachment === null) {
- return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', [
- 'id' => $attachmentID,
- ]));
+ return WCF::getTPL()->fetch('contentNotVisible');
}
$outputType = $parser->getOutputType();
return $this->showVideoPlayer($attachment);
} elseif (\substr($attachment->fileType, 0, 6) === 'audio/' && $outputType == 'text/html') {
return $this->showAudioPlayer($attachment);
+ } elseif (!$attachment->canDownload()) {
+ return WCF::getTPL()->fetch('contentNotVisible', 'wcf', [
+ 'message' => WCF::getLanguage()->get('wcf.message.content.no.permission.title')
+ ], true);
}
return StringUtil::getAnchorTag($attachment->getLink(), $attachment->filename);
/** @var ViewableArticle $object */
$object = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.article', $objectID);
- if ($object !== null && $object->canRead() && $parser->getOutputType() == 'text/html') {
+ if ($object === null) {
+ return WCF::getTPL()->fetch('contentNotVisible');
+ }
+
+ if ($object->canRead() && $parser->getOutputType() == 'text/html') {
return WCF::getTPL()->fetch('articleBBCode', 'wcf', [
'article' => $object,
'articleID' => $object->articleID,
'titleHash' => \substr(StringUtil::getRandomID(), 0, 8),
], true);
+ } elseif (!$object->canRead()) {
+ return WCF::getTPL()->fetch('contentNotVisible', 'wcf', [
+ 'message' => WCF::getLanguage()->get('wcf.message.content.no.permission.title')
+ ], true);
}
return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Article', [
/** @var ViewableMedia $media */
$media = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.media', $mediaID);
- if ($media !== null && $media->isAccessible()) {
+ if ($media === null) {
+ return WCF::getTPL()->fetch('contentNotVisible');
+ }
+
+ if ($media->isAccessible()) {
if ($removeLinks && !$media->isImage) {
if ($parser->getOutputType() === 'text/html' || $parser->getOutputType() === 'text/simplified-html') {
return StringUtil::encodeHTML($media->getTitle());
}
return StringUtil::encodeHTML($this->getLink($media));
+ } else {
+ return WCF::getTPL()->fetch('contentNotVisible', 'wcf', [
+ 'message' => WCF::getLanguage()->get('wcf.message.content.no.permission.title')
+ ], true);
}
-
- return '';
}
/**
use wcf\data\page\Page;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
+use wcf\system\WCF;
use wcf\util\StringUtil;
/**
return StringUtil::getAnchorTag($page->getLink(), $title ?: $page->getTitle());
}
- return '';
+ return WCF::getTPL()->fetch('contentNotVisible');
}
}