summaryrefslogtreecommitdiff
path: root/includes/ImagePage.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-01-04 12:24:29 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-01-04 12:24:29 +0100
commit8f93926e1bc6e96fc11b4d0d201025022d471de7 (patch)
tree7e13841de0a7d33faf5481d44ca7471ce639193a /includes/ImagePage.php
parentfe786bf329367b2d2663ea7f2474ceaeeace6180 (diff)
update to MediaWiki 1.16.1
Diffstat (limited to 'includes/ImagePage.php')
-rw-r--r--includes/ImagePage.php26
1 files changed, 26 insertions, 0 deletions
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 .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
} 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;
+ }
+
}