* Special page entry point
*/
public function execute( $par ) {
- global $wgGroupPermissions;
-
$this->setHeaders();
$this->outputHeader();
$user = $this->getUser();
$permissionRequired = UploadBase::isAllowed( $user );
if( $permissionRequired !== true ) {
- if( !$user->isLoggedIn() && ( $wgGroupPermissions['user']['upload']
- || $wgGroupPermissions['autoconfirmed']['upload'] ) ) {
- // Custom message if logged-in users without any special rights can upload
- throw new ErrorPageError( 'uploadnologin', 'uploadnologintext' );
- } else {
- throw new PermissionsError( $permissionRequired );
- }
+ throw new PermissionsError( $permissionRequired );
}
# Check blocks
if( $user->isBlocked() ) {
- $this->getOutput()->blockedPage();
- return;
+ throw new UserBlockedError( $user->mBlock );
}
# Check whether we actually want to allow changing stuff
- if( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
+ $this->checkReadOnly();
$this->loadRequest();
*/
protected function showRecoverableUploadError( $message ) {
$sessionKey = $this->mUpload->stashSession();
- $message = '<h2>' . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" .
+ $message = '<h2>' . wfMsgHtml( 'uploaderror' ) . "</h2>\n" .
'<div class="error">' . $message . "</div>\n";
$form = $this->getUploadForm( $message, $sessionKey );
$this->showRecoverableUploadError( wfMsgExt( 'illegalfilename',
'parseinline', $details['filtered'] ) );
break;
+ case UploadBase::FILENAME_TOO_LONG:
+ $this->showRecoverableUploadError( wfMsgHtml( 'filename-toolong' ) );
+ break;
case UploadBase::FILETYPE_MISSING:
$this->showRecoverableUploadError( wfMsgExt( 'filetype-missing',
'parseinline' ) );
case UploadBase::FILETYPE_BADTYPE:
$msg = wfMessage( 'filetype-banned-type' );
if ( isset( $details['blacklistedExt'] ) ) {
- $msg->params( $this->getLang()->commaList( $details['blacklistedExt'] ) );
+ $msg->params( $this->getLanguage()->commaList( $details['blacklistedExt'] ) );
} else {
$msg->params( $details['finalExt'] );
}
- $msg->params( $this->getLang()->commaList( $wgFileExtensions ),
+ $msg->params( $this->getLanguage()->commaList( $wgFileExtensions ),
count( $wgFileExtensions ) );
// Add PLURAL support for the first parameter. This results
'radio' => &$radio,
'help' => wfMsgExt( 'upload-maxfilesize',
array( 'parseinline', 'escapenoentities' ),
- $this->getContext()->getLang()->formatSize( $this->mMaxUploadSize['file'] )
+ $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )
) . ' ' . wfMsgHtml( 'upload_source_file' ),
'checked' => $selectedSourceType == 'file',
);
'radio' => &$radio,
'help' => wfMsgExt( 'upload-maxfilesize',
array( 'parseinline', 'escapenoentities' ),
- $this->getContext()->getLang()->formatSize( $this->mMaxUploadSize['url'] )
+ $this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['url'] )
) . ' ' . wfMsgHtml( 'upload_source_url' ),
'checked' => $selectedSourceType == 'url',
);
# Everything not permitted is banned
$extensionsList =
'<div id="mw-upload-permitted">' .
- wfMsgExt( 'upload-permitted', 'parse', $this->getContext()->getLang()->commaList( $wgFileExtensions ) ) .
+ wfMsgExt( 'upload-permitted', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) .
"</div>\n";
} else {
# We have to list both preferred and prohibited
$extensionsList =
'<div id="mw-upload-preferred">' .
- wfMsgExt( 'upload-preferred', 'parse', $this->getContext()->getLang()->commaList( $wgFileExtensions ) ) .
+ wfMsgExt( 'upload-preferred', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) .
"</div>\n" .
'<div id="mw-upload-prohibited">' .
- wfMsgExt( 'upload-prohibited', 'parse', $this->getContext()->getLang()->commaList( $wgFileBlacklist ) ) .
+ wfMsgExt( 'upload-prohibited', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileBlacklist ) ) .
"</div>\n";
}
} else {