# extensions should take care to _append_ to the present value
var $uploadFormTextTop;
var $uploadFormTextAfterSummary;
- var $mTokenOk = false;
- var $mForReUpload = false;
+ var $mTokenOk = false;
+ var $mForReUpload = false;
/**#@-*/
/**
if( !$this->mDesiredDestName )
$this->mDesiredDestName = $request->getText( 'wpUploadFile' );
+ $this->mForReUpload = $request->getBool( 'wpForReUpload' ); // updating a file
$this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' );
$this->mComment = $request->getText( 'wpUploadDescription' );
$this->mSourceType = $request->getText( 'wpSourceType' );
$this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' );
- $this->mForReUpload = $request->getBool( 'wpForReUpload' );
-
- $this->mReUpload = $request->getCheck( 'wpReUpload' );
+ $this->mReUpload = $request->getCheck( 'wpReUpload' ); // retrying upload
$this->mAction = $request->getVal( 'action' );
$this->mUpload = UploadBase::createFromRequest( $request );
}
//check token if uploading or reUploading
if( !$this->mTokenOk && !$this->mReUpload && ($this->mUpload && (
- 'submit' == $this->mAction || $this->mUploadClicked ) )
- ){
- $this->mainUploadForm ( wfMsg( 'session_fail_preview' ) );
- return ;
+ 'submit' == $this->mAction || $this->mUploadClicked ) ) )
+ {
+ $this->mainUploadForm ( wfMsg( 'session_fail_preview' ) );
+ return ;
}
*
* @access private
*/
- function processUpload(){
+ function processUpload() {
global $wgOut, $wgFileExtensions, $wgLang;
$details = $this->internalProcessUpload();
switch( $details['status'] ) {
case UploadBase::VERIFICATION_ERROR:
unset( $details['status'] );
- $code = array_shift( $details );
- $this->uploadError( wfMsgExt( $code, 'parseinline', $details ) );
+ $code = array_shift( $details['details'] );
+ $this->uploadError( wfMsgExt( $code, 'parseinline', $details['details'] ) );
break;
case UploadBase::UPLOAD_VERIFICATION_ERROR:
// Fetch the file if required
$status = $this->mUpload->fetchFile();
- if( !$status->isOK() ){
- return array( 'status' =>UploadBase::BEFORE_PROCESSING, 'error'=>$status->getWikiText() );
+ if( !$status->isOK() ) {
+ return array( 'status' => UploadBase::BEFORE_PROCESSING, 'error'=> $status->getWikiText() );
}
// Check whether this is a sane upload
$result = $this->mUpload->verifyUpload();
- if( $result != UploadBase::OK )
+ if( $result['status'] != UploadBase::OK )
return $result;
$this->mLocalFile = $this->mUpload->getLocalFile();
wgUploadAutoFill = {$autofill};
</script>" );
- if( $wgEnableJS2system ){
+ if( $wgEnableJS2system ) {
//js2version of upload page:
- $wgOut->addScriptClass( 'uploadPage' );
+ $wgOut->addScriptClass( 'uploadPage' );
}else{
//legacy upload code:
$wgOut->addScriptFile( 'upload.js' );
$wgLang->formatSize( $val ) ) .
"</div>\n";
//add a hidden filed for upload by url (uses the $wgMaxUploadSize var)
- if( UploadFromUrl::isEnabled() ){
+ if( UploadFromUrl::isEnabled() ) {
$maxUploadSize.='<div id="mw-upload-maxfilesize-url" style="display:none">' .
wfMsgExt( 'upload-maxfilesize', array( 'parseinline', 'escapenoentities' ),
$wgLang->formatSize( $wgMaxUploadSize ) ) .
}
$sourcefilename = wfMsgExt( 'sourcefilename', array( 'parseinline', 'escapenoentities' ) );
- $destfilename = wfMsgExt( 'destfilename', array( 'parseinline', 'escapenoentities' ) );
+ $destfilename = wfMsgExt( 'destfilename', array( 'parseinline', 'escapenoentities' ) );
$msg = ( $this->mForReUpload ) ? 'filereuploadsummary' : 'fileuploadsummary';
$summary = wfMsgExt( $msg, 'parseinline' );
// Prepare form for upload or upload/copy
//javascript moved from inline calls to setup:
if( UploadFromUrl::isEnabled() && $wgUser->isAllowed( 'upload_by_url' ) ) {
- if($wgEnableJS2system){
- $filename_form =
- Xml::input( 'wpSourceType', false, 'file', array( 'id'=>'wpSourceTypeFile', 'type' => 'radio', 'checked' => 'checked' ) ) .
- Xml::input( 'wpUploadFile', 60, false, array( 'id'=>'wpUploadFile', 'type'=>'file', 'tabindex' => '1' ) ) .
- wfMsgHTML( 'upload_source_file' ) . "<br/>" .
- Xml::input( 'wpSourceType', false, 'Url', array( 'id'=>'wpSourceTypeURL', 'type' => 'radio' )) .
- Xml::input( 'wpUploadFileURL', 60, false, array( 'id'=>'wpUploadFileURL', 'type' => 'text', 'tabindex' => '1')) .
+ if( $wgEnableJS2system ) {
+ $filename_form =
+ Xml::input( 'wpSourceType', false, 'file',
+ array( 'id' => 'wpSourceTypeFile', 'type' => 'radio', 'checked' => 'checked' ) ) .
+ Xml::input( 'wpUploadFile', 60, false,
+ array( 'id' => 'wpUploadFile', 'type' => 'file', 'tabindex' => '1' ) ) .
+ wfMsgHTML( 'upload_source_file' ) . "<br/>" .
+ Xml::input( 'wpSourceType', false, 'Url',
+ array( 'id' => 'wpSourceTypeURL', 'type' => 'radio' ) ) .
+ Xml::input( 'wpUploadFileURL', 60, false,
+ array( 'id' => 'wpUploadFileURL', 'type' => 'text', 'tabindex' => '1' ) ) .
wfMsgHtml( 'upload_source_url' ) ;
- }else{
- //@@todo depreciate (not needed once $wgEnableJS2system is turned on)
- $filename_form =
+ } else {
+ //@@todo deprecate (not needed once $wgEnableJS2system is turned on)
+ $filename_form =
"<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " .
"onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked='checked' />" .
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " .
"onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" .
wfMsgHtml( 'upload_source_url' ) ;
- }
+ }
} else {
- if($wgEnableJS2system){
+ if( $wgEnableJS2system ) {
$filename_form =
- Xml::input( 'wpUploadFile', 60, false, array( 'id'=>'wpUploadFile', 'type'=>'file', 'tabindex' => '1' ) ) .
+ Xml::input( 'wpUploadFile', 60, false,
+ array( 'id' => 'wpUploadFile', 'type' => 'file', 'tabindex' => '1' ) ) .
Xml::hidden( 'wpSourceType', 'file');
- }else{
+ } else {
$filename_form =
"<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' size='60' ".
"onchange='fillDestFilename(\"wpUploadFile\")' />" .
}
$warningRow = '';
$destOnkeyup = '';
- if($wgEnableJS2system){
+ if( $wgEnableJS2system ) {
$warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>";
- }else{
+ } else {
if ( $useAjaxDestCheck ) {
$warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>";
$destOnkeyup = 'onchange=\'wgUploadWarningObj.checkNow(this.value);\'';
$encComment = htmlspecialchars( $this->mComment );
- //add the wpEditToken
+ //add the wpEditToken
$wgOut->addHTML(
- Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ),
+ Xml::openElement( 'form',
+ array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ),
'enctype' => 'multipart/form-data', 'id' => 'mw-upload-form' ) ) .
- Xml::hidden('wpEditToken', $wgUser->editToken(), array('id' => 'wpEditToken')) .
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMsg( 'upload' ) ) .
- Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-upload-table' ) ) .
- "<tr>
+ Xml::hidden( 'wpEditToken', $wgUser->editToken(), array( 'id' => 'wpEditToken' ) ) .
+ Xml::openElement( 'fieldset' ) .
+ Xml::element( 'legend', null, wfMsg( 'upload' ) ) .
+ Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-upload-table' ) ) .
+ "<tr>
{$this->uploadFormTextTop}
<td class='mw-label'>
<label for='wpUploadFile'>{$sourcefilename}</label>
}
}
- /**
+ /**
* Check if a user is the last uploader
*
* @param User $user
/**
* Get the initial image page text based on a comment and optional file status information
*/
- static function getInitialPageText( $comment='', $license='', $copyStatus='', $source='' ) {
+ static function getInitialPageText( $comment = '', $license = '', $copyStatus = '', $source = '' ) {
global $wgUseCopyrightUpload;
if ( $wgUseCopyrightUpload ) {
$licensetxt = '';
if ( $license != '' ) {
- $licensetxt = '== ' . wfMsgForContent( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";
+ $licensetxt = '== ' . wfMsgForContent( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n";
}
$pageText = '== ' . wfMsgForContent ( 'filedesc' ) . " ==\n" . $comment . "\n" .
'== ' . wfMsgForContent ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
if ( $license != '' ) {
$filedesc = $comment == '' ? '' : '== ' . wfMsgForContent ( 'filedesc' ) . " ==\n" . $comment . "\n";
$pageText = $filedesc .
- '== ' . wfMsgForContent ( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";
+ '== ' . wfMsgForContent ( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n";
} else {
$pageText = $comment;
}