From d78201151474475177ffc060564703aadf4721a5 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 9 Jun 2002 02:16:23 +0000 Subject: [PATCH] Fixed bug #566280 --- lib/WebGUI/Operation/Search.pm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Operation/Search.pm b/lib/WebGUI/Operation/Search.pm index 5ba1c9a2f..d393598de 100644 --- a/lib/WebGUI/Operation/Search.pm +++ b/lib/WebGUI/Operation/Search.pm @@ -15,6 +15,7 @@ use strict; use WebGUI::HTMLForm; use WebGUI::International; use WebGUI::Paginator; +use WebGUI::Privilege; use WebGUI::Search; use WebGUI::Session; use WebGUI::SQL; @@ -25,22 +26,30 @@ our @EXPORT = qw(&www_search); #------------------------------------------------------------------- sub www_search { - my ($constraints, $p, $output, %page, $sth, @row, $i); + my ($constraints, $p, $output, %page, $sth, @row, $i, $url); + $url = WebGUI::URL::page('op=search'); + $url = WebGUI::URL::append($url,'all='.$session{form}{all}) if ($session{form}{all} ne ""); + $url = WebGUI::URL::append($url,'exactPhrase='.$session{form}{exactPhrase}) if ($session{form}{exactPhrase} ne ""); + $url = WebGUI::URL::append($url,'atLeastOne='.$session{form}{atLeastOne}) if ($session{form}{atLeastOne} ne ""); + $url = WebGUI::URL::append($url,'without='.$session{form}{without}) if ($session{form}{without} ne ""); $output = WebGUI::Search::form({op=>'search'}); $constraints = WebGUI::Search::buildConstraints([qw(page.synopsis page.title page.menuTitle page.metaTags page.urlizedTitle wobject.description wobject.title wobject.namespace)]); if ($constraints ne "") { tie %page, 'Tie::CPHash'; - $sth = WebGUI::SQL->read("select page.urlizedTitle,page.title,wobject.wobjectId from page,wobject where $constraints - and page.pageId=wobject.pageId and (page.pageId > 25 or page.pageId=1) and page.pageId<>$session{page}{pageId} order by lastEdited"); + $sth = WebGUI::SQL->read("select page.urlizedTitle,page.title,wobject.wobjectId,page.pageId from page,wobject where $constraints + and page.pageId=wobject.pageId and (page.pageId > 25 or page.pageId=1) + and page.pageId<>$session{page}{pageId} order by lastEdited"); while (%page = $sth->hash) { - $row[$i] = '
  • '.$page{title}.''; - $i++; + if (WebGUI::Privilege::canViewPage($page{pageId})) { + $row[$i] = '
  • '.$page{title}.''; + $i++; + } } $sth->finish; } if ($row[0] ne "") { - $p = WebGUI::Paginator->new(WebGUI::URL::page('op=search'),\@row,$session{form}{numResults}); + $p = WebGUI::Paginator->new($url,\@row,$session{form}{numResults}); $output .= '

    '.WebGUI::International::get(365).'

      '; $output .= $p->getPage($session{form}{pn}); $output .= '
    '.$p->getBarTraditional($session{form}{pn});