r36727 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36726‎ | r36727 | r36728 >
Date:11:43, 27 June 2008
Author:ialex
Status:old
Tags:
Comment:
Tweaks for r36682:
* output an error if an invalid title was given
* Don't allow interwiki links
* Removed unused global definition of $wgContLang in SpecialRecentchanges::makeOptionsLink()
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchangeslinked.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRecentchangeslinked.php
@@ -40,23 +40,23 @@
4141 public function doMainQuery( $conds, $opts ) {
4242 global $wgUser, $wgOut;
4343
44 - $title = Title::newFromURL( $opts['target'] );
 44+ $target = $opts['target'];
4545 $showlinkedto = $opts['showlinkedto'];
4646 $limit = $opts['limit'];
4747
48 - $target = $title ? $title->getPrefixedText() : '';
4948 if ( $target === '' ) {
5049 return false;
5150 }
52 - if( !$title ){
 51+ $title = Title::newFromURL( $target );
 52+ if( !$title || $title->getInterwiki() != '' ){
5353 global $wgOut;
54 - $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 54+ $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div><br clear="both" />', 'allpagesbadtitle' );
5555 return false;
5656 }
57 -
58 - $wgOut->setPageTitle( wfMsg( 'recentchangeslinked-title', $target ) );
5957 $this->mTargetTitle = $title;
6058
 59+ $wgOut->setPageTitle( wfMsg( 'recentchangeslinked-title', $title->getPrefixedText() ) );
 60+
6161 $dbr = wfGetDB( DB_SLAVE, 'recentchangeslinked' );
6262 $id = $title->getArticleId();
6363
@@ -118,10 +118,10 @@
119119 function setTopText( &$out, $opts ){}
120120
121121 function setBottomText( &$out, $opts ){
122 - if( $target = $opts['target'] ){
 122+ if( isset( $this->mTargetTitle ) && is_object( $this->mTargetTitle ) ){
123123 global $wgUser;
124 - $out->setFeedAppendQuery( "target=" . urlencode( $target ) );
125 - $out->addHTML("&lt; ".$wgUser->getSkin()->makeLinkObj( Title::newFromUrl( $target ), "", "redirect=no" )."<hr />\n");
 124+ $out->setFeedAppendQuery( "target=" . urlencode( $this->mTargetTitle->getPrefixedDBkey() ) );
 125+ $out->addHTML("&lt; ".$wgUser->getSkin()->makeLinkObj( $this->mTargetTitle, "", "redirect=no" )."<hr />\n");
126126 }
127127 if( isset( $this->mResultEmpty ) && $this->mResultEmpty ){
128128 $out->addWikiMsg( 'recentchangeslinked-noresult' );
Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -571,11 +571,10 @@
572572 * @param $options
573573 */
574574 function makeOptionsLink( $title, $override, $options, $active = false ) {
575 - global $wgUser, $wgContLang;
 575+ global $wgUser;
576576 $sk = $wgUser->getSkin();
577 - return $sk->makeKnownLinkObj( $this->getTitle(),
578 - htmlspecialchars( $title ), wfArrayToCGI( $override, $options ), '', '',
579 - $active ? 'style="font-weight: bold;"' : '' );
 577+ return $sk->makeKnownLinkObj( $this->getTitle(), htmlspecialchars( $title ),
 578+ wfArrayToCGI( $override, $options ), '', '', $active ? 'style="font-weight: bold;"' : '' );
580579 }
581580
582581 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r36682Rewritten Special:Recentchangeslinked, now using a subclass of SpecialRecentc...ialex19:12, 26 June 2008

Status & tagging log