From: <ru...@us...> - 2010-06-19 20:16:25
|
Revision: 7551 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7551&view=rev Author: rurban Date: 2010-06-19 20:16:19 +0000 (Sat, 19 Jun 2010) Log Message: ----------- Exact Title Search fails with blank page patch 3018192 by Sebastien Le Callonnec plus some more fixes to enable the redirect. whitespace fixes Modified Paths: -------------- trunk/lib/PageList.php trunk/lib/plugin/TitleSearch.php Modified: trunk/lib/PageList.php =================================================================== --- trunk/lib/PageList.php 2010-06-17 15:48:19 UTC (rev 7550) +++ trunk/lib/PageList.php 2010-06-19 20:16:19 UTC (rev 7551) @@ -904,6 +904,13 @@ return false; } + function first() { + if (count($this->_pages) > 0) { + return $this->_pages[0]; + } + return false; + } + function getContent() { // Note that the <caption> element wants inline content. $caption = $this->getCaption(); Modified: trunk/lib/plugin/TitleSearch.php =================================================================== --- trunk/lib/plugin/TitleSearch.php 2010-06-17 15:48:19 UTC (rev 7550) +++ trunk/lib/plugin/TitleSearch.php 2010-06-19 20:16:19 UTC (rev 7551) @@ -1,7 +1,7 @@ <?php // -*-php-*- // rcs_id('$Id$'); /** - * Copyright 1999,2000,2001,2002,2004,2005 $ThePhpWikiProgrammingTeam + * Copyright 1999,2000,2001,2002,2004,2005,2010 $ThePhpWikiProgrammingTeam * Copyright 2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. @@ -26,8 +26,8 @@ /** * Display results of pagename search. - * Provides no own input box, just <?plugin-form TitleSearch ?> is enough. - * Fancier Inputforms can be made using WikiForm Rich, to support regex and case_exact args. + * Provides no own input box, just <<TitleSearch>> is enough. + * Fancier Inputforms can be made using <<WikiFormRich>> to support regex and case_exact args. * * If only one pages is found and auto_redirect is true, this page is displayed immediatly, * otherwise the found pagelist is displayed. @@ -58,8 +58,8 @@ 'exclude' => false, 'info' => false, 'case_exact' => false, - 'regex' => 'auto', - 'format' => false, + 'regex' => 'auto', + 'format' => false, )); } // info arg allows multiple columns @@ -79,18 +79,7 @@ $pagelist = new PageList($args['info'], $args['exclude'], $args); $pagelist->addPages($pages); - // this hack will go away - if ($args['format'] == 'livesearch') { - $request->discardOutput(); - $request->buffer_output(false); - echo '<div class="LSRes">'; - echo $pagelist->asXml(); - echo '</div>'; - if (empty($WikiTheme->DUMP_MODE)) { - unset($GLOBALS['ErrorManager']->_postponed_errors); - $request->finish(); - } - } + // Provide an unknown WikiWord link to allow for page creation // when a search returns no results if (!$args['noheader']) { @@ -100,16 +89,15 @@ $s = WikiLink($args['s'], 'auto'); } if ($total) { - $pagelist->setCaption(fmt("Title search results for '%s' (%d total)", $s, $total)); + $pagelist->setCaption(fmt("Title search results for '%s' (%d total)", $s, $total)); } else { $pagelist->setCaption(fmt("Title search results for '%s'", $s)); } } if ($args['auto_redirect'] && ($pagelist->getTotal() == 1)) { - $page = $pages->next(); - return HTML($request->redirect(WikiURL($page->getName(), false, 'absurl'), false), - $pagelist); + $page = $pagelist->first(); + $request->redirect(WikiURL($page->getName(), false, 'absurl'), false); } return $pagelist; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |