"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "includes/htmlform/fields/HTMLUserTextField.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

HTMLUserTextField.php  (mediawiki-1.31.1):HTMLUserTextField.php  (mediawiki-1.32.0)
skipping to change at line 37 skipping to change at line 37
'IPv4' => '16', 'IPv4' => '16',
'IPv6' => '32', 'IPv6' => '32',
], ],
] ]
); );
parent::__construct( $params ); parent::__construct( $params );
} }
public function validate( $value, $alldata ) { public function validate( $value, $alldata ) {
// Default value (from getDefault()) is null, User::newFromName()
expects a string
if ( $value === null ) {
$value = '';
}
// check, if a user exists with the given username // check, if a user exists with the given username
$user = User::newFromName( $value, false ); $user = User::newFromName( $value, false );
$rangeError = null; $rangeError = null;
if ( !$user ) { if ( !$user ) {
return $this->msg( 'htmlform-user-not-valid', $value ); return $this->msg( 'htmlform-user-not-valid', $value );
} elseif ( } elseif (
// check, if the user exists, if requested // check, if the user exists, if requested
( $this->mParams['exists'] && $user->getId() === 0 ) && ( $this->mParams['exists'] && $user->getId() === 0 ) &&
// check, if the username is a valid IP address, otherwei se save the error message // check, if the username is a valid IP address, otherwis e save the error message
!( $this->mParams['ipallowed'] && IP::isValid( $value ) ) && !( $this->mParams['ipallowed'] && IP::isValid( $value ) ) &&
// check, if the username is a valid IP range, otherwise save the error message // check, if the username is a valid IP range, otherwise save the error message
!( $this->mParams['iprange'] && ( $rangeError = $this->is ValidIPRange( $value ) ) === true ) !( $this->mParams['iprange'] && ( $rangeError = $this->is ValidIPRange( $value ) ) === true )
) { ) {
if ( is_string( $rangeError ) ) { if ( is_string( $rangeError ) ) {
return $rangeError; return $rangeError;
} }
return $this->msg( 'htmlform-user-not-exists', $user->get Name() ); return $this->msg( 'htmlform-user-not-exists', $user->get Name() );
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)