From 98c968c7f7cb5279fb72353861126d8494fc8ad0 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 27 Feb 2010 14:52:53 +0000 Subject: [PATCH] * Allow string to be passed to showUploadForm to make porting old extensions easier * Add mUploadSuccessful so that subclasses know if the upload was successful --- includes/specials/SpecialUpload.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 81adb6a84b..85f2b1a577 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -45,6 +45,7 @@ class SpecialUpload extends SpecialPage { protected $mForReUpload; // The user followed an "overwrite this file" link protected $mCancelUpload; // The user clicked "Cancel and return to upload form" button protected $mTokenOk; + protected $mUploadSuccessful = false; // Subclasses can use this to determine whether a file was uploaded /** Text injection points for hooks not using HTMLForm **/ public $uploadFormTextTop; @@ -181,18 +182,23 @@ class SpecialUpload extends SpecialPage { } /** - * Show the main upload form and optionally add the session key to the - * output. This hides the source selection. + * Show the main upload form * - * @param string $message HTML message to be shown at top of form - * @param string $sessionKey Session key of the stashed upload + * @param mixed $form An HTMLForm instance or HTML string to show */ protected function showUploadForm( $form ) { # Add links if file was previously deleted - if ( !$this->mDesiredDestName ) + if ( !$this->mDesiredDestName ) { $this->showViewDeletedLinks(); - - $form->show(); + } + + if ( $form instanceof HTMLForm ) { + $form->show(); + } else { + global $wgOut; + $wgOut->addHTML( $form ); + } + } /** @@ -416,6 +422,7 @@ class SpecialUpload extends SpecialPage { } // Success, redirect to description page + $this->mUploadSuccessful = true; wfRunHooks( 'SpecialUploadComplete', array( &$this ) ); $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() ); -- 2.20.1