From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/specials/SpecialUpload.php | 98 ++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 46 deletions(-) (limited to 'includes/specials/SpecialUpload.php') diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 43ea345b..89c06b2a 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -39,7 +39,7 @@ class SpecialUpload extends SpecialPage { } /** Misc variables **/ - public $mRequest; // The WebRequest or FauxRequest this form is supposed to handle + public $mRequest; // The WebRequest or FauxRequest this form is supposed to handle public $mSourceType; /** @@ -54,7 +54,7 @@ class SpecialUpload extends SpecialPage { public $mUploadClicked; /** User input variables from the "description" section **/ - public $mDesiredDestName; // The requested target file name + public $mDesiredDestName; // The requested target file name public $mComment; public $mLicense; @@ -66,10 +66,10 @@ class SpecialUpload extends SpecialPage { /** Hidden variables **/ public $mDestWarningAck; - public $mForReUpload; // The user followed an "overwrite this file" link - public $mCancelUpload; // The user clicked "Cancel and return to upload form" button + public $mForReUpload; // The user followed an "overwrite this file" link + public $mCancelUpload; // The user clicked "Cancel and return to upload form" button public $mTokenOk; - public $mUploadSuccessful = false; // Subclasses can use this to determine whether a file was uploaded + public $mUploadSuccessful = false; // Subclasses can use this to determine whether a file was uploaded /** Text injection points for hooks not using HTMLForm **/ public $uploadFormTextTop; @@ -82,32 +82,30 @@ class SpecialUpload extends SpecialPage { */ protected function loadRequest() { $this->mRequest = $request = $this->getRequest(); - $this->mSourceType = $request->getVal( 'wpSourceType', 'file' ); - $this->mUpload = UploadBase::createFromRequest( $request ); - $this->mUploadClicked = $request->wasPosted() + $this->mSourceType = $request->getVal( 'wpSourceType', 'file' ); + $this->mUpload = UploadBase::createFromRequest( $request ); + $this->mUploadClicked = $request->wasPosted() && ( $request->getCheck( 'wpUpload' ) || $request->getCheck( 'wpUploadIgnoreWarning' ) ); // Guess the desired name from the filename if not provided - $this->mDesiredDestName = $request->getText( 'wpDestFile' ); + $this->mDesiredDestName = $request->getText( 'wpDestFile' ); if( !$this->mDesiredDestName && $request->getFileName( 'wpUploadFile' ) !== null ) { $this->mDesiredDestName = $request->getFileName( 'wpUploadFile' ); } - $this->mComment = $request->getText( 'wpUploadDescription' ); - $this->mLicense = $request->getText( 'wpLicense' ); + $this->mComment = $request->getText( 'wpUploadDescription' ); + $this->mLicense = $request->getText( 'wpLicense' ); - - $this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' ); - $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' ) + $this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' ); + $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' ) || $request->getCheck( 'wpUploadIgnoreWarning' ); - $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $this->getUser()->isLoggedIn(); - $this->mCopyrightStatus = $request->getText( 'wpUploadCopyStatus' ); - $this->mCopyrightSource = $request->getText( 'wpUploadSource' ); - + $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $this->getUser()->isLoggedIn(); + $this->mCopyrightStatus = $request->getText( 'wpUploadCopyStatus' ); + $this->mCopyrightSource = $request->getText( 'wpUploadSource' ); - $this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file - $this->mCancelUpload = $request->getCheck( 'wpCancelUpload' ) - || $request->getCheck( 'wpReUpload' ); // b/w compat + $this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file + $this->mCancelUpload = $request->getCheck( 'wpCancelUpload' ) + || $request->getCheck( 'wpReUpload' ); // b/w compat // If it was posted check for the token (no remote POST'ing with user credentials) $token = $request->getVal( 'wpEditToken' ); @@ -209,8 +207,8 @@ class SpecialUpload extends SpecialPage { /** * Get an UploadForm instance with title and text properly set. * - * @param $message String: HTML string to add to the form - * @param $sessionKey String: session key in case this is a stashed upload + * @param string $message HTML string to add to the form + * @param string $sessionKey session key in case this is a stashed upload * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box * @return UploadForm */ @@ -246,9 +244,9 @@ class SpecialUpload extends SpecialPage { LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ), $desiredTitleObj, '', array( 'lim' => 10, - 'conds' => array( "log_action != 'revision'" ), - 'showIfEmpty' => false, - 'msgKey' => array( 'upload-recreate-warning' ) ) + 'conds' => array( "log_action != 'revision'" ), + 'showIfEmpty' => false, + 'msgKey' => array( 'upload-recreate-warning' ) ) ); } $form->addPreText( $delNotice ); @@ -300,7 +298,7 @@ class SpecialUpload extends SpecialPage { * essentially means that UploadBase::VERIFICATION_ERROR and * UploadBase::EMPTY_FILE should not be passed here. * - * @param $message String: HTML message to be passed to mainUploadForm + * @param string $message HTML message to be passed to mainUploadForm */ protected function showRecoverableUploadError( $message ) { $sessionKey = $this->mUpload->stashSession(); @@ -312,12 +310,12 @@ class SpecialUpload extends SpecialPage { $this->showUploadForm( $form ); } /** - * Stashes the upload, shows the main form, but adds an "continue anyway button". + * Stashes the upload, shows the main form, but adds a "continue anyway button". * Also checks whether there are actually warnings to display. * * @param $warnings Array * @return boolean true if warnings were displayed, false if there are no - * warnings and the should continue processing like there was no warning + * warnings and it should continue processing */ protected function showUploadWarning( $warnings ) { # If there are no warnings, or warnings we can ignore, return early. @@ -336,6 +334,9 @@ class SpecialUpload extends SpecialPage { $warningHtml = '

' . $this->msg( 'uploadwarning' )->escaped() . "

\n" . '