From: Gabriel Wicke Date: Thu, 24 Jun 2004 22:30:16 +0000 (+0000) Subject: make sure all applicable warnings are displayed (as li's and not as intrusive as... X-Git-Tag: 1.5.0alpha1~2779 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=3db0f7fa2ffb8f419121af24c9ba2de755dda86e;p=lhc%2Fweb%2Fwiklou.git make sure all applicable warnings are displayed (as li's and not as intrusive as before) and honour -\>mIgnoreWarning --- diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 41b8c443dc..28f0cb89cb 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -117,29 +117,31 @@ class UploadForm { } $this->saveUploadedFile( $this->mUploadSaveName, $this->mUploadTempName ); - if ( ( ! $this->mIgnoreWarning ) && - ( 0 != strcmp( ucfirst( $basename ), $this->mUploadSaveName ) ) ) { - return $this->uploadWarning( wfMsg( "badfilename", $this->mUploadSaveName ) ); - } - - if ( $wgCheckFileExtensions ) { - if ( ( ! $this->mIgnoreWarning ) && - ( ! $this->checkFileExtension( $ext, $wgFileExtensions ) ) ) { - return $this->uploadWarning( wfMsg( "badfiletype", $ext ) ); - } - } - if ( $wgUploadSizeWarning && ( ! $this->mIgnoreWarning ) && - ( $this->mUploadSize > $wgUploadSizeWarning ) ) { - return $this->uploadWarning( wfMsg( "largefile" ) ); - } if ( !$nt->userCanEdit() ) { return $this->uploadError( wfMsg( "protectedpage" ) ); } - if($nt->getArticleID()) { - $sk = $wgUser->getSkin(); - $dname = $wgLang->getNsText( Namespace::getImage() ) . ":{$this->mUploadSaveName}"; - $dlink = $sk->makeKnownLink( $dname, $dname ); - return $this->uploadWarning( wfMsg( "fileexists", $dlink ) ); + + if ( ! $this->mIgnoreWarning ) { + $warning = ''; + if( 0 != strcmp( ucfirst( $basename ), $this->mUploadSaveName ) ) { + $warning .= '
  • '.wfMsg( "badfilename", $this->mUploadSaveName ).'
  • '; + } + + if ( $wgCheckFileExtensions ) { + if ( ! $this->checkFileExtension( $ext, $wgFileExtensions ) ) { + $warning .= '
  • '.wfMsg( "badfiletype", $ext ).'
  • '; + } + } + if ( $wgUploadSizeWarning && ( $this->mUploadSize > $wgUploadSizeWarning ) ) { + $warning .= '
  • '.wfMsg( "largefile" ).'
  • '; + } + if( $nt->getArticleID() ) { + $sk = $wgUser->getSkin(); + $dname = $wgLang->getNsText( Namespace::getImage() ) . ":{$this->mUploadSaveName}"; + $dlink = $sk->makeKnownLink( $dname, $dname ); + $warning .= '
  • '.wfMsg( "fileexists", $dlink ).'
  • '; + } + if($warning != '') return $this->uploadWarning($warning); } } if ( !is_null( $this->mUploadOldVersion ) ) { @@ -232,7 +234,7 @@ class UploadForm { $sub = wfMsg( "uploadwarning" ); $wgOut->addHTML( "

    {$sub}

    \n" ); - $wgOut->addHTML( "

    {$warning}

    \n" ); + $wgOut->addHTML( "
    \n" ); $save = wfMsg( "savefile" ); $reupload = wfMsg( "reupload" );