Force-enable cover photos
authorAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jan 2021 18:53:16 +0000 (19:53 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jan 2021 12:46:59 +0000 (13:46 +0100)
com.woltlab.wcf/option.xml
com.woltlab.wcf/templates/user.tpl
constants.php
wcfsetup/install/files/lib/data/user/UserProfileAction.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 8c4d12f4a09f71fa5a31f114428481097634f2cc..8e8d2cccbcca40413a306c596404a075cfadd5f3 100644 (file)
                                <optiontype>boolean</optiontype>
                                <defaultvalue>1</defaultvalue>
                        </option>
-                       <option name="module_user_cover_photo">
-                               <categoryname>module.user</categoryname>
-                               <optiontype>boolean</optiontype>
-                               <defaultvalue>1</defaultvalue>
-                       </option>
                        <option name="module_like">
                                <categoryname>module.community</categoryname>
                                <optiontype>boolean</optiontype>
@@ -1701,5 +1696,6 @@ DESC:wcf.global.sortOrder.descending</selectoptions>
                <option name="session_validate_user_agent" />
                <option name="session_enable_virtualization" />
                <option name="blacklist_hostnames" />
+               <option name="module_user_cover_photo" />
        </delete>
 </data>
index 2a847565ba7c3482ebe1212ee22fe12a2b4c1cf1..c3e91ee7daca572a2e2ddd1c1607cfdfa3fc2b3e 100644 (file)
 {/capture}
 
 {capture assign='contentHeader'}
-       <header class="contentHeader userProfileUser{if MODULE_USER_COVER_PHOTO} userProfileUserWithCoverPhoto{/if}" data-object-id="{@$user->userID}"{if $isAccessible}
+       <header class="contentHeader userProfileUser userProfileUserWithCoverPhoto" data-object-id="{@$user->userID}"{if $isAccessible}
                {if $__wcf->session->getPermission('admin.user.canBanUser')}
                        data-banned="{@$user->banned}"
                {/if}
                {if $__wcf->session->getPermission('admin.user.canDisableSignature')}
                        data-disable-signature="{@$user->disableSignature}"
                {/if}
-               {if MODULE_USER_COVER_PHOTO && $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}
+               {if $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}
                        data-disable-cover-photo="{@$user->disableCoverPhoto}"
                {/if}
                {if $__wcf->session->getPermission('admin.user.canEnableUser')}
                        data-is-disabled="{if $user->activationCode}true{else}false{/if}"
                {/if}
                {/if}>
-               {if MODULE_USER_COVER_PHOTO}
-                       <div class="userProfileCoverPhoto" style="background-image: url({$user->getCoverPhoto()->getURL()})">
-                               {if ($user->userID == $__wcf->user->userID || $user->canEdit()) && ($__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto') || $user->coverPhotoHash)}
-                                       <div class="userProfileManageCoverPhoto dropdown jsOnly">
-                                               <a href="#" class="button small dropdownToggle"><span class="icon icon16 fa-pencil"></span> {lang}wcf.user.coverPhoto.edit{/lang}</a>
-                                               <ul class="dropdownMenu">
-                                                       {if $__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto')}
-                                                               <li><a href="#" class="jsButtonUploadCoverPhoto jsStaticDialog" data-dialog-id="userProfileCoverPhotoUpload">{lang}wcf.user.coverPhoto.upload{/lang}</a></li>
-                                                       {/if}
-                                                       <li{if !$user->coverPhotoHash} style="display:none;"{/if}><a href="#" class="jsButtonDeleteCoverPhoto">{lang}wcf.user.coverPhoto.delete{/lang}</a></li>
-                                               </ul>
-                                       </div>
-                               {/if}
-                       </div>
-               {/if}
+               <div class="userProfileCoverPhoto" style="background-image: url({$user->getCoverPhoto()->getURL()})">
+                       {if ($user->userID == $__wcf->user->userID || $user->canEdit()) && ($__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto') || $user->coverPhotoHash)}
+                               <div class="userProfileManageCoverPhoto dropdown jsOnly">
+                                       <a href="#" class="button small dropdownToggle"><span class="icon icon16 fa-pencil"></span> {lang}wcf.user.coverPhoto.edit{/lang}</a>
+                                       <ul class="dropdownMenu">
+                                               {if $__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto')}
+                                                       <li><a href="#" class="jsButtonUploadCoverPhoto jsStaticDialog" data-dialog-id="userProfileCoverPhotoUpload">{lang}wcf.user.coverPhoto.upload{/lang}</a></li>
+                                               {/if}
+                                               <li{if !$user->coverPhotoHash} style="display:none;"{/if}><a href="#" class="jsButtonDeleteCoverPhoto">{lang}wcf.user.coverPhoto.delete{/lang}</a></li>
+                                       </ul>
+                               </div>
+                       {/if}
+               </div>
                <div class="contentHeaderIcon">
                        {if $user->userID == $__wcf->user->userID}
                                <a href="{link controller='AvatarEdit'}{/link}" class="jsTooltip" title="{lang}wcf.user.avatar.edit{/lang}">{@$user->getAvatar()->getImageTag(128)}</a>
                                                                        {if $__wcf->session->getPermission('admin.user.canBanUser')}<li><a href="#" class="jsButtonUserBan">{lang}wcf.user.{if $user->banned}un{/if}ban{/lang}</a></li>{/if}
                                                                        {if $__wcf->session->getPermission('admin.user.canDisableAvatar')}<li><a href="#" class="jsButtonUserDisableAvatar">{lang}wcf.user.{if $user->disableAvatar}enable{else}disable{/if}Avatar{/lang}</a></li>{/if}
                                                                        {if $__wcf->session->getPermission('admin.user.canDisableSignature')}<li><a href="#" class="jsButtonUserDisableSignature">{lang}wcf.user.{if $user->disableSignature}enable{else}disable{/if}Signature{/lang}</a></li>{/if}
-                                                                       {if MODULE_USER_COVER_PHOTO && $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}<li><a href="#" class="jsButtonUserDisableCoverPhoto">{lang}wcf.user.{if $user->disableCoverPhoto}enable{else}disable{/if}CoverPhoto{/lang}</a></li>{/if}
+                                                                       {if $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}<li><a href="#" class="jsButtonUserDisableCoverPhoto">{lang}wcf.user.{if $user->disableCoverPhoto}enable{else}disable{/if}CoverPhoto{/lang}</a></li>{/if}
                                                                        {if $__wcf->session->getPermission('admin.user.canEnableUser')}<li><a href="#" class="jsButtonUserEnable">{lang}wcf.acp.user.{if $user->pendingActivation()}enable{else}disable{/if}{/lang}</a></li>{/if}
                                                                        
                                                                        {if $__wcf->session->getPermission('admin.general.canUseAcp') && $__wcf->session->getPermission('admin.user.canEditUser')}<li><a href="{link controller='UserEdit' object=$user isACP=true}{/link}" class="jsUserInlineEditor">{lang}wcf.user.edit{/lang}</a></li>{/if}
        <p class="info" role="status">{lang}wcf.user.profile.protected{/lang}</p>
 {/if}
 
-{if MODULE_USER_COVER_PHOTO && ($user->userID == $__wcf->user->userID || $user->canEdit())}
+{if $user->userID == $__wcf->user->userID || $user->canEdit()}
        {if $__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto')}
                <div id="userProfileCoverPhotoUpload" class="jsStaticDialogContent" data-title="{lang}wcf.user.coverPhoto.upload{/lang}">
                        {if $__wcf->user->disableCoverPhoto}
index 199d5330c43f95e4e337c692dd0c0071704c97cc..7cd5e166f1a61fe954cbb8410816b321697c6f46 100644 (file)
 \define('FORCE_LOGIN', 0);
 \define('DESKTOP_NOTIFICATION_PACKAGE_ID', 1);
 \define('PAGE_LOGO_LINK_TO_APP_DEFAULT', 1);
-\define('MODULE_USER_COVER_PHOTO', 1);
 \define('IMAGE_ALLOW_EXTERNAL_SOURCE', 0);
 \define('MESSAGE_ENABLE_TOC', 1);
 \define('MESSAGE_SIDEBAR_ENABLE_ARTICLES', 1);
index 66fa66c8e022da54bf9fdd3a3efc88fdb94b5c42..4579373c46bb3072c539a08a31d17c4c27b9ef46 100644 (file)
@@ -569,10 +569,6 @@ class UserProfileAction extends UserAction implements IPopoverAction
      */
     public function validateUploadCoverPhoto()
     {
-        if (!MODULE_USER_COVER_PHOTO) {
-            throw new PermissionDeniedException();
-        }
-
         WCF::getSession()->checkPermissions(['user.profile.coverPhoto.canUploadCoverPhoto']);
 
         $this->readInteger('userID', true);
@@ -645,10 +641,6 @@ class UserProfileAction extends UserAction implements IPopoverAction
      */
     public function validateDeleteCoverPhoto()
     {
-        if (!MODULE_USER_COVER_PHOTO) {
-            throw new PermissionDeniedException();
-        }
-
         $this->readInteger('userID', true);
         // The `userID` parameter did not exist in 3.1, defaulting to the own user for backwards compatibility.
         if (!$this->parameters['userID']) {
index d6e5d5f7dab6ac8f15a8436ab59340a71c002afe..768be8e23969a04575f29f249f59d5870f7233bb 100644 (file)
@@ -423,6 +423,10 @@ class WCF
         // https://github.com/WoltLab/WCF/issues/3909
         \define('BLACKLIST_HOSTNAMES', '');
 
+        // Cover photos are always enabled since 5.4.
+        // https://github.com/WoltLab/WCF/issues/3902
+        \define('MODULE_USER_COVER_PHOTO', 1);
+
         $filename = WCF_DIR . 'options.inc.php';
 
         // create options file if doesn't exist
index a7840f818c7a40775792e2a4456999033ccf53b0..fa69beb4ce1cdf4ac54a5f5dd6ad7aaf6effdde3 100644 (file)
@@ -1706,8 +1706,6 @@ Als Benachrichtigungs-URL in der Konfiguration der sofortigen Zahlungsbestätigu
                <item name="wcf.acp.option.desktop_notification_package_id.description"><![CDATA[Desktop-Benachrichtigungen werden nur für die ausgewählte App aktiviert, einschließlich aller anderen Apps die auf der identischen Domain laufen.]]></item>
                <item name="wcf.acp.option.page_logo_link_to_app_default"><![CDATA[Seitenlogo verlinkt auf die Startseite der aktiven App]]></item>
                <item name="wcf.acp.option.page_logo_link_to_app_default.description"><![CDATA[Deaktiviere{if !LANGUAGE_USE_INFORMAL_VARIANT}n Sie{/if} diese Option, damit das Logo stets auf die globale Startseite verlinkt. Die Deaktivierung entspricht dem Verhalten in früheren Versionen.]]></item>
-               <item name="wcf.acp.option.module_user_cover_photo"><![CDATA[Titelbilder aktivieren]]></item>
-               <item name="wcf.acp.option.module_user_cover_photo.description"><![CDATA[Aktiviert die Darstellung und die Verwaltung von Titelbildern.]]></item>
                <item name="wcf.acp.option.image_allow_external_source"><![CDATA[Bilder von externen Seiten erlauben]]></item>
                <item name="wcf.acp.option.image_external_source_whitelist"><![CDATA[Erlaubte Bilder von externen Seiten]]></item>
                <item name="wcf.acp.option.image_external_source_whitelist.description"><![CDATA[Die aufgeführten Domains sind von der Blockade ausgenommen. Der Abgleich erfolgt auf Basis der strikten Übereinstimmung, optional können Subdomains mit einem Platzhalter berücksichtigt werden: <kbd>*.example.com</kbd> umfasst sowohl <kbd>example.com</kbd> als auch Subdomains wie <kbd>foo.example.com</kbd> oder <kbd>www.example.com</kbd>.<br>Bitte nur eine Domain pro Zeile eingeben.]]></item>
index b8ba9e602ee01c6b5481fd03633724f71a8a2c9e..36ac7e085ed24ea2effc9aa141823d51d6a60fbb 100644 (file)
@@ -1690,8 +1690,6 @@ When prompted for the notification URL for the instant payment notifications, pl
                <item name="wcf.acp.option.desktop_notification_package_id.description"><![CDATA[Desktop Notifications will be enabled for the selected app only, including all other apps that use the exact same domain.]]></item>
                <item name="wcf.acp.option.page_logo_link_to_app_default"><![CDATA[Page logo links to the start page of the active app]]></item>
                <item name="wcf.acp.option.page_logo_link_to_app_default.description"><![CDATA[Disabling this option will cause the link to always point to the global landing page instead. This option enforces the behavior known from previous versions when disabled.]]></item>
-               <item name="wcf.acp.option.module_user_cover_photo"><![CDATA[Enable user cover photos]]></item>
-               <item name="wcf.acp.option.module_user_cover_photo.description"><![CDATA[Enables the display and upload of user profile cover photos.]]></item>
                <item name="wcf.acp.option.image_allow_external_source"><![CDATA[Allow images from external sites]]></item>
                <item name="wcf.acp.option.image_external_source_whitelist"><![CDATA[Allowed images from external sites]]></item>
                <item name="wcf.acp.option.image_external_source_whitelist.description"><![CDATA[The listed domains will be exempt from blocking. Hostnames are exact matches only, a leading wildcard can be used to exclude an entire domain: <kbd>*.example.com</kbd> matches <kbd>example.com</kbd> and subdomains such as <kbd>foo.example.com</kbd> or <kbd>www.example.com</kbd>.<br>Enter one domain per line only.]]></item>