From: Conrad Irwin Date: Wed, 27 Jan 2010 03:06:56 +0000 (+0000) Subject: (bug 19600) don't display searchmenu-new when user has not got permission to X-Git-Tag: 1.31.0-rc.0~38090 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=32522d53e0129c41306c93e5ecf8edfa45efe884;p=lhc%2Fweb%2Fwiklou.git (bug 19600) don't display searchmenu-new when user has not got permission to create the page. --- diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index fe1e3cbfba..da054e02bd 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -319,16 +319,20 @@ class SpecialSearch { protected function showCreateLink( $t ) { global $wgOut; - // show direct page/create link + // show direct page/create link if applicable + $messageName = null; if( !is_null($t) ) { - if( !$t->isKnown() ) { - $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $t->getPrefixedText() ) ); - } else { - $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $t->getPrefixedText() ) ); + if( $t->isKnown() ) { + $messageName = 'searchmenu-exists'; + } elseif( $t->userCan( 'create' ) ) { + $messageName = 'searchmenu-new'; } + } + if( $messageName ) { + $wgOut->addWikiMsg( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) ); } else { // preserve the paragraph for margins etc... - $wgOut->addHTML('

'); + $wgOut->addHtml( '

' ); } }