MediaWiki  REL1_20
SpecialUnwatchedpages.php
Go to the documentation of this file.
00001 <?php
00032 class UnwatchedpagesPage extends QueryPage {
00033 
00034         function __construct( $name = 'Unwatchedpages' ) {
00035                 parent::__construct( $name, 'unwatchedpages' );
00036         }
00037 
00038         function isExpensive() { return true; }
00039         function isSyndicated() { return false; }
00040 
00041         function getQueryInfo() {
00042                 return array (
00043                         'tables' => array ( 'page', 'watchlist' ),
00044                         'fields' => array ( 'namespace' => 'page_namespace',
00045                                         'title' => 'page_title',
00046                                         'value' => 'page_namespace' ),
00047                         'conds' => array ( 'wl_title IS NULL',
00048                                         'page_is_redirect' => 0,
00049                                         "page_namespace != '" . NS_MEDIAWIKI .
00050                                         "'" ),
00051                         'join_conds' => array ( 'watchlist' => array (
00052                                 'LEFT JOIN', array ( 'wl_title = page_title',
00053                                         'wl_namespace = page_namespace' ) ) )
00054                 );
00055         }
00056 
00057         function sortDescending() { return false; }
00058 
00059         function getOrderFields() {
00060                 return array( 'page_namespace', 'page_title' );
00061         }
00062 
00068         function formatResult( $skin, $result ) {
00069                 global $wgContLang;
00070 
00071                 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
00072                 if ( !$nt ) {
00073                         return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
00074                                 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
00075                 }
00076 
00077                 $text = $wgContLang->convert( $nt->getPrefixedText() );
00078 
00079                 $plink = Linker::linkKnown( $nt, htmlspecialchars( $text ) );
00080                 $token = WatchAction::getWatchToken( $nt, $this->getUser() );
00081                 $wlink = Linker::linkKnown(
00082                         $nt,
00083                         $this->msg( 'watch' )->escaped(),
00084                         array(),
00085                         array( 'action' => 'watch', 'token' => $token )
00086                 );
00087 
00088                 return $this->getLanguage()->specialList( $plink, $wlink );
00089         }
00090 }