From 0eedb17177d1e0319273fd2ba9741d2990fa69e1 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Wed, 28 Mar 2007 10:22:51 +0000 Subject: [PATCH] Use proper allowInlineDisplay function, by hint of Brion --- includes/SpecialUpload.php | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 9b110d5a39..46565c5ee7 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -423,10 +423,14 @@ class UploadForm { if( $image->exists() ) { $dlink = $sk->makeKnownLinkObj( $nt ); - $dlink2 = $sk->makeImageLinkObj( $nt, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt->getText(), 'right', false, false, false, true ); - - # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice - if ( substr( $dlink2, 0, 7) == 'allowInlineDisplay() ) { + $dlink2 = $sk->makeImageLinkObj( $nt, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt->getText(), 'right', false, false, false, true ); + } elseif ( !$image->allowInlineDisplay() && $image->isSafeFile() ) { + $icon = $image->iconThumb(); + $dlink2 = '
' . $icon->toHtml() . '
' . $dlink . '
'; + } else { + $dlink2 = ''; + } $warning .= '
  • ' . wfMsgExt( 'fileexists', 'parseline', $dlink ) . '
  • ' . $dlink2; @@ -434,10 +438,14 @@ class UploadForm { # Check if image with lowercase extension exists. # It's not forbidden but in 99% it makes no sense to upload the same filename with uppercase extension $dlink = $sk->makeKnownLinkObj( $nt_lc ); - $dlink2 = $sk->makeImageLinkObj( $nt_lc, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_lc->getText(), 'right', false, false, false, true ); - - # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice - if ( substr( $dlink2, 0, 7) == 'allowInlineDisplay() ) { + $dlink2 = $sk->makeImageLinkObj( $nt_lc, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_lc->getText(), 'right', false, false, false, true ); + } elseif ( !$image_lc->allowInlineDisplay() && $image_lc->isSafeFile() ) { + $icon = $image_lc->iconThumb(); + $dlink2 = '
    ' . $icon->toHtml() . '
    ' . $dlink . '
    '; + } else { + $dlink2 = ''; + } $warning .= '
  • ' . wfMsgExt( 'fileexists-extension', 'parsemag' , $partname . '.' . $finalExt , $dlink ) . '
  • ' . $dlink2; @@ -448,9 +456,15 @@ class UploadForm { if ($image_thb->exists() ) { # Check if an image without leading '180px-' (or similiar) exists $dlink = $sk->makeKnownLinkObj( $nt_thb); - $dlink2 = $sk->makeImageLinkObj( $nt_thb, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_thb->getText(), 'right', false, false, false, true ); - # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice - if ( substr( $dlink2, 0, 7) == 'allowInlineDisplay() ) { + $dlink2 = $sk->makeImageLinkObj( $nt_thb, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_thb->getText(), 'right', false, false, false, true ); + } elseif ( !$image_thb->allowInlineDisplay() && $image_thb->isSafeFile() ) { + $icon = $image_thb->iconThumb(); + $dlink2 = '
    ' . $icon->toHtml() . '
    ' . $dlink . '
    '; + } else { + $dlink2 = ''; + } + $warning .= '
  • ' . wfMsgExt( 'fileexists-thumbnail-yes', 'parsemag', $dlink ) . '
  • ' . $dlink2; } else { # Image w/o '180px-' does not exists, but we do not like these filenames -- 2.20.1