<canbeedited>1</canbeedited>
<canbedisabled>1</canbedisabled>
</cronjob>
+
+ <cronjob>
+ <classname><![CDATA[wcf\system\cronjob\UserBanCronjob]]></classname>
+ <description><![CDATA[Unbans users and enables disabled avatars and disabled signatures]]></description>
+ <description language="de"><![CDATA[Entsperrt gesperrte Benutzer, Avatare und Signaturen]]></description>
+ <startminute>0</startminute>
+ <starthour>1</starthour>
+ <startdom>*</startdom>
+ <startmonth>*</startmonth>
+ <startdow>*</startdow>
+ <active>1</active>
+ <canbeedited>1</canbeedited>
+ <canbedisabled>1</canbedisabled>
+ </cronjob>
</import>
</data>
\ No newline at end of file
WCF.Language.addObject({
'wcf.user.ban': '{lang}wcf.user.ban{/lang}',
'wcf.user.ban.confirmMessage': '{lang}wcf.user.ban.confirmMessage{/lang}',
+ 'wcf.user.ban.expires': '{lang}wcf.user.ban.expires{/lang}',
+ 'wcf.user.ban.expires.description': '{lang}wcf.user.ban.expires.description{/lang}',
+ 'wcf.user.ban.neverExpires': '{lang}wcf.user.ban.neverExpires{/lang}',
'wcf.user.ban.reason.description': '{lang}wcf.user.ban.reason.description{/lang}',
'wcf.user.unban': '{lang}wcf.user.unban{/lang}',
'wcf.user.disableAvatar': '{lang}wcf.user.disableAvatar{/lang}',
+ 'wcf.user.ban.expires': '{lang}wcf.user.ban.expires{/lang}',
+ 'wcf.user.ban.expires.description': '{lang}wcf.user.ban.expires.description{/lang}',
+ 'wcf.user.ban.neverExpires': '{lang}wcf.user.ban.neverExpires{/lang}',
'wcf.user.disableAvatar.confirmMessage': '{lang}wcf.user.disableAvatar.confirmMessage{/lang}',
+ 'wcf.user.disableAvatar.expires': '{lang}wcf.user.disableAvatar.expires{/lang}',
+ 'wcf.user.disableAvatar.expires.description': '{lang}wcf.user.disableAvatar.expires.description{/lang}',
+ 'wcf.user.disableAvatar.neverExpires': '{lang}wcf.user.disableAvatar.neverExpires{/lang}',
'wcf.user.disableSignature': '{lang}wcf.user.disableSignature{/lang}',
'wcf.user.disableSignature.confirmMessage': '{lang}wcf.user.disableSignature.confirmMessage{/lang}',
+ 'wcf.user.disableSignature.expires': '{lang}wcf.user.disableSignature.expires{/lang}',
+ 'wcf.user.disableSignature.expires.description': '{lang}wcf.user.disableSignature.expires.description{/lang}',
+ 'wcf.user.disableSignature.neverExpires': '{lang}wcf.user.disableSignature.neverExpires{/lang}',
'wcf.user.edit': '{lang}wcf.user.edit{/lang}',
'wcf.user.enableAvatar': '{lang}wcf.user.enableAvatar{/lang}',
'wcf.user.enableSignature': '{lang}wcf.user.enableSignature{/lang}'
* Initializes WCF.ACP.User.BanHandler on first use.
*/
init: function() {
- this._dialog = $('<div />').hide().appendTo(document.body);
this._proxy = new WCF.Action.Proxy({
success: $.proxy(this._success, this)
});
* @param array<integer> userIDs
*/
ban: function(userIDs) {
- WCF.System.Confirmation.show(WCF.Language.get('wcf.acp.user.ban.sure'), $.proxy(function(action) {
- if (action === 'confirm') {
- this._proxy.setOption('data', {
- actionName: 'ban',
- className: 'wcf\\data\\user\\UserAction',
- objectIDs: userIDs,
- parameters: {
- banReason: $('#userBanReason').val()
- }
- });
- this._proxy.sendRequest();
+ if (this._dialog === null) {
+ // create dialog
+ this._dialog = $('<div />').hide().appendTo(document.body);
+ this._dialog.append($('<fieldset><dl><dt><label for="userBanReason">' + WCF.Language.get('wcf.acp.user.banReason') + '</label></dt><dd><textarea id="userBanReason" cols="40" rows="3" /><small>' + WCF.Language.get('wcf.acp.user.banReason.description') + '</small></dd></dl><dl><dt></dt><dd><label for="userBanNeverExpires"><input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="checked" /> ' + WCF.Language.get('wcf.acp.user.ban.neverExpires') + '</label></dd></dl><dl id="userBanExpiresSettings" style="display: none;"><dt><label for="userBanExpires">' + WCF.Language.get('wcf.acp.user.ban.expires') + '</label></dt><dd><input type="date" name="userBanExpires" id="userBanExpires" class="medium" min="' + new Date(TIME_NOW * 1000).toISOString() + '" data-ignore-timezone="true" /><small>' + WCF.Language.get('wcf.acp.user.ban.expires.description') + '</small></dd></dl></fieldset>'));
+ this._dialog.append($('<div class="formSubmit"><button class="buttonPrimary" accesskey="s">' + WCF.Language.get('wcf.global.button.submit') + '</button></div>'));
+
+ this._dialog.find('#userBanNeverExpires').change(function() {
+ $('#userBanExpiresSettings').toggle();
+ });
+
+ this._dialog.find('button').click($.proxy(this._submit, this));
+ }
+ else {
+ // reset dialog
+ $('#userBanReason').val('');
+ $('#userBanNeverExpires').prop('checked', true);
+ $('#userBanExpiresSettings').hide();
+ $('#userBanExpiresDatePicker, #userBanExpires').val('');
+ }
+
+ this._dialog.data('userIDs', userIDs);
+ this._dialog.wcfDialog({
+ title: WCF.Language.get('wcf.acp.user.ban.sure')
+ });
+ },
+
+ /**
+ * Handles submitting the ban dialog.
+ */
+ _submit: function() {
+ this._dialog.find('.innerError').remove();
+
+ var $banExpires = '';
+ if (!$('#userBanNeverExpires').is(':checked')) {
+ var $banExpires = $('#userBanExpiresDatePicker').val();
+ if (!$banExpires) {
+ this._dialog.find('#userBanExpiresSettings > dd > small').prepend($('<small class="innerError" />').text(WCF.Language.get('wcf.global.form.error.empty')));
+ return
}
- }, this), '', $('<fieldset><dl><dt><label for="userBanReason">' + WCF.Language.get('wcf.acp.user.banReason') + '</label></dt><dd><textarea id="userBanReason" cols="40" rows="3" /><small>' + WCF.Language.get('wcf.acp.user.banReason.description') + '</small></dd></dl></fieldset>'));
+ }
+
+ this._proxy.setOption('data', {
+ actionName: 'ban',
+ className: 'wcf\\data\\user\\UserAction',
+ objectIDs: this._dialog.data('userIDs'),
+ parameters: {
+ banReason: $('#userBanReason').val(),
+ banExpires: $banExpires
+ }
+ });
+ this._proxy.sendRequest();
},
/**
$notification.show();
WCF.Clipboard.reload();
+
+ if (data.actionName == 'ban') {
+ this._dialog.wcfDialog('close');
+ }
}
};
</dd>
</dl>
+ <dl>
+ <dt></dt>
+ <dd><label><input type="checkbox" id="banNeverExpires" name="banNeverExpires" value="1" {if !$banExpires}checked="checked" {/if}/> {lang}wcf.acp.user.ban.neverExpires{/lang}</label></dd>
+ </dl>
+
+ <dl id="banExpiresSetting">
+ <dt><label for="banExpires">{lang}wcf.acp.user.ban.expires{/lang}</label></dt>
+ <dd>
+ <input type="date" name="banExpires" id="banExpires" min="{TIME_NOW|date:'Y-m-d'}" {if $banExpires} value="{$banExpires|date:'Y-m-d'}"{/if} class="medium" data-ignore-timezone="true" />
+ <small>{lang}wcf.acp.user.ban.expires.description{/lang}</small>
+ </dd>
+ </dl>
+
{event name='banFields'}
</fieldset>
<script data-relocate="true">
//<![CDATA[
- $('#banned').change(function (event) {
+ $('#banned').change(function() {
if ($('#banned').is(':checked')) {
$('#banReason').attr('readonly', false);
+ $('#banNeverExpires, #banExpires').enable();
+ $('#banReason, #banNeverExpires, #banExpires').parents('dl').removeClass('disabled');
}
else {
$('#banReason').attr('readonly', true);
+ $('#banNeverExpires, #banExpires').disable();
+ $('#banReason, #banNeverExpires, #banExpires').parents('dl').addClass('disabled');
}
});
+
$('#banned').change();
+
+ $('#banNeverExpires').change(function() {
+ if ($('#banNeverExpires').is(':checked')) {
+ $('#banExpiresSetting').hide();
+ }
+ else {
+ $('#banExpiresSetting').show();
+ }
+ });
+
+ $('#banNeverExpires').change();
//]]>
</script>
{/if}
<label><input id="signatureEnableHtml" name="signatureEnableHtml" type="checkbox" value="1"{if $signatureEnableHtml} checked="checked"{/if} /> {lang}wcf.message.settings.enableHtml{/lang}</label>
</dd>
</dl>
+
+ {event name='signatureFields'}
</fieldset>
{if $__wcf->session->getPermission('admin.user.canDisableSignature')}
<textarea name="disableSignatureReason" id="disableSignatureReason" cols="40" rows="10">{$disableSignatureReason}</textarea>
</dd>
</dl>
+
+ <dl>
+ <dt></dt>
+ <dd><label><input type="checkbox" id="disableSignatureNeverExpires" name="disableSignatureNeverExpires" value="1" {if !$disableSignatureExpires}checked="checked" {/if}/> {lang}wcf.acp.user.disableSignature.neverExpires{/lang}</label></dd>
+ </dl>
+
+ <dl id="disableSignatureExpiresSetting">
+ <dt><label for="disableSignatureExpiresExpires">{lang}wcf.acp.user.disableSignature.expires{/lang}</label></dt>
+ <dd>
+ <input type="date" name="disableSignatureExpires" id="disableSignatureExpires" min="{TIME_NOW|date:'Y-m-d'}" {if $disableSignatureExpires} value="{$disableSignatureExpires|date:'Y-m-d'}"{/if} class="medium" data-ignore-timezone="true" />
+ <small>{lang}wcf.acp.user.disableSignature.expires.description{/lang}</small>
+ </dd>
+ </dl>
+
+ {event name='disableSignatureFields'}
</fieldset>
<script data-relocate="true">
//<![CDATA[
- $('#disableSignature').change(function (event) {
+ $('#disableSignature').change(function() {
if ($('#disableSignature').is(':checked')) {
$('#disableSignatureReason').attr('readonly', false);
+ $('#disableSignatureNeverExpires, #disableSignatureExpires').enable();
+ $('#disableSignatureReason, #disableSignatureNeverExpires, #disableSignatureExpires').parents('dl').removeClass('disabled');
}
else {
$('#disableSignatureReason').attr('readonly', true);
+ $('#disableSignatureNeverExpires, #disableSignatureExpires').disable();
+ $('#disableSignatureReason, #disableSignatureNeverExpires, #disableSignatureExpires').parents('dl').addClass('disabled');
}
});
+
$('#disableSignature').change();
+
+ $('#disableSignatureNeverExpires').change(function() {
+ if ($('#disableSignatureNeverExpires').is(':checked')) {
+ $('#disableSignatureExpiresSetting').hide();
+ }
+ else {
+ $('#disableSignatureExpiresSetting').show();
+ }
+ });
+
+ $('#disableSignatureNeverExpires').change();
//]]>
</script>
{/if}
+
+ {event name='signatureFieldsets'}
</div>
{/if}
</dd>
</dl>
{/if}
+
+ {event name='avatarFields'}
</fieldset>
{if $__wcf->session->getPermission('admin.user.canDisableAvatar')}
<textarea name="disableAvatarReason" id="disableAvatarReason" cols="40" rows="10">{$disableAvatarReason}</textarea>
</dd>
</dl>
+
+ <dl>
+ <dt></dt>
+ <dd><label><input type="checkbox" id="disableAvatarNeverExpires" name="disableAvatarNeverExpires" value="1" {if !$disableAvatarExpires}checked="checked" {/if}/> {lang}wcf.acp.user.disableAvatar.neverExpires{/lang}</label></dd>
+ </dl>
+
+ <dl id="disableAvatarExpiresSetting">
+ <dt><label for="disableAvatarExpiresExpires">{lang}wcf.acp.user.disableAvatar.expires{/lang}</label></dt>
+ <dd>
+ <input type="date" name="disableAvatarExpires" id="disableAvatarExpires" min="{TIME_NOW|date:'Y-m-d'}" {if $disableAvatarExpires} value="{$disableAvatarExpires|date:'Y-m-d'}"{/if} class="medium" />
+ <small>{lang}wcf.acp.user.disableAvatar.expires.description{/lang}</small>
+ </dd>
+ </dl>
+
+ {event name='disableAvatarFields'}
</fieldset>
<script data-relocate="true">
- //<![CDATA[
- $(function() {
- $('#disableAvatar').change(function (event) {
+ //<![CDATA[
+ $('#disableAvatar').change(function() {
if ($('#disableAvatar').is(':checked')) {
$('#disableAvatarReason').attr('readonly', false);
+ $('#disableAvatarNeverExpires, #disableAvatarExpires').enable();
+ $('#disableAvatarReason, #disableAvatarNeverExpires, #disableAvatarExpires').parents('dl').removeClass('disabled');
}
else {
$('#disableAvatarReason').attr('readonly', true);
+ $('#disableAvatarNeverExpires, #disableAvatarExpires').disable();
+ $('#disableAvatarReason, #disableAvatarNeverExpires, #disableAvatarExpires').parents('dl').addClass('disabled');
}
});
+
$('#disableAvatar').change();
- //]]>
+
+ $('#disableAvatarNeverExpires').change(function() {
+ if ($('#disableAvatarNeverExpires').is(':checked')) {
+ $('#disableAvatarExpiresSetting').hide();
+ }
+ else {
+ $('#disableAvatarExpiresSetting').show();
+ }
+ });
+
+ $('#disableAvatarNeverExpires').change();
+ //]]>
</script>
{/if}
});
//]]>
</script>
+
+ {event name='avatarFieldsets'}
</div>
{/if}
'wcf.acp.user.banReason': '{lang}wcf.acp.user.banReason{/lang}',
'wcf.acp.user.banReason.description': '{lang}wcf.acp.user.banReason.description{/lang}',
'wcf.acp.user.ban.sure': '{lang}wcf.acp.user.ban.sure{/lang}',
+ 'wcf.acp.user.ban.expires': '{lang}wcf.acp.user.ban.expires{/lang}',
+ 'wcf.acp.user.ban.expires.description': '{lang}wcf.acp.user.ban.expires.description{/lang}',
+ 'wcf.acp.user.ban.neverExpires': '{lang}wcf.acp.user.ban.neverExpires{/lang}',
'wcf.acp.user.sendNewPassword.workerTitle': '{lang}wcf.acp.user.sendNewPassword.workerTitle{/lang}',
'wcf.acp.worker.abort.confirmMessage': '{lang}wcf.acp.worker.abort.confirmMessage{/lang}'
});
* Handles inline editing of users.
*/
WCF.User.InlineEditor = WCF.InlineEditor.extend({
+ /**
+ * dialog object
+ * @var jQuery
+ */
+ _dialog: null,
+
/**
* list of permissions
* @var object
* @param string reason
*/
_executeReasonAction: function(userID, optionName, reason) {
+ var $optionName = this._dialog.data('optionName');
+
+ this._dialog.find('.innerError').remove();
+
+ var $banExpires = '';
+ if (!$('#' + $optionName + 'NeverExpires').is(':checked')) {
+ var $banExpires = $('#' + $optionName + 'ExpiresDatePicker').val();
+ if (!$banExpires) {
+ this._dialog.find('#' + $optionName + 'ExpiresSettings > dd > small').prepend($('<small class="innerError" />').text(WCF.Language.get('wcf.global.form.error.empty')));
+ return
+ }
+ }
+
var $parameters = { };
- $parameters[optionName + WCF.String.ucfirst('reason')] = reason;
+ $parameters[$optionName + 'Reason'] = $('#' + $optionName + 'Reason').val();
+ $parameters[$optionName + 'Expires'] = $banExpires;
this._proxy.setOption('data', {
- actionName: optionName,
+ actionName: $optionName,
className: 'wcf\\data\\user\\UserAction',
- objectIDs: [ userID ],
+ objectIDs: [ this._dialog.data('userID') ],
parameters: $parameters
});
this._proxy.sendRequest();
* @param string optionName
*/
_showReasonDialog: function(userID, optionName) {
- var $languageItem = 'wcf.user.' + optionName + '.reason.description';
- var $reasonDescription = WCF.Language.get($languageItem);
+ if (this._dialog) {
+ this._dialog.remove();
+ }
- WCF.System.Confirmation.show(WCF.Language.get('wcf.user.' + optionName + '.confirmMessage'), $.proxy(function(action) {
- if (action === 'confirm') {
- this._executeReasonAction(userID, optionName, $('#wcfSystemConfirmationContent').find('textarea').val());
- }
- }, this), { }, $('<fieldset><dl><dt>' + WCF.Language.get('wcf.global.reason') + '</dt><dd><textarea cols="40" rows="4" />' + ($reasonDescription != $languageItem ? '<small>' + $reasonDescription + '</small>' : '') + '</dd></dl></fieldset>'));
+ // create dialog
+ this._dialog = $('<div />').hide().appendTo(document.body);
+ this._dialog.append($('<fieldset><dl><dt><label for="' + optionName + 'Reason">' + WCF.Language.get('wcf.global.reason') + '</label></dt><dd><textarea id="' + optionName + 'Reason" cols="40" rows="3" />' + (WCF.Language.get('wcf.user.' + optionName + '.reason.description') != 'wcf.user.' + optionName + '.reason.description' ? '<small>' + WCF.Language.get('wcf.user.' + optionName + '.reason.description') + '</small>' : '') + '</dd></dl><dl><dt></dt><dd><label for="' + optionName + 'NeverExpires"><input type="checkbox" name="' + optionName + 'NeverExpires" id="' + optionName + 'NeverExpires" checked="checked" /> ' + WCF.Language.get('wcf.user.' + optionName + '.neverExpires') + '</label></dd></dl><dl id="' + optionName + 'ExpiresSettings" style="display: none;"><dt><label for="' + optionName + 'Expires">' + WCF.Language.get('wcf.user.' + optionName + '.expires') + '</label></dt><dd><input type="date" name="' + optionName + 'Expires" id="' + optionName + 'Expires" class="medium" min="' + new Date(TIME_NOW * 1000).toISOString() + '" data-ignore-timezone="true" /><small>' + WCF.Language.get('wcf.user.' + optionName + '.expires.description') + '</small></dd></dl></fieldset>'));
+ this._dialog.append($('<div class="formSubmit"><button class="buttonPrimary" accesskey="s">' + WCF.Language.get('wcf.global.button.submit') + '</button></div>'));
+
+ this._dialog.data('optionName', optionName).data('userID', userID);
+
+ this._dialog.find('#' + optionName + 'NeverExpires').change(function() {
+ $('#' + optionName + 'ExpiresSettings').toggle();
+ });
+
+ this._dialog.find('button').click($.proxy(this._executeReasonAction, this));
+
+ this._dialog.wcfDialog({
+ title: WCF.Language.get('wcf.user.' + optionName + '.confirmMessage')
+ });
},
/**
$element.data($property, $data.data[$property]);
}
}
+
+ if (data.actionName == 'ban' || data.actionName == 'disableAvatar' || data.actionName == 'disableSignature') {
+ this._dialog.wcfDialog('close');
+ }
},
/**
*/
public $disableSignatureReason = '';
+ /**
+ * date when the signature will be enabled again
+ * @var string
+ */
+ public $disableSignatureExpires = '';
+
/**
* @see \wcf\form\IForm::readFormParameters()
*/
if (WCF::getSession()->getPermission('admin.user.canDisableSignature')) {
if (isset($_POST['disableSignatureReason'])) $this->disableSignatureReason = StringUtil::trim($_POST['disableSignatureReason']);
if (!empty($_POST['disableSignature'])) $this->disableSignature = 1;
+ if ($this->disableSignature && !isset($_POST['disableSignatureNeverExpires'])) {
+ if (isset($_POST['disableSignatureExpires'])) $this->disableSignatureExpires = StringUtil::trim($_POST['disableSignatureExpires']);
+ }
+ else {
+ $this->disableSignatureExpires = '';
+ }
}
}
);
if (WCF::getSession()->getPermission('admin.user.canDisableSignature')) {
+ $disableSignatureExpires = 0;
+ if ($this->disableSignatureExpires) {
+ $disableSignatureExpires = strtotime($this->disableSignatureExpires);
+ }
+
$data['data']['disableSignature'] = $this->disableSignature;
$data['data']['disableSignatureReason'] = $this->disableSignatureReason;
+ $data['data']['disableSignatureExpires'] = $disableSignatureExpires;
}
$this->objectAction = new UserAction(array(), 'create', $data);
));
// reset values
- $this->username = $this->email = $this->confirmEmail = $this->password = $this->confirmPassword = '';
+ $this->signatureEnableHtml = $this->disableSignature = 0;
+ $this->signatureEnableSmilies = $this->signatureEnableBBCodes = 1;
+ $this->username = $this->email = $this->confirmEmail = $this->password = $this->confirmPassword = $this->userTitle = '';
+ $this->signature = $this->disableSignatureReason = $this->disableSignatureExpires = '';
$this->groupIDs = array();
$this->languageID = $this->getDefaultFormLanguageID();
$this->optionHandler->resetOptionValues();
'signatureEnableSmilies' => $this->signatureEnableSmilies,
'signatureEnableHtml' => $this->signatureEnableHtml,
'disableSignature' => $this->disableSignature,
- 'disableSignatureReason' => $this->disableSignatureReason
+ 'disableSignatureReason' => $this->disableSignatureReason,
+ 'disableSignatureExpires' => $this->disableSignatureExpires
));
}
*/
public $banReason = '';
+ /**
+ * date when the ban expires
+ * @var string
+ */
+ public $banExpires = '';
+
/**
* user avatar object
* @var \wcf\data\user\avatar\UserAvatar
*/
public $disableAvatarReason = '';
+ /**
+ * date when the avatar will be enabled again
+ * @var string
+ */
+ public $disableAvatarExpires = '';
+
/**
* @see \wcf\page\IPage::readParameters()
*/
if (!empty($_POST['banned'])) $this->banned = 1;
if (isset($_POST['banReason'])) $this->banReason = StringUtil::trim($_POST['banReason']);
+ if ($this->banned && !isset($_POST['banNeverExpires'])) {
+ if (isset($_POST['banExpires'])) $this->banExpires = StringUtil::trim($_POST['banExpires']);
+ }
+ else {
+ $this->banExpires = '';
+ }
+
if (isset($_POST['avatarType'])) $this->avatarType = $_POST['avatarType'];
if (WCF::getSession()->getPermission('admin.user.canDisableAvatar')) {
if (!empty($_POST['disableAvatar'])) $this->disableAvatar = 1;
if (isset($_POST['disableAvatarReason'])) $this->disableAvatarReason = StringUtil::trim($_POST['disableAvatarReason']);
+ if ($this->disableAvatar && !isset($_POST['disableAvatarNeverExpires'])) {
+ if (isset($_POST['disableAvatarExpires'])) $this->disableAvatarExpires = StringUtil::trim($_POST['disableAvatarExpires']);
+ }
+ else {
+ $this->disableAvatarExpires = '';
+ }
}
}
$this->languageID = $this->user->languageID;
$this->banned = $this->user->banned;
$this->banReason = $this->user->banReason;
+ $this->banExpires = $this->user->banExpires;
$this->userTitle = $this->user->userTitle;
$this->signature = $this->user->signature;
$this->signatureEnableHtml = $this->user->signatureEnableHtml;
$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;
if ($this->user->avatarID) $this->avatarType = 'custom';
else if (MODULE_GRAVATAR && $this->user->enableGravatar) $this->avatarType = 'gravatar';
'avatarType' => $this->avatarType,
'disableAvatar' => $this->disableAvatar,
'disableAvatarReason' => $this->disableAvatarReason,
- 'userAvatar' => $this->userAvatar
+ 'disableAvatarExpires' => $this->disableAvatarExpires,
+ 'userAvatar' => $this->userAvatar,
+ 'banExpires' => $this->banExpires
));
}
break;
}
- if (WCF::getSession()->getPermission('admin.user.canDisableAvatar')) {
- $avatarData['disableAvatar'] = $this->disableAvatar;
- $avatarData['disableAvatarReason'] = $this->disableAvatarReason;
- }
-
$this->additionalFields = array_merge($this->additionalFields, $avatarData);
// add default groups
// save user
$saveOptions = $this->optionHandler->save();
- $this->additionalFields['languageID'] = $this->languageID;
- if (WCF::getSession()->getPermission('admin.user.canBanUser')) {
- $this->additionalFields['banned'] = $this->banned;
- $this->additionalFields['banReason'] = $this->banReason;
- }
+
$data = array(
'data' => array_merge($this->additionalFields, array(
'username' => $this->username,
'email' => $this->email,
'password' => $this->password,
- 'banned' => $this->banned,
- 'banReason' => $this->banReason,
+ 'languageID' => $this->languageID,
'userTitle' => $this->userTitle,
'signature' => $this->signature,
'signatureEnableBBCodes' => $this->signatureEnableBBCodes,
'languageIDs' => $this->visibleLanguages,
'options' => $saveOptions
);
+
+ // handle ban
+ if (WCF::getSession()->getPermission('admin.user.canBanUser')) {
+ if ($this->banExpires) {
+ $this->banExpires = strtotime($this->banExpires);
+ }
+ else {
+ $this->banExpires = 0;
+ }
+
+ $data['data']['banned'] = $this->banned;
+ $data['data']['banReason'] = $this->banReason;
+ $data['data']['banExpires'] = $this->banExpires;
+ }
+ // handle disabled signature
if (WCF::getSession()->getPermission('admin.user.canDisableSignature')) {
+ if ($this->disableSignatureExpires) {
+ $this->disableSignatureExpires = strtotime($this->disableSignatureExpires);
+ }
+ else {
+ $this->disableSignatureExpires = 0;
+ }
+
$data['data']['disableSignature'] = $this->disableSignature;
$data['data']['disableSignatureReason'] = $this->disableSignatureReason;
+ $data['data']['disableSignatureExpires'] = $this->disableSignatureExpires;
+ }
+
+ // handle disabled avatar
+ if (WCF::getSession()->getPermission('admin.user.canDisableAvatar')) {
+ if ($this->disableAvatarExpires) {
+ $this->disableAvatarExpires = strtotime($this->disableAvatarExpires);
+ }
+ else {
+ $this->disableAvatarExpires = 0;
+ }
+
+ $data['data']['disableAvatar'] = $this->disableAvatar;
+ $data['data']['disableAvatarReason'] = $this->disableAvatarReason;
+ $data['data']['disableAvatarExpires'] = $this->disableAvatarExpires;
}
$this->objectAction = new UserAction(array($this->userID), 'update', $data);
* Validates the ban action.
*/
public function validateBan() {
- WCF::getSession()->checkPermissions(array('admin.user.canBanUser'));
+ $this->validateUnban();
- $this->__validateAccessibleGroups();
+ $this->readString('banReason', true);
+ $this->readString('banExpires', true);
}
/**
* Validates the unban action.
*/
public function validateUnban() {
- $this->validateBan();
+ WCF::getSession()->checkPermissions(array('admin.user.canBanUser'));
+
+ $this->__validateAccessibleGroups();
}
/**
* Bans users.
*/
public function ban() {
+ $banExpires = $this->parameters['banExpires'];
+ if ($banExpires) {
+ $banExpires = strtotime($banExpires);
+ }
+ else {
+ $banExpires = 0;
+ }
+
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('userID IN (?)', array($this->objectIDs));
+
$sql = "UPDATE wcf".WCF_N."_user
SET banned = ?,
- banReason = ?
+ banReason = ?,
+ banExpires = ?
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(
- array_merge(array(1, $this->parameters['banReason']), $conditionBuilder->getParameters())
+ array_merge(array(
+ 1,
+ $this->parameters['banReason'],
+ $banExpires
+ ), $conditionBuilder->getParameters())
);
$this->unmarkItems();
public function unban() {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('userID IN (?)', array($this->objectIDs));
+
$sql = "UPDATE wcf".WCF_N."_user
- SET banned = 0
+ SET banned = ?,
+ banExpires = ?
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditionBuilder->getParameters());
+ $statement->execute(
+ array_merge(array(
+ 0,
+ 0
+ ), $conditionBuilder->getParameters())
+ );
}
/**
$this->validateEnableSignature();
$this->readString('disableSignatureReason', true);
+ $this->readString('disableSignatureExpires', true);
}
/**
$this->readObjects();
}
+ $disableSignatureExpires = $this->parameters['disableSignatureExpires'];
+ if ($disableSignatureExpires) {
+ $disableSignatureExpires = strtotime($disableSignatureExpires);
+ }
+ else {
+ $disableSignatureExpires = 0;
+ }
+
foreach ($this->objects as $userEditor) {
$userEditor->update(array(
'disableSignature' => 1,
- 'disableSignatureReason' => $this->parameters['disableSignatureReason']
+ 'disableSignatureReason' => $this->parameters['disableSignatureReason'],
+ 'disableSignatureExpires' => $disableSignatureExpires
));
}
}
$this->validateEnableAvatar();
$this->readString('disableAvatarReason', true);
+ $this->readString('disableAvatarExpires', true);
}
/**
if (empty($this->objects)) {
$this->readObjects();
}
+
+ $disableAvatarExpires = $this->parameters['disableAvatarExpires'];
+ if ($disableAvatarExpires) {
+ $disableAvatarExpires = strtotime($disableAvatarExpires);
+ }
+ else {
+ $disableAvatarExpires = 0;
+ }
foreach ($this->objects as $userEditor) {
$userEditor->update(array(
'disableAvatar' => 1,
- 'disableAvatarReason' => $this->parameters['disableAvatarReason']
+ 'disableAvatarReason' => $this->parameters['disableAvatarReason'],
+ 'disableAvatarExpires' => $disableAvatarExpires
));
}
}
--- /dev/null
+<?php
+namespace wcf\system\cronjob;
+use wcf\data\cronjob\Cronjob;
+use wcf\system\WCF;
+
+/**
+ * Unbans users and enables disabled avatars and disabled signatures.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.cronjob
+ * @category Community Framework
+ */
+class UserBanCronjob extends AbstractCronjob {
+ /**
+ * @see \wcf\system\cronjob\ICronjob::execute()
+ */
+ public function execute(Cronjob $cronjob) {
+ parent::execute($cronjob);
+
+ // unban users
+ $sql = "UPDATE wcf".WCF_N."_user
+ SET banned = ?,
+ banExpires = ?
+ WHERE banned = ?
+ AND banExpires <= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ 0,
+ 0,
+ 1,
+ TIME_NOW
+ ));
+
+ // enable avatars
+ $sql = "UPDATE wcf".WCF_N."_user
+ SET disableAvatar = ?,
+ disableAvatarExpires = ?
+ WHERE disableAvatar = ?
+ AND disableAvatarExpires <= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ 0,
+ 0,
+ 1,
+ TIME_NOW
+ ));
+
+ // enable signatures
+ $sql = "UPDATE wcf".WCF_N."_user
+ SET disableSignature = ?,
+ disableSignatureExpires = ?
+ WHERE disableSignature = ?
+ AND disableSignatureExpires <= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ 0,
+ 0,
+ 1,
+ TIME_NOW
+ ));
+ }
+}
<item name="wcf.acp.user.banReason.description"><![CDATA[Die Begründung wird dem gesperrten Benutzer beim Aufruf der Seite angezeigt.]]></item>
<item name="wcf.acp.user.ban"><![CDATA[Sperren]]></item>
<item name="wcf.acp.user.unban"><![CDATA[Sperrung aufheben]]></item>
+ <item name="wcf.acp.user.ban.expires"><![CDATA[Entsperrung]]></item>
+ <item name="wcf.acp.user.ban.expires.description"><![CDATA[Der Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
+ <item name="wcf.acp.user.ban.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
<item name="wcf.acp.user.ban.sure"><![CDATA[Wollen Sie den/die Benutzer wirklich sperren?]]></item>
<item name="wcf.acp.user.delete.sure"><![CDATA[Wollen Sie Benutzer „{$user->username}“ wirklich löschen?]]></item>
<item name="wcf.acp.user.edit"><![CDATA[Benutzer bearbeiten]]></item>
<item name="wcf.acp.user.disableSignatureReason"><![CDATA[Begründung]]></item>
<item name="wcf.acp.user.disableAvatar"><![CDATA[Avatar sperren]]></item>
<item name="wcf.acp.user.disableAvatarReason"><![CDATA[Begründung]]></item>
+ <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.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>
<item name="wcf.acp.user.disable"><![CDATA[Deaktivieren]]></item>
<item name="wcf.acp.user.enable"><![CDATA[Aktivieren]]></item>
<item name="wcf.acp.user.quickSearch.disabled"><![CDATA[Nicht aktivierte Benutzer]]></item>
<item name="wcf.user.moderate"><![CDATA[Benutzer moderieren]]></item>
<item name="wcf.user.ban"><![CDATA[Benutzer sperren]]></item>
<item name="wcf.user.ban.confirmMessage"><![CDATA[Wollen Sie den Benutzer wirklich sperren?]]></item>
+ <item name="wcf.user.ban.expires"><![CDATA[Entsperrung]]></item>
+ <item name="wcf.user.ban.expires.description"><![CDATA[Der Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
+ <item name="wcf.user.ban.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
<item name="wcf.user.ban.reason.description"><![CDATA[Die Begründung wird dem gesperrten Benutzer beim Aufruf der Seite angezeigt.]]></item>
<item name="wcf.user.unban"><![CDATA[Benutzer entsperren]]></item>
<item name="wcf.user.disableAvatar"><![CDATA[Avatar sperren]]></item>
<item name="wcf.user.disableAvatar.confirmMessage"><![CDATA[Wollen Sie den Avatar des Benutzers wirklich sperren?]]></item>
+ <item name="wcf.user.disableAvatar.expires"><![CDATA[Entsperrung]]></item>
+ <item name="wcf.user.disableAvatar.expires.description"><![CDATA[Der Avatar des Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
+ <item name="wcf.user.disableAvatar.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
<item name="wcf.user.enableAvatar"><![CDATA[Avatar entsperren]]></item>
<item name="wcf.user.disableSignature"><![CDATA[Signatur sperren]]></item>
<item name="wcf.user.disableSignature.confirmMessage"><![CDATA[Wollen Sie die Signatur des Benutzers wirklich sperren?]]></item>
+ <item name="wcf.user.disableSignature.expires"><![CDATA[Entsperrung]]></item>
+ <item name="wcf.user.disableSignature.expires.description"><![CDATA[Die Signatur des Benutzer wird zum festgelegten Zeitpunkt automatisch entsperrt.]]></item>
+ <item name="wcf.user.disableSignature.neverExpires"><![CDATA[Dauerhafte Sperrung]]></item>
<item name="wcf.user.enableSignature"><![CDATA[Signatur entsperren]]></item>
<item name="wcf.user.edit"><![CDATA[Benutzer bearbeiten]]></item>
<item name="wcf.user.birthdayToday"><![CDATA[Hat heute Geburtstag]]></item>
<item name="wcf.acp.user.banUser.description"><![CDATA[The user is permanently banned from using any site functions and will be notified on site access.]]></item>
<item name="wcf.acp.user.banReason"><![CDATA[Reason]]></item>
<item name="wcf.acp.user.banReason.description"><![CDATA[The reason will be displayed for the affected users.]]></item>
+ <item name="wcf.acp.user.ban.expires"><![CDATA[Unbanning]]></item>
+ <item name="wcf.acp.user.ban.expires.description"><![CDATA[The user will be automatically unbanned at the entered point in time.]]></item>
+ <item name="wcf.acp.user.ban.neverExpires"><![CDATA[Permanent Ban]]></item>
<item name="wcf.acp.user.ban"><![CDATA[Ban]]></item>
<item name="wcf.acp.user.unban"><![CDATA[Unban]]></item>
<item name="wcf.acp.user.ban.sure"><![CDATA[Do you really want to ban this user?]]></item>
<item name="wcf.acp.user.disableSignatureReason"><![CDATA[Reason]]></item>
<item name="wcf.acp.user.disableAvatar"><![CDATA[Block avatar]]></item>
<item name="wcf.acp.user.disableAvatarReason"><![CDATA[Reason]]></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 be automatically unblocked at the entered point in time.]]></item>
+ <item name="wcf.acp.user.disableAvatar.neverExpires"><![CDATA[Permanent 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 be automatically unblocked at the entered point in time.]]></item>
+ <item name="wcf.acp.user.disableSignature.neverExpires"><![CDATA[Permanent Block]]></item>
<item name="wcf.acp.user.disable"><![CDATA[Disable]]></item>
<item name="wcf.acp.user.enable"><![CDATA[Approve]]></item>
<item name="wcf.acp.user.quickSearch.disabled"><![CDATA[Users awaiting approval]]></item>
<item name="wcf.user.moderate"><![CDATA[Moderate User]]></item>
<item name="wcf.user.ban"><![CDATA[Ban User]]></item>
<item name="wcf.user.ban.confirmMessage"><![CDATA[Do you really want to ban this user?]]></item>
+ <item name="wcf.user.ban.expires"><![CDATA[Unbanning]]></item>
+ <item name="wcf.user.ban.expires.description"><![CDATA[The user will be automatically unbanned at the entered point in time.]]></item>
+ <item name="wcf.user.ban.neverExpires"><![CDATA[Permanent Ban]]></item>
<item name="wcf.user.ban.reason.description"><![CDATA[The reason will be displayed for the user when visiting the site.]]></item>
<item name="wcf.user.unban"><![CDATA[Unban User]]></item>
<item name="wcf.user.disableAvatar"><![CDATA[Block Avatar]]></item>
<item name="wcf.user.disableAvatar.confirmMessage"><![CDATA[Do you really want to block the avatar of this user?]]></item>
+ <item name="wcf.user.disableAvatar.expires"><![CDATA[Unblocking]]></item>
+ <item name="wcf.user.disableAvatar.expires.description"><![CDATA[The avatar of the user will be automatically unblocked at the entered point in time.]]></item>
+ <item name="wcf.user.disableAvatar.neverExpires"><![CDATA[Permanent Block]]></item>
<item name="wcf.user.enableAvatar"><![CDATA[Unblock Avatar]]></item>
<item name="wcf.user.disableSignature"><![CDATA[Block Signature]]></item>
<item name="wcf.user.disableSignature.confirmMessage"><![CDATA[Do you really want to block the signature of this user?]]></item>
+ <item name="wcf.user.disableSignature.expires"><![CDATA[Unblocking]]></item>
+ <item name="wcf.user.disableSignature.expires.description"><![CDATA[The signature of the user will be automatically unblocked at the entered point in time.]]></item>
+ <item name="wcf.user.disableSignature.neverExpires"><![CDATA[Permanent Block]]></item>
<item name="wcf.user.enableSignature"><![CDATA[Unblock Signature]]></item>
<item name="wcf.user.edit"><![CDATA[Edit User]]></item>
<item name="wcf.user.birthdayToday"><![CDATA[It is their birthday]]></item>
styleID INT(10) NOT NULL DEFAULT 0,
banned TINYINT(1) NOT NULL DEFAULT 0,
banReason MEDIUMTEXT NULL,
+ banExpires INT(10) NOT NULL DEFAULT 0,
activationCode INT(10) NOT NULL DEFAULT 0,
lastLostPasswordRequestTime INT(10) NOT NULL DEFAULT 0,
lostPasswordKey VARCHAR(40) NOT NULL DEFAULT '',
avatarID INT(10),
disableAvatar TINYINT(1) NOT NULL DEFAULT 0,
disableAvatarReason TEXT,
+ disableAvatarExpires INT(10) NOT NULL DEFAULT 0,
enableGravatar TINYINT(1) NOT NULL DEFAULT 0,
signature TEXT,
signatureEnableBBCodes TINYINT(1) NOT NULL DEFAULT 1,
signatureEnableSmilies TINYINT(1) NOT NULL DEFAULT 1,
disableSignature TINYINT(1) NOT NULL DEFAULT 0,
disableSignatureReason TEXT,
+ disableSignatureExpires INT(10) NOT NULL DEFAULT 0,
lastActivityTime INT(10) NOT NULL DEFAULT 0,
profileHits INT(10) NOT NULL DEFAULT 0,
rankID INT(10),