From 57f30e2d8910c54397b8005e0b65d1c081bf3a08 Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Thu, 3 May 2007 12:44:05 +0000 Subject: [PATCH] don't show excerpts from non-readable articles --- includes/SpecialSearch.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index fdaa8541a5..c347888123 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -320,6 +320,14 @@ class SpecialSearch { $contextchars = $wgUser->getOption( 'contextchars', 50 ); $link = $sk->makeKnownLinkObj( $t ); + + //If page content is not readable, just return the title. + //This is not quite safe, but better than showing excerpts from non-readable pages + //Note that hiding the entry entirely would screw up paging. + if (!$t->userCanRead()) { + return "
  • {$link}
  • \n"; + } + $revision = Revision::newFromTitle( $t ); $text = $revision->getText(); $size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'), -- 2.20.1