Implement ISafeFormatAvatar in DefaultAvatar
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 22 Feb 2021 12:50:46 +0000 (13:50 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 22 Feb 2021 12:50:46 +0000 (13:50 +0100)
wcfsetup/install/files/images/avatars/avatar-default.png [new file with mode: 0644]
wcfsetup/install/files/lib/data/user/avatar/DefaultAvatar.class.php

diff --git a/wcfsetup/install/files/images/avatars/avatar-default.png b/wcfsetup/install/files/images/avatars/avatar-default.png
new file mode 100644 (file)
index 0000000..2bd3f75
Binary files /dev/null and b/wcfsetup/install/files/images/avatars/avatar-default.png differ
index d69b8c9fd082a5ce9d2650e8bdfc91ba3044a672..cc4beb05ca4e8285973486ab3581ad821d0c8611 100644 (file)
@@ -13,7 +13,7 @@ use wcf\util\StringUtil;
  * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package WoltLabSuite\Core\Data\User\Avatar
  */
-class DefaultAvatar implements IUserAvatar
+class DefaultAvatar implements IUserAvatar, ISafeFormatAvatar
 {
     /**
      * image size
@@ -68,6 +68,22 @@ SVG;
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    public function getSafeURL(?int $size = null): string
+    {
+        return WCF::getPath() . 'images/avatars/avatar-default.png';
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getSafeImageTag(?int $size = null): string
+    {
+        return '<img src="' . StringUtil::encodeHTML($this->getSafeURL($size)) . '" width="' . $size . '" height="' . $size . '" alt="" class="userAvatarImage">';
+    }
+
     /**
      * @inheritDoc
      */