r61555 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61554‎ | r61555 | r61556 >
Date:03:06, 27 January 2010
Author:conrad
Status:ok
Tags:
Comment:
(bug 19600) don't display searchmenu-new when user has not got permission to
create the page.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -319,16 +319,20 @@
320320 protected function showCreateLink( $t ) {
321321 global $wgOut;
322322
323 - // show direct page/create link
 323+ // show direct page/create link if applicable
 324+ $messageName = null;
324325 if( !is_null($t) ) {
325 - if( !$t->isKnown() ) {
326 - $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $t->getPrefixedText() ) );
327 - } else {
328 - $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $t->getPrefixedText() ) );
 326+ if( $t->isKnown() ) {
 327+ $messageName = 'searchmenu-exists';
 328+ } elseif( $t->userCan( 'create' ) ) {
 329+ $messageName = 'searchmenu-new';
329330 }
 331+ }
 332+ if( $messageName ) {
 333+ $wgOut->addWikiMsg( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) );
330334 } else {
331335 // preserve the paragraph for margins etc...
332 - $wgOut->addHTML('<p></p>');
 336+ $wgOut->addHtml( '<p></p>' );
333337 }
334338 }
335339

Follow-up revisions

RevisionCommit summaryAuthorDate
r65902Add a new searchmenu-new-nocreate message...hartman15:36, 4 May 2010

Status & tagging log