MediaWiki
REL1_21
|
00001 <?php 00028 class ImagePage extends Article { 00029 00033 private $displayImg; 00037 private $repo; 00038 private $fileLoaded; 00039 00040 var $mExtraDescription = false; 00041 00046 protected function newPage( Title $title ) { 00047 // Overload mPage with a file-specific page 00048 return new WikiFilePage( $title ); 00049 } 00050 00056 public static function newFromID( $id ) { 00057 $t = Title::newFromID( $id ); 00058 # @todo FIXME: Doesn't inherit right 00059 return $t == null ? null : new self( $t ); 00060 # return $t == null ? null : new static( $t ); // PHP 5.3 00061 } 00062 00067 public function setFile( $file ) { 00068 $this->mPage->setFile( $file ); 00069 $this->displayImg = $file; 00070 $this->fileLoaded = true; 00071 } 00072 00073 protected function loadFile() { 00074 if ( $this->fileLoaded ) { 00075 return; 00076 } 00077 $this->fileLoaded = true; 00078 00079 $this->displayImg = $img = false; 00080 wfRunHooks( 'ImagePageFindFile', array( $this, &$img, &$this->displayImg ) ); 00081 if ( !$img ) { // not set by hook? 00082 $img = wfFindFile( $this->getTitle() ); 00083 if ( !$img ) { 00084 $img = wfLocalFile( $this->getTitle() ); 00085 } 00086 } 00087 $this->mPage->setFile( $img ); 00088 if ( !$this->displayImg ) { // not set by hook? 00089 $this->displayImg = $img; 00090 } 00091 $this->repo = $img->getRepo(); 00092 } 00093 00098 public function render() { 00099 $this->getContext()->getOutput()->setArticleBodyOnly( true ); 00100 parent::view(); 00101 } 00102 00103 public function view() { 00104 global $wgShowEXIF; 00105 00106 $out = $this->getContext()->getOutput(); 00107 $request = $this->getContext()->getRequest(); 00108 $diff = $request->getVal( 'diff' ); 00109 $diffOnly = $request->getBool( 'diffonly', $this->getContext()->getUser()->getOption( 'diffonly' ) ); 00110 00111 if ( $this->getTitle()->getNamespace() != NS_FILE || ( $diff !== null && $diffOnly ) ) { 00112 parent::view(); 00113 return; 00114 } 00115 00116 $this->loadFile(); 00117 00118 if ( $this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected() ) { 00119 if ( $this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !== null ) { 00120 // mTitle is the same as the redirect target so ask Article 00121 // to perform the redirect for us. 00122 $request->setVal( 'diffonly', 'true' ); 00123 parent::view(); 00124 return; 00125 } else { 00126 // mTitle is not the same as the redirect target so it is 00127 // probably the redirect page itself. Fake the redirect symbol 00128 $out->setPageTitle( $this->getTitle()->getPrefixedText() ); 00129 $out->addHTML( $this->viewRedirect( Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ), 00130 /* $appendSubtitle */ true, /* $forceKnown */ true ) ); 00131 $this->mPage->doViewUpdates( $this->getContext()->getUser() ); 00132 return; 00133 } 00134 } 00135 00136 if ( $wgShowEXIF && $this->displayImg->exists() ) { 00137 // @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata(). 00138 $formattedMetadata = $this->displayImg->formatMetadata(); 00139 $showmeta = $formattedMetadata !== false; 00140 } else { 00141 $showmeta = false; 00142 } 00143 00144 if ( !$diff && $this->displayImg->exists() ) { 00145 $out->addHTML( $this->showTOC( $showmeta ) ); 00146 } 00147 00148 if ( !$diff ) { 00149 $this->openShowImage(); 00150 } 00151 00152 # No need to display noarticletext, we use our own message, output in openShowImage() 00153 if ( $this->mPage->getID() ) { 00154 # NS_FILE is in the user language, but this section (the actual wikitext) 00155 # should be in page content language 00156 $pageLang = $this->getTitle()->getPageViewLanguage(); 00157 $out->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content', 00158 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(), 00159 'class' => 'mw-content-' . $pageLang->getDir() ) ) ); 00160 00161 parent::view(); 00162 00163 $out->addHTML( Xml::closeElement( 'div' ) ); 00164 } else { 00165 # Just need to set the right headers 00166 $out->setArticleFlag( true ); 00167 $out->setPageTitle( $this->getTitle()->getPrefixedText() ); 00168 $this->mPage->doViewUpdates( $this->getContext()->getUser() ); 00169 } 00170 00171 # Show shared description, if needed 00172 if ( $this->mExtraDescription ) { 00173 $fol = wfMessage( 'shareddescriptionfollows' ); 00174 if ( !$fol->isDisabled() ) { 00175 $out->addWikiText( $fol->plain() ); 00176 } 00177 $out->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" ); 00178 } 00179 00180 $this->closeShowImage(); 00181 $this->imageHistory(); 00182 // TODO: Cleanup the following 00183 00184 $out->addHTML( Xml::element( 'h2', 00185 array( 'id' => 'filelinks' ), 00186 wfMessage( 'imagelinks' )->text() ) . "\n" ); 00187 $this->imageDupes(); 00188 # @todo FIXME: For some freaky reason, we can't redirect to foreign images. 00189 # Yet we return metadata about the target. Definitely an issue in the FileRepo 00190 $this->imageLinks(); 00191 00192 # Allow extensions to add something after the image links 00193 $html = ''; 00194 wfRunHooks( 'ImagePageAfterImageLinks', array( $this, &$html ) ); 00195 if ( $html ) { 00196 $out->addHTML( $html ); 00197 } 00198 00199 if ( $showmeta ) { 00200 $out->addHTML( Xml::element( 00201 'h2', 00202 array( 'id' => 'metadata' ), 00203 wfMessage( 'metadata' )->text() ) . "\n" ); 00204 $out->addWikiText( $this->makeMetadataTable( $formattedMetadata ) ); 00205 $out->addModules( array( 'mediawiki.action.view.metadata' ) ); 00206 } 00207 00208 // Add remote Filepage.css 00209 if( !$this->repo->isLocal() ) { 00210 $css = $this->repo->getDescriptionStylesheetUrl(); 00211 if ( $css ) { 00212 $out->addStyle( $css ); 00213 } 00214 } 00215 // always show the local local Filepage.css, bug 29277 00216 $out->addModuleStyles( 'filepage' ); 00217 } 00218 00222 public function getDisplayedFile() { 00223 $this->loadFile(); 00224 return $this->displayImg; 00225 } 00226 00233 protected function showTOC( $metadata ) { 00234 $r = array( 00235 '<li><a href="#file">' . wfMessage( 'file-anchor-link' )->escaped() . '</a></li>', 00236 '<li><a href="#filehistory">' . wfMessage( 'filehist' )->escaped() . '</a></li>', 00237 '<li><a href="#filelinks">' . wfMessage( 'imagelinks' )->escaped() . '</a></li>', 00238 ); 00239 if ( $metadata ) { 00240 $r[] = '<li><a href="#metadata">' . wfMessage( 'metadata' )->escaped() . '</a></li>'; 00241 } 00242 00243 wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) ); 00244 00245 return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>'; 00246 } 00247 00256 protected function makeMetadataTable( $metadata ) { 00257 $r = "<div class=\"mw-imagepage-section-metadata\">"; 00258 $r .= wfMessage( 'metadata-help' )->plain(); 00259 $r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n"; 00260 foreach ( $metadata as $type => $stuff ) { 00261 foreach ( $stuff as $v ) { 00262 # @todo FIXME: Why is this using escapeId for a class?! 00263 $class = Sanitizer::escapeId( $v['id'] ); 00264 if ( $type == 'collapsed' ) { 00265 $class .= ' collapsable'; // sic 00266 } 00267 $r .= "<tr class=\"$class\">\n"; 00268 $r .= "<th>{$v['name']}</th>\n"; 00269 $r .= "<td>{$v['value']}</td>\n</tr>"; 00270 } 00271 } 00272 $r .= "</table>\n</div>\n"; 00273 return $r; 00274 } 00275 00283 public function getContentObject() { 00284 $this->loadFile(); 00285 if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getID() ) { 00286 return null; 00287 } 00288 return parent::getContentObject(); 00289 } 00290 00291 protected function openShowImage() { 00292 global $wgImageLimits, $wgEnableUploads, $wgSend404Code; 00293 00294 $this->loadFile(); 00295 $out = $this->getContext()->getOutput(); 00296 $user = $this->getContext()->getUser(); 00297 $lang = $this->getContext()->getLanguage(); 00298 $dirmark = $lang->getDirMarkEntity(); 00299 $request = $this->getContext()->getRequest(); 00300 00301 $max = $this->getImageLimitsFromOption( $user, 'imagesize' ); 00302 $maxWidth = $max[0]; 00303 $maxHeight = $max[1]; 00304 00305 if ( $this->displayImg->exists() ) { 00306 # image 00307 $page = $request->getIntOrNull( 'page' ); 00308 if ( is_null( $page ) ) { 00309 $params = array(); 00310 $page = 1; 00311 } else { 00312 $params = array( 'page' => $page ); 00313 } 00314 $width_orig = $this->displayImg->getWidth( $page ); 00315 $width = $width_orig; 00316 $height_orig = $this->displayImg->getHeight( $page ); 00317 $height = $height_orig; 00318 00319 $filename = wfEscapeWikiText( $this->displayImg->getName() ); 00320 $linktext = $filename; 00321 00322 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) ); 00323 00324 if ( $this->displayImg->allowInlineDisplay() ) { 00325 # image 00326 00327 # "Download high res version" link below the image 00328 # $msgsize = wfMessage( 'file-info-size', $width_orig, $height_orig, Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped(); 00329 # We'll show a thumbnail of this image 00330 if ( $width > $maxWidth || $height > $maxHeight ) { 00331 # Calculate the thumbnail size. 00332 # First case, the limiting factor is the width, not the height. 00333 if ( $width / $height >= $maxWidth / $maxHeight ) { // FIXME: Possible division by 0. bug 36911 00334 $height = round( $height * $maxWidth / $width ); // FIXME: Possible division by 0. bug 36911 00335 $width = $maxWidth; 00336 # Note that $height <= $maxHeight now. 00337 } else { 00338 $newwidth = floor( $width * $maxHeight / $height ); // FIXME: Possible division by 0. bug 36911 00339 $height = round( $height * $newwidth / $width ); // FIXME: Possible division by 0. bug 36911 00340 $width = $newwidth; 00341 # Note that $height <= $maxHeight now, but might not be identical 00342 # because of rounding. 00343 } 00344 $linktext = wfMessage( 'show-big-image' )->escaped(); 00345 if ( $this->displayImg->getRepo()->canTransformVia404() ) { 00346 $thumbSizes = $wgImageLimits; 00347 } else { 00348 # Creating thumb links triggers thumbnail generation. 00349 # Just generate the thumb for the current users prefs. 00350 $thumbSizes = array( $this->getImageLimitsFromOption( $user, 'thumbsize' ) ); 00351 } 00352 # Generate thumbnails or thumbnail links as needed... 00353 $otherSizes = array(); 00354 foreach ( $thumbSizes as $size ) { 00355 if ( $size[0] < $width_orig && $size[1] < $height_orig 00356 && $size[0] != $width && $size[1] != $height ) 00357 { 00358 $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] ); 00359 if ( $sizeLink ) { 00360 $otherSizes[] = $sizeLink; 00361 } 00362 } 00363 } 00364 $msgsmall = ''; 00365 $sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height ); 00366 if ( $sizeLinkBigImagePreview ) { 00367 $msgsmall .= wfMessage( 'show-big-image-preview' )-> 00368 rawParams( $sizeLinkBigImagePreview )-> 00369 parse(); 00370 } 00371 if ( count( $otherSizes ) ) { 00372 $msgsmall .= ' ' . 00373 Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ), 00374 wfMessage( 'show-big-image-other' )->rawParams( $lang->pipeList( $otherSizes ) )-> 00375 params( count( $otherSizes ) )->parse() 00376 ); 00377 } 00378 } elseif ( $width == 0 && $height == 0 ) { 00379 # Some sort of audio file that doesn't have dimensions 00380 # Don't output a no hi res message for such a file 00381 $msgsmall = ''; 00382 } elseif ( $this->displayImg->isVectorized() ) { 00383 # For vectorized images, full size is just the frame size 00384 $msgsmall = ''; 00385 } else { 00386 # Image is small enough to show full size on image page 00387 $msgsmall = wfMessage( 'file-nohires' )->parse(); 00388 } 00389 00390 $params['width'] = $width; 00391 $params['height'] = $height; 00392 $thumbnail = $this->displayImg->transform( $params ); 00393 00394 $anchorclose = Html::rawElement( 'div', array( 'class' => 'mw-filepage-resolutioninfo' ), $msgsmall ); 00395 00396 $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1; 00397 if ( $isMulti ) { 00398 $out->addHTML( '<table class="multipageimage"><tr><td>' ); 00399 } 00400 00401 if ( $thumbnail ) { 00402 $options = array( 00403 'alt' => $this->displayImg->getTitle()->getPrefixedText(), 00404 'file-link' => true, 00405 ); 00406 $out->addHTML( '<div class="fullImageLink" id="file">' . 00407 $thumbnail->toHtml( $options ) . 00408 $anchorclose . "</div>\n" ); 00409 } 00410 00411 if ( $isMulti ) { 00412 $count = $this->displayImg->pageCount(); 00413 00414 if ( $page > 1 ) { 00415 $label = $out->parse( wfMessage( 'imgmultipageprev' )->text(), false ); 00416 $link = Linker::linkKnown( 00417 $this->getTitle(), 00418 $label, 00419 array(), 00420 array( 'page' => $page - 1 ) 00421 ); 00422 $thumb1 = Linker::makeThumbLinkObj( $this->getTitle(), $this->displayImg, $link, $label, 'none', 00423 array( 'page' => $page - 1 ) ); 00424 } else { 00425 $thumb1 = ''; 00426 } 00427 00428 if ( $page < $count ) { 00429 $label = wfMessage( 'imgmultipagenext' )->text(); 00430 $link = Linker::linkKnown( 00431 $this->getTitle(), 00432 $label, 00433 array(), 00434 array( 'page' => $page + 1 ) 00435 ); 00436 $thumb2 = Linker::makeThumbLinkObj( $this->getTitle(), $this->displayImg, $link, $label, 'none', 00437 array( 'page' => $page + 1 ) ); 00438 } else { 00439 $thumb2 = ''; 00440 } 00441 00442 global $wgScript; 00443 00444 $formParams = array( 00445 'name' => 'pageselector', 00446 'action' => $wgScript, 00447 'onchange' => 'document.pageselector.submit();', 00448 ); 00449 $options = array(); 00450 for ( $i = 1; $i <= $count; $i++ ) { 00451 $options[] = Xml::option( $lang->formatNum( $i ), $i, $i == $page ); 00452 } 00453 $select = Xml::tags( 'select', 00454 array( 'id' => 'pageselector', 'name' => 'page' ), 00455 implode( "\n", $options ) ); 00456 00457 $out->addHTML( 00458 '</td><td><div class="multipageimagenavbox">' . 00459 Xml::openElement( 'form', $formParams ) . 00460 Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . 00461 wfMessage( 'imgmultigoto' )->rawParams( $select )->parse() . 00462 Xml::submitButton( wfMessage( 'imgmultigo' )->text() ) . 00463 Xml::closeElement( 'form' ) . 00464 "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>" 00465 ); 00466 } 00467 } elseif ( $this->displayImg->isSafeFile() ) { 00468 # if direct link is allowed but it's not a renderable image, show an icon. 00469 $icon = $this->displayImg->iconThumb(); 00470 00471 $out->addHTML( '<div class="fullImageLink" id="file">' . 00472 $icon->toHtml( array( 'file-link' => true ) ) . 00473 "</div>\n" ); 00474 } 00475 00476 $longDesc = wfMessage( 'parentheses', $this->displayImg->getLongDesc() )->text(); 00477 00478 $medialink = "[[Media:$filename|$linktext]]"; 00479 00480 if ( !$this->displayImg->isSafeFile() ) { 00481 $warning = wfMessage( 'mediawarning' )->plain(); 00482 // dirmark is needed here to separate the file name, which 00483 // most likely ends in Latin characters, from the description, 00484 // which may begin with the file type. In RTL environment 00485 // this will get messy. 00486 // The dirmark, however, must not be immediately adjacent 00487 // to the filename, because it can get copied with it. 00488 // See bug 25277. 00489 $out->addWikiText( <<<EOT 00490 <div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div> 00491 <div class="mediaWarning">$warning</div> 00492 EOT 00493 ); 00494 } else { 00495 $out->addWikiText( <<<EOT 00496 <div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span> 00497 </div> 00498 EOT 00499 ); 00500 } 00501 00502 // Add cannot animate thumbnail warning 00503 if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) { 00504 // Include the extension so wiki admins can 00505 // customize it on a per file-type basis 00506 // (aka say things like use format X instead). 00507 // additionally have a specific message for 00508 // file-no-thumb-animation-gif 00509 $ext = $this->displayImg->getExtension(); 00510 $noAnimMesg = wfMessageFallback( 00511 'file-no-thumb-animation-' . $ext, 00512 'file-no-thumb-animation' 00513 )->plain(); 00514 00515 $out->addWikiText( <<<EOT 00516 <div class="mw-noanimatethumb">{$noAnimMesg}</div> 00517 EOT 00518 ); 00519 } 00520 00521 if ( !$this->displayImg->isLocal() ) { 00522 $this->printSharedImageText(); 00523 } 00524 } else { 00525 # Image does not exist 00526 if ( !$this->getID() ) { 00527 # No article exists either 00528 # Show deletion log to be consistent with normal articles 00529 LogEventsList::showLogExtract( 00530 $out, 00531 array( 'delete', 'move' ), 00532 $this->getTitle()->getPrefixedText(), 00533 '', 00534 array( 'lim' => 10, 00535 'conds' => array( "log_action != 'revision'" ), 00536 'showIfEmpty' => false, 00537 'msgKey' => array( 'moveddeleted-notice' ) 00538 ) 00539 ); 00540 } 00541 00542 if ( $wgEnableUploads && $user->isAllowed( 'upload' ) ) { 00543 // Only show an upload link if the user can upload 00544 $uploadTitle = SpecialPage::getTitleFor( 'Upload' ); 00545 $nofile = array( 00546 'filepage-nofile-link', 00547 $uploadTitle->getFullURL( array( 'wpDestFile' => $this->mPage->getFile()->getName() ) ) 00548 ); 00549 } else { 00550 $nofile = 'filepage-nofile'; 00551 } 00552 // Note, if there is an image description page, but 00553 // no image, then this setRobotPolicy is overridden 00554 // by Article::View(). 00555 $out->setRobotPolicy( 'noindex,nofollow' ); 00556 $out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile ); 00557 if ( !$this->getID() && $wgSend404Code ) { 00558 // If there is no image, no shared image, and no description page, 00559 // output a 404, to be consistent with articles. 00560 $request->response()->header( 'HTTP/1.1 404 Not Found' ); 00561 } 00562 } 00563 $out->setFileVersion( $this->displayImg ); 00564 } 00565 00573 private function makeSizeLink( $params, $width, $height ) { 00574 $params['width'] = $width; 00575 $params['height'] = $height; 00576 $thumbnail = $this->displayImg->transform( $params ); 00577 if ( $thumbnail && !$thumbnail->isError() ) { 00578 return Html::rawElement( 'a', array( 00579 'href' => $thumbnail->getUrl(), 00580 'class' => 'mw-thumbnail-link' 00581 ), wfMessage( 'show-big-image-size' )->numParams( 00582 $thumbnail->getWidth(), $thumbnail->getHeight() 00583 )->parse() ); 00584 } else { 00585 return ''; 00586 } 00587 } 00588 00592 protected function printSharedImageText() { 00593 $out = $this->getContext()->getOutput(); 00594 $this->loadFile(); 00595 00596 $descUrl = $this->mPage->getFile()->getDescriptionUrl(); 00597 $descText = $this->mPage->getFile()->getDescriptionText(); 00598 00599 /* Add canonical to head if there is no local page for this shared file */ 00600 if( $descUrl && $this->mPage->getID() == 0 ) { 00601 $out->setCanonicalUrl( $descUrl ); 00602 } 00603 00604 $wrap = "<div class=\"sharedUploadNotice\">\n$1\n</div>\n"; 00605 $repo = $this->mPage->getFile()->getRepo()->getDisplayName(); 00606 00607 if ( $descUrl && $descText && wfMessage( 'sharedupload-desc-here' )->plain() !== '-' ) { 00608 $out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-here', $repo, $descUrl ) ); 00609 } elseif ( $descUrl && wfMessage( 'sharedupload-desc-there' )->plain() !== '-' ) { 00610 $out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-there', $repo, $descUrl ) ); 00611 } else { 00612 $out->wrapWikiMsg( $wrap, array( 'sharedupload', $repo ), ''/*BACKCOMPAT*/ ); 00613 } 00614 00615 if ( $descText ) { 00616 $this->mExtraDescription = $descText; 00617 } 00618 } 00619 00620 public function getUploadUrl() { 00621 $this->loadFile(); 00622 $uploadTitle = SpecialPage::getTitleFor( 'Upload' ); 00623 return $uploadTitle->getFullURL( array( 00624 'wpDestFile' => $this->mPage->getFile()->getName(), 00625 'wpForReUpload' => 1 00626 ) ); 00627 } 00628 00633 protected function uploadLinksBox() { 00634 global $wgEnableUploads, $wgUseExternalEditor; 00635 00636 if ( !$wgEnableUploads ) { 00637 return; 00638 } 00639 00640 $this->loadFile(); 00641 if ( !$this->mPage->getFile()->isLocal() ) { 00642 return; 00643 } 00644 00645 $out = $this->getContext()->getOutput(); 00646 $out->addHTML( "<ul>\n" ); 00647 00648 # "Upload a new version of this file" link 00649 $canUpload = $this->getTitle()->userCan( 'upload', $this->getContext()->getUser() ); 00650 if ( $canUpload && UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) { 00651 $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMessage( 'uploadnewversion-linktext' )->text() ); 00652 $out->addHTML( "<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n" ); 00653 } else { 00654 $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" ); 00655 } 00656 00657 # External editing link 00658 if ( $wgUseExternalEditor ) { 00659 $elink = Linker::linkKnown( 00660 $this->getTitle(), 00661 wfMessage( 'edit-externally' )->escaped(), 00662 array(), 00663 array( 00664 'action' => 'edit', 00665 'externaledit' => 'true', 00666 'mode' => 'file' 00667 ) 00668 ); 00669 $out->addHTML( 00670 '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . 00671 wfMessage( 'edit-externally-help' )->parse() . 00672 "</small></li>\n" 00673 ); 00674 } 00675 00676 $out->addHTML( "</ul>\n" ); 00677 } 00678 00679 protected function closeShowImage() { } # For overloading 00680 00685 protected function imageHistory() { 00686 $this->loadFile(); 00687 $out = $this->getContext()->getOutput(); 00688 $pager = new ImageHistoryPseudoPager( $this ); 00689 $out->addHTML( $pager->getBody() ); 00690 $out->preventClickjacking( $pager->getPreventClickjacking() ); 00691 00692 $this->mPage->getFile()->resetHistory(); // free db resources 00693 00694 # Exist check because we don't want to show this on pages where an image 00695 # doesn't exist along with the noimage message, that would suck. -ævar 00696 if ( $this->mPage->getFile()->exists() ) { 00697 $this->uploadLinksBox(); 00698 } 00699 } 00700 00706 protected function queryImageLinks( $target, $limit ) { 00707 $dbr = wfGetDB( DB_SLAVE ); 00708 00709 return $dbr->select( 00710 array( 'imagelinks', 'page' ), 00711 array( 'page_namespace', 'page_title', 'page_is_redirect', 'il_to' ), 00712 array( 'il_to' => $target, 'il_from = page_id' ), 00713 __METHOD__, 00714 array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', ) 00715 ); 00716 } 00717 00718 protected function imageLinks() { 00719 $limit = 100; 00720 00721 $out = $this->getContext()->getOutput(); 00722 $res = $this->queryImageLinks( $this->getTitle()->getDbKey(), $limit + 1); 00723 $rows = array(); 00724 $redirects = array(); 00725 foreach ( $res as $row ) { 00726 if ( $row->page_is_redirect ) { 00727 $redirects[$row->page_title] = array(); 00728 } 00729 $rows[] = $row; 00730 } 00731 $count = count( $rows ); 00732 00733 $hasMore = $count > $limit; 00734 if ( !$hasMore && count( $redirects ) ) { 00735 $res = $this->queryImageLinks( array_keys( $redirects ), 00736 $limit - count( $rows ) + 1 ); 00737 foreach ( $res as $row ) { 00738 $redirects[$row->il_to][] = $row; 00739 $count++; 00740 } 00741 $hasMore = ( $res->numRows() + count( $rows ) ) > $limit; 00742 } 00743 00744 if ( $count == 0 ) { 00745 $out->wrapWikiMsg( 00746 Html::rawElement( 'div', 00747 array( 'id' => 'mw-imagepage-nolinkstoimage' ), "\n$1\n" ), 00748 'nolinkstoimage' 00749 ); 00750 return; 00751 } 00752 00753 $out->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" ); 00754 if ( !$hasMore ) { 00755 $out->addWikiMsg( 'linkstoimage', $count ); 00756 } else { 00757 // More links than the limit. Add a link to [[Special:Whatlinkshere]] 00758 $out->addWikiMsg( 'linkstoimage-more', 00759 $this->getContext()->getLanguage()->formatNum( $limit ), 00760 $this->getTitle()->getPrefixedDBkey() 00761 ); 00762 } 00763 00764 $out->addHTML( 00765 Html::openElement( 'ul', 00766 array( 'class' => 'mw-imagepage-linkstoimage' ) ) . "\n" 00767 ); 00768 $count = 0; 00769 00770 // Sort the list by namespace:title 00771 usort( $rows, array( $this, 'compare' ) ); 00772 00773 // Create links for every element 00774 $currentCount = 0; 00775 foreach( $rows as $element ) { 00776 $currentCount++; 00777 if ( $currentCount > $limit ) { 00778 break; 00779 } 00780 00781 $link = Linker::linkKnown( Title::makeTitle( $element->page_namespace, $element->page_title ) ); 00782 if ( !isset( $redirects[$element->page_title] ) ) { 00783 # No redirects 00784 $liContents = $link; 00785 } elseif ( count( $redirects[$element->page_title] ) === 0 ) { 00786 # Redirect without usages 00787 $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams( $link, '' )->parse(); 00788 } else { 00789 # Redirect with usages 00790 $li = ''; 00791 foreach ( $redirects[$element->page_title] as $row ) { 00792 $currentCount++; 00793 if ( $currentCount > $limit ) { 00794 break; 00795 } 00796 00797 $link2 = Linker::linkKnown( Title::makeTitle( $row->page_namespace, $row->page_title ) ); 00798 $li .= Html::rawElement( 00799 'li', 00800 array( 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ), 00801 $link2 00802 ) . "\n"; 00803 } 00804 00805 $ul = Html::rawElement( 00806 'ul', 00807 array( 'class' => 'mw-imagepage-redirectstofile' ), 00808 $li 00809 ) . "\n"; 00810 $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams( 00811 $link, $ul )->parse(); 00812 } 00813 $out->addHTML( Html::rawElement( 00814 'li', 00815 array( 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ), 00816 $liContents 00817 ) . "\n" 00818 ); 00819 00820 }; 00821 $out->addHTML( Html::closeElement( 'ul' ) . "\n" ); 00822 $res->free(); 00823 00824 // Add a links to [[Special:Whatlinkshere]] 00825 if ( $count > $limit ) { 00826 $out->addWikiMsg( 'morelinkstoimage', $this->getTitle()->getPrefixedDBkey() ); 00827 } 00828 $out->addHTML( Html::closeElement( 'div' ) . "\n" ); 00829 } 00830 00831 protected function imageDupes() { 00832 $this->loadFile(); 00833 $out = $this->getContext()->getOutput(); 00834 00835 $dupes = $this->mPage->getDuplicates(); 00836 if ( count( $dupes ) == 0 ) { 00837 return; 00838 } 00839 00840 $out->addHTML( "<div id='mw-imagepage-section-duplicates'>\n" ); 00841 $out->addWikiMsg( 'duplicatesoffile', 00842 $this->getContext()->getLanguage()->formatNum( count( $dupes ) ), $this->getTitle()->getDBkey() 00843 ); 00844 $out->addHTML( "<ul class='mw-imagepage-duplicates'>\n" ); 00845 00849 foreach ( $dupes as $file ) { 00850 $fromSrc = ''; 00851 if ( $file->isLocal() ) { 00852 $link = Linker::linkKnown( $file->getTitle() ); 00853 } else { 00854 $link = Linker::makeExternalLink( $file->getDescriptionUrl(), 00855 $file->getTitle()->getPrefixedText() ); 00856 $fromSrc = wfMessage( 'shared-repo-from', $file->getRepo()->getDisplayName() )->text(); 00857 } 00858 $out->addHTML( "<li>{$link} {$fromSrc}</li>\n" ); 00859 } 00860 $out->addHTML( "</ul></div>\n" ); 00861 } 00862 00866 public function delete() { 00867 $file = $this->mPage->getFile(); 00868 if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) { 00869 // Standard article deletion 00870 parent::delete(); 00871 return; 00872 } 00873 00874 $deleter = new FileDeleteForm( $file ); 00875 $deleter->execute(); 00876 } 00877 00883 function showError( $description ) { 00884 $out = $this->getContext()->getOutput(); 00885 $out->setPageTitle( wfMessage( 'internalerror' ) ); 00886 $out->setRobotPolicy( 'noindex,nofollow' ); 00887 $out->setArticleRelated( false ); 00888 $out->enableClientCache( false ); 00889 $out->addWikiText( $description ); 00890 } 00891 00900 protected function compare( $a, $b ) { 00901 if ( $a->page_namespace == $b->page_namespace ) { 00902 return strcmp( $a->page_title, $b->page_title ); 00903 } else { 00904 return $a->page_namespace - $b->page_namespace; 00905 } 00906 } 00907 00916 public function getImageLimitsFromOption( $user, $optionName ) { 00917 global $wgImageLimits; 00918 00919 $option = $user->getIntOption( $optionName ); 00920 if ( !isset( $wgImageLimits[$option] ) ) { 00921 $option = User::getDefaultOption( $optionName ); 00922 } 00923 00924 // The user offset might still be incorrect, specially if 00925 // $wgImageLimits got changed (see bug #8858). 00926 if ( !isset( $wgImageLimits[$option] ) ) { 00927 // Default to the first offset in $wgImageLimits 00928 $option = 0; 00929 } 00930 00931 return isset( $wgImageLimits[$option] ) 00932 ? $wgImageLimits[$option] 00933 : array( 800, 600 ); // if nothing is set, fallback to a hardcoded default 00934 } 00935 } 00936 00942 class ImageHistoryList extends ContextSource { 00943 00947 protected $title; 00948 00952 protected $img; 00953 00957 protected $imagePage; 00958 00962 protected $current; 00963 00964 protected $repo, $showThumb; 00965 protected $preventClickjacking = false; 00966 00970 public function __construct( $imagePage ) { 00971 global $wgShowArchiveThumbnails; 00972 $this->current = $imagePage->getFile(); 00973 $this->img = $imagePage->getDisplayedFile(); 00974 $this->title = $imagePage->getTitle(); 00975 $this->imagePage = $imagePage; 00976 $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender(); 00977 $this->setContext( $imagePage->getContext() ); 00978 } 00979 00983 public function getImagePage() { 00984 return $this->imagePage; 00985 } 00986 00990 public function getFile() { 00991 return $this->img; 00992 } 00993 00998 public function beginImageHistoryList( $navLinks = '' ) { 00999 return Xml::element( 'h2', array( 'id' => 'filehistory' ), $this->msg( 'filehist' )->text() ) . "\n" 01000 . "<div id=\"mw-imagepage-section-filehistory\">\n" 01001 . $this->msg( 'filehist-help' )->parseAsBlock() 01002 . $navLinks . "\n" 01003 . Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n" 01004 . '<tr><td></td>' 01005 . ( $this->current->isLocal() && ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '<td></td>' : '' ) 01006 . '<th>' . $this->msg( 'filehist-datetime' )->escaped() . '</th>' 01007 . ( $this->showThumb ? '<th>' . $this->msg( 'filehist-thumb' )->escaped() . '</th>' : '' ) 01008 . '<th>' . $this->msg( 'filehist-dimensions' )->escaped() . '</th>' 01009 . '<th>' . $this->msg( 'filehist-user' )->escaped() . '</th>' 01010 . '<th>' . $this->msg( 'filehist-comment' )->escaped() . '</th>' 01011 . "</tr>\n"; 01012 } 01013 01018 public function endImageHistoryList( $navLinks = '' ) { 01019 return "</table>\n$navLinks\n</div>\n"; 01020 } 01021 01027 public function imageHistoryLine( $iscur, $file ) { 01028 global $wgContLang; 01029 01030 $user = $this->getUser(); 01031 $lang = $this->getLanguage(); 01032 $timestamp = wfTimestamp( TS_MW, $file->getTimestamp() ); 01033 $img = $iscur ? $file->getName() : $file->getArchiveName(); 01034 $userId = $file->getUser( 'id' ); 01035 $userText = $file->getUser( 'text' ); 01036 $description = $file->getDescription( File::FOR_THIS_USER, $user ); 01037 01038 $local = $this->current->isLocal(); 01039 $row = $selected = ''; 01040 01041 // Deletion link 01042 if ( $local && ( $user->isAllowedAny( 'delete', 'deletedhistory' ) ) ) { 01043 $row .= '<td>'; 01044 # Link to remove from history 01045 if ( $user->isAllowed( 'delete' ) ) { 01046 $q = array( 'action' => 'delete' ); 01047 if ( !$iscur ) { 01048 $q['oldimage'] = $img; 01049 } 01050 $row .= Linker::linkKnown( 01051 $this->title, 01052 $this->msg( $iscur ? 'filehist-deleteall' : 'filehist-deleteone' )->escaped(), 01053 array(), $q 01054 ); 01055 } 01056 # Link to hide content. Don't show useless link to people who cannot hide revisions. 01057 $canHide = $user->isAllowed( 'deleterevision' ); 01058 if ( $canHide || ( $user->isAllowed( 'deletedhistory' ) && $file->getVisibility() ) ) { 01059 if ( $user->isAllowed( 'delete' ) ) { 01060 $row .= '<br />'; 01061 } 01062 // If file is top revision or locked from this user, don't link 01063 if ( $iscur || !$file->userCan( File::DELETED_RESTRICTED, $user ) ) { 01064 $del = Linker::revDeleteLinkDisabled( $canHide ); 01065 } else { 01066 list( $ts, ) = explode( '!', $img, 2 ); 01067 $query = array( 01068 'type' => 'oldimage', 01069 'target' => $this->title->getPrefixedText(), 01070 'ids' => $ts, 01071 ); 01072 $del = Linker::revDeleteLink( $query, 01073 $file->isDeleted( File::DELETED_RESTRICTED ), $canHide ); 01074 } 01075 $row .= $del; 01076 } 01077 $row .= '</td>'; 01078 } 01079 01080 // Reversion link/current indicator 01081 $row .= '<td>'; 01082 if ( $iscur ) { 01083 $row .= $this->msg( 'filehist-current' )->escaped(); 01084 } elseif ( $local && $this->title->quickUserCan( 'edit', $user ) 01085 && $this->title->quickUserCan( 'upload', $user ) 01086 ) { 01087 if ( $file->isDeleted( File::DELETED_FILE ) ) { 01088 $row .= $this->msg( 'filehist-revert' )->escaped(); 01089 } else { 01090 $row .= Linker::linkKnown( 01091 $this->title, 01092 $this->msg( 'filehist-revert' )->escaped(), 01093 array(), 01094 array( 01095 'action' => 'revert', 01096 'oldimage' => $img, 01097 'wpEditToken' => $user->getEditToken( $img ) 01098 ) 01099 ); 01100 } 01101 } 01102 $row .= '</td>'; 01103 01104 // Date/time and image link 01105 if ( $file->getTimestamp() === $this->img->getTimestamp() ) { 01106 $selected = "class='filehistory-selected'"; 01107 } 01108 $row .= "<td $selected style='white-space: nowrap;'>"; 01109 if ( !$file->userCan( File::DELETED_FILE, $user ) ) { 01110 # Don't link to unviewable files 01111 $row .= '<span class="history-deleted">' . $lang->userTimeAndDate( $timestamp, $user ) . '</span>'; 01112 } elseif ( $file->isDeleted( File::DELETED_FILE ) ) { 01113 if ( $local ) { 01114 $this->preventClickjacking(); 01115 $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); 01116 # Make a link to review the image 01117 $url = Linker::linkKnown( 01118 $revdel, 01119 $lang->userTimeAndDate( $timestamp, $user ), 01120 array(), 01121 array( 01122 'target' => $this->title->getPrefixedText(), 01123 'file' => $img, 01124 'token' => $user->getEditToken( $img ) 01125 ) 01126 ); 01127 } else { 01128 $url = $lang->userTimeAndDate( $timestamp, $user ); 01129 } 01130 $row .= '<span class="history-deleted">' . $url . '</span>'; 01131 } else { 01132 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img ); 01133 $row .= Xml::element( 'a', array( 'href' => $url ), $lang->userTimeAndDate( $timestamp, $user ) ); 01134 } 01135 $row .= "</td>"; 01136 01137 // Thumbnail 01138 if ( $this->showThumb ) { 01139 $row .= '<td>' . $this->getThumbForLine( $file ) . '</td>'; 01140 } 01141 01142 // Image dimensions + size 01143 $row .= '<td>'; 01144 $row .= htmlspecialchars( $file->getDimensionsString() ); 01145 $row .= $this->msg( 'word-separator' )->plain(); 01146 $row .= '<span style="white-space: nowrap;">'; 01147 $row .= $this->msg( 'parentheses' )->rawParams( Linker::formatSize( $file->getSize() ) )->plain(); 01148 $row .= '</span>'; 01149 $row .= '</td>'; 01150 01151 // Uploading user 01152 $row .= '<td>'; 01153 // Hide deleted usernames 01154 if ( $file->isDeleted( File::DELETED_USER ) ) { 01155 $row .= '<span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>'; 01156 } else { 01157 if ( $local ) { 01158 $row .= Linker::userLink( $userId, $userText ); 01159 $row .= $this->msg( 'word-separator' )->plain(); 01160 $row .= '<span style="white-space: nowrap;">'; 01161 $row .= Linker::userToolLinks( $userId, $userText ); 01162 $row .= '</span>'; 01163 } else { 01164 $row .= htmlspecialchars( $userText ); 01165 } 01166 } 01167 $row .= '</td>'; 01168 01169 // Don't show deleted descriptions 01170 if ( $file->isDeleted( File::DELETED_COMMENT ) ) { 01171 $row .= '<td><span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>'; 01172 } else { 01173 $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::formatComment( $description, $this->title ) . '</td>'; 01174 } 01175 01176 $rowClass = null; 01177 wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) ); 01178 $classAttr = $rowClass ? " class='$rowClass'" : ''; 01179 01180 return "<tr{$classAttr}>{$row}</tr>\n"; 01181 } 01182 01187 protected function getThumbForLine( $file ) { 01188 $lang = $this->getLanguage(); 01189 $user = $this->getUser(); 01190 if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE, $user ) 01191 && !$file->isDeleted( File::DELETED_FILE ) ) 01192 { 01193 $params = array( 01194 'width' => '120', 01195 'height' => '120', 01196 ); 01197 $timestamp = wfTimestamp( TS_MW, $file->getTimestamp() ); 01198 01199 $thumbnail = $file->transform( $params ); 01200 $options = array( 01201 'alt' => $this->msg( 'filehist-thumbtext', 01202 $lang->userTimeAndDate( $timestamp, $user ), 01203 $lang->userDate( $timestamp, $user ), 01204 $lang->userTime( $timestamp, $user ) )->text(), 01205 'file-link' => true, 01206 ); 01207 01208 if ( !$thumbnail ) { 01209 return $this->msg( 'filehist-nothumb' )->escaped(); 01210 } 01211 01212 return $thumbnail->toHtml( $options ); 01213 } else { 01214 return $this->msg( 'filehist-nothumb' )->escaped(); 01215 } 01216 } 01217 01221 protected function preventClickjacking( $enable = true ) { 01222 $this->preventClickjacking = $enable; 01223 } 01224 01228 public function getPreventClickjacking() { 01229 return $this->preventClickjacking; 01230 } 01231 } 01232 01233 class ImageHistoryPseudoPager extends ReverseChronologicalPager { 01234 protected $preventClickjacking = false; 01235 01239 protected $mImg; 01240 01244 protected $mTitle; 01245 01249 function __construct( $imagePage ) { 01250 parent::__construct( $imagePage->getContext() ); 01251 $this->mImagePage = $imagePage; 01252 $this->mTitle = clone ( $imagePage->getTitle() ); 01253 $this->mTitle->setFragment( '#filehistory' ); 01254 $this->mImg = null; 01255 $this->mHist = array(); 01256 $this->mRange = array( 0, 0 ); // display range 01257 } 01258 01262 function getTitle() { 01263 return $this->mTitle; 01264 } 01265 01266 function getQueryInfo() { 01267 return false; 01268 } 01269 01273 function getIndexField() { 01274 return ''; 01275 } 01276 01281 function formatRow( $row ) { 01282 return ''; 01283 } 01284 01288 function getBody() { 01289 $s = ''; 01290 $this->doQuery(); 01291 if ( count( $this->mHist ) ) { 01292 $list = new ImageHistoryList( $this->mImagePage ); 01293 # Generate prev/next links 01294 $navLink = $this->getNavigationBar(); 01295 $s = $list->beginImageHistoryList( $navLink ); 01296 // Skip rows there just for paging links 01297 for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) { 01298 $file = $this->mHist[$i]; 01299 $s .= $list->imageHistoryLine( !$file->isOld(), $file ); 01300 } 01301 $s .= $list->endImageHistoryList( $navLink ); 01302 01303 if ( $list->getPreventClickjacking() ) { 01304 $this->preventClickjacking(); 01305 } 01306 } 01307 return $s; 01308 } 01309 01310 function doQuery() { 01311 if ( $this->mQueryDone ) { 01312 return; 01313 } 01314 $this->mImg = $this->mImagePage->getFile(); // ensure loading 01315 if ( !$this->mImg->exists() ) { 01316 return; 01317 } 01318 $queryLimit = $this->mLimit + 1; // limit plus extra row 01319 if ( $this->mIsBackwards ) { 01320 // Fetch the file history 01321 $this->mHist = $this->mImg->getHistory( $queryLimit, null, $this->mOffset, false ); 01322 // The current rev may not meet the offset/limit 01323 $numRows = count( $this->mHist ); 01324 if ( $numRows <= $this->mLimit && $this->mImg->getTimestamp() > $this->mOffset ) { 01325 $this->mHist = array_merge( array( $this->mImg ), $this->mHist ); 01326 } 01327 } else { 01328 // The current rev may not meet the offset 01329 if ( !$this->mOffset || $this->mImg->getTimestamp() < $this->mOffset ) { 01330 $this->mHist[] = $this->mImg; 01331 } 01332 // Old image versions (fetch extra row for nav links) 01333 $oiLimit = count( $this->mHist ) ? $this->mLimit : $this->mLimit + 1; 01334 // Fetch the file history 01335 $this->mHist = array_merge( $this->mHist, 01336 $this->mImg->getHistory( $oiLimit, $this->mOffset, null, false ) ); 01337 } 01338 $numRows = count( $this->mHist ); // Total number of query results 01339 if ( $numRows ) { 01340 # Index value of top item in the list 01341 $firstIndex = $this->mIsBackwards ? 01342 $this->mHist[$numRows - 1]->getTimestamp() : $this->mHist[0]->getTimestamp(); 01343 # Discard the extra result row if there is one 01344 if ( $numRows > $this->mLimit && $numRows > 1 ) { 01345 if ( $this->mIsBackwards ) { 01346 # Index value of item past the index 01347 $this->mPastTheEndIndex = $this->mHist[0]->getTimestamp(); 01348 # Index value of bottom item in the list 01349 $lastIndex = $this->mHist[1]->getTimestamp(); 01350 # Display range 01351 $this->mRange = array( 1, $numRows - 1 ); 01352 } else { 01353 # Index value of item past the index 01354 $this->mPastTheEndIndex = $this->mHist[$numRows - 1]->getTimestamp(); 01355 # Index value of bottom item in the list 01356 $lastIndex = $this->mHist[$numRows - 2]->getTimestamp(); 01357 # Display range 01358 $this->mRange = array( 0, $numRows - 2 ); 01359 } 01360 } else { 01361 # Setting indexes to an empty string means that they will be 01362 # omitted if they would otherwise appear in URLs. It just so 01363 # happens that this is the right thing to do in the standard 01364 # UI, in all the relevant cases. 01365 $this->mPastTheEndIndex = ''; 01366 # Index value of bottom item in the list 01367 $lastIndex = $this->mIsBackwards ? 01368 $this->mHist[0]->getTimestamp() : $this->mHist[$numRows - 1]->getTimestamp(); 01369 # Display range 01370 $this->mRange = array( 0, $numRows - 1 ); 01371 } 01372 } else { 01373 $firstIndex = ''; 01374 $lastIndex = ''; 01375 $this->mPastTheEndIndex = ''; 01376 } 01377 if ( $this->mIsBackwards ) { 01378 $this->mIsFirst = ( $numRows < $queryLimit ); 01379 $this->mIsLast = ( $this->mOffset == '' ); 01380 $this->mLastShown = $firstIndex; 01381 $this->mFirstShown = $lastIndex; 01382 } else { 01383 $this->mIsFirst = ( $this->mOffset == '' ); 01384 $this->mIsLast = ( $numRows < $queryLimit ); 01385 $this->mLastShown = $lastIndex; 01386 $this->mFirstShown = $firstIndex; 01387 } 01388 $this->mQueryDone = true; 01389 } 01390 01394 protected function preventClickjacking( $enable = true ) { 01395 $this->preventClickjacking = $enable; 01396 } 01397 01401 public function getPreventClickjacking() { 01402 return $this->preventClickjacking; 01403 } 01404 01405 }