Use WikiPage instead of Article
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 0bf52ec..906ac2c 100644 (file)
@@ -140,8 +140,6 @@ class SpecialUpload extends SpecialPage {
         * Special page entry point
         */
        public function execute( $par ) {
-               global $wgGroupPermissions;
-
                $this->setHeaders();
                $this->outputHeader();
 
@@ -154,19 +152,12 @@ class SpecialUpload extends SpecialPage {
                $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
@@ -266,7 +257,7 @@ class SpecialUpload extends SpecialPage {
                $delNotice = ''; // empty by default
                if ( $desiredTitleObj instanceof Title && !$desiredTitleObj->exists() ) {
                        LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ),
-                               $desiredTitleObj->getPrefixedText(),
+                               $desiredTitleObj,
                                '', array( 'lim' => 10,
                                           'conds' => array( "log_action != 'revision'" ),
                                           'showIfEmpty' => false,
@@ -300,10 +291,9 @@ class SpecialUpload extends SpecialPage {
                $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName );
                $user = $this->getUser();
                // Show a subtitle link to deleted revisions (to sysops et al only)
-               if( $title instanceof Title && $user->isAllowed( 'deletedhistory' ) && !$user->isBlocked() ) {
-                       $canViewSuppress = $user->isAllowed( 'suppressrevision' );
-                       $count = $title->isDeleted( $canViewSuppress );
-                       if ( $count > 0 ) {
+               if( $title instanceof Title ) {
+                       $count = $title->isDeleted();
+                       if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) {
                                $link = wfMsgExt(
                                        $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted',
                                        array( 'parse', 'replaceafter' ),
@@ -330,7 +320,7 @@ class SpecialUpload extends SpecialPage {
         */
        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 );
@@ -559,6 +549,9 @@ class SpecialUpload extends SpecialPage {
                                $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' ) );