X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=a83217d5a20db4b882536d287fabf0e089972707;hb=c2665e4b6e615c80e4126f1ff343e7f9f3018dcc;hp=93cef53feeb25cc8c30d8d7d801586fefceebb10;hpb=661c5c3f0198508ea6dc3c050f91ee1e64f6db04;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 93cef53fee..a83217d5a2 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -262,7 +262,9 @@ class ImagePage extends Article {
# @todo FIXME: Why is this using escapeId for a class?!
$class = Sanitizer::escapeId( $v['id'] );
if ( $type == 'collapsed' ) {
- $class .= ' collapsable'; // sic
+ // Handled by mediawiki.action.view.metadata module
+ // and skins/common/shared.css.
+ $class .= ' collapsable';
}
$r .= "
\n";
$r .= "{$v['name']} | \n";
@@ -314,7 +316,12 @@ class ImagePage extends Article {
$renderLang = $request->getVal( 'lang' );
if ( !is_null( $renderLang ) ) {
- $params['lang'] = $renderLang;
+ $handler = $this->displayImg->getHandler();
+ if ( $handler && $handler->validateParam( 'lang', $renderLang ) ) {
+ $params['lang'] = $renderLang;
+ } else {
+ $renderLang = null;
+ }
}
$width_orig = $this->displayImg->getWidth( $page );
@@ -725,7 +732,7 @@ EOT
return $dbr->select(
array( 'imagelinks', 'page' ),
- array( 'page_namespace', 'page_title', 'page_is_redirect', 'il_to' ),
+ array( 'page_namespace', 'page_title', 'il_to' ),
array( 'il_to' => $target, 'il_from = page_id' ),
__METHOD__,
array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', )
@@ -736,13 +743,19 @@ EOT
$limit = 100;
$out = $this->getContext()->getOutput();
- $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
+
$rows = array();
$redirects = array();
+ foreach ( $this->getTitle()->getRedirectsHere( NS_FILE ) as $redir ) {
+ $redirects[$redir->getDBkey()] = array();
+ $rows[] = (object)array(
+ 'page_namespace' => NS_FILE,
+ 'page_title' => $redir->getDBkey(),
+ );
+ }
+
+ $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
foreach ( $res as $row ) {
- if ( $row->page_is_redirect ) {
- $redirects[$row->page_title] = array();
- }
$rows[] = $row;
}
$count = count( $rows );
@@ -989,7 +1002,7 @@ EOT
} else {
$display = $code;
}
- $opts .= "\n" . XML::Option( $display, $code, $curLang === $code );
+ $opts .= "\n" . Xml::option( $display, $code, $curLang === $code );
if ( $curLang === $code ) {
$haveCurrentLang = true;
}
@@ -1000,7 +1013,7 @@ EOT
if ( !$haveDefaultLang ) {
// Its hard to know if the content is really in the default language, or
// if its just unmarked content that could be in any language.
- $opts = XML::Option( wfMessage( 'img-lang-default' )->text(), '', $defaultLang === $curLang ) . $opts;
+ $opts = Xml::option( wfMessage( 'img-lang-default' )->text(), $defaultLang, $defaultLang === $curLang ) . $opts;
}
if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
$name = Language::fetchLanguageName( $curLang, $this->getContext()->getLanguage()->getCode() );
@@ -1009,7 +1022,7 @@ EOT
} else {
$display = $curLang;
}
- $opts = XML::Option( $display, $curLang, true ) . $opts;
+ $opts = Xml::option( $display, $curLang, true ) . $opts;
}
$select = Html::rawElement( 'select', array( 'id' => 'mw-imglangselector', 'name' => 'lang' ), $opts );