diff options
Diffstat (limited to 'includes/specials/SpecialRecentchangeslinked.php')
-rw-r--r-- | includes/specials/SpecialRecentchangeslinked.php | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index d773fb77..c0734354 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -7,7 +7,8 @@ class SpecialRecentchangeslinked extends SpecialRecentchanges { function __construct(){ - SpecialPage::SpecialPage( 'Recentchangeslinked' ); + SpecialPage::SpecialPage( 'Recentchangeslinked' ); + $this->includable( true ); } public function getDefaultOptions() { @@ -92,10 +93,13 @@ class SpecialRecentchangeslinked extends SpecialRecentchanges { } else { // for now, always join on these tables; really should be configurable as in whatlinkshere $link_tables = array( 'pagelinks', 'templatelinks' ); - // imagelinks only contains links to pages in NS_IMAGE - if( $ns == NS_IMAGE || !$showlinkedto ) $link_tables[] = 'imagelinks'; + // imagelinks only contains links to pages in NS_FILE + if( $ns == NS_FILE || !$showlinkedto ) $link_tables[] = 'imagelinks'; } + if( $id == 0 && !$showlinkedto ) + return false; // nonexistent pages can't link to any pages + // field name prefixes for all the various tables we might want to join with $prefix = array( 'pagelinks' => 'pl', 'templatelinks' => 'tl', 'categorylinks' => 'cl', 'imagelinks' => 'il' ); @@ -105,7 +109,7 @@ class SpecialRecentchangeslinked extends SpecialRecentchanges { $pfx = $prefix[$link_table]; // imagelinks and categorylinks tables have no xx_namespace field, and have xx_to instead of xx_title - if( $link_table == 'imagelinks' ) $link_ns = NS_IMAGE; + if( $link_table == 'imagelinks' ) $link_ns = NS_FILE; else if( $link_table == 'categorylinks' ) $link_ns = NS_CATEGORY; else $link_ns = 0; @@ -145,7 +149,7 @@ class SpecialRecentchangeslinked extends SpecialRecentchanges { $res = $dbr->query( $sql, __METHOD__ ); - if( $dbr->numRows( $res ) == 0 ) + if( $res->numRows() == 0 ) $this->mResultEmpty = true; return $res; @@ -159,17 +163,21 @@ class SpecialRecentchangeslinked extends SpecialRecentchanges { Xml::input( 'target', 40, str_replace('_',' ',$opts['target']) ) . Xml::check( 'showlinkedto', $opts['showlinkedto'], array('id' => 'showlinkedto') ) . ' ' . Xml::label( wfMsg("recentchangeslinked-to"), 'showlinkedto' ) ); - $extraOpts['submit'] = Xml::submitbutton( wfMsg('allpagessubmit') ); return $extraOpts; } - - function setTopText( &$out, $opts ){} - - function setBottomText( &$out, $opts ){ + + function setTopText( OutputPage $out, FormOptions $opts ) { + global $wgUser; + $skin = $wgUser->getSkin(); + if( isset( $this->mTargetTitle ) && is_object( $this->mTargetTitle ) ) + $out->setSubtitle( wfMsg( 'recentchangeslinked-backlink', $skin->link( $this->mTargetTitle, + $this->mTargetTitle->getPrefixedText(), array(), array( 'redirect' => 'no' ) ) ) ); + } + + function setBottomText( OutputPage $out, FormOptions $opts ){ if( isset( $this->mTargetTitle ) && is_object( $this->mTargetTitle ) ){ global $wgUser; $out->setFeedAppendQuery( "target=" . urlencode( $this->mTargetTitle->getPrefixedDBkey() ) ); - $out->addHTML("< ".$wgUser->getSkin()->makeLinkObj( $this->mTargetTitle, "", "redirect=no" )."<hr />\n"); } if( isset( $this->mResultEmpty ) && $this->mResultEmpty ){ $out->addWikiMsg( 'recentchangeslinked-noresult' ); |