<usersonly>1</usersonly>
<options>module_user_signature</options>
</option>
+ <option name="admin.user.canDisableCoverPhoto">
+ <categoryname>admin.user.user</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ <admindefaultvalue>1</admindefaultvalue>
+ <usersonly>1</usersonly>
+ </option>
<option name="admin.user.canMailUser">
<categoryname>admin.user.user</categoryname>
<optiontype>boolean</optiontype>
<li><a href="{@$__wcf->getAnchor('signatureManagement')}">{lang}wcf.user.signature{/lang}</a></li>
{/if}
- {if $action == 'edit'}
+ {if $action === 'edit'}
<li><a href="{@$__wcf->getAnchor('avatarForm')}">{lang}wcf.user.avatar{/lang}</a></li>
+ <li><a href="{@$__wcf->getAnchor('coverPhotoForm')}">{lang}wcf.user.coverPhoto{/lang}</a></li>
{/if}
{event name='tabMenuTabs'}
{event name='avatarFieldsets'}
</div>
+
+ <div id="coverPhotoForm" class="tabMenuContent hidden">
+ <section class="section">
+ <h2 class="sectionTitle">{lang}wcf.user.coverPhoto{/lang}</h2>
+
+ {if $userCoverPhoto}
+ <dl>
+ <dt></dt>
+ <dd>
+ <div id="coverPhotoPreview" style="background-image: url({$userCoverPhoto->getURL()})"></div>
+ </dd>
+ </dl>
+ {else}
+ <p class="info">{lang}wcf.user.coverPhoto.noImage{/lang}</p>
+ {/if}
+
+ {event name='coverPhotoFields'}
+ </section>
+
+ {if $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}
+ <section class="section">
+ <h2 class="sectionTitle">{lang}wcf.acp.user.disableCoverPhoto{/lang}</h2>
+
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" id="disableCoverPhoto" name="disableCoverPhoto" value="1"{if $disableCoverPhoto == 1} checked{/if}> {lang}wcf.acp.user.disableCoverPhoto{/lang}</label>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt><label for="disableCoverPhotoReason">{lang}wcf.acp.user.disableCoverPhoto.reason{/lang}</label></dt>
+ <dd>
+ <textarea name="disableCoverPhotoReason" id="disableCoverPhotoReason" cols="40" rows="10">{$disableCoverPhotoReason}</textarea>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt></dt>
+ <dd><label><input type="checkbox" id="disableCoverPhotoNeverExpires" name="disableCoverPhotoNeverExpires" value="1"{if !$disableCoverPhotoExpires} checked{/if}> {lang}wcf.acp.user.disableCoverPhoto.neverExpires{/lang}</label></dd>
+ </dl>
+
+ <dl id="disableCoverPhotoExpiresSetting">
+ <dt><label for="disableCoverPhotoExpires">{lang}wcf.acp.user.disableCoverPhoto.expires{/lang}</label></dt>
+ <dd>
+ <input type="date" name="disableCoverPhotoExpires" id="disableCoverPhotoExpires" min="{TIME_NOW|date:'Y-m-d'}" {if $disableCoverPhotoExpires} value="{$disableCoverPhotoExpires|date:'Y-m-d'}"{/if} class="medium">
+ <small>{lang}wcf.acp.user.disableCoverPhoto.expires.description{/lang}</small>
+ </dd>
+ </dl>
+
+ {event name='disableAvatarFields'}
+ </section>
+
+ <script data-relocate="true">
+ $('#disableCoverPhoto').change(function() {
+ if ($('#disableCoverPhoto').is(':checked')) {
+ $('#disableCoverPhotoReason').attr('readonly', false);
+ $('#disableCoverPhotoNeverExpires, #disableCoverPhotoExpires').enable();
+ $('#disableCoverPhotoReason, #disableCoverPhotoNeverExpires, #disableCoverPhotoExpires').parents('dl').removeClass('disabled');
+ }
+ else {
+ $('#disableCoverPhotoReason').attr('readonly', true);
+ $('#disableCoverPhotoNeverExpires, #disableCoverPhotoExpires').disable();
+ $('#disableCoverPhotoReason, #disableCoverPhotoNeverExpires, #disableCoverPhotoExpires').parents('dl').addClass('disabled');
+ }
+ });
+
+ $('#disableCoverPhoto').change();
+
+ $('#disableCoverPhotoNeverExpires').change(function() {
+ if ($('#disableCoverPhotoNeverExpires').is(':checked')) {
+ $('#disableCoverPhotoExpiresSetting').hide();
+ }
+ else {
+ $('#disableCoverPhotoExpiresSetting').show();
+ }
+ });
+
+ $('#disableCoverPhotoNeverExpires').change();
+ </script>
+ {/if}
+
+ {event name='coverPhotoFieldsets'}
+ </div>
{/if}
{event name='tabMenuContent'} {* deprecated event *}
use wcf\data\user\avatar\Gravatar;
use wcf\data\user\avatar\UserAvatar;
use wcf\data\user\avatar\UserAvatarAction;
+use wcf\data\user\cover\photo\UserCoverPhoto;
use wcf\data\user\group\UserGroup;
use wcf\data\user\User;
use wcf\data\user\UserAction;
use wcf\data\user\UserEditor;
use wcf\data\user\UserProfileAction;
use wcf\form\AbstractForm;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
* user editor object
* @var UserEditor
*/
- public $user = null;
+ public $user;
/**
* ban status
* user avatar object
* @var UserAvatar
*/
- public $userAvatar = null;
+ public $userAvatar;
/**
* avatar type
*/
public $disableAvatarExpires = 0;
+ /**
+ * user cover photo object
+ * @var UserCoverPhoto
+ */
+ public $userCoverPhoto;
+
+ /**
+ * true to disable this cover photo
+ * @var boolean
+ */
+ public $disableCoverPhoto = 0;
+
+ /**
+ * reason
+ * @var string
+ */
+ public $disableCoverPhotoReason = '';
+
+ /**
+ * date when the cover photo will be enabled again
+ * @var integer
+ */
+ public $disableCoverPhotoExpires = 0;
+
/**
* @inheritDoc
*/
if (isset($_POST['disableAvatarExpires'])) $this->disableAvatarExpires = @strtotime(StringUtil::trim($_POST['disableAvatarExpires']));
}
}
+
+ if (WCF::getSession()->getPermission('admin.user.canDisableCoverPhoto')) {
+ if (!empty($_POST['disableCoverPhoto'])) $this->disableCoverPhoto = 1;
+ if (isset($_POST['disableCoverPhotoReason'])) $this->disableCoverPhotoReason = StringUtil::trim($_POST['disableCoverPhotoReason']);
+ if ($this->disableCoverPhoto && !isset($_POST['disableCoverPhotoNeverExpires'])) {
+ if (isset($_POST['disableCoverPhotoExpires'])) $this->disableCoverPhotoExpires = @strtotime(StringUtil::trim($_POST['disableCoverPhotoExpires']));
+ }
+ }
}
/**
parent::readData();
- // get avatar object
+ // get the avatar object
if ($this->avatarType == 'custom') {
$this->userAvatar = new UserAvatar($this->user->avatarID);
}
+
+ // get the user cover photo object
+ if ($this->user->coverPhotoHash) {
+ $this->userCoverPhoto = UserProfileRuntimeCache::getInstance()->getObject($this->userID)->getCoverPhoto();
+ }
}
/**
$this->disableSignature = $this->user->disableSignature;
$this->disableSignatureReason = $this->user->disableSignatureReason;
$this->disableSignatureExpires = $this->user->disableSignatureExpires;
+
$this->disableAvatar = $this->user->disableAvatar;
$this->disableAvatarReason = $this->user->disableAvatarReason;
$this->disableAvatarExpires = $this->user->disableAvatarExpires;
+ $this->disableCoverPhoto = $this->user->disableCoverPhoto;
+ $this->disableCoverPhotoReason = $this->user->disableCoverPhotoReason;
+ $this->disableCoverPhotoExpires = $this->user->disableCoverPhotoExpires;
+
if ($this->user->avatarID) $this->avatarType = 'custom';
else if (MODULE_GRAVATAR && $this->user->enableGravatar) $this->avatarType = 'gravatar';
}
'disableAvatarReason' => $this->disableAvatarReason,
'disableAvatarExpires' => $this->disableAvatarExpires,
'userAvatar' => $this->userAvatar,
- 'banExpires' => $this->banExpires
+ 'banExpires' => $this->banExpires,
+ 'userCoverPhoto' => $this->userCoverPhoto,
+ 'disableCoverPhoto' => $this->disableCoverPhoto,
+ 'disableCoverPhotoReason' => $this->disableCoverPhotoReason,
+ 'disableCoverPhotoExpires' => $this->disableCoverPhotoExpires
]);
}
$data['data']['disableAvatarExpires'] = $this->disableAvatarExpires;
}
+ // handle disabled cover photo
+ if (WCF::getSession()->getPermission('admin.user.canDisableCoverPhoto')) {
+ $data['data']['disableCoverPhoto'] = $this->disableCoverPhoto;
+ $data['data']['disableCoverPhotoReason'] = $this->disableCoverPhotoReason;
+ $data['data']['disableCoverPhotoExpires'] = $this->disableCoverPhotoExpires;
+ }
+
$this->objectAction = new UserAction([$this->userID], 'update', $data);
$this->objectAction->executeAction();
return $this->styleID . '.' . $this->coverPhotoExtension;
}
- return 'default.png';
+ return 'default.jpg';
}
/**
case IMAGETYPE_PNG:
case IMAGETYPE_JPEG:
case IMAGETYPE_GIF:
- $style->update(['coverPhotoExtension' => $fileExtension]);
+ $style->update(['coverPhotoExtension' => mb_substr($fileExtension, 1)]);
}
}
}
* @property-read string $coverPhotoHash hash of the user's cover photo
* @property-read string $coverPhotoExtension extension of the user's cover photo file
* @property-read integer $disableCoverPhoto is `1` if the user's cover photo has been disabled, otherwise `0`
+ * @property-read string $disableCoverPhotoReason reason why the user's cover photo is disabled
* @property-read integer $disableCoverPhotoExpires timestamp at which the user's cover photo will automatically be enabled again
*/
final class User extends DatabaseObject implements IRouteController, IUserContent {
0,
TIME_NOW
]);
+
+ // enable cover photos
+ $sql = "UPDATE wcf".WCF_N."_user
+ SET disableCoverPhoto = ?,
+ disableCoverPhotoExpires = ?
+ WHERE disableCoverPhoto = ?
+ AND disableCoverPhotoExpires <> ?
+ AND disableCoverPhotoExpires <= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([
+ 0,
+ 0,
+ 1,
+ 0,
+ TIME_NOW
+ ]);
}
}
<item name="wcf.acp.user.disableAvatar.expires"><![CDATA[Entsperrung]]></item>
<item name="wcf.acp.user.disableAvatar.expires.description"><![CDATA[Der Avatar des Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
<item name="wcf.acp.user.disableAvatar.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto"><![CDATA[Profilbild sperren]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.reason"><![CDATA[Begründung]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.expires"><![CDATA[Entsperrung]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.expires.description"><![CDATA[Das Profilbild des Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
<item name="wcf.acp.user.disableSignature.expires"><![CDATA[Entsperrung]]></item>
<item name="wcf.acp.user.disableSignature.expires.description"><![CDATA[Die Signatur des Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
<item name="wcf.acp.user.disableSignature.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
</category>
<category name="wcf.user.coverPhoto">
+ <item name="wcf.user.coverPhoto"><![CDATA[Profilbild]]></item>
<item name="wcf.user.coverPhoto.delete"><![CDATA[Profilbild löschen]]></item>
<item name="wcf.user.coverPhoto.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du dein{else}Wollen Sie Ihr{/if} Profilbild wirklich löschen? Nach dem Löschen wird wieder das Standard-Bild angezeigt.]]></item>
<item name="wcf.user.coverPhoto.edit"><![CDATA[Profilbild bearbeiten]]></item>
+ <item name="wcf.user.coverPhoto.error.disabled"><![CDATA[Der Administrator hat{if $__wcf->user->coverPhotoHash} {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} derzeitiges Profilbild gesperrt und{/if} {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if} die weitere Nutzungsberechtigung der Profilbild-Funktion {if !$__wcf->user->disableCoverPhotoReason}entzogen.{else} aus folgenden Gründen entzogen: {$__wcf->user->disableCoverPhotoReason}{/if}]]></item>
+ <item name="wcf.user.coverPhoto.noImage"><![CDATA[Der Benutzer hat noch kein Profilbild hochgeladen.]]></item>
<item name="wcf.user.coverPhoto.upload"><![CDATA[Profilbild hochladen]]></item>
<item name="wcf.user.coverPhoto.upload.description"><![CDATA[Minimale Bildgröße: {$coverPhotoDimensions.min.width}×{$coverPhotoDimensions.min.height} Pixel<br>Maximale Bildgröße: {$coverPhotoDimensions.max.width}×{$coverPhotoDimensions.max.height} Pixel<br>Erlaubte Dateiendungen: gif, jpg, jpeg, png<br>Maximale Dateigröße: {$__wcf->session->getPermission('user.profile.coverPhoto.maxSize')|filesize}]]></item>
<item name="wcf.user.coverPhoto.upload.error.badImage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} kein gültiges Bild hochgeladen.]]></item>
<item name="wcf.acp.user.disableAvatar.expires"><![CDATA[Unblocking]]></item>
<item name="wcf.acp.user.disableAvatar.expires.description"><![CDATA[The avatar of the user will automatically be unblocked at the set time.]]></item>
<item name="wcf.acp.user.disableAvatar.neverExpires"><![CDATA[Permanently Block]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto"><![CDATA[Block Cover Photo]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.reason"><![CDATA[Reason]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.expires"><![CDATA[Unblocking]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.expires.description"><![CDATA[The cover photo of the user will automatically be unblocked at the set time.]]></item>
+ <item name="wcf.acp.user.disableCoverPhoto.neverExpires"><![CDATA[Permanently Block]]></item>
<item name="wcf.acp.user.disableSignature.expires"><![CDATA[Unblocking]]></item>
<item name="wcf.acp.user.disableSignature.expires.description"><![CDATA[The signature of the user will automatically be unblocked at the set time.]]></item>
<item name="wcf.acp.user.disableSignature.neverExpires"><![CDATA[Permanently Block]]></item>
</category>
<category name="wcf.user.coverPhoto">
+ <item name="wcf.user.coverPhoto"><![CDATA[Cover Photo]]></item>
<item name="wcf.user.coverPhoto.delete"><![CDATA[Delete Cover Photo]]></item>
<item name="wcf.user.coverPhoto.delete.confirmMessage"><![CDATA[Do you really want to delete your cover photo? This will replace your current photo with the default image.]]></item>
<item name="wcf.user.coverPhoto.edit"><![CDATA[Edit Cover Photo]]></item>
+ <item name="wcf.user.coverPhoto.error.disabled"><![CDATA[The administrators {if $__wcf->user->coverPhotoHash}have banned your cover photo and {/if}disallowed you from using a cover photo{if $__wcf->user->disableCoverPhotoReason}: {$__wcf->user->disableCoverPhotoReason}{/if}.]]></item>
+ <item name="wcf.user.coverPhoto.noImage"><![CDATA[The user has not yet uploaded a cover photo.]]></item>
<item name="wcf.user.coverPhoto.upload"><![CDATA[Upload Cover Photo]]></item>
<item name="wcf.user.coverPhoto.upload.description"><![CDATA[Minimum Image Size: {$coverPhotoDimensions.min.width}×{$coverPhotoDimensions.min.height} pixels<br>Maximum Image Size: {$coverPhotoDimensions.max.width}×{$coverPhotoDimensions.max.height} pixels<br>Allowed File Extensions: gif, jpg, jpeg, png<br>Maximum Filesize: {$__wcf->session->getPermission('user.profile.coverPhoto.maxSize')|filesize}]]></item>
<item name="wcf.user.coverPhoto.upload.error.badImage"><![CDATA[The uploaded file is not an image.]]></item>
coverPhotoHash CHAR(40) DEFAULT NULL,
coverPhotoExtension VARCHAR(4) NOT NULL DEFAULT '',
disableCoverPhoto TINYINT(1) NOT NULL DEFAULT 0,
+ disableCoverPhotoReason TEXT,
disableCoverPhotoExpires INT(10) NOT NULL DEFAULT 0,
KEY username (username),