X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=1ab1c36f455952da02b5e5dc3f670c77fc9c41ba;hb=8f618346f808fcc65de4574654053c73b588bf50;hp=f7aec171763b7e58c2b2f44809bda6fbeadc4774;hpb=f2b9274bce47afabb468d24e021820f318fbde68;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ImagePage.php b/includes/ImagePage.php index f7aec17176..1ab1c36f45 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -86,9 +86,9 @@ class ImagePage extends Article { global $wgLang; $r = ''; return $r; } @@ -103,11 +103,13 @@ class ImagePage extends Article { */ function makeMetadataTable( $exif ) { $r = "{| class=metadata align=right width=250px\n"; - $r .= '|+ id=metadata | '. htmlspecialchars( wfMsg( 'metadata' ) ) . "\n"; + $r .= '|+ id=metadata | '. wfMsg( 'metadata' ) . "\n"; foreach( $exif as $k => $v ) { $tag = strtolower( $k ); - $r .= "! class=$tag |" . wfMsg( "exif-$tag" ) . "\n"; - $r .= "| class=$tag |" . htmlspecialchars( $v ) . "\n"; + $msg = wfMsg( "exif-$tag" ); + + $r .= "! class=$tag | $msg\n"; + $r .= "| class=$tag | $v\n"; $r .= "|-\n"; } return substr($r, 0, -3) . '|}'; @@ -132,14 +134,14 @@ class ImagePage extends Article { global $wgOut, $wgUser, $wgImageLimits, $wgRequest, $wgUseImageResize, $wgRepositoryBaseUrl, $wgUseExternalEditor, $wgServer, $wgFetchCommonsDescriptions; - $full_url = $this->img->getViewURL(); + $full_url = $this->img->getURL(); $anchoropen = ''; $anchorclose = ''; if( $wgUser->getOption( 'imagesize' ) == '' ) { $sizeSel = User::getDefaultOption( 'imagesize' ); } else { - $sizeSel = IntVal( $wgUser->getOption( 'imagesize' ) ); + $sizeSel = intval( $wgUser->getOption( 'imagesize' ) ); } if( !isset( $wgImageLimits[$sizeSel] ) ) { $sizeSel = User::getDefaultOption( 'imagesize' ); @@ -159,7 +161,7 @@ class ImagePage extends Article { # image # "Download high res version" link below the image - $msg = wfMsg('showbigimage', $width, $height, intval( $this->img->getSize()/1024 ) ); + $msg = wfMsgHtml('showbigimage', $width, $height, intval( $this->img->getSize()/1024 ) ); if ( $width > $maxWidth ) { $height = floor( $height * $maxWidth / $width ); $width = $maxWidth; @@ -168,25 +170,29 @@ class ImagePage extends Article { $width = floor( $width * $maxHeight / $height ); $height = $maxHeight; } - if ( !$this->img->mustRender() - && ( $width != $this->img->getWidth() || $height != $this->img->getHeight() ) ) { + if ( $width != $this->img->getWidth() || $height != $this->img->getHeight() ) { if( $wgUseImageResize ) { $thumbnail = $this->img->getThumbnail( $width ); if ( $thumbnail == null ) { - $url = $full_url; + $url = $this->img->getViewURL(); } else { - $url = $thumbnail->getUrl(); + $url = $thumbnail->getURL(); } } else { # No resize ability? Show the full image, but scale # it down in the browser so it fits on the page. - $url = $full_url; + $url = $this->img->getViewURL(); } $anchoropen = ""; - $anchorclose = "
\n$anchoropen{$msg}"; + $anchorclose = "
"; + if( $this->img->mustRender() ) { + $showLink = true; + } else { + $anchorclose .= "\n$anchoropen{$msg}"; + } } else { - $url = $full_url; - $showLink = $this->img->mustRender(); + $url = $this->img->getViewURL(); + $showLink = true; } $wgOut->addHTML( '' ); } - + $showLink = true; } @@ -210,7 +216,7 @@ class ImagePage extends Article { $info = wfMsg( 'fileinfo', ceil($this->img->getSize()/1024.0), $this->img->getMimeType() ); - + if (!$this->img->isSafeFile()) { $warning = wfMsg( 'mediawarning' ); $wgOut->addWikiText( <<addWikiText( wfMsg( 'noimage', $this->getUploadUrl() ) ); + + $title = Title::makeTitle( NS_SPECIAL, 'Upload' ); + $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'), + 'wpDestFile=' . urlencode( $this->img->getName() ) ); + $wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) ); } } function printSharedImageText() { - global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut; + global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser; $url = $wgRepositoryBaseUrl . urlencode($this->mTitle->getDBkey()); - $sharedtext = "
" . wfMsg("sharedupload"); + $sharedtext = "
" . wfMsgWikiHtml("sharedupload"); if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) { - $sharedtext .= " " . wfMsg("shareduploadwiki", $url); + + $sk = $wgUser->getSkin(); + $title = Title::makeTitle( NS_SPECIAL, 'Upload' ); + $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'), + array( 'wpDestFile' => urlencode( $this->img->getName() ))); + $sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link); } $sharedtext .= "
"; - $wgOut->addWikiText($sharedtext); + $wgOut->addHTML($sharedtext); if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) { require_once("HttpFunctions.php"); @@ -277,9 +292,11 @@ END return; $sk = $wgUser->getSkin(); - $wgOut->addHTML( '