Index: trunk/phase3/includes/specials/SpecialUploadStash.php |
— | — | @@ -16,15 +16,7 @@ |
17 | 17 | * @ingroup Upload |
18 | 18 | */ |
19 | 19 | |
20 | | -class SpecialUploadStash extends SpecialPage { |
21 | | - |
22 | | - static $HttpErrors = array( // FIXME: Use OutputPage::getStatusMessage() --RK |
23 | | - 400 => 'Bad Request', |
24 | | - 403 => 'Access Denied', |
25 | | - 404 => 'File not found', |
26 | | - 500 => 'Internal Server Error', |
27 | | - ); |
28 | | - |
| 20 | +class SpecialUploadStash extends UnlistedSpecialPage { |
29 | 21 | // UploadStash |
30 | 22 | private $stash; |
31 | 23 | |
— | — | @@ -35,7 +27,7 @@ |
36 | 28 | // $subpage is everything in the URL after Special:UploadStash |
37 | 29 | // FIXME: These parameters don't match SpecialPage::__construct()'s params at all, and are unused --RK |
38 | 30 | public function __construct( $request = null, $subpage = null ) { |
39 | | - parent::__construct( 'UploadStash', 'upload' ); |
| 31 | + parent::__construct( 'UploadStash', 'upload' ); |
40 | 32 | $this->stash = new UploadStash(); |
41 | 33 | } |
42 | 34 | |
— | — | @@ -44,7 +36,7 @@ |
45 | 37 | * n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward. |
46 | 38 | * |
47 | 39 | * @param {String} $subPage: subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part |
48 | | - * @return {Boolean} success |
| 40 | + * @return {Boolean} success |
49 | 41 | */ |
50 | 42 | public function execute( $subPage ) { |
51 | 43 | global $wgOut, $wgUser; |
— | — | @@ -73,7 +65,7 @@ |
74 | 66 | $code = 500; |
75 | 67 | } |
76 | 68 | |
77 | | - wfHttpError( $code, self::$HttpErrors[$code], $e->getCode(), $e->getMessage() ); |
| 69 | + wfHttpError( $code, OutputPage::getStatusMessage( $code ), $e->getMessage() ); |
78 | 70 | return false; |
79 | 71 | } |
80 | 72 | |
— | — | @@ -89,8 +81,8 @@ |
90 | 82 | // the stash key doesn't have an extension |
91 | 83 | $key = $subPage; |
92 | 84 | $n = strrpos( $subPage, '.' ); |
93 | | - if ( $n !== false ) { |
94 | | - $key = $n ? substr( $subPage, 0, $n ) : $subPage; |
| 85 | + if ( $n !== false ) { |
| 86 | + $key = $n ? substr( $subPage, 0, $n ) : $subPage; |
95 | 87 | } |
96 | 88 | |
97 | 89 | try { |
— | — | @@ -119,7 +111,7 @@ |
120 | 112 | } |
121 | 113 | $file = $thumbnailImage->thumbnailFile; |
122 | 114 | } |
123 | | - |
| 115 | + |
124 | 116 | return $file; |
125 | 117 | } |
126 | 118 | |
— | — | @@ -127,7 +119,7 @@ |
128 | 120 | * Output HTTP response for file |
129 | 121 | * Side effects, obviously, of echoing lots of stuff to stdout. |
130 | 122 | * @param {File} file |
131 | | - */ |
| 123 | + */ |
132 | 124 | private function outputFile( $file ) { |
133 | 125 | header( 'Content-Type: ' . $file->getMimeType(), true ); |
134 | 126 | header( 'Content-Transfer-Encoding: binary', true ); |
— | — | @@ -137,4 +129,3 @@ |
138 | 130 | readfile( $file->getPath() ); |
139 | 131 | } |
140 | 132 | } |
141 | | - |