Use local context instead of global variables
[lhc/web/wiklou.git] / includes / specials / SpecialUploadStash.php
index cc47af4..9dd78ef 100644 (file)
@@ -46,9 +46,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
         * @return Boolean: success
         */
        public function execute( $subPage ) {
-               global $wgUser;
-
-               if ( !$this->userCanExecute( $wgUser ) ) {
+               if ( !$this->userCanExecute( $this->getUser() ) ) {
                        $this->displayRestrictionError();
                        return;
                }
@@ -95,8 +93,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                        $message = $e->getMessage();
                }
 
-               wfHttpError( $code, HttpStatus::getMessage( $code ), $message );
-               return false;
+               throw new HttpError( $code, $message );
        }
 
        /**
@@ -214,7 +211,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                        // this is apparently a protocol-relative URL, which makes no sense in this context,
                        // since this is used for communication that's internal to the application.
                        // default to http.
-                       $scalerBaseUrl = 'http:' . $scalerBaseUrl;
+                       $scalerBaseUrl = wfExpandUrl( $scalerBaseUrl, PROTO_CANONICAL );
                }
 
                // We need to use generateThumbName() instead of thumbName(), because