3 * Special handling for file description pages.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 * Class for viewing MediaWiki file description pages
28 class ImagePage
extends Article
{
39 protected $mExtraDescription = false;
43 * @return WikiFilePage
45 protected function newPage( Title
$title ) {
46 // Overload mPage with a file-specific page
47 return new WikiFilePage( $title );
51 * Constructor from a page id
52 * @param int $id Article ID to load
53 * @return ImagePage|null
55 public static function newFromID( $id ) {
56 $t = Title
::newFromID( $id );
57 # @todo FIXME: Doesn't inherit right
58 return $t == null ?
null : new self( $t );
59 # return $t == null ? null : new static( $t ); // PHP 5.3
66 public function setFile( $file ) {
67 $this->mPage
->setFile( $file );
68 $this->displayImg
= $file;
69 $this->fileLoaded
= true;
72 protected function loadFile() {
73 if ( $this->fileLoaded
) {
76 $this->fileLoaded
= true;
78 $this->displayImg
= $img = false;
79 Hooks
::run( 'ImagePageFindFile', array( $this, &$img, &$this->displayImg
) );
80 if ( !$img ) { // not set by hook?
81 $img = wfFindFile( $this->getTitle() );
83 $img = wfLocalFile( $this->getTitle() );
86 $this->mPage
->setFile( $img );
87 if ( !$this->displayImg
) { // not set by hook?
88 $this->displayImg
= $img;
90 $this->repo
= $img->getRepo();
94 * Handler for action=render
95 * Include body text only; none of the image extras
97 public function render() {
98 $this->getContext()->getOutput()->setArticleBodyOnly( true );
102 public function view() {
105 $out = $this->getContext()->getOutput();
106 $request = $this->getContext()->getRequest();
107 $diff = $request->getVal( 'diff' );
108 $diffOnly = $request->getBool(
110 $this->getContext()->getUser()->getOption( 'diffonly' )
113 if ( $this->getTitle()->getNamespace() != NS_FILE ||
( $diff !== null && $diffOnly ) ) {
120 if ( $this->getTitle()->getNamespace() == NS_FILE
&& $this->mPage
->getFile()->getRedirected() ) {
121 if ( $this->getTitle()->getDBkey() == $this->mPage
->getFile()->getName() ||
$diff !== null ) {
122 // mTitle is the same as the redirect target so ask Article
123 // to perform the redirect for us.
124 $request->setVal( 'diffonly', 'true' );
128 // mTitle is not the same as the redirect target so it is
129 // probably the redirect page itself. Fake the redirect symbol
130 $out->setPageTitle( $this->getTitle()->getPrefixedText() );
131 $out->addHTML( $this->viewRedirect(
132 Title
::makeTitle( NS_FILE
, $this->mPage
->getFile()->getName() ),
133 /* $appendSubtitle */ true,
134 /* $forceKnown */ true )
136 $this->mPage
->doViewUpdates( $this->getContext()->getUser(), $this->getOldID() );
141 if ( $wgShowEXIF && $this->displayImg
->exists() ) {
142 // @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
143 $formattedMetadata = $this->displayImg
->formatMetadata( $this->getContext() );
144 $showmeta = $formattedMetadata !== false;
149 if ( !$diff && $this->displayImg
->exists() ) {
150 $out->addHTML( $this->showTOC( $showmeta ) );
154 $this->openShowImage();
157 # No need to display noarticletext, we use our own message, output in openShowImage()
158 if ( $this->mPage
->getID() ) {
159 # NS_FILE is in the user language, but this section (the actual wikitext)
160 # should be in page content language
161 $pageLang = $this->getTitle()->getPageViewLanguage();
162 $out->addHTML( Xml
::openElement( 'div', array( 'id' => 'mw-imagepage-content',
163 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(),
164 'class' => 'mw-content-' . $pageLang->getDir() ) ) );
168 $out->addHTML( Xml
::closeElement( 'div' ) );
170 # Just need to set the right headers
171 $out->setArticleFlag( true );
172 $out->setPageTitle( $this->getTitle()->getPrefixedText() );
173 $this->mPage
->doViewUpdates( $this->getContext()->getUser(), $this->getOldID() );
176 # Show shared description, if needed
177 if ( $this->mExtraDescription
) {
178 $fol = $this->getContext()->msg( 'shareddescriptionfollows' );
179 if ( !$fol->isDisabled() ) {
180 $out->addWikiText( $fol->plain() );
182 $out->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription
. "</div>\n" );
185 $this->closeShowImage();
186 $this->imageHistory();
187 // TODO: Cleanup the following
189 $out->addHTML( Xml
::element( 'h2',
190 array( 'id' => 'filelinks' ),
191 $this->getContext()->msg( 'imagelinks' )->text() ) . "\n" );
193 # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
194 # Yet we return metadata about the target. Definitely an issue in the FileRepo
197 # Allow extensions to add something after the image links
199 Hooks
::run( 'ImagePageAfterImageLinks', array( $this, &$html ) );
201 $out->addHTML( $html );
205 $out->addHTML( Xml
::element(
207 array( 'id' => 'metadata' ),
208 $this->getContext()->msg( 'metadata' )->text() ) . "\n" );
209 $out->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
210 $out->addModules( array( 'mediawiki.action.view.metadata' ) );
213 // Add remote Filepage.css
214 if ( !$this->repo
->isLocal() ) {
215 $css = $this->repo
->getDescriptionStylesheetUrl();
217 $out->addStyle( $css );
220 // always show the local local Filepage.css, bug 29277
221 $out->addModuleStyles( 'filepage' );
227 public function getDisplayedFile() {
229 return $this->displayImg
;
235 * @param bool $metadata Whether or not to show the metadata link
238 protected function showTOC( $metadata ) {
240 '<li><a href="#file">' . $this->getContext()->msg( 'file-anchor-link' )->escaped() . '</a></li>',
241 '<li><a href="#filehistory">' . $this->getContext()->msg( 'filehist' )->escaped() . '</a></li>',
242 '<li><a href="#filelinks">' . $this->getContext()->msg( 'imagelinks' )->escaped() . '</a></li>',
245 Hooks
::run( 'ImagePageShowTOC', array( $this, &$r ) );
248 $r[] = '<li><a href="#metadata">' . $this->getContext()->msg( 'metadata' )->escaped() . '</a></li>';
251 return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>';
255 * Make a table with metadata to be shown in the output page.
257 * @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
259 * @param array $metadata The array containing the Exif data
260 * @return string The metadata table. This is treated as Wikitext (!)
262 protected function makeMetadataTable( $metadata ) {
263 $r = "<div class=\"mw-imagepage-section-metadata\">";
264 $r .= $this->getContext()->msg( 'metadata-help' )->plain();
265 $r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n";
266 foreach ( $metadata as $type => $stuff ) {
267 foreach ( $stuff as $v ) {
268 # @todo FIXME: Why is this using escapeId for a class?!
269 $class = Sanitizer
::escapeId( $v['id'] );
270 if ( $type == 'collapsed' ) {
271 // Handled by mediawiki.action.view.metadata module.
272 $class .= ' collapsable';
274 $r .= "<tr class=\"$class\">\n";
275 $r .= "<th>{$v['name']}</th>\n";
276 $r .= "<td>{$v['value']}</td>\n</tr>";
279 $r .= "</table>\n</div>\n";
284 * Overloading Article's getContentObject method.
286 * Omit noarticletext if sharedupload; text will be fetched from the
287 * shared upload server if possible.
290 public function getContentObject() {
292 if ( $this->mPage
->getFile() && !$this->mPage
->getFile()->isLocal() && 0 == $this->getID() ) {
295 return parent
::getContentObject();
298 protected function openShowImage() {
299 global $wgEnableUploads, $wgSend404Code;
302 $out = $this->getContext()->getOutput();
303 $user = $this->getContext()->getUser();
304 $lang = $this->getContext()->getLanguage();
305 $dirmark = $lang->getDirMarkEntity();
306 $request = $this->getContext()->getRequest();
308 $max = $this->getImageLimitsFromOption( $user, 'imagesize' );
310 $maxHeight = $max[1];
312 if ( $this->displayImg
->exists() ) {
314 $page = $request->getIntOrNull( 'page' );
315 if ( is_null( $page ) ) {
319 $params = array( 'page' => $page );
322 $renderLang = $request->getVal( 'lang' );
323 if ( !is_null( $renderLang ) ) {
324 $handler = $this->displayImg
->getHandler();
325 if ( $handler && $handler->validateParam( 'lang', $renderLang ) ) {
326 $params['lang'] = $renderLang;
332 $width_orig = $this->displayImg
->getWidth( $page );
333 $width = $width_orig;
334 $height_orig = $this->displayImg
->getHeight( $page );
335 $height = $height_orig;
337 $filename = wfEscapeWikiText( $this->displayImg
->getName() );
338 $linktext = $filename;
340 Hooks
::run( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) );
342 if ( $this->displayImg
->allowInlineDisplay() ) {
344 # "Download high res version" link below the image
345 # $msgsize = $this->getContext()->msg( 'file-info-size', $width_orig, $height_orig,
346 # Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
347 # We'll show a thumbnail of this image
348 if ( $width > $maxWidth ||
$height > $maxHeight ||
$this->displayImg
->isVectorized() ) {
349 list( $width, $height ) = $this->getDisplayWidthHeight(
350 $maxWidth, $maxHeight, $width, $height
352 $linktext = $this->getContext()->msg( 'show-big-image' )->escaped();
354 $thumbSizes = $this->getThumbSizes( $width, $height, $width_orig, $height_orig );
355 # Generate thumbnails or thumbnail links as needed...
356 $otherSizes = array();
357 foreach ( $thumbSizes as $size ) {
358 // We include a thumbnail size in the list, if it is
359 // less than or equal to the original size of the image
360 // asset ($width_orig/$height_orig). We also exclude
361 // the current thumbnail's size ($width/$height)
362 // since that is added to the message separately, so
363 // it can be denoted as the current size being shown.
364 // Vectorized images are "infinitely" big, so all thumb
366 if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
367 ||
$this->displayImg
->isVectorized() )
368 && $size[0] != $width && $size[1] != $height
370 $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
372 $otherSizes[] = $sizeLink;
376 $otherSizes = array_unique( $otherSizes );
379 $sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height );
380 if ( $sizeLinkBigImagePreview ) {
381 $msgsmall .= $this->getContext()->msg( 'show-big-image-preview' )->
382 rawParams( $sizeLinkBigImagePreview )->
385 if ( count( $otherSizes ) ) {
387 Html
::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ),
388 $this->getContext()->msg( 'show-big-image-other' )->rawParams( $lang->pipeList( $otherSizes ) )->
389 params( count( $otherSizes ) )->parse()
392 } elseif ( $width == 0 && $height == 0 ) {
393 # Some sort of audio file that doesn't have dimensions
394 # Don't output a no hi res message for such a file
397 # Image is small enough to show full size on image page
398 $msgsmall = $this->getContext()->msg( 'file-nohires' )->parse();
401 $params['width'] = $width;
402 $params['height'] = $height;
403 $thumbnail = $this->displayImg
->transform( $params );
404 Linker
::processResponsiveImages( $this->displayImg
, $thumbnail, $params );
406 $anchorclose = Html
::rawElement(
408 array( 'class' => 'mw-filepage-resolutioninfo' ),
412 $isMulti = $this->displayImg
->isMultipage() && $this->displayImg
->pageCount() > 1;
414 $out->addModules( 'mediawiki.page.image.pagination' );
415 $out->addHTML( '<table class="multipageimage"><tr><td>' );
420 'alt' => $this->displayImg
->getTitle()->getPrefixedText(),
423 $out->addHTML( '<div class="fullImageLink" id="file">' .
424 $thumbnail->toHtml( $options ) .
425 $anchorclose . "</div>\n" );
429 $count = $this->displayImg
->pageCount();
432 $label = $out->parse( $this->getContext()->msg( 'imgmultipageprev' )->text(), false );
433 // on the client side, this link is generated in ajaxifyPageNavigation()
434 // in the mediawiki.page.image.pagination module
435 $link = Linker
::linkKnown(
439 array( 'page' => $page - 1 )
441 $thumb1 = Linker
::makeThumbLinkObj(
447 array( 'page' => $page - 1 )
453 if ( $page < $count ) {
454 $label = $this->getContext()->msg( 'imgmultipagenext' )->text();
455 $link = Linker
::linkKnown(
459 array( 'page' => $page +
1 )
461 $thumb2 = Linker
::makeThumbLinkObj(
467 array( 'page' => $page +
1 )
476 'name' => 'pageselector',
477 'action' => $wgScript,
480 for ( $i = 1; $i <= $count; $i++
) {
481 $options[] = Xml
::option( $lang->formatNum( $i ), $i, $i == $page );
483 $select = Xml
::tags( 'select',
484 array( 'id' => 'pageselector', 'name' => 'page' ),
485 implode( "\n", $options ) );
488 '</td><td><div class="multipageimagenavbox">' .
489 Xml
::openElement( 'form', $formParams ) .
490 Html
::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
491 $this->getContext()->msg( 'imgmultigoto' )->rawParams( $select )->parse() .
492 Xml
::submitButton( $this->getContext()->msg( 'imgmultigo' )->text() ) .
493 Xml
::closeElement( 'form' ) .
494 "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
497 } elseif ( $this->displayImg
->isSafeFile() ) {
498 # if direct link is allowed but it's not a renderable image, show an icon.
499 $icon = $this->displayImg
->iconThumb();
501 $out->addHTML( '<div class="fullImageLink" id="file">' .
502 $icon->toHtml( array( 'file-link' => true ) ) .
506 $longDesc = $this->getContext()->msg( 'parentheses', $this->displayImg
->getLongDesc() )->text();
508 $handler = $this->displayImg
->getHandler();
510 // If this is a filetype with potential issues, warn the user.
512 $warningConfig = $handler->getWarningConfig( $this->displayImg
);
514 if ( $warningConfig !== null ) {
515 // The warning will be displayed via CSS and JavaScript.
516 // We just need to tell the client side what message to use.
517 $output = $this->getContext()->getOutput();
518 $output->addJsConfigVars( 'wgFileWarning', $warningConfig );
519 $output->addModules( $warningConfig['module'] );
520 $output->addModules( 'mediawiki.filewarning' );
524 $medialink = "[[Media:$filename|$linktext]]";
526 if ( !$this->displayImg
->isSafeFile() ) {
527 $warning = $this->getContext()->msg( 'mediawarning' )->plain();
528 // dirmark is needed here to separate the file name, which
529 // most likely ends in Latin characters, from the description,
530 // which may begin with the file type. In RTL environment
531 // this will get messy.
532 // The dirmark, however, must not be immediately adjacent
533 // to the filename, because it can get copied with it.
535 // @codingStandardsIgnoreStart Ignore long line
536 $out->addWikiText( <<<EOT
537 <div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
538 <div class="mediaWarning">$warning</div>
541 // @codingStandardsIgnoreEnd
543 $out->addWikiText( <<<EOT
544 <div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
550 $renderLangOptions = $this->displayImg
->getAvailableLanguages();
551 if ( count( $renderLangOptions ) >= 1 ) {
552 $currentLanguage = $renderLang;
553 $defaultLang = $this->displayImg
->getDefaultRenderLanguage();
554 if ( is_null( $currentLanguage ) ) {
555 $currentLanguage = $defaultLang;
557 $out->addHtml( $this->doRenderLangOpt( $renderLangOptions, $currentLanguage, $defaultLang ) );
560 // Add cannot animate thumbnail warning
561 if ( !$this->displayImg
->canAnimateThumbIfAppropriate() ) {
562 // Include the extension so wiki admins can
563 // customize it on a per file-type basis
564 // (aka say things like use format X instead).
565 // additionally have a specific message for
566 // file-no-thumb-animation-gif
567 $ext = $this->displayImg
->getExtension();
568 $noAnimMesg = wfMessageFallback(
569 'file-no-thumb-animation-' . $ext,
570 'file-no-thumb-animation'
573 $out->addWikiText( <<<EOT
574 <div class="mw-noanimatethumb">{$noAnimMesg}</div>
579 if ( !$this->displayImg
->isLocal() ) {
580 $this->printSharedImageText();
583 # Image does not exist
584 if ( !$this->getID() ) {
585 # No article exists either
586 # Show deletion log to be consistent with normal articles
587 LogEventsList
::showLogExtract(
589 array( 'delete', 'move' ),
590 $this->getTitle()->getPrefixedText(),
593 'conds' => array( "log_action != 'revision'" ),
594 'showIfEmpty' => false,
595 'msgKey' => array( 'moveddeleted-notice' )
600 if ( $wgEnableUploads && $user->isAllowed( 'upload' ) ) {
601 // Only show an upload link if the user can upload
602 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
604 'filepage-nofile-link',
605 $uploadTitle->getFullURL( array( 'wpDestFile' => $this->mPage
->getFile()->getName() ) )
608 $nofile = 'filepage-nofile';
610 // Note, if there is an image description page, but
611 // no image, then this setRobotPolicy is overridden
612 // by Article::View().
613 $out->setRobotPolicy( 'noindex,nofollow' );
614 $out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
615 if ( !$this->getID() && $wgSend404Code ) {
616 // If there is no image, no shared image, and no description page,
617 // output a 404, to be consistent with articles.
618 $request->response()->header( 'HTTP/1.1 404 Not Found' );
621 $out->setFileVersion( $this->displayImg
);
625 * Creates an thumbnail of specified size and returns an HTML link to it
626 * @param array $params Scaler parameters
631 private function makeSizeLink( $params, $width, $height ) {
632 $params['width'] = $width;
633 $params['height'] = $height;
634 $thumbnail = $this->displayImg
->transform( $params );
635 if ( $thumbnail && !$thumbnail->isError() ) {
636 return Html
::rawElement( 'a', array(
637 'href' => $thumbnail->getUrl(),
638 'class' => 'mw-thumbnail-link'
639 ), $this->getContext()->msg( 'show-big-image-size' )->numParams(
640 $thumbnail->getWidth(), $thumbnail->getHeight()
648 * Show a notice that the file is from a shared repository
650 protected function printSharedImageText() {
651 $out = $this->getContext()->getOutput();
654 $descUrl = $this->mPage
->getFile()->getDescriptionUrl();
655 $descText = $this->mPage
->getFile()->getDescriptionText( $this->getContext()->getLanguage() );
657 /* Add canonical to head if there is no local page for this shared file */
658 if ( $descUrl && $this->mPage
->getID() == 0 ) {
659 $out->setCanonicalUrl( $descUrl );
662 $wrap = "<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
663 $repo = $this->mPage
->getFile()->getRepo()->getDisplayName();
665 if ( $descUrl && $descText && $this->getContext()->msg( 'sharedupload-desc-here' )->plain() !== '-' ) {
666 $out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-here', $repo, $descUrl ) );
667 } elseif ( $descUrl && $this->getContext()->msg( 'sharedupload-desc-there' )->plain() !== '-' ) {
668 $out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-there', $repo, $descUrl ) );
670 $out->wrapWikiMsg( $wrap, array( 'sharedupload', $repo ), ''/*BACKCOMPAT*/ );
674 $this->mExtraDescription
= $descText;
678 public function getUploadUrl() {
680 $uploadTitle = SpecialPage
::getTitleFor( 'Upload' );
681 return $uploadTitle->getFullURL( array(
682 'wpDestFile' => $this->mPage
->getFile()->getName(),
688 * Print out the various links at the bottom of the image page, e.g. reupload,
689 * external editing (and instructions link) etc.
691 protected function uploadLinksBox() {
692 global $wgEnableUploads;
694 if ( !$wgEnableUploads ) {
699 if ( !$this->mPage
->getFile()->isLocal() ) {
703 $out = $this->getContext()->getOutput();
704 $out->addHTML( "<ul>\n" );
706 # "Upload a new version of this file" link
707 $canUpload = $this->getTitle()->userCan( 'upload', $this->getContext()->getUser() );
708 if ( $canUpload && UploadBase
::userCanReUpload(
709 $this->getContext()->getUser(),
710 $this->mPage
->getFile()->name
)
712 $ulink = Linker
::makeExternalLink(
713 $this->getUploadUrl(),
714 $this->getContext()->msg( 'uploadnewversion-linktext' )->text()
716 $out->addHTML( "<li id=\"mw-imagepage-reupload-link\">"
717 . "<div class=\"plainlinks\">{$ulink}</div></li>\n" );
719 $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">"
720 . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" );
723 $out->addHTML( "</ul>\n" );
729 protected function closeShowImage() {
733 * If the page we've just displayed is in the "Image" namespace,
734 * we follow it with an upload history of the image and its usage.
736 protected function imageHistory() {
738 $out = $this->getContext()->getOutput();
739 $pager = new ImageHistoryPseudoPager( $this );
740 $out->addHTML( $pager->getBody() );
741 $out->preventClickjacking( $pager->getPreventClickjacking() );
743 $this->mPage
->getFile()->resetHistory(); // free db resources
745 # Exist check because we don't want to show this on pages where an image
746 # doesn't exist along with the noimage message, that would suck. -ævar
747 if ( $this->mPage
->getFile()->exists() ) {
748 $this->uploadLinksBox();
753 * @param string $target
755 * @return ResultWrapper
757 protected function queryImageLinks( $target, $limit ) {
758 $dbr = wfGetDB( DB_SLAVE
);
761 array( 'imagelinks', 'page' ),
762 array( 'page_namespace', 'page_title', 'il_to' ),
763 array( 'il_to' => $target, 'il_from = page_id' ),
765 array( 'LIMIT' => $limit +
1, 'ORDER BY' => 'il_from', )
769 protected function imageLinks() {
772 $out = $this->getContext()->getOutput();
775 $redirects = array();
776 foreach ( $this->getTitle()->getRedirectsHere( NS_FILE
) as $redir ) {
777 $redirects[$redir->getDBkey()] = array();
778 $rows[] = (object)array(
779 'page_namespace' => NS_FILE
,
780 'page_title' => $redir->getDBkey(),
784 $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit +
1 );
785 foreach ( $res as $row ) {
788 $count = count( $rows );
790 $hasMore = $count > $limit;
791 if ( !$hasMore && count( $redirects ) ) {
792 $res = $this->queryImageLinks( array_keys( $redirects ),
793 $limit - count( $rows ) +
1 );
794 foreach ( $res as $row ) {
795 $redirects[$row->il_to
][] = $row;
798 $hasMore = ( $res->numRows() +
count( $rows ) ) > $limit;
803 Html
::rawElement( 'div',
804 array( 'id' => 'mw-imagepage-nolinkstoimage' ), "\n$1\n" ),
810 $out->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
812 $out->addWikiMsg( 'linkstoimage', $count );
814 // More links than the limit. Add a link to [[Special:Whatlinkshere]]
815 $out->addWikiMsg( 'linkstoimage-more',
816 $this->getContext()->getLanguage()->formatNum( $limit ),
817 $this->getTitle()->getPrefixedDBkey()
822 Html
::openElement( 'ul',
823 array( 'class' => 'mw-imagepage-linkstoimage' ) ) . "\n"
827 // Sort the list by namespace:title
828 usort( $rows, array( $this, 'compare' ) );
830 // Create links for every element
832 foreach ( $rows as $element ) {
834 if ( $currentCount > $limit ) {
839 # Add a redirect=no to make redirect pages reachable
840 if ( isset( $redirects[$element->page_title
] ) ) {
841 $query['redirect'] = 'no';
843 $link = Linker
::linkKnown(
844 Title
::makeTitle( $element->page_namespace
, $element->page_title
),
845 null, array(), $query
847 if ( !isset( $redirects[$element->page_title
] ) ) {
850 } elseif ( count( $redirects[$element->page_title
] ) === 0 ) {
851 # Redirect without usages
852 $liContents = $this->getContext()->msg( 'linkstoimage-redirect' )->rawParams( $link, '' )->parse();
854 # Redirect with usages
856 foreach ( $redirects[$element->page_title
] as $row ) {
858 if ( $currentCount > $limit ) {
862 $link2 = Linker
::linkKnown( Title
::makeTitle( $row->page_namespace
, $row->page_title
) );
863 $li .= Html
::rawElement(
865 array( 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace
),
870 $ul = Html
::rawElement(
872 array( 'class' => 'mw-imagepage-redirectstofile' ),
875 $liContents = $this->getContext()->msg( 'linkstoimage-redirect' )->rawParams(
876 $link, $ul )->parse();
878 $out->addHTML( Html
::rawElement(
880 array( 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace
),
886 $out->addHTML( Html
::closeElement( 'ul' ) . "\n" );
889 // Add a links to [[Special:Whatlinkshere]]
890 if ( $count > $limit ) {
891 $out->addWikiMsg( 'morelinkstoimage', $this->getTitle()->getPrefixedDBkey() );
893 $out->addHTML( Html
::closeElement( 'div' ) . "\n" );
896 protected function imageDupes() {
898 $out = $this->getContext()->getOutput();
900 $dupes = $this->mPage
->getDuplicates();
901 if ( count( $dupes ) == 0 ) {
905 $out->addHTML( "<div id='mw-imagepage-section-duplicates'>\n" );
906 $out->addWikiMsg( 'duplicatesoffile',
907 $this->getContext()->getLanguage()->formatNum( count( $dupes ) ), $this->getTitle()->getDBkey()
909 $out->addHTML( "<ul class='mw-imagepage-duplicates'>\n" );
914 foreach ( $dupes as $file ) {
916 if ( $file->isLocal() ) {
917 $link = Linker
::linkKnown( $file->getTitle() );
919 $link = Linker
::makeExternalLink( $file->getDescriptionUrl(),
920 $file->getTitle()->getPrefixedText() );
921 $fromSrc = $this->getContext()->msg( 'shared-repo-from', $file->getRepo()->getDisplayName() )->text();
923 $out->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
925 $out->addHTML( "</ul></div>\n" );
929 * Delete the file, or an earlier version of it
931 public function delete() {
932 $file = $this->mPage
->getFile();
933 if ( !$file->exists() ||
!$file->isLocal() ||
$file->getRedirected() ) {
934 // Standard article deletion
939 $deleter = new FileDeleteForm( $file );
944 * Display an error with a wikitext description
946 * @param string $description
948 function showError( $description ) {
949 $out = $this->getContext()->getOutput();
950 $out->setPageTitle( $this->getContext()->msg( 'internalerror' ) );
951 $out->setRobotPolicy( 'noindex,nofollow' );
952 $out->setArticleRelated( false );
953 $out->enableClientCache( false );
954 $out->addWikiText( $description );
958 * Callback for usort() to do link sorts by (namespace, title)
959 * Function copied from Title::compare()
961 * @param object $a Object page to compare with
962 * @param object $b Object page to compare with
963 * @return int Result of string comparison, or namespace comparison
965 protected function compare( $a, $b ) {
966 if ( $a->page_namespace
== $b->page_namespace
) {
967 return strcmp( $a->page_title
, $b->page_title
);
969 return $a->page_namespace
- $b->page_namespace
;
974 * Returns the corresponding $wgImageLimits entry for the selected user option
977 * @param string $optionName Name of a option to check, typically imagesize or thumbsize
981 public function getImageLimitsFromOption( $user, $optionName ) {
982 global $wgImageLimits;
984 $option = $user->getIntOption( $optionName );
985 if ( !isset( $wgImageLimits[$option] ) ) {
986 $option = User
::getDefaultOption( $optionName );
989 // The user offset might still be incorrect, specially if
990 // $wgImageLimits got changed (see bug #8858).
991 if ( !isset( $wgImageLimits[$option] ) ) {
992 // Default to the first offset in $wgImageLimits
996 return isset( $wgImageLimits[$option] )
997 ?
$wgImageLimits[$option]
998 : array( 800, 600 ); // if nothing is set, fallback to a hardcoded default
1002 * Output a drop-down box for language options for the file
1004 * @param array $langChoices Array of string language codes
1005 * @param string $curLang Language code file is being viewed in.
1006 * @param string $defaultLang Language code that image is rendered in by default
1007 * @return string HTML to insert underneath image.
1009 protected function doRenderLangOpt( array $langChoices, $curLang, $defaultLang ) {
1011 sort( $langChoices );
1012 $curLang = wfBCP47( $curLang );
1013 $defaultLang = wfBCP47( $defaultLang );
1015 $haveCurrentLang = false;
1016 $haveDefaultLang = false;
1018 // We make a list of all the language choices in the file.
1019 // Additionally if the default language to render this file
1020 // is not included as being in this file (for example, in svgs
1021 // usually the fallback content is the english content) also
1022 // include a choice for that. Last of all, if we're viewing
1023 // the file in a language not on the list, add it as a choice.
1024 foreach ( $langChoices as $lang ) {
1025 $code = wfBCP47( $lang );
1026 $name = Language
::fetchLanguageName( $code, $this->getContext()->getLanguage()->getCode() );
1027 if ( $name !== '' ) {
1028 $display = $this->getContext()->msg( 'img-lang-opt', $code, $name )->text();
1032 $opts .= "\n" . Xml
::option( $display, $code, $curLang === $code );
1033 if ( $curLang === $code ) {
1034 $haveCurrentLang = true;
1036 if ( $defaultLang === $code ) {
1037 $haveDefaultLang = true;
1040 if ( !$haveDefaultLang ) {
1041 // Its hard to know if the content is really in the default language, or
1042 // if its just unmarked content that could be in any language.
1043 $opts = Xml
::option(
1044 $this->getContext()->msg( 'img-lang-default' )->text(),
1046 $defaultLang === $curLang
1049 if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
1050 $name = Language
::fetchLanguageName( $curLang, $this->getContext()->getLanguage()->getCode() );
1051 if ( $name !== '' ) {
1052 $display = $this->getContext()->msg( 'img-lang-opt', $curLang, $name )->text();
1054 $display = $curLang;
1056 $opts = Xml
::option( $display, $curLang, true ) . $opts;
1059 $select = Html
::rawElement(
1061 array( 'id' => 'mw-imglangselector', 'name' => 'lang' ),
1064 $submit = Xml
::submitButton( $this->getContext()->msg( 'img-lang-go' )->text() );
1066 $formContents = $this->getContext()->msg( 'img-lang-info' )->rawParams( $select, $submit )->parse()
1067 . Html
::hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
1069 $langSelectLine = Html
::rawElement( 'div', array( 'id' => 'mw-imglangselector-line' ),
1070 Html
::rawElement( 'form', array( 'action' => $wgScript ), $formContents )
1072 return $langSelectLine;
1076 * Get the width and height to display image at.
1078 * @note This method assumes that it is only called if one
1079 * of the dimensions are bigger than the max, or if the
1080 * image is vectorized.
1082 * @param int $maxWidth Max width to display at
1083 * @param int $maxHeight Max height to display at
1084 * @param int $width Actual width of the image
1085 * @param int $height Actual height of the image
1086 * @throws MWException
1087 * @return array Array (width, height)
1089 protected function getDisplayWidthHeight( $maxWidth, $maxHeight, $width, $height ) {
1090 if ( !$maxWidth ||
!$maxHeight ) {
1091 // should never happen
1092 throw new MWException( 'Using a choice from $wgImageLimits that is 0x0' );
1095 if ( !$width ||
!$height ) {
1096 return array( 0, 0 );
1099 # Calculate the thumbnail size.
1100 if ( $width <= $maxWidth && $height <= $maxHeight ) {
1101 // Vectorized image, do nothing.
1102 } elseif ( $width / $height >= $maxWidth / $maxHeight ) {
1103 # The limiting factor is the width, not the height.
1104 $height = round( $height * $maxWidth / $width );
1106 # Note that $height <= $maxHeight now.
1108 $newwidth = floor( $width * $maxHeight / $height );
1109 $height = round( $height * $newwidth / $width );
1111 # Note that $height <= $maxHeight now, but might not be identical
1112 # because of rounding.
1114 return array( $width, $height );
1118 * Get alternative thumbnail sizes.
1120 * @note This will only list several alternatives if thumbnails are rendered on 404
1121 * @param int $origWidth Actual width of image
1122 * @param int $origHeight Actual height of image
1123 * @return array An array of [width, height] pairs.
1125 protected function getThumbSizes( $origWidth, $origHeight ) {
1126 global $wgImageLimits;
1127 if ( $this->displayImg
->getRepo()->canTransformVia404() ) {
1128 $thumbSizes = $wgImageLimits;
1129 // Also include the full sized resolution in the list, so
1130 // that users know they can get it. This will link to the
1131 // original file asset if mustRender() === false. In the case
1132 // that we mustRender, some users have indicated that they would
1133 // find it useful to have the full size image in the rendered
1135 $thumbSizes[] = array( $origWidth, $origHeight );
1137 # Creating thumb links triggers thumbnail generation.
1138 # Just generate the thumb for the current users prefs.
1139 $thumbSizes = array( $this->getImageLimitsFromOption( $this->getContext()->getUser(), 'thumbsize' ) );
1140 if ( !$this->displayImg
->mustRender() ) {
1141 // We can safely include a link to the "full-size" preview,
1142 // without actually rendering.
1143 $thumbSizes[] = array( $origWidth, $origHeight );
1152 * Builds the image revision log shown on image pages
1156 class ImageHistoryList
extends ContextSource
{
1171 protected $imagePage;
1178 protected $repo, $showThumb;
1179 protected $preventClickjacking = false;
1182 * @param ImagePage $imagePage
1184 public function __construct( $imagePage ) {
1185 global $wgShowArchiveThumbnails;
1186 $this->current
= $imagePage->getFile();
1187 $this->img
= $imagePage->getDisplayedFile();
1188 $this->title
= $imagePage->getTitle();
1189 $this->imagePage
= $imagePage;
1190 $this->showThumb
= $wgShowArchiveThumbnails && $this->img
->canRender();
1191 $this->setContext( $imagePage->getContext() );
1197 public function getImagePage() {
1198 return $this->imagePage
;
1204 public function getFile() {
1209 * @param string $navLinks
1212 public function beginImageHistoryList( $navLinks = '' ) {
1213 return Xml
::element( 'h2', array( 'id' => 'filehistory' ), $this->msg( 'filehist' )->text() )
1215 . "<div id=\"mw-imagepage-section-filehistory\">\n"
1216 . $this->msg( 'filehist-help' )->parseAsBlock()
1218 . Xml
::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
1220 . ( $this->current
->isLocal()
1221 && ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ?
'<th></th>' : '' )
1222 . '<th>' . $this->msg( 'filehist-datetime' )->escaped() . '</th>'
1223 . ( $this->showThumb ?
'<th>' . $this->msg( 'filehist-thumb' )->escaped() . '</th>' : '' )
1224 . '<th>' . $this->msg( 'filehist-dimensions' )->escaped() . '</th>'
1225 . '<th>' . $this->msg( 'filehist-user' )->escaped() . '</th>'
1226 . '<th>' . $this->msg( 'filehist-comment' )->escaped() . '</th>'
1231 * @param string $navLinks
1234 public function endImageHistoryList( $navLinks = '' ) {
1235 return "</table>\n$navLinks\n</div>\n";
1239 * @param bool $iscur
1243 public function imageHistoryLine( $iscur, $file ) {
1246 $user = $this->getUser();
1247 $lang = $this->getLanguage();
1248 $timestamp = wfTimestamp( TS_MW
, $file->getTimestamp() );
1249 $img = $iscur ?
$file->getName() : $file->getArchiveName();
1250 $userId = $file->getUser( 'id' );
1251 $userText = $file->getUser( 'text' );
1252 $description = $file->getDescription( File
::FOR_THIS_USER
, $user );
1254 $local = $this->current
->isLocal();
1255 $row = $selected = '';
1258 if ( $local && ( $user->isAllowedAny( 'delete', 'deletedhistory' ) ) ) {
1260 # Link to remove from history
1261 if ( $user->isAllowed( 'delete' ) ) {
1262 $q = array( 'action' => 'delete' );
1264 $q['oldimage'] = $img;
1266 $row .= Linker
::linkKnown(
1268 $this->msg( $iscur ?
'filehist-deleteall' : 'filehist-deleteone' )->escaped(),
1272 # Link to hide content. Don't show useless link to people who cannot hide revisions.
1273 $canHide = $user->isAllowed( 'deleterevision' );
1274 if ( $canHide ||
( $user->isAllowed( 'deletedhistory' ) && $file->getVisibility() ) ) {
1275 if ( $user->isAllowed( 'delete' ) ) {
1278 // If file is top revision or locked from this user, don't link
1279 if ( $iscur ||
!$file->userCan( File
::DELETED_RESTRICTED
, $user ) ) {
1280 $del = Linker
::revDeleteLinkDisabled( $canHide );
1282 list( $ts, ) = explode( '!', $img, 2 );
1284 'type' => 'oldimage',
1285 'target' => $this->title
->getPrefixedText(),
1288 $del = Linker
::revDeleteLink( $query,
1289 $file->isDeleted( File
::DELETED_RESTRICTED
), $canHide );
1296 // Reversion link/current indicator
1299 $row .= $this->msg( 'filehist-current' )->escaped();
1300 } elseif ( $local && $this->title
->quickUserCan( 'edit', $user )
1301 && $this->title
->quickUserCan( 'upload', $user )
1303 if ( $file->isDeleted( File
::DELETED_FILE
) ) {
1304 $row .= $this->msg( 'filehist-revert' )->escaped();
1306 $row .= Linker
::linkKnown(
1308 $this->msg( 'filehist-revert' )->escaped(),
1311 'action' => 'revert',
1313 'wpEditToken' => $user->getEditToken( $img )
1320 // Date/time and image link
1321 if ( $file->getTimestamp() === $this->img
->getTimestamp() ) {
1322 $selected = "class='filehistory-selected'";
1324 $row .= "<td $selected style='white-space: nowrap;'>";
1325 if ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
1326 # Don't link to unviewable files
1327 $row .= '<span class="history-deleted">'
1328 . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
1329 } elseif ( $file->isDeleted( File
::DELETED_FILE
) ) {
1331 $this->preventClickjacking();
1332 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
1333 # Make a link to review the image
1334 $url = Linker
::linkKnown(
1336 $lang->userTimeAndDate( $timestamp, $user ),
1339 'target' => $this->title
->getPrefixedText(),
1341 'token' => $user->getEditToken( $img )
1345 $url = $lang->userTimeAndDate( $timestamp, $user );
1347 $row .= '<span class="history-deleted">' . $url . '</span>';
1348 } elseif ( !$file->exists() ) {
1349 $row .= '<span class="mw-file-missing">'
1350 . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
1352 $url = $iscur ?
$this->current
->getUrl() : $this->current
->getArchiveUrl( $img );
1353 $row .= Xml
::element(
1355 array( 'href' => $url ),
1356 $lang->userTimeAndDate( $timestamp, $user )
1362 if ( $this->showThumb
) {
1363 $row .= '<td>' . $this->getThumbForLine( $file ) . '</td>';
1366 // Image dimensions + size
1368 $row .= htmlspecialchars( $file->getDimensionsString() );
1369 $row .= $this->msg( 'word-separator' )->escaped();
1370 $row .= '<span style="white-space: nowrap;">';
1371 $row .= $this->msg( 'parentheses' )->sizeParams( $file->getSize() )->escaped();
1377 // Hide deleted usernames
1378 if ( $file->isDeleted( File
::DELETED_USER
) ) {
1379 $row .= '<span class="history-deleted">'
1380 . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
1383 $row .= Linker
::userLink( $userId, $userText );
1384 $row .= '<span style="white-space: nowrap;">';
1385 $row .= Linker
::userToolLinks( $userId, $userText );
1388 $row .= htmlspecialchars( $userText );
1393 // Don't show deleted descriptions
1394 if ( $file->isDeleted( File
::DELETED_COMMENT
) ) {
1395 $row .= '<td><span class="history-deleted">' .
1396 $this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
1398 $row .= '<td dir="' . $wgContLang->getDir() . '">' .
1399 Linker
::formatComment( $description, $this->title
) . '</td>';
1403 Hooks
::run( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
1404 $classAttr = $rowClass ?
" class='$rowClass'" : '';
1406 return "<tr{$classAttr}>{$row}</tr>\n";
1413 protected function getThumbForLine( $file ) {
1414 $lang = $this->getLanguage();
1415 $user = $this->getUser();
1416 if ( $file->allowInlineDisplay() && $file->userCan( File
::DELETED_FILE
, $user )
1417 && !$file->isDeleted( File
::DELETED_FILE
)
1423 $timestamp = wfTimestamp( TS_MW
, $file->getTimestamp() );
1425 $thumbnail = $file->transform( $params );
1427 'alt' => $this->msg( 'filehist-thumbtext',
1428 $lang->userTimeAndDate( $timestamp, $user ),
1429 $lang->userDate( $timestamp, $user ),
1430 $lang->userTime( $timestamp, $user ) )->text(),
1431 'file-link' => true,
1434 if ( !$thumbnail ) {
1435 return $this->msg( 'filehist-nothumb' )->escaped();
1438 return $thumbnail->toHtml( $options );
1440 return $this->msg( 'filehist-nothumb' )->escaped();
1445 * @param bool $enable
1447 protected function preventClickjacking( $enable = true ) {
1448 $this->preventClickjacking
= $enable;
1454 public function getPreventClickjacking() {
1455 return $this->preventClickjacking
;
1459 class ImageHistoryPseudoPager
extends ReverseChronologicalPager
{
1460 protected $preventClickjacking = false;
1473 * @param ImagePage $imagePage
1475 function __construct( $imagePage ) {
1476 parent
::__construct( $imagePage->getContext() );
1477 $this->mImagePage
= $imagePage;
1478 $this->mTitle
= clone ( $imagePage->getTitle() );
1479 $this->mTitle
->setFragment( '#filehistory' );
1481 $this->mHist
= array();
1482 $this->mRange
= array( 0, 0 ); // display range
1488 function getTitle() {
1489 return $this->mTitle
;
1492 function getQueryInfo() {
1499 function getIndexField() {
1504 * @param object $row
1507 function formatRow( $row ) {
1514 function getBody() {
1517 if ( count( $this->mHist
) ) {
1518 $list = new ImageHistoryList( $this->mImagePage
);
1519 # Generate prev/next links
1520 $navLink = $this->getNavigationBar();
1521 $s = $list->beginImageHistoryList( $navLink );
1522 // Skip rows there just for paging links
1523 for ( $i = $this->mRange
[0]; $i <= $this->mRange
[1]; $i++
) {
1524 $file = $this->mHist
[$i];
1525 $s .= $list->imageHistoryLine( !$file->isOld(), $file );
1527 $s .= $list->endImageHistoryList( $navLink );
1529 if ( $list->getPreventClickjacking() ) {
1530 $this->preventClickjacking();
1536 function doQuery() {
1537 if ( $this->mQueryDone
) {
1540 $this->mImg
= $this->mImagePage
->getFile(); // ensure loading
1541 if ( !$this->mImg
->exists() ) {
1544 $queryLimit = $this->mLimit +
1; // limit plus extra row
1545 if ( $this->mIsBackwards
) {
1546 // Fetch the file history
1547 $this->mHist
= $this->mImg
->getHistory( $queryLimit, null, $this->mOffset
, false );
1548 // The current rev may not meet the offset/limit
1549 $numRows = count( $this->mHist
);
1550 if ( $numRows <= $this->mLimit
&& $this->mImg
->getTimestamp() > $this->mOffset
) {
1551 $this->mHist
= array_merge( array( $this->mImg
), $this->mHist
);
1554 // The current rev may not meet the offset
1555 if ( !$this->mOffset ||
$this->mImg
->getTimestamp() < $this->mOffset
) {
1556 $this->mHist
[] = $this->mImg
;
1558 // Old image versions (fetch extra row for nav links)
1559 $oiLimit = count( $this->mHist
) ?
$this->mLimit
: $this->mLimit +
1;
1560 // Fetch the file history
1561 $this->mHist
= array_merge( $this->mHist
,
1562 $this->mImg
->getHistory( $oiLimit, $this->mOffset
, null, false ) );
1564 $numRows = count( $this->mHist
); // Total number of query results
1566 # Index value of top item in the list
1567 $firstIndex = $this->mIsBackwards ?
1568 $this->mHist
[$numRows - 1]->getTimestamp() : $this->mHist
[0]->getTimestamp();
1569 # Discard the extra result row if there is one
1570 if ( $numRows > $this->mLimit
&& $numRows > 1 ) {
1571 if ( $this->mIsBackwards
) {
1572 # Index value of item past the index
1573 $this->mPastTheEndIndex
= $this->mHist
[0]->getTimestamp();
1574 # Index value of bottom item in the list
1575 $lastIndex = $this->mHist
[1]->getTimestamp();
1577 $this->mRange
= array( 1, $numRows - 1 );
1579 # Index value of item past the index
1580 $this->mPastTheEndIndex
= $this->mHist
[$numRows - 1]->getTimestamp();
1581 # Index value of bottom item in the list
1582 $lastIndex = $this->mHist
[$numRows - 2]->getTimestamp();
1584 $this->mRange
= array( 0, $numRows - 2 );
1587 # Setting indexes to an empty string means that they will be
1588 # omitted if they would otherwise appear in URLs. It just so
1589 # happens that this is the right thing to do in the standard
1590 # UI, in all the relevant cases.
1591 $this->mPastTheEndIndex
= '';
1592 # Index value of bottom item in the list
1593 $lastIndex = $this->mIsBackwards ?
1594 $this->mHist
[0]->getTimestamp() : $this->mHist
[$numRows - 1]->getTimestamp();
1596 $this->mRange
= array( 0, $numRows - 1 );
1601 $this->mPastTheEndIndex
= '';
1603 if ( $this->mIsBackwards
) {
1604 $this->mIsFirst
= ( $numRows < $queryLimit );
1605 $this->mIsLast
= ( $this->mOffset
== '' );
1606 $this->mLastShown
= $firstIndex;
1607 $this->mFirstShown
= $lastIndex;
1609 $this->mIsFirst
= ( $this->mOffset
== '' );
1610 $this->mIsLast
= ( $numRows < $queryLimit );
1611 $this->mLastShown
= $lastIndex;
1612 $this->mFirstShown
= $firstIndex;
1614 $this->mQueryDone
= true;
1618 * @param bool $enable
1620 protected function preventClickjacking( $enable = true ) {
1621 $this->preventClickjacking
= $enable;
1627 public function getPreventClickjacking() {
1628 return $this->preventClickjacking
;