SpecialUpload Class Reference

Inherits SpecialPage.

List of all members.

Public Member Functions

 __construct ($request=null)
 Constructor : initialise object Get data POSTed through the form and assign them to the object.
 userCanExecute ($user)
 This page can be shown if uploading is enabled.
 execute ($par)
 Special page entry point.

Static Public Member Functions

static getInitialPageText ($comment= '', $license= '', $copyStatus= '', $source= '')
 Get the initial image page text based on a comment and optional file status information.
static getExistsWarning ($exists)
 Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upload via AJAX.
static ajaxGetExistsWarning ($filename)
 Get a list of warnings.
static getDupeWarning ($dupes)
 Construct a warning and a gallery from an array of duplicate files.

Public Attributes

 $mRequest
 Misc variables.
 $mSourceType
 $mUpload
 $mLocalFile
 $mUploadClicked
 $mDesiredDestName
 User input variables from the "description" section.
 $mComment
 $mLicense
 $mIgnoreWarning
 User input variables from the root section.
 $mWatchThis
 $mCopyrightStatus
 $mCopyrightSource
 $mDestWarningAck
 Hidden variables.
 $mForReUpload
 $mCancelUpload
 $mTokenOk
 $mUploadSuccessful = false
 $uploadFormTextTop
 Text injection points for hooks not using HTMLForm.
 $uploadFormTextAfterSummary

Protected Member Functions

 loadRequest ($request)
 Initialize instance variables from request and create an Upload handler.
 showUploadForm ($form)
 Show the main upload form.
 getUploadForm ($message= '', $sessionKey= '', $hideIgnoreWarning=false)
 Get an UploadForm instance with title and text properly set.
 showViewDeletedLinks ()
 Shows the "view X deleted revivions link"".
 showRecoverableUploadError ($message)
 Stashes the upload and shows the main upload form.
 showUploadWarning ($warnings)
 Stashes the upload, shows the main form, but adds an "continue anyway button".
 showUploadError ($message)
 Show the upload form with error message, but do not stash the file.
 processUpload ()
 Do the upload.
 getWatchCheck ()
 See if we should check the 'watch this page' checkbox on the form based on the user's preferences and whether we're being asked to create a new file or update an existing one.
 processVerificationError ($details)
 Provides output to the user for a result of UploadBase::verifyUpload.
 unsaveUploadedFile ()
 Remove a temporarily kept file stashed by saveTempUploadedFile().


Detailed Description

Definition at line 11 of file SpecialUpload.php.


Constructor & Destructor Documentation

SpecialUpload::__construct ( request = null  ) 

Constructor : initialise object Get data POSTed through the form and assign them to the object.

Parameters:
WebRequest $request Data posted.

Definition at line 17 of file SpecialUpload.php.

References $wgRequest, and loadRequest().


Member Function Documentation

static SpecialUpload::ajaxGetExistsWarning ( filename  )  [static]

Get a list of warnings.

Parameters:
string local filename, e.g. 'file exists', 'non-descriptive filename'
Returns:
array list of warning messages

Definition at line 644 of file SpecialUpload.php.

References $filename, $s, getExistsWarning(), wfFindFile(), and wfLocalFile().

SpecialUpload::execute ( par  ) 

static SpecialUpload::getDupeWarning ( dupes  )  [static]

Construct a warning and a gallery from an array of duplicate files.

Definition at line 665 of file SpecialUpload.php.

References $msg, $title, $wgOut, and wfMsgExt().

Referenced by showUploadWarning().

static SpecialUpload::getExistsWarning ( exists  )  [static]

Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upload via AJAX.

Parameters:
array $exists The result of UploadBase::getExistsWarning
Returns:
string Empty string if there is no warning or an HTML fragment

Definition at line 588 of file SpecialUpload.php.

References $filename, $name, $wgContLang, $wgUser, SpecialPage::getTitle(), SpecialPage::getTitleFor(), wfMsgExt(), wfMsgHtml(), and wfMsgWikiHtml().

Referenced by ajaxGetExistsWarning(), and showUploadWarning().

static SpecialUpload::getInitialPageText ( comment = '',
license = '',
copyStatus = '',
source = '' 
) [static]

Get the initial image page text based on a comment and optional file status information.

Definition at line 442 of file SpecialUpload.php.

References $wgUseCopyrightUpload, and wfMsgForContent().

Referenced by processUpload(), and LocalFile::recordUpload().

SpecialUpload::getUploadForm ( message = '',
sessionKey = '',
hideIgnoreWarning = false 
) [protected]

Get an UploadForm instance with title and text properly set.

Parameters:
string $message HTML string to add to the form
string $sessionKey Session key in case this is a stashed upload
Returns:
UploadForm

Definition at line 211 of file SpecialUpload.php.

References $wgOut, SpecialPage::getTitle(), getWatchCheck(), wfEmptyMsg(), wfMsgExt(), and wfMsgNoTrans().

Referenced by execute(), processUpload(), processVerificationError(), showRecoverableUploadError(), showUploadError(), and showUploadWarning().

SpecialUpload::getWatchCheck (  )  [protected]

See if we should check the 'watch this page' checkbox on the form based on the user's preferences and whether we're being asked to create a new file or update an existing one.

In the case where 'watch edits' is off but 'watch creations' is on, we'll leave the box unchecked.

Note that the page target can be changed *on the form*, so our check state can get out of sync.

Definition at line 476 of file SpecialUpload.php.

References $wgUser, and wfLocalFile().

Referenced by getUploadForm().

SpecialUpload::loadRequest ( request  )  [protected]

Initialize instance variables from request and create an Upload handler.

Parameters:
WebRequest $request The request to extract variables from

Definition at line 60 of file SpecialUpload.php.

References $wgUser, and UploadBase::createFromRequest().

Referenced by __construct().

SpecialUpload::processUpload (  )  [protected]

SpecialUpload::processVerificationError ( details  )  [protected]

SpecialUpload::showRecoverableUploadError ( message  )  [protected]

Stashes the upload and shows the main upload form.

Note: only errors that can be handled by changing the name or description should be redirected here. It should be assumed that the file itself is sane and has passed UploadBase::verifyFile. This essentially means that UploadBase::VERIFICATION_ERROR and UploadBase::EMPTY_FILE should not be passed here.

Parameters:
string $message HTML message to be passed to mainUploadForm

Definition at line 292 of file SpecialUpload.php.

References getUploadForm(), showUploadForm(), wfMsg(), and wfMsgHtml().

Referenced by processVerificationError().

SpecialUpload::showUploadError ( message  )  [protected]

Show the upload form with error message, but do not stash the file.

Parameters:
string $message

Definition at line 367 of file SpecialUpload.php.

References getUploadForm(), showUploadForm(), and wfMsgHtml().

Referenced by processUpload(), and processVerificationError().

SpecialUpload::showUploadForm ( form  )  [protected]

Show the main upload form.

Parameters:
mixed $form An HTMLForm instance or HTML string to show

Definition at line 189 of file SpecialUpload.php.

References $wgOut, and showViewDeletedLinks().

Referenced by execute(), processUpload(), processVerificationError(), showRecoverableUploadError(), showUploadError(), and showUploadWarning().

SpecialUpload::showUploadWarning ( warnings  )  [protected]

Stashes the upload, shows the main form, but adds an "continue anyway button".

Also checks whether there are actually warnings to display.

Parameters:
array $warnings
Returns:
boolean true if warnings were displayed, false if there are no warnings and the should continue processing like there was no warning

Definition at line 309 of file SpecialUpload.php.

References $msg, $wgUser, getDupeWarning(), getExistsWarning(), getUploadForm(), Title::makeTitle(), showUploadForm(), wfMsg(), wfMsgExt(), and wfMsgHtml().

Referenced by processUpload().

SpecialUpload::showViewDeletedLinks (  )  [protected]

Shows the "view X deleted revivions link"".

Definition at line 255 of file SpecialUpload.php.

References $title, $wgOut, $wgUser, SpecialPage::getTitleFor(), Title::makeTitleSafe(), and wfMsgExt().

Referenced by showUploadForm().

SpecialUpload::unsaveUploadedFile (  )  [protected]

Remove a temporarily kept file stashed by saveTempUploadedFile().

Access:
private
Returns:
success

Definition at line 566 of file SpecialUpload.php.

References $success, and $wgOut.

Referenced by execute().

SpecialUpload::userCanExecute ( user  ) 

This page can be shown if uploading is enabled.

Handle permission checking elsewhere in order to be able to show custom error messages.

Parameters:
User $user
Returns:
bool

Reimplemented from SpecialPage.

Definition at line 113 of file SpecialUpload.php.

References UploadBase::isEnabled().


Member Data Documentation

SpecialUpload::$mCancelUpload

Definition at line 46 of file SpecialUpload.php.

SpecialUpload::$mComment

Definition at line 34 of file SpecialUpload.php.

SpecialUpload::$mCopyrightSource

Definition at line 41 of file SpecialUpload.php.

SpecialUpload::$mCopyrightStatus

Definition at line 40 of file SpecialUpload.php.

SpecialUpload::$mDesiredDestName

User input variables from the "description" section.

Definition at line 33 of file SpecialUpload.php.

SpecialUpload::$mDestWarningAck

Hidden variables.

Definition at line 44 of file SpecialUpload.php.

SpecialUpload::$mForReUpload

Definition at line 45 of file SpecialUpload.php.

SpecialUpload::$mIgnoreWarning

User input variables from the root section.

Definition at line 38 of file SpecialUpload.php.

SpecialUpload::$mLicense

Definition at line 35 of file SpecialUpload.php.

SpecialUpload::$mLocalFile

Definition at line 29 of file SpecialUpload.php.

SpecialUpload::$mRequest

Misc variables.

Definition at line 26 of file SpecialUpload.php.

SpecialUpload::$mSourceType

Definition at line 27 of file SpecialUpload.php.

SpecialUpload::$mTokenOk

Definition at line 47 of file SpecialUpload.php.

SpecialUpload::$mUpload

Definition at line 28 of file SpecialUpload.php.

SpecialUpload::$mUploadClicked

Definition at line 30 of file SpecialUpload.php.

SpecialUpload::$mUploadSuccessful = false

Definition at line 48 of file SpecialUpload.php.

SpecialUpload::$mWatchThis

Definition at line 39 of file SpecialUpload.php.

SpecialUpload::$uploadFormTextAfterSummary

Definition at line 52 of file SpecialUpload.php.

SpecialUpload::$uploadFormTextTop

Text injection points for hooks not using HTMLForm.

Definition at line 51 of file SpecialUpload.php.


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:50 2011 for MediaWiki by  doxygen 1.5.9