* created by MediaWiki rather than being stored
* in the database. Value is a string to return
* from self::getSystemBlockType().
+ * sitewide bool Disallow editing all pages and all contribution
+ * actions, except those specifically allowed by
+ * other block flags
*
* @since 1.26 accepts $options array instead of individual parameters; order
* of parameters above reflects the original order
'sitewide' => true,
];
- if ( func_num_args() > 1 || !is_array( $options ) ) {
- $options = array_combine(
- array_slice( array_keys( $defaults ), 0, func_num_args() ),
- func_get_args()
- );
- wfDeprecated( __METHOD__ . ' with multiple arguments', '1.26' );
- }
-
$options += $defaults;
$this->setTarget( $options['address'] );
*/
public function getRedactedName() {
if ( $this->mAuto ) {
- return Html::rawElement(
+ return Html::element(
'span',
[ 'class' => 'mw-autoblockid' ],
- wfMessage( 'autoblockid', $this->mId )
+ wfMessage( 'autoblockid', $this->mId )->text()
);
} else {
return htmlspecialchars( $this->getTarget() );
* they can never edit it. (Ideally the flag would be stored as
* null in these cases, but the database field isn't nullable.)
*
+ * This method does not validate that the passed in talk page belongs to the
+ * block target since the target (an IP) might not be the same as the user's
+ * talk page (if they are logged in).
+ *
* @since 1.33
* @param Title|null $usertalk The user's user talk page. If null,
* and if the target is a User, the target's userpage is used
* @return bool The user can edit their talk page
*/
public function appliesToUsertalk( Title $usertalk = null ) {
- $target = $this->target;
- $targetIsUser = $target instanceof User;
- $targetName = $targetIsUser ? $target->getName() : $target;
-
if ( !$usertalk ) {
- if ( $targetIsUser ) {
+ if ( $this->target instanceof User ) {
$usertalk = $this->target->getTalkPage();
} else {
throw new InvalidArgumentException(
);
}
- switch ( $this->type ) {
- case self::TYPE_USER:
- case self::TYPE_IP:
- if ( $usertalk->getText() !== $targetName ) {
- throw new InvalidArgumentException(
- '$usertalk must be a talk page for the block target'
- );
- }
- break;
- case self::TYPE_RANGE:
- if ( !IP::isInRange( $usertalk->getText(), $target ) ) {
- throw new InvalidArgumentException(
- '$usertalk must be a talk page for an IP within the block target range'
- );
- }
- break;
- default:
- throw new LogicException(
- 'Cannot determine validity of $usertalk for this type of block'
- );
- }
-
if ( !$this->isSitewide() ) {
if ( $this->appliesToPage( $usertalk->getArticleID() ) ) {
return true;