--- scripts/pagelist.php.orig 2007-01-03 04:26:36.000000000 +0000 +++ scripts/pagelist.php 2007-01-03 05:05:59.000000000 +0000 @@ -91,9 +91,9 @@ foreach(array('random', 'size', 'time', 'ctime') as $o) SDV($PageListSortCmp[$o], "@(\$PCache[\$x]['$o']-\$PCache[\$y]['$o'])"); -#define PAGELIST_PRE 1 -#define PAGELIST_ITEM 2 -#define PAGELIST_POST 4 +define( 'PAGELIST_PRE', 1 ); +define( 'PAGELIST_ITEM', 2 ); +define( 'PAGELIST_POST', 4 ); ## SearchBox generates the output of the (:searchbox:) markup. ## If $SearchBoxFmt is defined, that is used, otherwise a searchbox @@ -106,7 +106,7 @@ 'value' => str_replace("'", "'", $SearchQuery))); $opt = array_merge((array)$SearchBoxOpt, @$_GET, (array)$opt); $opt['action'] = 'search'; - $target = ($opt['target']) + $target = (!empty($opt['target'])) ? MakePageName($pagename, $opt['target']) : $pagename; $out = FmtPageName(" class='wikisearch' action='\$PageUrl' method='get'>", $target); @@ -229,7 +229,10 @@ StopWatch('PageListSources begin'); ## add the list= option to our list of pagename filter patterns - $opt['=pnfilter'] = array_merge((array)@$opt['=pnfilter'], + if ( !isset($opt['=pnfilter']) ) + $opt['=pnfilter'] = array(); + if ( isset($SearchPatterns[$opt['list']]) ) + $opt['=pnfilter'] = array_merge((array)@$opt['=pnfilter'], (array)$SearchPatterns[$opt['list']]); if (@$opt['group']) $opt['=pnfilter'][] = FixGlob($opt['group'], '$1$2.*'); @@ -260,7 +263,7 @@ switch ($opt['=phase']) { case PAGELIST_PRE: $FmtV['$MatchSearched'] = count($list); - $incl = array(); $inclp = array(); + $incl = array(); $excl = array(); foreach((array)@$opt[''] as $i) { $incl[] = $i; } foreach((array)@$opt['+'] as $i) { $incl[] = $i; } foreach((array)@$opt['-'] as $i) { $excl[] = $i; } @@ -363,6 +366,7 @@ ## case PAGELIST_POST StopWatch('PageListSort begin'); + $code = ''; foreach(preg_split('/[\\s,|]+/', $order, -1, PREG_SPLIT_NO_EMPTY) as $o) { if ($o{0} == '-') { $r = '-'; $o = substr($o, 1); } else $r = ''; @@ -389,7 +393,8 @@ $form = RetrieveAuthPage($pagename, $level, true, READPAGE_CURRENT); if (!$form) Abort("?unable to read $pagename"); PCache($pagename, $form); - $text = preg_replace('/\\[([=@])(.*?)\\1\\]/s', ' ', $form['text']); + $text = isset($form['text']) ? $form['text'] : ''; + $text = preg_replace('/\\[([=@])(.*?)\\1\\]/s', ' ', $text); if (!preg_match('/\\(:searchresults(\\s.*?)?:\\)/', $text)) foreach((array)$PageSearchForm as $formfmt) { $form = ReadPage(FmtPageName($formfmt, $pagename), READPAGE_CURRENT);