From 4b63c2a4cafed7f91bc1199a503e8fcd58c64d98 Mon Sep 17 00:00:00 2001 From: rurban Date: Tue, 23 Nov 2004 15:17:20 +0000 Subject: [PATCH] better support for case_exact search (not caseexact for consistency), plugin args simplification: handle and explode exclude and pages argument in WikiPlugin::getArgs and exclude in advance (at the sql level if possible) handle sortby and limit from request override in WikiPlugin::getArgs ListSubpages: renamed pages to maxpages git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@4167 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/PageList.php | 22 +++++---- lib/TextSearchQuery.php | 12 +++-- lib/WikiDB/backend.php | 6 +-- lib/WikiDB/backend/dumb/TextSearchIter.php | 7 +-- lib/WikiPlugin.php | 31 ++++++++++-- lib/plugin/AllPages.php | 23 +++------ lib/plugin/AllUsers.php | 15 +++--- lib/plugin/BackLinks.php | 12 +++-- lib/plugin/FullTextSearch.php | 28 ++++++----- lib/plugin/FuzzyPages.php | 9 ++-- lib/plugin/LikePages.php | 8 +-- lib/plugin/ListPages.php | 10 ++-- lib/plugin/ListSubpages.php | 25 ++++++---- lib/plugin/MostPopular.php | 12 +++-- lib/plugin/PopularNearby.php | 9 ++-- lib/plugin/TitleSearch.php | 16 +++--- lib/plugin/UnfoldSubpages.php | 57 +++++++++++----------- lib/plugin/WantedPages.php | 13 +++-- lib/plugin/WikiAdminChmod.php | 21 +++++--- lib/plugin/WikiAdminChown.php | 21 +++++--- lib/plugin/WikiAdminRemove.php | 24 ++++++--- lib/plugin/WikiAdminRename.php | 18 ++++--- lib/plugin/WikiAdminSearchReplace.php | 30 ++++++------ lib/plugin/WikiAdminSelect.php | 23 ++++----- lib/plugin/WikiAdminSetAcl.php | 18 ++++--- lib/plugin/WikiFormRich.php | 31 ++++++++---- 26 files changed, 300 insertions(+), 201 deletions(-) diff --git a/lib/PageList.php b/lib/PageList.php index 10ffe851b..94ac9a96d 100644 --- a/lib/PageList.php +++ b/lib/PageList.php @@ -1,4 +1,4 @@ -getDbh(); // $dbi->titleSearch($input); + //TODO: need an SQL optimization here $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit, $exclude); while ($pagehandle = $allPagehandles->next()) { $allPages[] = $pagehandle->getName(); @@ -821,9 +822,9 @@ class PageList { } } - function allPagesByAuthor($wildcard, $include_empty=false, $sortby=false, $limit=false) { + function allPagesByAuthor($wildcard, $include_empty=false, $sortby=false, $limit=false, $exclude=false) { $dbi = $GLOBALS['request']->getDbh(); - $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit); + $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit, $exclude); $allPages = array(); if ($wildcard === '[]') { $wildcard = $GLOBALS['request']->_user->getAuthenticatedId(); @@ -846,9 +847,9 @@ class PageList { return $allPages; } - function allPagesByOwner($wildcard, $include_empty=false, $sortby=false, $limit=false) { + function allPagesByOwner($wildcard, $include_empty=false, $sortby=false, $limit=false, $exclude=false) { $dbi = $GLOBALS['request']->getDbh(); - $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit); + $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit, $exclude); $allPages = array(); if ($wildcard === '[]') { $wildcard = $GLOBALS['request']->_user->getAuthenticatedId(); @@ -870,9 +871,9 @@ class PageList { return $allPages; } - function allPagesByCreator($wildcard, $include_empty=false, $sortby=false, $limit=false) { + function allPagesByCreator($wildcard, $include_empty=false, $sortby=false, $limit=false, $exclude=false) { $dbi = $GLOBALS['request']->getDbh(); - $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit); + $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit, $exclude); $allPages = array(); if ($wildcard === '[]') { $wildcard = $GLOBALS['request']->_user->getAuthenticatedId(); @@ -1434,6 +1435,9 @@ extends PageList { } // $Log: not supported by cvs2svn $ +// Revision 1.123 2004/11/23 13:35:31 rurban +// add case_exact search +// // Revision 1.122 2004/11/21 11:59:15 rurban // remove final \n to be ob_cache independent // diff --git a/lib/TextSearchQuery.php b/lib/TextSearchQuery.php index 79ecd5a52..8cc97c497 100644 --- a/lib/TextSearchQuery.php +++ b/lib/TextSearchQuery.php @@ -1,4 +1,4 @@ -_tree = $parser->parse($search_query, $case_exact); + $this->_case_exact = $case_exact; + $this->_isregex = $regex; $this->_optimize(); } @@ -62,8 +64,12 @@ class TextSearchQuery { * Get a regexp which matches the query. */ function asRegexp() { - if (!isset($this->_regexp)) - $this->_regexp = '/^' . $this->_tree->regexp() . '/isS'; + if (!isset($this->_regexp)) { + if ($this->_isregex) // already regex? glob or pcre + $this->_regexp = '/' . $this->_tree->regexp() . '/'.($this->_case_exact?'':'i').'sS'; + else + $this->_regexp = '/^' . $this->_tree->regexp() . '/'.($this->_case_exact?'':'i').'sS'; + } return $this->_regexp; } diff --git a/lib/WikiDB/backend.php b/lib/WikiDB/backend.php index 466356200..89f4722a7 100644 --- a/lib/WikiDB/backend.php +++ b/lib/WikiDB/backend.php @@ -1,5 +1,5 @@ get_all_pages(false); - return new WikiDB_backend_dumb_TextSearchIter($this, $pages, $search, $fullsearch); + return new WikiDB_backend_dumb_TextSearchIter($this, $pages, $search, $fulltext, $case_exact); } /** diff --git a/lib/WikiDB/backend/dumb/TextSearchIter.php b/lib/WikiDB/backend/dumb/TextSearchIter.php index bb34b41cb..9324b192d 100644 --- a/lib/WikiDB/backend/dumb/TextSearchIter.php +++ b/lib/WikiDB/backend/dumb/TextSearchIter.php @@ -1,14 +1,15 @@ _backend = &$backend; $this->_pages = $pages; - $this->_fullsearch = $fullsearch; + $this->_fullsearch = $fulltext; $this->_search = $search; + $this->_case_exact = $case_exact; } function _get_content(&$page) { diff --git a/lib/WikiPlugin.php b/lib/WikiPlugin.php index b29df3223..c983b97d5 100644 --- a/lib/WikiPlugin.php +++ b/lib/WikiPlugin.php @@ -1,5 +1,5 @@ getDefaultArguments(); } @@ -125,6 +125,26 @@ class WikiPlugin trigger_error(sprintf(_("argument '%s' not declared by plugin"), $arg), E_USER_NOTICE); } + + // add special handling of pages and exclude args to accept + // and split explodePageList($args['exclude']) => array() + // TODO : handle p[] pagehash + foreach (array('pages', 'exclude') as $key) { + if (!empty($args[$key]) and array_key_exists($key, $defaults)) + $args[$key] = is_string($args[$key]) + ? explodePageList($args[$key]) + : $args[$key]; // + } + + // always override sortby,limit from the REQUEST. ignore defaults if defined as such. + foreach (array('sortby', 'limit') as $key) { + if (array_key_exists($key, $defaults)) { + if ($val = $request->getArg($key)) + $args[$key] = $val; + elseif (!empty($args[$key])) + $GLOBALS['request']->setArg($val, $args[$val]); + } + } return $args; } @@ -272,7 +292,7 @@ class WikiPlugin function makeForm($argstr, $request) { $form_defaults = $this->getDefaultFormArguments(); $defaults = array_merge($form_defaults, - array('start_debug' => false), + array('start_debug' => $request->getArg('start_debug')), $this->getDefaultArguments()); $args = $this->getArgs($argstr, $request, $defaults); @@ -286,7 +306,8 @@ class WikiPlugin 'accept-charset' => $GLOBALS['charset'])); if (! USE_PATH_INFO ) { $pagename = $request->get('pagename'); - $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'pagename', + $form->pushContent(HTML::input(array('type' => 'hidden', + 'name' => 'pagename', 'value' => $args['targetpage']))); } if ($args['targetpage'] != $this->getName()) { diff --git a/lib/plugin/AllPages.php b/lib/plugin/AllPages.php index 4dcdbec0a..c5342ac0f 100644 --- a/lib/plugin/AllPages.php +++ b/lib/plugin/AllPages.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); - // very strange php reference bug: dbi gets destroyed at array_merge with defaults - //if (!is_object($dbi)) $dbi = $request->getDbh(); - //if (!is_object($request->_dbi)) { - // trigger_error("strange php reference bug destroyed request->_dbi", E_USER_WARNING); - // return HTML(); - //} - //extract($args); - //$pages = isset($args['pages']) ? $args['pages'] : false; // Todo: extend given _GET args - // TODO: shouldn't the REQUEST sortby,limit override be handled in getArgs for all? - if ($sorted = $request->getArg('sortby')) - $args['sortby'] = $sorted; - elseif (!empty($args['sortby'])) - $request->setArg('sortby', $args['sortby']); if ($args['debug']) $timer = new DebugTimer; $caption = _("All pages in this wiki (%d total):"); @@ -135,6 +122,12 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.33 2004/11/01 10:43:59 rurban +// seperate PassUser methods into seperate dir (memory usage) +// fix WikiUser (old) overlarge data session +// remove wikidb arg from various page class methods, use global ->_dbi instead +// ... +// // Revision 1.32 2004/10/05 17:00:04 rurban // support paging for simple lists // fix RatingDb sql backend. diff --git a/lib/plugin/AllUsers.php b/lib/plugin/AllUsers.php index a94379d92..853b96f66 100644 --- a/lib/plugin/AllUsers.php +++ b/lib/plugin/AllUsers.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); extract($args); - if ($sorted = $request->getArg('sortby')) - $sortby = $sorted; - elseif ($sortby) - $request->setArg('sortby',$sortby); - - //if (defined('DEBUG') and DEBUG) $debug = true; if ($debug) $timer = new DebugTimer; @@ -89,7 +83,7 @@ extends WikiPlugin $pagelist->setCaption(_("Authenticated users on this wiki (%d total):")); if ($include_empty and empty($info)) $pagelist->_addColumn('version'); - list($offset,$pagesize) = $pagelist->limit($args['limit']); + list($offset, $pagesize) = $pagelist->limit($args['limit']); if (!$pagesize) { $pagelist->addPageList($allusers); } else { @@ -116,6 +110,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.17 2004/11/19 13:25:31 rurban +// clarify docs +// // Revision 1.16 2004/09/25 16:37:18 rurban // add support for all PageList options // diff --git a/lib/plugin/BackLinks.php b/lib/plugin/BackLinks.php index ffc797aec..a0e197c7f 100644 --- a/lib/plugin/BackLinks.php +++ b/lib/plugin/BackLinks.php @@ -1,5 +1,5 @@ _args); if (empty($page) and $page != '0') return ''; - - $exclude = is_string($exclude) ? explodePageList($exclude) : (is_array($exclude) ? $exclude : array()); + // exclude is already expanded in WikiPlugin::getArgs() + //$exclude = is_string($exclude) ? explodePageList($exclude) : (is_array($exclude) ? $exclude : array()); + if (empty($exclude)) $exclude = array(); if (!$include_self) $exclude[] = $page; if ($info) { @@ -146,6 +147,9 @@ class _PageList_Column_BackLinks_count extends _PageList_Column { // $Log: not supported by cvs2svn $ +// Revision 1.28 2004/10/14 17:16:22 rurban +// override DB sort: not applicable +// // Revision 1.27 2004/09/25 16:33:52 rurban // add support for all PageList options // diff --git a/lib/plugin/FullTextSearch.php b/lib/plugin/FullTextSearch.php index b353ba14c..302fcb239 100644 --- a/lib/plugin/FullTextSearch.php +++ b/lib/plugin/FullTextSearch.php @@ -1,5 +1,5 @@ false, - 'hilight' => true, - 'case_exact' => false, //not yet supported - 'regex' => false, //not yet supported - 'noheader' => false, - 'exclude' => false, //comma-seperated list of glob - 'limit' => false, - 'quiet' => false); // be less verbose + return array_merge + ( + PageList::supportedArgs(), // paging and more. + array('s' => false, + 'hilight' => true, + 'case_exact' => false, //not yet supported + 'regex' => false, //not yet supported + 'noheader' => false, + 'exclude' => false, //comma-seperated list of glob + 'limit' => false, + 'quiet' => false)); // be less verbose } function run($dbi, $argstr, &$request, $basepage) { @@ -64,7 +67,6 @@ extends WikiPlugin $args = $this->getArgs($argstr, $request); if (empty($args['s'])) return ''; - extract($args); $query = new TextSearchQuery($s, $case_exact, $regex); @@ -134,6 +136,10 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.22 2004/05/28 11:01:58 rurban +// support to disable highlighting +// example: s=ReiniUrban&hilight=0&noheader=1 +// // Revision 1.21 2004/04/18 01:11:52 rurban // more numeric pagename fixes. // fixed action=upload with merge conflict warnings. diff --git a/lib/plugin/FuzzyPages.php b/lib/plugin/FuzzyPages.php index 39d2e504b..b34881b3c 100644 --- a/lib/plugin/FuzzyPages.php +++ b/lib/plugin/FuzzyPages.php @@ -1,5 +1,5 @@ _list = array(); $this->collectSimilarPages($this->_list, $dbi); - $this->sortCollectedPages($this->_list); - return $this->formatTable($this->_list, $dbi); } @@ -186,6 +184,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.11 2004/02/17 12:11:36 rurban +// added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) +// // Revision 1.10 2003/02/22 20:49:55 dairiki // Fixes for "Call-time pass by reference has been deprecated" errors. // diff --git a/lib/plugin/LikePages.php b/lib/plugin/LikePages.php index 925c7516b..3260e8f37 100644 --- a/lib/plugin/LikePages.php +++ b/lib/plugin/LikePages.php @@ -1,5 +1,5 @@ '[pagename]', 'prefix' => false, 'suffix' => false, - 'exclude' => '', 'noheader' => false, )); } @@ -120,6 +119,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.21 2004/09/25 16:33:52 rurban +// add support for all PageList options +// // Revision 1.20 2004/05/18 16:23:40 rurban // rename split_pagename to SplitPagename // diff --git a/lib/plugin/ListPages.php b/lib/plugin/ListPages.php index 9de3b5f53..372a66e04 100755 --- a/lib/plugin/ListPages.php +++ b/lib/plugin/ListPages.php @@ -1,5 +1,5 @@ false, - 'exclude' => false, + //'exclude' => false, 'info' => 'pagename,top3recs', 'dimension' => 0, )); @@ -140,6 +140,10 @@ class _PageList_Column_ListPages_count extends _PageList_Column { } // $Log: not supported by cvs2svn $ +// Revision 1.8 2004/10/14 19:19:34 rurban +// loadsave: check if the dumped file will be accessible from outside. +// and some other minor fixes. (cvsclient native not yet ready) +// // Revision 1.7 2004/09/25 16:33:52 rurban // add support for all PageList options // diff --git a/lib/plugin/ListSubpages.php b/lib/plugin/ListSubpages.php index 250157371..ce2881bb4 100644 --- a/lib/plugin/ListSubpages.php +++ b/lib/plugin/ListSubpages.php @@ -1,5 +1,5 @@ false, // no header + return array_merge + ( + PageList::supportedArgs(), + array('noheader' => false, // no header 'basepage' => false, // subpages of which page, default: current - 'pages' => '', // maximum number of pages - // to include - 'exclude' => '', - /*'relative' => false, */ + 'maxpages' => '', // maximum number of pages to include, change that to limit + //'exclude' => '', + /*'relative' => false, */ 'info' => '' - ); + )); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,count @@ -75,8 +77,8 @@ extends WikiPlugin $content = HTML(); $subpages = array_reverse($subpages); - if ($pages) { - $subpages = array_slice ($subpages, 0, $pages); + if ($maxpages) { + $subpages = array_slice ($subpages, 0, $maxpages); } $descrip = fmt("SubPages of %s:", @@ -121,6 +123,9 @@ class _PageList_Column_ListSubpages_count extends _PageList_Column { } // $Log: not supported by cvs2svn $ +// Revision 1.5 2004/09/13 14:59:56 rurban +// info=count: number of backlinks for this subpage +// // Revision 1.4 2004/08/18 11:15:11 rurban // added basepage argument. Default current // diff --git a/lib/plugin/MostPopular.php b/lib/plugin/MostPopular.php index 7401438f5..4d56a0421 100644 --- a/lib/plugin/MostPopular.php +++ b/lib/plugin/MostPopular.php @@ -1,5 +1,5 @@ '[pagename]', // hackish - 'exclude' => '', + //'exclude' => '', 'limit' => 20, // limit <0 returns least popular pages 'noheader' => 0, 'sortby' => 'hits', 'info' => false, - 'paging' => 'auto' + //'paging' => 'auto' )); } @@ -107,6 +107,10 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.30 2004/10/14 19:19:34 rurban +// loadsave: check if the dumped file will be accessible from outside. +// and some other minor fixes. (cvsclient native not yet ready) +// // Revision 1.29 2004/09/25 16:33:52 rurban // add support for all PageList options // diff --git a/lib/plugin/PopularNearby.php b/lib/plugin/PopularNearby.php index 0c1430cfa..3fe0ab589 100644 --- a/lib/plugin/PopularNearby.php +++ b/lib/plugin/PopularNearby.php @@ -1,5 +1,5 @@ '[pagename]', 'mode' => 'nearby', // or 'incoming' or 'outgoing' - 'exclude' => '', + //'exclude' => false, // not yet 'limit' => 5, 'noheader' => 0, ); @@ -157,6 +157,9 @@ function cmp_by_hits($a, $b) { // $Log: not supported by cvs2svn $ +// Revision 1.4 2004/05/01 18:02:41 rurban +// 4.0.6 obviously cannot use methods as cmp function. so it must be a global func +// // Revision 1.2 2004/04/29 23:25:12 rurban // re-ordered locale init (as in 1.3.9) // fixed loadfile with subpages, and merge/restore anyway diff --git a/lib/plugin/TitleSearch.php b/lib/plugin/TitleSearch.php index 3c3490951..699055bad 100644 --- a/lib/plugin/TitleSearch.php +++ b/lib/plugin/TitleSearch.php @@ -1,5 +1,5 @@ false, 'auto_redirect' => false, 'noheader' => false, - 'exclude' => '', + 'exclude' => false, 'info' => false, - 'caseexact' => false + 'case_exact' => false )); } // info arg allows multiple columns @@ -60,11 +60,10 @@ extends WikiPlugin $args = $this->getArgs($argstr, $request); if (empty($args['s'])) return ''; - extract($args); - $query = new TextSearchQuery($s, $caseexact); - $pages = $dbi->titleSearch($query, $caseexact); + $query = new TextSearchQuery($s, $case_exact); + $pages = $dbi->titleSearch($query, $case_exact); $pagelist = new PageList($info, $exclude, $args); while ($page = $pages->next()) { @@ -88,6 +87,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.22 2004/11/23 13:35:49 rurban +// add case_exact search +// // Revision 1.21 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // diff --git a/lib/plugin/UnfoldSubpages.php b/lib/plugin/UnfoldSubpages.php index fa630c74b..82f8d5ba4 100644 --- a/lib/plugin/UnfoldSubpages.php +++ b/lib/plugin/UnfoldSubpages.php @@ -1,5 +1,5 @@ '[pagename]', // default: current page - //'header' => '', // expandable string - 'quiet' => false, // print no header - //'sort' => 'asc', // deprecated: use sortby=+pagename or - // sortby=-mtime instead, - 'sortby' => 'pagename', // [+|-]pagename, [+|-]mtime, [+|-]hits - 'limit' => 0, - 'pages' => false, // deprecated. use maxpages instead - 'maxpages' => false, // maximum number of pages to include - 'sections' => false,// maximum number of sections per page to - // include - 'smalltitle' => false, // if set, hide transclusion-title, - // just have a small link at the start of - // the page. - 'words' => false, // maximum number of words - // per page to include - 'lines' => false, // maximum number of lines - // per page to include - 'bytes' => false, // maximum number of bytes - // per page to include - 'section' => false, // this named section per page only - 'sectionhead' => false // when including a named - // section show the heading - ); + return array_merge + ( + PageList::supportedArgs(), + array( + 'pagename' => '[pagename]', // default: current page + //'header' => '', // expandable string + 'quiet' => false, // print no header + 'sortby' => 'pagename', // [+|-]pagename, [+|-]mtime, [+|-]hits + 'maxpages' => false, // maximum number of pages to include + 'sections' => false, // maximum number of sections per page to include + 'smalltitle' => false, // if set, hide transclusion-title, + // just have a small link at the start of + // the page. + 'words' => false, // maximum number of words + // per page to include + 'lines' => false, // maximum number of lines + // per page to include + 'bytes' => false, // maximum number of bytes + // per page to include + 'section' => false, // this named section per page only + 'sectionhead' => false // when including a named + // section show the heading + )); } function run($dbi, $argstr, &$request, $basepage) { @@ -78,7 +76,7 @@ extends WikiPlugin $args = $this->getArgs($argstr, $request); extract($args); - $subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*',false,$sortby,$limit); + $subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*', false, $sortby, $limit, $exclude); if (! $subpages ) { return $this->error(_("The current page has no subpages defined.")); } @@ -152,6 +150,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.16 2004/09/25 16:35:09 rurban +// use stdlib firstNWordsOfContent, extractSection +// // Revision 1.15 2004/07/03 14:48:18 rurban // Tested new mysql 4.1.3-beta: binary search bug as fixed. // => fixed action=upgrade, diff --git a/lib/plugin/WantedPages.php b/lib/plugin/WantedPages.php index a5750d7ac..36af85db3 100644 --- a/lib/plugin/WantedPages.php +++ b/lib/plugin/WantedPages.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); + if (!empty($args['exclude_from'])) + $args['exclude_from'] = is_string($args['exclude_from']) + ? explodePageList($args['exclude_from']) + : $args['exclude_from']; // extract($args); if ($page == _("WantedPages")) $page = ""; @@ -73,8 +77,6 @@ extends WikiPlugin $GLOBALS['WikiTheme']->addPageListColumn( array('wanted' => array('_PageList_Column_WantedPages_wanted', 'custom:wanted', _("Wanted From"), 'left'))); $pagelist = new PageList($page ? '' : 'pagename,wanted', $exclude, $args); // search button? - if ($exclude_from) $exclude_from = $pagelist->explodePageList($exclude_from); - else $exclude_from = array(); $pagelist->_wpagelist = array(); if (!$page) { @@ -140,6 +142,9 @@ class _PageList_Column_WantedPages_wanted extends _PageList_Column { } // $Log: not supported by cvs2svn $ +// Revision 1.15 2004/11/23 13:35:49 rurban +// add case_exact search +// // Revision 1.14 2004/11/20 17:35:58 rurban // improved WantedPages SQL backends // PageList::sortby new 3rd arg valid_fields (override db fields) diff --git a/lib/plugin/WikiAdminChmod.php b/lib/plugin/WikiAdminChmod.php index 07a0e921a..d58f6f2d4 100644 --- a/lib/plugin/WikiAdminChmod.php +++ b/lib/plugin/WikiAdminChmod.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); $this->_args = $args; - if (!empty($args['exclude'])) - $exclude = explodePageList($args['exclude']); - else - $exclude = false; $this->preSelectS($args, $request); $p = $request->getArg('p'); @@ -138,12 +134,12 @@ extends WikiPlugin_WikiAdminSelect } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,perm,author,mtime"; } - $pagelist = new PageList_Selectable($args['info'], $exclude, $args); + $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); $pagelist->addPageList($pages); $header = HTML::p(); @@ -201,6 +197,15 @@ extends WikiPlugin_WikiAdminSelect } // $Log: not supported by cvs2svn $ +// Revision 1.11 2004/06/16 10:38:59 rurban +// Disallow refernces in calls if the declaration is a reference +// ("allow_call_time_pass_reference clean"). +// PhpWiki is now allow_call_time_pass_reference = Off clean, +// but several external libraries may not. +// In detail these libs look to be affected (not tested): +// * Pear_DB odbc +// * adodb oracle +// // Revision 1.10 2004/06/14 11:31:39 rurban // renamed global $Theme to $WikiTheme (gforge nameclash) // inherit PageList default options from PageList diff --git a/lib/plugin/WikiAdminChown.php b/lib/plugin/WikiAdminChown.php index 9543d1876..daecea322 100644 --- a/lib/plugin/WikiAdminChown.php +++ b/lib/plugin/WikiAdminChown.php @@ -1,5 +1,5 @@ _args = $args; if (empty($args['user'])) $args['user'] = $request->_user->UserName(); - if (!empty($args['exclude'])) + /*if (!empty($args['exclude'])) $exclude = explodePageList($args['exclude']); else - $exclude = false; + $exclude = false;*/ $this->preSelectS($args, $request); $p = $request->getArg('p'); @@ -137,14 +137,14 @@ extends WikiPlugin_WikiAdminSelect } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } /* // let the user decide which info if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,owner,mtime"; } */ - $pagelist = new PageList_Selectable($args['info'], $exclude, $args); + $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); $pagelist->addPageList($pages); $header = HTML::p(); @@ -189,6 +189,15 @@ extends WikiPlugin_WikiAdminSelect } // $Log: not supported by cvs2svn $ +// Revision 1.6 2004/06/16 10:38:59 rurban +// Disallow refernces in calls if the declaration is a reference +// ("allow_call_time_pass_reference clean"). +// PhpWiki is now allow_call_time_pass_reference = Off clean, +// but several external libraries may not. +// In detail these libs look to be affected (not tested): +// * Pear_DB odbc +// * adodb oracle +// // Revision 1.5 2004/06/14 11:31:39 rurban // renamed global $Theme to $WikiTheme (gforge nameclash) // inherit PageList default options from PageList diff --git a/lib/plugin/WikiAdminRemove.php b/lib/plugin/WikiAdminRemove.php index 818ea3963..31d9fe04e 100644 --- a/lib/plugin/WikiAdminRemove.php +++ b/lib/plugin/WikiAdminRemove.php @@ -1,5 +1,5 @@ _args =& $args; - - if (!empty($args['exclude'])) + /*if (!empty($args['exclude'])) $exclude = explodePageList($args['exclude']); else - $exclude = false; + $exclude = false;*/ $this->preSelectS($args, $request); $p = $request->getArg('p'); @@ -176,9 +175,9 @@ extends WikiPlugin_WikiAdminSelect } if ($next_action == 'select') { // List all pages to select from. - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } - $pagelist = new PageList_Selectable($args['info'], $exclude, + $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('remove' => new _PageList_Column_remove('remove', _("Remove"))))); @@ -237,6 +236,17 @@ class _PageList_Column_remove extends _PageList_Column { // $Log: not supported by cvs2svn $ +// Revision 1.29 2004/11/09 17:11:17 rurban +// * revert to the wikidb ref passing. there's no memory abuse there. +// * use new wikidb->_cache->_id_cache[] instead of wikidb->_iwpcache, to effectively +// store page ids with getPageLinks (GleanDescription) of all existing pages, which +// are also needed at the rendering for linkExistingWikiWord(). +// pass options to pageiterator. +// use this cache also for _get_pageid() +// This saves about 8 SELECT count per page (num all pagelinks). +// * fix passing of all page fields to the pageiterator. +// * fix overlarge session data which got broken with the latest ACCESS_LOG_SQL changes +// // Revision 1.28 2004/11/01 10:43:59 rurban // seperate PassUser methods into seperate dir (memory usage) // fix WikiUser (old) overlarge data session diff --git a/lib/plugin/WikiAdminRename.php b/lib/plugin/WikiAdminRename.php index 902f5aab8..12690103f 100644 --- a/lib/plugin/WikiAdminRename.php +++ b/lib/plugin/WikiAdminRename.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); $this->_args = $args; - if (!empty($args['exclude'])) - $exclude = explodePageList($args['exclude']); - else - $exclude = false; $this->preSelectS($args, $request); $p = $request->getArg('p'); @@ -165,14 +161,14 @@ extends WikiPlugin_WikiAdminSelect } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,renamed_pagename"; } $pagelist = new PageList_Selectable ( - $args['info'], $exclude, + $args['info'], $args['exclude'], array('types' => array('renamed_pagename' => new _PageList_Column_renamed_pagename('rename', _("Rename to")), @@ -278,6 +274,12 @@ class _PageList_Column_renamed_pagename extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.21 2004/11/01 10:43:59 rurban +// seperate PassUser methods into seperate dir (memory usage) +// fix WikiUser (old) overlarge data session +// remove wikidb arg from various page class methods, use global ->_dbi instead +// ... +// // Revision 1.20 2004/06/16 10:38:59 rurban // Disallow refernces in calls if the declaration is a reference // ("allow_call_time_pass_reference clean"). diff --git a/lib/plugin/WikiAdminSearchReplace.php b/lib/plugin/WikiAdminSearchReplace.php index 222f05d8d..ad373580a 100644 --- a/lib/plugin/WikiAdminSearchReplace.php +++ b/lib/plugin/WikiAdminSearchReplace.php @@ -1,5 +1,5 @@ getPage($pagename); if ($page->exists()) {// don't replace default contents $current = $page->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); if ($regex) { - $newtext = preg_replace("/".$from."/".($caseexact?'':'i'), $to, $text); + $newtext = preg_replace("/".$from."/".($case_exact?'':'i'), $to, $text); } else { - if ($caseexact) { + if ($case_exact) { $newtext = str_replace($from, $to, $text); } else { //not all PHP have this enabled. use a workaround @@ -91,12 +91,12 @@ extends WikiPlugin_WikiAdminSelect $ul = HTML::ul(); $count = 0; $post_args = $request->getArg('admin_replace'); - $caseexact = !empty($post_args['caseexact']); + $case_exact = !empty($post_args['case_exact']); $regex = !empty($post_args['regex']); foreach ($pages as $pagename) { if (!mayAccessPage('edit',$pagename)) { $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.",$pagename))); - } elseif (($result = $this->replaceHelper($dbi, $pagename, $from, $to, $caseexact, $regex))) { + } elseif (($result = $this->replaceHelper($dbi, $pagename, $from, $to, $case_exact, $regex))) { $ul->pushContent(HTML::li(fmt("Replaced '%s' with '%s' in page '%s'.", $from, $to, WikiLink($pagename)))); $count++; } else { @@ -121,11 +121,6 @@ extends WikiPlugin_WikiAdminSelect $args = $this->getArgs($argstr, $request); $this->_args = $args; - if (!empty($args['exclude'])) - $exclude = is_string($args['exclude']) ? explodePageList($args['exclude']) - : $args['exclude']; // - else - $exclude = false; //TODO: support p from $this->preSelectS($args, $request); @@ -160,13 +155,13 @@ extends WikiPlugin_WikiAdminSelect if ($next_action == 'select' and empty($pages)) { // List all pages to select from. //TODO: check for permissions and list only the allowed - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,hi_content"; } - $pagelist = new PageList_Selectable($args['info'], $exclude, + $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array_merge ( $args, @@ -223,9 +218,9 @@ extends WikiPlugin_WikiAdminSelect $header->pushContent(HTML::input(array('name' => 'admin_replace[to]', 'value' => $post_args['to']))); $checkbox = HTML::input(array('type' => 'checkbox', - 'name' => 'admin_replace[caseexact]', + 'name' => 'admin_replace[case_exact]', 'value' => 1)); - if (!empty($post_args['caseexact'])) + if (!empty($post_args['case_exact'])) $checkbox->setAttr('checked','checked'); $header->pushContent(HTML::br(),$checkbox," ",_("case-exact")); $checkbox_re = HTML::input(array('type' => 'checkbox', @@ -269,6 +264,9 @@ function stri_replace($find,$replace,$string) { } // $Log: not supported by cvs2svn $ +// Revision 1.17 2004/09/17 14:24:06 rurban +// support exclude=, p not yet +// // Revision 1.16 2004/06/16 10:38:59 rurban // Disallow refernces in calls if the declaration is a reference // ("allow_call_time_pass_reference clean"). diff --git a/lib/plugin/WikiAdminSelect.php b/lib/plugin/WikiAdminSelect.php index 115d93634..f06268294 100644 --- a/lib/plugin/WikiAdminSelect.php +++ b/lib/plugin/WikiAdminSelect.php @@ -1,5 +1,5 @@ _list */ - function collectPages(&$list, &$dbi, $sortby, $limit=0) { - $allPages = $dbi->getAllPages(0,$sortby,$limit); + function collectPages(&$list, &$dbi, $sortby, $limit=0, $exclude=false) { + $allPages = $dbi->getAllPages(0, $sortby, $limit, $exclude); while ($pagehandle = $allPages->next()) { $pagename = $pagehandle->getName(); if (empty($list[$pagename])) @@ -91,11 +91,11 @@ extends WikiPlugin if (!empty($request->getArg['s'])) $args['s'] = $request->getArg['s']; if ( !empty($args['owner']) ) - $sl = PageList::allPagesByOwner($args['owner'],false,$args['sortby'],$args['limit']); + $sl = PageList::allPagesByOwner($args['owner'],false,$args['sortby'],$args['limit'],$args['exclude']); elseif ( !empty($args['author']) ) - $sl = PageList::allPagesByAuthor($args['author'],false,$args['sortby'],$args['limit']); + $sl = PageList::allPagesByAuthor($args['author'],false,$args['sortby'],$args['limit'],$args['exclude']); elseif ( !empty($args['creator']) ) - $sl = PageList::allPagesByCreator($args['creator'],false,$args['sortby'],$args['limit']); + $sl = PageList::allPagesByCreator($args['creator'],false,$args['sortby'],$args['limit'],$args['exclude']); elseif ( !empty($args['s']) or !empty($args['only']) ) { // all pages by name $sl = explodePageList(empty($args['only']) ? $args['s'] : $args['only']); @@ -103,11 +103,9 @@ extends WikiPlugin $this->_list = array(); if (!empty($sl)) { $request->setArg('verify', 1); - if (!empty($args['exclude'])) - $exclude = explodePageList($args['exclude']); foreach ($sl as $name) { if (!empty($args['exclude'])) { - if (!in_array($name, $exclude)) + if (!in_array($name, $args['exclude'])) $this->_list[$name] = 1; } else { $this->_list[$name] = 1; @@ -198,7 +196,7 @@ extends WikiPlugin // List all pages to select from. $this->_list = $this->collectPages($this->_list, $dbi, $args['sortby'], $args['limit']); } - $pagelist = new PageList_Selectable($info, $exclude, $args); + $pagelist = new PageList_Selectable($info, $args['exclude'], $args); $pagelist->addPageList($this->_list); $form->pushContent($pagelist->getContent()); foreach ($args as $k => $v) { @@ -249,6 +247,9 @@ extends WikiPlugin } // $Log: not supported by cvs2svn $ +// Revision 1.20 2004/10/04 23:39:34 rurban +// just aesthetics +// // Revision 1.19 2004/06/29 08:52:24 rurban // Use ...version() $need_content argument in WikiDB also: // To reduce the memory footprint for larger sets of pagelists, diff --git a/lib/plugin/WikiAdminSetAcl.php b/lib/plugin/WikiAdminSetAcl.php index 85aed358b..5da86f40b 100644 --- a/lib/plugin/WikiAdminSetAcl.php +++ b/lib/plugin/WikiAdminSetAcl.php @@ -1,5 +1,5 @@ getArgs($argstr, $request); $this->_args = $args; - if (!empty($args['exclude'])) - $exclude = explodePageList($args['exclude']); - else - $exclude = false; $this->preSelectS($args, $request); $p = $request->getArg('p'); @@ -160,13 +156,13 @@ extends WikiPlugin_WikiAdminSelect } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. - $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit']); + $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,perm,mtime,owner,author"; } $pagelist = new PageList_Selectable($args['info'], - $exclude, + $args['exclude'], array('types' => array( 'perm' => new _PageList_Column_perm('perm', _("Permission")), @@ -280,6 +276,12 @@ class _PageList_Column_perm extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.20 2004/11/01 10:43:59 rurban +// seperate PassUser methods into seperate dir (memory usage) +// fix WikiUser (old) overlarge data session +// remove wikidb arg from various page class methods, use global ->_dbi instead +// ... +// // Revision 1.19 2004/06/16 10:38:59 rurban // Disallow refernces in calls if the declaration is a reference // ("allow_call_time_pass_reference clean"). diff --git a/lib/plugin/WikiFormRich.php b/lib/plugin/WikiFormRich.php index af02936f2..9d38ce7df 100644 --- a/lib/plugin/WikiFormRich.php +++ b/lib/plugin/WikiFormRich.php @@ -1,7 +1,7 @@ - - */ + + + +*/ class WikiPlugin_WikiFormRich extends WikiPlugin { function getName () { + return "WikiFormRich"; + } + function getDescription () { return _("Provide generic WikiForm input buttons"); } - function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.3 $"); + "\$Revision: 1.4 $"); } - function getDefaultArguments() { return array('action' => false, // required argument 'method' => 'POST', // or GET 'class' => false, - 'buttontext' => false, // for the submit button + 'buttontext' => false, // for the submit button. default: action 'cancel' => false, // boolean if the action supports cancel also ); } @@ -175,6 +186,9 @@ extends WikiPlugin }; // $Log: not supported by cvs2svn $ +// Revision 1.3 2004/07/09 13:05:34 rurban +// just aesthetics +// // Revision 1.2 2004/07/09 10:25:52 rurban // fix the args parser // @@ -190,7 +204,6 @@ extends WikiPlugin // Revision 1.1 2004/07/01 13:11:53 rurban // more generic forms // -// // For emacs users // Local Variables: -- 2.45.0