<title>Benutzerkonto-Sicherheit</title>
</content>
</page>
- <page identifier="com.woltlab.wcf.AvatarEdit">
- <pageType>system</pageType>
- <controller>wcf\form\AvatarEditForm</controller>
- <name language="de">Avatar-Verwaltung</name>
- <name language="en">Avatar Management</name>
- <hasFixedParent>1</hasFixedParent>
- <parent>com.woltlab.wcf.AccountManagement</parent>
- <content language="en">
- <title>Avatar Management</title>
- </content>
- <content language="de">
- <title>Avatar-Verwaltung</title>
- </content>
- </page>
<page identifier="com.woltlab.wcf.EmailActivation">
<pageType>system</pageType>
<controller>wcf\form\EmailActivationForm</controller>
</page>
</import>
<delete>
+ <page identifier="com.woltlab.wcf.AvatarEdit"/>
<!-- The notification list is no longer part of the user menu. -->
<page identifier="com.woltlab.wcf.NotificationList"/>
</delete>
</div>
</div>
{/if}
+ {if $__wcf->getSession()->getPermission('user.profile.avatar.canUploadAvatar') && !$__wcf->getUserProfileHandler()->disableAvatar}
+ <div class="userMenuItem userMenuItemNarrow userMenuItemSingleLine">
+ <div class="userMenuItemImage">
+ {icon size=16 name='user-pen'}
+ </div>
+ <div class="userMenuItemContent">
+ <button type="button" class="userMenuItemLink userAvatarManagement">
+ {lang}wcf.user.avatarManagement{/lang}
+ </button>
+ </div>
+ </div>
+ {/if}
{if $__wcf->session->getPermission('admin.general.canUseAcp')}
<div class="userMenuItem userMenuItemNarrow userMenuItemSingleLine">
<div class="userMenuItemImage">
<parent>wcf.user.menu.profile</parent>
<showorder>2</showorder>
</usermenuitem>
- <usermenuitem name="wcf.user.menu.profile.avatar">
- <controller>wcf\form\AvatarEditForm</controller>
- <parent>wcf.user.menu.profile</parent>
- <showorder>3</showorder>
- </usermenuitem>
<usermenuitem name="wcf.user.menu.profile.signature">
<controller>wcf\form\SignatureEditForm</controller>
<parent>wcf.user.menu.profile</parent>
</import>
<delete>
<usermenuitem name="wcf.user.menu.community.notification"/>
+ <usermenuitem name="wcf.user.menu.profile.avatar"/>
</delete>
</data>
use wcf\data\file\File;
use wcf\data\user\avatar\UserAvatar;
-use wcf\data\user\User;
use wcf\data\user\UserEditor;
-use wcf\system\cache\runtime\UserRuntimeCache;
+use wcf\data\user\UserProfile;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\UserInputException;
use wcf\system\user\storage\UserStorageHandler;
#[\Override]
public function canDownload(File $file): bool
{
- return true;
+ $user = $this->getUserByFile($file);
+ if ($user === null) {
+ return false;
+ }
+
+ return $user->canSeeAvatar();
}
#[\Override]
);
}
- private function getUser(array $context): ?User
+ private function getUser(array $context): ?UserProfile
{
$userID = $context['objectID'] ?? null;
if ($userID === null) {
return null;
}
- return UserRuntimeCache::getInstance()->getObject($userID);
+ return UserProfileRuntimeCache::getInstance()->getObject($userID);
}
- private function getUserByFile(File $file): ?User
+ private function getUserByFile(File $file): ?UserProfile
{
- $sql = "SELECT *
+ $sql = "SELECT userID
FROM wcf1_user
WHERE avatarFileID = ?";
$statement = WCF::getDB()->prepare($sql);
$statement->execute([$file->fileID]);
+ $userID = $statement->fetchSingleColumn();
+
+ if ($userID === false) {
+ return null;
+ }
- return $statement->fetchObject(User::class);
+ return UserProfileRuntimeCache::getInstance()->getObject($userID);
}
- private function canEditAvatar(User $user): bool
+ private function canEditAvatar(UserProfile $user): bool
{
if (WCF::getSession()->getPermission('admin.user.canEditUser')) {
return true;
<item name="wcf.user.ignore.type.hideMessages"><![CDATA[Direkten Kontakt blockieren und erstellte Inhalte ausblenden]]></item>
<item name="wcf.user.ignore.error.cannotBeIgnored"><![CDATA[Der Benutzer kann nicht blockiert werden.]]></item>
<item name="wcf.user.reactionsReceived"><![CDATA[Reaktionen]]></item>
+ <item name="wcf.user.avatarManagement"><![CDATA[Avatar-Verwaltung]]></item>
</category>
<category name="wcf.user.menu">
<item name="wcf.user.menu.community"><![CDATA[Community]]></item>
<item name="wcf.user.ignore.type.hideMessages"><![CDATA[Block Direct Contact and Hide Created Messages]]></item>
<item name="wcf.user.ignore.error.cannotBeIgnored"><![CDATA[The user cannot be blocked.]]></item>
<item name="wcf.user.reactionsReceived"><![CDATA[Reactions]]></item>
+ <item name="wcf.user.avatarManagement"><![CDATA[Avatar Management]]></item>
</category>
<category name="wcf.user.menu">
<item name="wcf.user.menu.community"><![CDATA[Community]]></item>