return array( 'badipaddress' );
}
- if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 )
- || !self::parseExpiryInput( $data['Expiry'] )
+ $expiryTime = self::parseExpiryInput( $data['Expiry'] );
+
+ if (
+ // an expiry time is needed
+ ( strlen( $data['Expiry'] ) == 0 ) ||
+ // can't be a larger string as 50 (it should be a time format in any way)
+ ( strlen( $data['Expiry'] ) > 50 ) ||
+ // check, if the time could be parsed
+ !$expiryTime
) {
return array( 'ipb_expiry_invalid' );
}
+ // an expiry time should be in the future, not in the
+ // past (wouldn't make any sense) - bug T123069
+ if ( $expiryTime < wfTimestampNow() ) {
+ return array( 'ipb_expiry_old' );
+ }
+
if ( !isset( $data['DisableEmail'] ) ) {
$data['DisableEmail'] = false;
}
$block->setBlocker( $performer );
# Truncate reason for whole multibyte characters
$block->mReason = $wgContLang->truncate( $data['Reason'][0], 255 );
- $block->mExpiry = self::parseExpiryInput( $data['Expiry'] );
+ $block->mExpiry = $expiryTime;
$block->prevents( 'createaccount', $data['CreateAccount'] );
$block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );
$block->prevents( 'sendemail', $data['DisableEmail'] );
"block-log-flags-hiddenname": "username hidden",
"range_block_disabled": "The administrator ability to create range blocks is disabled.",
"ipb_expiry_invalid": "Expiry time invalid.",
+ "ipb_expiry_old": "Expiry time is in the past.",
"ipb_expiry_temp": "Hidden username blocks must be permanent.",
"ipb_hide_invalid": "Unable to suppress this account; it has more than {{PLURAL:$1|one edit|$1 edits}}.",
"ipb_already_blocked": "\"$1\" is already blocked.",
"block-log-flags-hiddenname": "Used as a block log flag in [[Special:Log/block]] and in [[Special:Block]].\n\n{{Related|Block-log-flags}}",
"range_block_disabled": "Used as error message in [[Special:Block]].\n\nSee also:\n* {{msg-mw|Range block disabled}}\n* {{msg-mw|Ip range invalid}}\n* {{msg-mw|Ip range toolarge}}",
"ipb_expiry_invalid": "Used as error message in [[Special:Block]].",
+ "ipb_expiry_old": "Used as error message in [[Special:Block]], if the expiry time is in the past.\n{{Identical|protect_expiry_old}}",
"ipb_expiry_temp": "Warning message displayed on [[Special:BlockIP]] if the option \"hide username\" is selected but the expiry time is not infinite.",
"ipb_hide_invalid": "Used as error message in [[Special:Block]].\n* $1 - Number of edits (Value of [[mw:Manual:$wgHideUserContribLimit]])",
"ipb_already_blocked": "{{Identical|$1 is already blocked}}",