From 8f93926e1bc6e96fc11b4d0d201025022d471de7 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Tue, 4 Jan 2011 12:24:29 +0100 Subject: update to MediaWiki 1.16.1 --- includes/ImagePage.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'includes/ImagePage.php') diff --git a/includes/ImagePage.php b/includes/ImagePage.php index dd2c2ab1..f16acc33 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -600,6 +600,7 @@ EOT $this->loadFile(); $pager = new ImageHistoryPseudoPager( $this ); $wgOut->addHTML( $pager->getBody() ); + $wgOut->preventClickjacking( $pager->getPreventClickjacking() ); $this->img->resetHistory(); // free db resources @@ -803,6 +804,7 @@ EOT class ImageHistoryList { protected $imagePage, $img, $skin, $title, $repo, $showThumb; + protected $preventClickjacking = false; public function __construct( $imagePage ) { global $wgUser, $wgShowArchiveThumbnails; @@ -929,6 +931,7 @@ class ImageHistoryList { # Don't link to unviewable files $row .= '' . $wgLang->timeAndDate( $timestamp, true ) . ''; } elseif( $file->isDeleted(File::DELETED_FILE) ) { + $this->preventClickjacking(); $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); # Make a link to review the image $url = $this->skin->link( @@ -1015,9 +1018,19 @@ class ImageHistoryList { return wfMsgHtml( 'filehist-nothumb' ); } } + + protected function preventClickjacking( $enable = true ) { + $this->preventClickjacking = $enable; + } + + public function getPreventClickjacking() { + return $this->preventClickjacking; + } } class ImageHistoryPseudoPager extends ReverseChronologicalPager { + protected $preventClickjacking = false; + function __construct( $imagePage ) { parent::__construct(); $this->mImagePage = $imagePage; @@ -1058,6 +1071,10 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { $s .= $list->imageHistoryLine( !$file->isOld(), $file ); } $s .= $list->endImageHistoryList($navLink); + + if ( $list->getPreventClickjacking() ) { + $this->preventClickjacking(); + } } return $s; } @@ -1140,4 +1157,13 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { } $this->mQueryDone = true; } + + protected function preventClickjacking( $enable = true ) { + $this->preventClickjacking = $enable; + } + + public function getPreventClickjacking() { + return $this->preventClickjacking; + } + } -- cgit v1.2.2