$warning .= '<li>'.wfMsgHtml( 'emptyfile' ).'</li>';
}
+ global $wgUser;
+ $sk = $wgUser->getSkin();
$image = new Image( $nt );
+
+ // Check for uppercase extension. We allow these filenames but check if an image
+ // with lowercase extension exists already
+ if ( $finalExt != strtolower( $finalExt ) ) {
+ $nt_lc = Title::newFromText( $partname . '.' . strtolower( $finalExt ) );
+ $image_lc = new Image( $nt_lc );
+ }
+
if( $image->exists() ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
$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) == '<a href' ) $dlink2 = '';
- $warning .= '<li>' . wfMsgHtml( 'fileexists', $dlink ) . '</li>' . $dlink2;
- } else {
+ $warning .= '<li>' . wfMsgExt( 'fileexists', 'parseline', $dlink ) . '</li>' . $dlink2;
+
+ } elseif ( isset( $image_lc) && $image_lc->exists() ) {
+ # 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) == '<a href' ) $dlink2 = '';
+
+ $warning .= '<li>' . wfMsgExt( 'fileexists-extension', 'parsemag' , $partname . '.' . $finalExt , $dlink ) . '</li>' . $dlink2;
+
+ } elseif ( ( substr( $partname , 3, 3 ) == 'px-' || substr( $partname , 2, 3 ) == 'px-' ) && ereg( "[0-9]{2}" , substr( $partname , 0, 2) ) ) {
+ # Check for filenames like 50px- or 180px-, these are mostly thumbnails
+ $nt_thb = Title::newFromText( substr( $partname , strpos( $partname , '-' ) +1 ) . '.' . $finalExt );
+ $image_thb = new Image( $nt_thb );
+ 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) == '<a href' ) $dlink2 = '';
+ $warning .= '<li>' . wfMsgExt( 'fileexists-thumbnail-yes', 'parsemag', $dlink ) . '</li>' . $dlink2;
+ } else {
+ # Image w/o '180px-' does not exists, but we do not like these filenames
+ $warning .= '<li>' . wfMsgExt( 'file-thumbnail-no', 'parseinline' , substr( $partname , 0, strpos( $partname , '-' ) +1 ) ) . '</li>';
+ }
+ }
+ if ( $image->wasDeleted() ) {
# If the file existed before and was deleted, warn the user of this
# Don't bother doing so if the image exists now, however
- if( $image->wasDeleted() ) {
- $skin = $wgUser->getSkin();
- $ltitle = SpecialPage::getTitleFor( 'Log' );
- $llink = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
- $warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' );
- }
+ $ltitle = SpecialPage::getTitleFor( 'Log' );
+ $llink = $sk->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
+ $warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' );
}
if( $warning != '' ) {
'large-file' => 'Die Dateigröße sollte nach Möglichkeit $1 nicht überschreiten. Diese Datei ist $2 groß.',
'largefileserver' => 'Die Datei ist größer als die vom Server eingestellte Maximalgröße.',
'emptyfile' => 'Die hochgeladene Datei ist leer. Der Grund kann ein Tippfehler im Dateinamen sein. Bitte kontrollieren Sie, ob Sie die Datei wirklich hochladen wollen.',
-'fileexists' => 'Eine Datei mit diesem Namen existiert bereits. Wenn Sie auf „Datei speichern“ klicken, wird die Datei überschrieben. Bitte prüfen Sie $1, wenn Sie sich nicht sicher sind.',
+'fileexists' => 'Eine Datei mit diesem Namen existiert bereits. Wenn Sie auf „Datei speichern“ klicken, wird die Datei überschrieben. Bitte prüfen Sie <strong><tt>$1</tt></strong>, wenn Sie sich nicht sicher sind.',
+'fileexists-extension' => "Eine Datei mit ähnlichem Namen existiert bereits:<br />
+Name der hochzuladenden Datei: <strong><tt>$1</tt></strong><br />
+Name der vorhandenen Datei: <strong><tt>$2</tt></strong><br />
+Nur die Dateiendung unterscheidet sich in Groß-/Kleinschreibung. Bitte prüfen Sie, ob die Dateien inhaltlich identisch sind.",
'fileexists-thumb' => "'''<center>Vorhandenes Bild</center>'''",
+'fileexists-thumbnail-yes' => "Bei der Datei scheint es sich um ein Bild verringerter Größe <i>(thumbnail)</i> zu handeln. Bitte prüfen Sie die Datei <strong><tt>$1</tt></strong>.<br />
+Wenn es sich um das Bild in Originalgröße handelt, so braucht kein separates Vorschaubild hochgeladen zu werden.",
+'file-thumbnail-no' => "Der Dateiname beginnt mit <strong><tt>$1</tt></strong>. Dies deutet auf ein Bild verringerter Größe <i>(thumbnail)</i> hin.
+Bitte prüfen Sie, ob Sie das Bild in voller Auflösung vorliegen haben und laden Sie dieses unter dem Originalnamen hoch.",
'fileexists-forbidden' => 'Mit diesem Namen existiert bereits eine Datei. Bitte gehen Sie zurück und laden Ihre Datei unter einem anderen Namen hoch. [[Image:$1|thumb|center|$1]]',
'fileexists-shared-forbidden' => 'Mit diesem Namen existiert bereits eine Datei. Bitte gehen Sie zurück und laden Sie diese Datei unter einem anderen Namen hoch. [[Image:$1|thumb|center|$1]]',
'successfulupload' => 'Erfolgreich hochgeladen',
'filetype-missing' => 'The file has no extension (like ".jpg").',
'large-file' => 'It is recommended that files are no larger than $1; this file is $2.',
'largefileserver' => 'This file is bigger than the server is configured to allow.',
-'emptyfile' => 'The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file.',
-'fileexists' => 'A file with this name exists already, please check $1 if you are not sure if you want to change it.',
-'fileexists-thumb' => "'''<center>Existing image</center>'''",
-'fileexists-forbidden' => 'A file with this name exists already; please go back and upload this file under a new name. [[Image:$1|thumb|center|$1]]',
-'fileexists-shared-forbidden' => 'A file with this name exists already in the shared file repository; please go back and upload this file under a new name. [[Image:$1|thumb|center|$1]]',
+'emptyfile' => 'The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file.',
+'fileexists' => 'A file with this name exists already, please check <strong><tt>$1</tt></strong> if you are not sure if you want to change it.',
+'fileexists-extension' => 'A file with a similiar name exists:<br />
+Name of the uploading file: <strong><tt>$1</tt></strong><br />
+Name of the existing file: <strong><tt>$2</tt></strong><br />
+The only difference is in the lower/uppercase of the extension. Please check the files for identity.',
+'fileexists-thumb' => "'''<center>Existing image</center>'''",
+'fileexists-thumbnail-yes' => "The file seems to be an image of reduced size <i>(thumbnail)</i> zu handeln. Please check the file <strong><tt>$1</tt></strong>.<br />
+If the checked file is the same image of original size it is not necessary to upload an extra thumbnail.",
+'file-thumbnail-no' => "The filename begins with <strong><tt>$1</tt></strong>. It seems to be an image of reduced size <i>(thumbnail)</i>.
+If you have this image in full resolution upload this one, otherwise change the file name please.",
+'fileexists-forbidden' => 'A file with this name exists already; please go back and upload this file under a new name. [[Image:$1|thumb|center|$1]]',
+'fileexists-shared-forbidden' => 'A file with this name exists already in the shared file repository; please go back and upload this file under a new name. [[Image:$1|thumb|center|$1]]',
'successfulupload' => 'Successful upload',
'fileuploaded' => "File $1 uploaded successfully.
Please follow this link: $2 to the description page and fill