Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -94,17 +94,16 @@ |
95 | 95 | $wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext' ); |
96 | 96 | return; |
97 | 97 | } |
| 98 | + |
98 | 99 | # Check permissions |
99 | | - if( $this->mUpload ) { |
100 | | - $permission = $this->mUpload->isAllowed( $wgUser ); |
101 | | - } else { |
102 | | - $permission = $wgUser->isAllowed( 'upload' ) ? true : 'upload'; |
103 | | - } |
104 | | - if( $permission !== true ) { |
105 | | - if( !$wgUser->isLoggedIn() ) { |
| 100 | + global $wgGroupPermissions; |
| 101 | + if( !$wgUser->isAllowed( 'upload' ) ) { |
| 102 | + if( !$wgUser->isLoggedIn() && ( $wgGroupPermissions['user']['upload'] |
| 103 | + || $wgGroupPermissions['autoconfirmed']['upload'] ) ) { |
| 104 | + // Custom message if logged-in users without any special rights can upload |
106 | 105 | $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); |
107 | 106 | } else { |
108 | | - $wgOut->permissionRequired( $permission ); |
| 107 | + $wgOut->permissionRequired( 'upload' ); |
109 | 108 | } |
110 | 109 | return; |
111 | 110 | } |
— | — | @@ -121,10 +120,7 @@ |
122 | 121 | } |
123 | 122 | //check token if uploading or reUploading |
124 | 123 | if( !$this->mTokenOk && !$this->mReUpload && ($this->mUpload && ( |
125 | | - 'submit' == $this->mAction || |
126 | | - $this->mUploadClicked |
127 | | - ) |
128 | | - ) |
| 124 | + 'submit' == $this->mAction || $this->mUploadClicked ) ) |
129 | 125 | ){ |
130 | 126 | $this->mainUploadForm ( wfMsg( 'session_fail_preview' ) ); |
131 | 127 | return ; |
— | — | @@ -320,6 +316,10 @@ |
321 | 317 | */ |
322 | 318 | static function getExistsWarning( $exists ) { |
323 | 319 | global $wgUser, $wgContLang; |
| 320 | + // Check for uppercase extension. We allow these filenames but check if an image |
| 321 | + // with lowercase extension exists already |
| 322 | + $warning = ''; |
| 323 | + $align = $wgContLang->isRtl() ? 'left' : 'right'; |
324 | 324 | |
325 | 325 | if( $exists === false ) |
326 | 326 | return ''; |
— | — | @@ -333,7 +333,7 @@ |
334 | 334 | |
335 | 335 | if( $existsType == 'exists' ) { |
336 | 336 | // Exact match |
337 | | - $dlink = $sk->makeKnownLinkObj( $file->getTitle() ); |
| 337 | + $dlink = $sk->linkKnown( $file->getTitle() ); |
338 | 338 | if ( $file->allowInlineDisplay() ) { |
339 | 339 | $dlink2 = $sk->makeImageLinkObj( $file->getTitle(), wfMsgExt( 'fileexists-thumb', 'parseinline' ), |
340 | 340 | $file->getName(), $align, array(), false, true ); |
— | — | @@ -348,7 +348,7 @@ |
349 | 349 | $warning .= '<li>' . wfMsgExt( 'fileexists', array('parseinline','replaceafter'), $dlink ) . '</li>' . $dlink2; |
350 | 350 | |
351 | 351 | } elseif( $existsType == 'page-exists' ) { |
352 | | - $lnk = $sk->makeKnownLinkObj( $file->getTitle(), '', 'redirect=no' ); |
| 352 | + $lnk = $sk->linkKnown( $file->getTitle(), '', 'redirect=no' ); |
353 | 353 | $warning .= '<li>' . wfMsgExt( 'filepageexists', array( 'parseinline', 'replaceafter' ), $lnk ) . '</li>'; |
354 | 354 | } elseif ( $existsType == 'exists-normalized' ) { |
355 | 355 | # Check if image with lowercase extension exists. |
— | — | @@ -654,14 +654,14 @@ |
655 | 655 | return false; |
656 | 656 | } |
657 | 657 | |
658 | | - if( $this->mDesiredDestName ) { |
| 658 | + if( $this->mDesiredDestName != '' ) { |
659 | 659 | $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName ); |
660 | 660 | // Show a subtitle link to deleted revisions (to sysops et al only) |
661 | 661 | if( $title instanceof Title && ( $count = $title->isDeleted() ) > 0 && $wgUser->isAllowed( 'deletedhistory' ) ) { |
662 | 662 | $link = wfMsgExt( |
663 | 663 | $wgUser->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted', |
664 | 664 | array( 'parse', 'replaceafter' ), |
665 | | - $wgUser->getSkin()->makeKnownLinkObj( |
| 665 | + $wgUser->getSkin()->linkKnown( |
666 | 666 | SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ), |
667 | 667 | wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $count ) |
668 | 668 | ) |
— | — | @@ -700,21 +700,20 @@ |
701 | 701 | |
702 | 702 | $allowedExtensions = ''; |
703 | 703 | if( $wgCheckFileExtensions ) { |
704 | | - $delim = wfMsgExt( 'comma-separator', array( 'escapenoentities' ) ); |
705 | 704 | if( $wgStrictFileExtensions ) { |
706 | 705 | # Everything not permitted is banned |
707 | 706 | $extensionsList = |
708 | 707 | '<div id="mw-upload-permitted">' . |
709 | | - wfMsgWikiHtml( 'upload-permitted', implode( $wgFileExtensions, $delim ) ) . |
| 708 | + wfMsgWikiHtml( 'upload-permitted', $wgLang->commaList( $wgFileExtensions ) ) . |
710 | 709 | "</div>\n"; |
711 | 710 | } else { |
712 | 711 | # We have to list both preferred and prohibited |
713 | 712 | $extensionsList = |
714 | 713 | '<div id="mw-upload-preferred">' . |
715 | | - wfMsgWikiHtml( 'upload-preferred', implode( $wgFileExtensions, $delim ) ) . |
| 714 | + wfMsgWikiHtml( 'upload-preferred', $wgLang->commaList( $wgFileExtensions ) ) . |
716 | 715 | "</div>\n" . |
717 | 716 | '<div id="mw-upload-prohibited">' . |
718 | | - wfMsgWikiHtml( 'upload-prohibited', implode( $wgFileBlacklist, $delim ) ) . |
| 717 | + wfMsgWikiHtml( 'upload-prohibited', $wgLang->commaList( $wgFileExtensions ) ) . |
719 | 718 | "</div>\n"; |
720 | 719 | } |
721 | 720 | } else { |