From: Matthias Schmidt Date: Wed, 29 Jun 2016 17:13:10 +0000 (+0200) Subject: Encode media links X-Git-Tag: 3.0.0_Beta_1~1306 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f40392e0cde93bcf984e350aefc68157d1022728;p=GitHub%2FWoltLab%2FWCF.git Encode media links --- diff --git a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php index 50bfb194ad..829da19c62 100644 --- a/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php +++ b/wcfsetup/install/files/lib/data/media/ViewableMedia.class.php @@ -1,7 +1,6 @@ isImage) { - return ''.StringUtil::encodeHTML($this->altText).'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'/>'; + return ''.StringUtil::encodeHTML($this->altText).'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'/>'; } - return ''.StringUtil::encodeHTML($this->getTitle()).''; + return ''.StringUtil::encodeHTML($this->getTitle()).''; } /** @@ -49,7 +48,7 @@ class ViewableMedia extends DatabaseObjectDecorator { if ($this->isImage && $this->tinyThumbnailType) { $tinyThumbnail = Media::getThumbnailSizes()['tiny']; if ($size <= $tinyThumbnail['width'] && $size <= $tinyThumbnail['height']) { - return '' . StringUtil::encodeHTML($this->altText) . 'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'style="width: ' . $size . 'px; height: ' . $size . 'px;">'; + return '' . StringUtil::encodeHTML($this->altText) . 'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'style="width: ' . $size . 'px; height: ' . $size . 'px;">'; } } @@ -61,21 +60,21 @@ class ViewableMedia extends DatabaseObjectDecorator { * * @param string $size thumbnail size * @return string - * @throws SystemException + * @throws \InvalidArgumentException */ public function getThumbnailTag($size = 'tiny') { if (!isset(Media::getThumbnailSizes()[$size])) { - throw new SystemException("Unknown thumbnail size '".$size."'"); + throw new \InvalidArgumentException("Unknown thumbnail size '".$size."'"); } - return ''.StringUtil::encodeHTML($this->altText).'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'style="width: ' . $this->getThumbnailWidth($size) . 'px; height: ' . $this->getThumbnailHeight($size) . 'px;">'; + return ''.StringUtil::encodeHTML($this->altText).'title ? 'title="'.StringUtil::encodeHTML($this->title).'" ' : '').'style="width: ' . $this->getThumbnailWidth($size) . 'px; height: ' . $this->getThumbnailHeight($size) . 'px;">'; } /** * Returns the viewable media file with the given id. * * @param integer $mediaID - * @return Media|null + * @return ViewableMedia|null */ public static function getMedia($mediaID) { $mediaList = new ViewableMediaList();