From 0c81d883fa3c9f08b8cccdec0cfe7735000db8db Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 24 Nov 2006 23:48:22 +0000 Subject: [PATCH] Patch by Leon Weber that adds a hook 'UploadForm:initial' before the upload form is generated, and two member variable for text injection into the form, which can be filled by the hooks. --- RELEASE-NOTES | 3 ++- includes/SpecialUpload.php | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 34b9b25c31..94450e55f8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -217,7 +217,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Installer support for experimental MySQL 4.1/5.0 binary-safe schema * Use INSERT IGNORE for db-based BagOStuff add/insert, for more memcache-like behavior when keys already exist on add (instead of dying with an error...) - +* Add a hook 'UploadForm:initial' before the upload form is generated, and two + member variable for text injection into the form, which can be filled by the hooks. == Languages updated == diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 937d9fc1db..fc262e18ca 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -29,6 +29,12 @@ class UploadForm { var $mUploadCopyStatus, $mUploadSource, $mReUpload, $mAction, $mUpload; var $mOname, $mSessionKey, $mStashed, $mDestFile, $mRemoveTempFile, $mSourceType; var $mUploadTempFileSize = 0; + + # Placeholders for text injection by hooks (must be HTML) + # extensions should take care to _append_ to the present value + var $uploadFormTextTop; + var $uploadFormTextAfterSummary; + /**#@-*/ /** @@ -45,6 +51,10 @@ class UploadForm { return; } + # Placeholders for text injection by hooks (empty per default) + $this->uploadFormTextTop = ""; + $this->uploadFormTextAfterSummary = ""; + $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' ); $this->mReUpload = $request->getCheck( 'wpReUpload' ); $this->mUpload = $request->getCheck( 'wpUpload' ); @@ -691,6 +701,12 @@ class UploadForm { global $wgUseCopyrightUpload; global $wgRequest, $wgAllowCopyUploads; + if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) + { + wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" ); + return false; + } + $cols = intval($wgUser->getOption( 'cols' )); $ew = $wgUser->getOption( 'editwidth' ); if ( $ew ) $ew = " style=\"width:100%\""; @@ -751,6 +767,7 @@ class UploadForm {
+ {$this->uploadFormTextTop} " ); -- 2.20.1
{$filename_form} @@ -766,6 +783,7 @@ class UploadForm { + {$this->uploadFormTextAfterSummary}