Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -778,7 +778,10 @@ |
779 | 779 | 'largefileserver', |
780 | 780 | 'emptyfile', |
781 | 781 | 'fileexists', |
| 782 | + 'fileexists-extension', |
782 | 783 | 'fileexists-thumb', |
| 784 | + 'fileexists-thumbnail-yes', |
| 785 | + 'file-thumbnail-no', |
783 | 786 | 'fileexists-forbidden', |
784 | 787 | 'fileexists-shared-forbidden', |
785 | 788 | 'successfulupload', |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -410,26 +410,59 @@ |
411 | 411 | $warning .= '<li>'.wfMsgHtml( 'emptyfile' ).'</li>'; |
412 | 412 | } |
413 | 413 | |
| 414 | + global $wgUser; |
| 415 | + $sk = $wgUser->getSkin(); |
414 | 416 | $image = new Image( $nt ); |
| 417 | + |
| 418 | + // Check for uppercase extension. We allow these filenames but check if an image |
| 419 | + // with lowercase extension exists already |
| 420 | + if ( $finalExt != strtolower( $finalExt ) ) { |
| 421 | + $nt_lc = Title::newFromText( $partname . '.' . strtolower( $finalExt ) ); |
| 422 | + $image_lc = new Image( $nt_lc ); |
| 423 | + } |
| 424 | + |
415 | 425 | if( $image->exists() ) { |
416 | | - global $wgUser; |
417 | | - $sk = $wgUser->getSkin(); |
418 | 426 | $dlink = $sk->makeKnownLinkObj( $nt ); |
419 | 427 | $dlink2 = $sk->makeImageLinkObj( $nt, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt->getText(), 'right', false, false, false, true ); |
420 | 428 | |
421 | 429 | # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice |
422 | 430 | if ( substr( $dlink2, 0, 7) == '<a href' ) $dlink2 = ''; |
423 | 431 | |
424 | | - $warning .= '<li>' . wfMsgHtml( 'fileexists', $dlink ) . '</li>' . $dlink2; |
425 | | - } else { |
| 432 | + $warning .= '<li>' . wfMsgExt( 'fileexists', 'parseline', $dlink ) . '</li>' . $dlink2; |
| 433 | + |
| 434 | + } elseif ( isset( $image_lc) && $image_lc->exists() ) { |
| 435 | + # Check if image with lowercase extension exists. |
| 436 | + # It's not forbidden but in 99% it makes no sense to upload the same filename with uppercase extension |
| 437 | + $dlink = $sk->makeKnownLinkObj( $nt_lc ); |
| 438 | + $dlink2 = $sk->makeImageLinkObj( $nt_lc, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_lc->getText(), 'right', false, false, false, true ); |
| 439 | + |
| 440 | + # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice |
| 441 | + if ( substr( $dlink2, 0, 7) == '<a href' ) $dlink2 = ''; |
| 442 | + |
| 443 | + $warning .= '<li>' . wfMsgExt( 'fileexists-extension', 'parsemag' , $partname . '.' . $finalExt , $dlink ) . '</li>' . $dlink2; |
| 444 | + |
| 445 | + } elseif ( ( substr( $partname , 3, 3 ) == 'px-' || substr( $partname , 2, 3 ) == 'px-' ) && ereg( "[0-9]{2}" , substr( $partname , 0, 2) ) ) { |
| 446 | + # Check for filenames like 50px- or 180px-, these are mostly thumbnails |
| 447 | + $nt_thb = Title::newFromText( substr( $partname , strpos( $partname , '-' ) +1 ) . '.' . $finalExt ); |
| 448 | + $image_thb = new Image( $nt_thb ); |
| 449 | + if ($image_thb->exists() ) { |
| 450 | + # Check if an image without leading '180px-' (or similiar) exists |
| 451 | + $dlink = $sk->makeKnownLinkObj( $nt_thb); |
| 452 | + $dlink2 = $sk->makeImageLinkObj( $nt_thb, wfMsgExt( 'fileexists-thumb', 'parseinline', $dlink ), $nt_thb->getText(), 'right', false, false, false, true ); |
| 453 | + # when $dlink2 begins with a normal href it is not a thumbnail -> do not show the link twice |
| 454 | + if ( substr( $dlink2, 0, 7) == '<a href' ) $dlink2 = ''; |
| 455 | + $warning .= '<li>' . wfMsgExt( 'fileexists-thumbnail-yes', 'parsemag', $dlink ) . '</li>' . $dlink2; |
| 456 | + } else { |
| 457 | + # Image w/o '180px-' does not exists, but we do not like these filenames |
| 458 | + $warning .= '<li>' . wfMsgExt( 'file-thumbnail-no', 'parseinline' , substr( $partname , 0, strpos( $partname , '-' ) +1 ) ) . '</li>'; |
| 459 | + } |
| 460 | + } |
| 461 | + if ( $image->wasDeleted() ) { |
426 | 462 | # If the file existed before and was deleted, warn the user of this |
427 | 463 | # Don't bother doing so if the image exists now, however |
428 | | - if( $image->wasDeleted() ) { |
429 | | - $skin = $wgUser->getSkin(); |
430 | | - $ltitle = SpecialPage::getTitleFor( 'Log' ); |
431 | | - $llink = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() ); |
432 | | - $warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' ); |
433 | | - } |
| 464 | + $ltitle = SpecialPage::getTitleFor( 'Log' ); |
| 465 | + $llink = $sk->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() ); |
| 466 | + $warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' ); |
434 | 467 | } |
435 | 468 | |
436 | 469 | if( $warning != '' ) { |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1357,11 +1357,19 @@ |
1358 | 1358 | 'filetype-missing' => 'The file has no extension (like ".jpg").', |
1359 | 1359 | 'large-file' => 'It is recommended that files are no larger than $1; this file is $2.', |
1360 | 1360 | 'largefileserver' => 'This file is bigger than the server is configured to allow.', |
1361 | | -'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.', |
1362 | | -'fileexists' => 'A file with this name exists already, please check $1 if you are not sure if you want to change it.', |
1363 | | -'fileexists-thumb' => "'''<center>Existing image</center>'''", |
1364 | | -'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]]', |
1365 | | -'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]]', |
| 1361 | +'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.', |
| 1362 | +'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.', |
| 1363 | +'fileexists-extension' => 'A file with a similiar name exists:<br /> |
| 1364 | +Name of the uploading file: <strong><tt>$1</tt></strong><br /> |
| 1365 | +Name of the existing file: <strong><tt>$2</tt></strong><br /> |
| 1366 | +The only difference is in the lower/uppercase of the extension. Please check the files for identity.', |
| 1367 | +'fileexists-thumb' => "'''<center>Existing image</center>'''", |
| 1368 | +'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 /> |
| 1369 | +If the checked file is the same image of original size it is not necessary to upload an extra thumbnail.", |
| 1370 | +'file-thumbnail-no' => "The filename begins with <strong><tt>$1</tt></strong>. It seems to be an image of reduced size <i>(thumbnail)</i>. |
| 1371 | +If you have this image in full resolution upload this one, otherwise change the file name please.", |
| 1372 | +'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]]', |
| 1373 | +'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]]', |
1366 | 1374 | 'successfulupload' => 'Successful upload', |
1367 | 1375 | 'fileuploaded' => "File $1 uploaded successfully. |
1368 | 1376 | Please follow this link: $2 to the description page and fill |
Index: trunk/phase3/languages/messages/MessagesDe.php |
— | — | @@ -980,8 +980,16 @@ |
981 | 981 | 'large-file' => 'Die Dateigröße sollte nach Möglichkeit $1 nicht überschreiten. Diese Datei ist $2 groß.', |
982 | 982 | 'largefileserver' => 'Die Datei ist größer als die vom Server eingestellte Maximalgröße.', |
983 | 983 | 'emptyfile' => 'Die hochgeladene Datei ist leer. Der Grund kann ein Tippfehler im Dateinamen sein. Bitte kontrollieren Sie, ob Sie die Datei wirklich hochladen wollen.', |
984 | | -'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.', |
| 984 | +'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.', |
| 985 | +'fileexists-extension' => "Eine Datei mit ähnlichem Namen existiert bereits:<br /> |
| 986 | +Name der hochzuladenden Datei: <strong><tt>$1</tt></strong><br /> |
| 987 | +Name der vorhandenen Datei: <strong><tt>$2</tt></strong><br /> |
| 988 | +Nur die Dateiendung unterscheidet sich in Groß-/Kleinschreibung. Bitte prüfen Sie, ob die Dateien inhaltlich identisch sind.", |
985 | 989 | 'fileexists-thumb' => "'''<center>Vorhandenes Bild</center>'''", |
| 990 | +'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 /> |
| 991 | +Wenn es sich um das Bild in Originalgröße handelt, so braucht kein separates Vorschaubild hochgeladen zu werden.", |
| 992 | +'file-thumbnail-no' => "Der Dateiname beginnt mit <strong><tt>$1</tt></strong>. Dies deutet auf ein Bild verringerter Größe <i>(thumbnail)</i> hin. |
| 993 | +Bitte prüfen Sie, ob Sie das Bild in voller Auflösung vorliegen haben und laden Sie dieses unter dem Originalnamen hoch.", |
986 | 994 | '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]]', |
987 | 995 | '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]]', |
988 | 996 | 'successfulupload' => 'Erfolgreich hochgeladen', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -279,6 +279,9 @@ |
280 | 280 | * (bug 8716) Change math_inputhash and math_outputhash to byte for Postgres |
281 | 281 | * (bug 8558) Correct display of timestamps on some pages when using Postgres |
282 | 282 | * (bug 9343) Correct Wolof interwiki links |
| 283 | +* (bug 3069) Warning on upload of scaled down images |
| 284 | + Warning on upload of images with uppercase extension if image with lowercase |
| 285 | + extension exists |
283 | 286 | |
284 | 287 | == Languages updated == |
285 | 288 | |