MediaWiki
REL1_19
|
Form for handling uploads and special page. More...
Public Member Functions | |
__construct ($request=null) | |
Constructor : initialise object Get data POSTed through the form and assign them to the object. | |
execute ($par) | |
Special page entry point. | |
userCanExecute (User $user) | |
This page can be shown if uploading is enabled. | |
Static Public Member Functions | |
static | ajaxGetExistsWarning ($filename) |
Get a list of warnings. | |
static | getDupeWarning ($dupes) |
Construct a warning and a gallery from an array of duplicate files. | |
static | getExistsWarning ($exists) |
Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upload via AJAX. | |
static | getInitialPageText ($comment= '', $license= '', $copyStatus= '', $source= '') |
Get the initial image page text based on a comment and optional file status information. | |
Public Attributes | |
$mCancelUpload | |
$mComment | |
$mCopyrightSource | |
$mCopyrightStatus | |
$mDesiredDestName | |
User input variables from the "description" section. | |
$mDestWarningAck | |
Hidden variables. | |
$mForReUpload | |
$mIgnoreWarning | |
User input variables from the root section. | |
$mLicense | |
$mLocalFile | |
$mRequest | |
Misc variables. | |
$mSourceType | |
$mTokenOk | |
$mUpload | |
$mUploadClicked | |
$mUploadSuccessful = false | |
$mWatchThis | |
$mWatchthis | |
$uploadFormTextAfterSummary | |
$uploadFormTextTop | |
Text injection points for hooks not using HTMLForm. | |
Protected Member Functions | |
getUploadForm ($message= '', $sessionKey= '', $hideIgnoreWarning=false) | |
Get an UploadForm instance with title and text properly set. | |
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. | |
loadRequest () | |
Initialize instance variables from request and create an Upload handler. | |
processUpload () | |
Do the upload. | |
processVerificationError ($details) | |
Provides output to the user for a result of UploadBase::verifyUpload. | |
showRecoverableUploadError ($message) | |
Stashes the upload and shows the main upload form. | |
showUploadError ($message) | |
Show the upload form with error message, but do not stash the file. | |
showUploadForm ($form) | |
Show the main upload form. | |
showUploadWarning ($warnings) | |
Stashes the upload, shows the main form, but adds an "continue anyway button". | |
showViewDeletedLinks () | |
Shows the "view X deleted revivions link"". | |
unsaveUploadedFile () | |
Remove a temporarily kept file stashed by saveTempUploadedFile(). |
Form for handling uploads and special page.
Definition at line 31 of file SpecialUpload.php.
SpecialUpload::__construct | ( | $ | request = null | ) |
Constructor : initialise object Get data POSTed through the form and assign them to the object.
$request | WebRequest : data posted. |
Definition at line 37 of file SpecialUpload.php.
static SpecialUpload::ajaxGetExistsWarning | ( | $ | filename | ) | [static] |
Get a list of warnings.
$filename | String: local filename, e.g. 'file exists', 'non-descriptive filename' |
Definition at line 686 of file SpecialUpload.php.
References $file, getExistsWarning(), wfFindFile(), and wfLocalFile().
SpecialUpload::execute | ( | $ | par | ) |
Special page entry point.
Reimplemented from SpecialPage.
Definition at line 135 of file SpecialUpload.php.
References $user, SpecialPage\checkReadOnly(), getUploadForm(), SpecialPage\getUser(), UploadBase\isAllowed(), UploadBase\isEnabled(), loadRequest(), SpecialPage\outputHeader(), processUpload(), SpecialPage\setHeaders(), showUploadForm(), unsaveUploadedFile(), wfDebug(), and wfRunHooks().
static SpecialUpload::getDupeWarning | ( | $ | dupes | ) | [static] |
Construct a warning and a gallery from an array of duplicate files.
$dupes | array |
Definition at line 709 of file SpecialUpload.php.
References $file, $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.
$exists | Array: the result of UploadBase::getExistsWarning |
Definition at line 633 of file SpecialUpload.php.
References $file, SpecialPage\getTitle(), SpecialPage\getTitleFor(), Linker\linkKnown(), wfMsgExt(), and wfMsgHtml().
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.
$comment | string |
$license | string |
$copyStatus | string |
$source | string |
Definition at line 459 of file SpecialUpload.php.
References $comment, $license, $wgForceUIMsgAsContentMsg, $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.
$message | String: HTML string to add to the form |
$sessionKey | String: session key in case this is a stashed upload |
$hideIgnoreWarning | Boolean: whether to hide "ignore warning" check box |
Definition at line 217 of file SpecialUpload.php.
References Title\exists(), SpecialPage\getContext(), SpecialPage\getOutput(), SpecialPage\getTitle(), getWatchCheck(), Title\makeTitleSafe(), LogEventsList\showLogExtract(), wfMessage(), and wfMsgExt().
Referenced by execute(), 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 509 of file SpecialUpload.php.
References SpecialPage\getUser(), and wfLocalFile().
Referenced by getUploadForm().
SpecialUpload::loadRequest | ( | ) | [protected] |
Initialize instance variables from request and create an Upload handler.
Definition at line 83 of file SpecialUpload.php.
References UploadBase\createFromRequest(), SpecialPage\getRequest(), and SpecialPage\getUser().
Referenced by execute().
SpecialUpload::processUpload | ( | ) | [protected] |
Do the upload.
Checks are made in SpecialUpload::execute()
Definition at line 388 of file SpecialUpload.php.
References getInitialPageText(), SpecialPage\getOutput(), SpecialPage\getUser(), UploadBase\OK, processVerificationError(), showRecoverableUploadError(), showUploadError(), showUploadWarning(), wfDebug(), wfMsgExt(), and wfRunHooks().
Referenced by execute().
SpecialUpload::processVerificationError | ( | $ | details | ) | [protected] |
Provides output to the user for a result of UploadBase::verifyUpload.
$details | Array: result of UploadBase::verifyUpload |
Definition at line 532 of file SpecialUpload.php.
References $wgFileExtensions, UploadBase\EMPTY_FILE, UploadBase\FILE_TOO_LARGE, UploadBase\FILENAME_TOO_LONG, UploadBase\FILETYPE_BADTYPE, UploadBase\FILETYPE_MISSING, SpecialPage\getLanguage(), UploadBase\HOOK_ABORTED, UploadBase\ILLEGAL_FILENAME, UploadBase\MIN_LENGTH_PARTNAME, showRecoverableUploadError(), showUploadError(), UploadBase\VERIFICATION_ERROR, wfMessage(), wfMsgExt(), wfMsgHtml(), and UploadBase\WINDOWS_NONASCII_FILENAME.
Referenced by processUpload().
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.
$message | String: HTML message to be passed to mainUploadForm |
Definition at line 307 of file SpecialUpload.php.
References getUploadForm(), showUploadForm(), wfMsg(), and wfMsgHtml().
Referenced by processUpload(), and processVerificationError().
SpecialUpload::showUploadError | ( | $ | message | ) | [protected] |
Show the upload form with error message, but do not stash the file.
$message | string HTML string |
Definition at line 378 of file SpecialUpload.php.
References getUploadForm(), showUploadForm(), and wfMsgHtml().
Referenced by processUpload(), and processVerificationError().
SpecialUpload::showUploadForm | ( | $ | form | ) | [protected] |
Show the main upload form.
$form | Mixed: an HTMLForm instance or HTML string to show |
Definition at line 195 of file SpecialUpload.php.
References SpecialPage\getOutput(), and showViewDeletedLinks().
Referenced by execute(), 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.
$warnings | Array |
Definition at line 324 of file SpecialUpload.php.
References 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 276 of file SpecialUpload.php.
References $count, $title, $user, SpecialPage\getOutput(), SpecialPage\getTitleFor(), SpecialPage\getUser(), Linker\linkKnown(), Title\makeTitleSafe(), and wfMsgExt().
Referenced by showUploadForm().
SpecialUpload::unsaveUploadedFile | ( | ) | [protected] |
Remove a temporarily kept file stashed by saveTempUploadedFile().
Definition at line 611 of file SpecialUpload.php.
References $success, and SpecialPage\getOutput().
Referenced by execute().
SpecialUpload::userCanExecute | ( | User $ | user | ) |
This page can be shown if uploading is enabled.
Handle permission checking elsewhere in order to be able to show custom error messages.
$user | User object |
Reimplemented from SpecialPage.
Definition at line 128 of file SpecialUpload.php.
References UploadBase\isEnabled().
SpecialUpload::$mCancelUpload |
Definition at line 70 of file SpecialUpload.php.
SpecialUpload::$mComment |
Definition at line 58 of file SpecialUpload.php.
SpecialUpload::$mCopyrightSource |
Definition at line 65 of file SpecialUpload.php.
SpecialUpload::$mCopyrightStatus |
Definition at line 64 of file SpecialUpload.php.
SpecialUpload::$mDesiredDestName |
User input variables from the "description" section.
Definition at line 57 of file SpecialUpload.php.
SpecialUpload::$mDestWarningAck |
Hidden variables.
Definition at line 68 of file SpecialUpload.php.
SpecialUpload::$mForReUpload |
Definition at line 69 of file SpecialUpload.php.
SpecialUpload::$mIgnoreWarning |
User input variables from the root section.
Definition at line 62 of file SpecialUpload.php.
SpecialUpload::$mLicense |
Definition at line 59 of file SpecialUpload.php.
SpecialUpload::$mLocalFile |
Definition at line 53 of file SpecialUpload.php.
SpecialUpload::$mRequest |
Misc variables.
Definition at line 42 of file SpecialUpload.php.
SpecialUpload::$mSourceType |
Definition at line 43 of file SpecialUpload.php.
SpecialUpload::$mTokenOk |
Definition at line 71 of file SpecialUpload.php.
SpecialUpload::$mUpload |
Definition at line 48 of file SpecialUpload.php.
SpecialUpload::$mUploadClicked |
Definition at line 54 of file SpecialUpload.php.
SpecialUpload::$mUploadSuccessful = false |
Definition at line 72 of file SpecialUpload.php.
SpecialUpload::$mWatchThis |
Definition at line 63 of file SpecialUpload.php.
SpecialUpload::$mWatchthis |
Definition at line 78 of file SpecialUpload.php.
SpecialUpload::$uploadFormTextAfterSummary |
Definition at line 76 of file SpecialUpload.php.
SpecialUpload::$uploadFormTextTop |
Text injection points for hooks not using HTMLForm.
Definition at line 75 of file SpecialUpload.php.