http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76386
Revision: 76386 Author: ialex Date: 2010-11-09 12:56:05 +0000 (Tue, 09 Nov 2010) Log Message: ----------- * Marked Special:UploadStash unlisted since accessing it only subpage param only returns a 403 (and also resolves bug 25813) * Use OutputPage::getStatusMessage() instead of duplicating the list * Removed trailing whitespaces Modified Paths: -------------- trunk/phase3/includes/specials/SpecialUploadStash.php Modified: trunk/phase3/includes/specials/SpecialUploadStash.php =================================================================== --- trunk/phase3/includes/specials/SpecialUploadStash.php 2010-11-09 12:25:57 UTC (rev 76385) +++ trunk/phase3/includes/specials/SpecialUploadStash.php 2010-11-09 12:56:05 UTC (rev 76386) @@ -16,15 +16,7 @@ * @ingroup Upload */ -class SpecialUploadStash extends SpecialPage { - - static $HttpErrors = array( // FIXME: Use OutputPage::getStatusMessage() --RK - 400 => 'Bad Request', - 403 => 'Access Denied', - 404 => 'File not found', - 500 => 'Internal Server Error', - ); - +class SpecialUploadStash extends UnlistedSpecialPage { // UploadStash private $stash; @@ -35,7 +27,7 @@ // $subpage is everything in the URL after Special:UploadStash // FIXME: These parameters don't match SpecialPage::__construct()'s params at all, and are unused --RK public function __construct( $request = null, $subpage = null ) { - parent::__construct( 'UploadStash', 'upload' ); + parent::__construct( 'UploadStash', 'upload' ); $this->stash = new UploadStash(); } @@ -44,7 +36,7 @@ * n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward. * * @param {String} $subPage: subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part - * @return {Boolean} success + * @return {Boolean} success */ public function execute( $subPage ) { global $wgOut, $wgUser; @@ -73,7 +65,7 @@ $code = 500; } - wfHttpError( $code, self::$HttpErrors[$code], $e->getCode(), $e->getMessage() ); + wfHttpError( $code, OutputPage::getStatusMessage( $code ), $e->getMessage() ); return false; } @@ -89,8 +81,8 @@ // the stash key doesn't have an extension $key = $subPage; $n = strrpos( $subPage, '.' ); - if ( $n !== false ) { - $key = $n ? substr( $subPage, 0, $n ) : $subPage; + if ( $n !== false ) { + $key = $n ? substr( $subPage, 0, $n ) : $subPage; } try { @@ -119,7 +111,7 @@ } $file = $thumbnailImage->thumbnailFile; } - + return $file; } @@ -127,7 +119,7 @@ * Output HTTP response for file * Side effects, obviously, of echoing lots of stuff to stdout. * @param {File} file - */ + */ private function outputFile( $file ) { header( 'Content-Type: ' . $file->getMimeType(), true ); header( 'Content-Transfer-Encoding: binary', true ); @@ -137,4 +129,3 @@ readfile( $file->getPath() ); } } - _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs