X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FInfoAction.php;h=c5cd89f14baaf852dcebf5aa6048c9d1f784b9ae;hb=74426f3cf796b149f1ae445e41815bbe148640b2;hp=baec944e67a9501dfbfc4f343c381b5035d4d5e7;hpb=12601ff7d2796752404bfb331fccc41083d31f9f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index baec944e67..1165a268ef 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -128,7 +128,7 @@ class InfoAction extends FormlessAction { // pageinfo-header-basic, pageinfo-header-edits, pageinfo-header-restrictions, // pageinfo-header-properties, pageinfo-category-info $content .= $this->makeHeader( - $this->msg( "pageinfo-${header}" )->escaped(), + $this->msg( "pageinfo-${header}" )->text(), "mw-pageinfo-${header}" ) . "\n"; $table = "\n"; @@ -153,11 +153,12 @@ class InfoAction extends FormlessAction { * Creates a header that can be added to the output. * * @param string $header The header text. + * @param string $canonicalId * @return string The HTML. */ protected function makeHeader( $header, $canonicalId ) { - $spanAttribs = [ 'class' => 'mw-headline', 'id' => Sanitizer::escapeId( $header ) ]; - $h2Attribs = [ 'id' => Sanitizer::escapeId( $canonicalId ) ]; + $spanAttribs = [ 'class' => 'mw-headline', 'id' => Sanitizer::escapeIdForAttribute( $header ) ]; + $h2Attribs = [ 'id' => Sanitizer::escapeIdForAttribute( $canonicalId ) ]; return Html::rawElement( 'h2', $h2Attribs, Html::element( 'span', $spanAttribs, $header ) ); } @@ -185,7 +186,7 @@ class InfoAction extends FormlessAction { * Adds a table to the content that will be added to the output. * * @param string $content The content that will be added to the output - * @param string $table The table + * @param string $table * @return string The content with the table added */ protected function addTable( $content, $table ) { @@ -436,6 +437,19 @@ class InfoAction extends FormlessAction { ]; } + // Display image SHA-1 value + if ( $title->inNamespace( NS_FILE ) ) { + $fileObj = wfFindFile( $title ); + if ( $fileObj !== false ) { + // Convert the base-36 sha1 value obtained from database to base-16 + $output = Wikimedia\base_convert( $fileObj->getSha1(), 36, 16, 40 ); + $pageInfo['header-basic'][] = [ + $this->msg( 'pageinfo-file-hash' ), + $output + ]; + } + } + // Page protection $pageInfo['header-restrictions'] = []; @@ -848,7 +862,7 @@ class InfoAction extends FormlessAction { $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); # Sift for real versus user names - /** @var $user User */ + /** @var User $user */ foreach ( $contributors as $user ) { $page = $user->isAnon() ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )