4 Copyright 1999,2000,2001,2002,2004,2005 $ThePhpWikiProgrammingTeam
6 This file is part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 require_once('lib/PageList.php');
26 * Supports author=[] (current user), owner=[] and creator=[]
27 * to be able to have the action pages:
28 * AllPagesCreatedByMe, AllPagesOwnedByMe, AllPagesLastAuthoredByMe
30 class WikiPlugin_AllPages
37 function getDescription () {
38 return _("List all pages in this wiki.");
41 function getVersion() {
42 return preg_replace("/[Revision: $]/", '',
46 function getDefaultArguments() {
49 PageList::supportedArgs(),
52 'include_empty' => false,
53 //'pages' => false, // DONT, this would be ListPages then.
59 // info arg allows multiple columns
60 // info=mtime,hits,summary,version,author,locked,minor,markup or all
61 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
62 // sortby: [+|-] pagename|mtime|hits
64 // 2004-07-08 22:05:35 rurban: turned off &$request to prevent from strange bug below
65 function run($dbi, $argstr, $request, $basepage) {
66 $args = $this->getArgs($argstr, $request);
68 // Todo: extend given _GET args
70 $timer = new DebugTimer;
71 $caption = _("All pages in this wiki (%d total):");
73 if ( !empty($args['owner']) ) {
74 $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'],
77 $caption = fmt("List of pages owned by [%s] (%d total):",
78 WikiLink($args['owner'] == '[]'
79 ? $request->_user->getAuthenticatedId()
83 $args['count'] = $request->getArg('count');
84 $pages->_options['count'] = $args['count'];
85 } elseif ( !empty($args['author']) ) {
86 $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'],
89 $caption = fmt("List of pages last edited by [%s] (%d total):",
90 WikiLink($args['author'] == '[]'
91 ? $request->_user->getAuthenticatedId()
95 $args['count'] = $request->getArg('count');
96 $pages->_options['count'] = $args['count'];
97 } elseif ( !empty($args['creator']) ) {
98 $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'],
101 $caption = fmt("List of pages created by [%s] (%d total):",
102 WikiLink($args['creator'] == '[]'
103 ? $request->_user->getAuthenticatedId()
107 $args['count'] = $request->getArg('count');
108 $pages->_options['count'] = $args['count'];
109 //} elseif ($pages) {
110 // $args['count'] = count($pages);
112 if (! $request->getArg('count'))
113 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
115 $args['count'] = $request->getArg('count');
117 if (empty($args['count']) and !empty($pages))
118 $args['count'] = count($pages);
119 $pagelist = new PageList($args['info'], $args['exclude'], $args);
120 if (!$args['noheader']) $pagelist->setCaption($caption);
122 // deleted pages show up as version 0.
123 if ($args['include_empty'])
124 $pagelist->_addColumn('version');
126 if ($pages !== false)
127 $pagelist->addPageList($pages);
129 $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'],
131 if ($args['debug']) {
132 return HTML($pagelist,
133 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
139 function getmicrotime(){
140 list($usec, $sec) = explode(" ",microtime());
141 return (float)$usec + (float)$sec;
145 // $Log: not supported by cvs2svn $
146 // Revision 1.36 2005/01/28 12:08:42 rurban
147 // dont print [] as user
149 // Revision 1.35 2004/12/06 19:50:04 rurban
150 // enable action=remove which is undoable and seeable in RecentChanges: ADODB ony for now.
151 // renamed delete_page to purge_page.
152 // enable action=edit&version=-1 to force creation of a new version.
153 // added BABYCART_PATH config
154 // fixed magiqc in adodb.inc.php
155 // and some more docs
157 // Revision 1.34 2004/11/23 15:17:19 rurban
158 // better support for case_exact search (not caseexact for consistency),
159 // plugin args simplification:
160 // handle and explode exclude and pages argument in WikiPlugin::getArgs
161 // and exclude in advance (at the sql level if possible)
162 // handle sortby and limit from request override in WikiPlugin::getArgs
163 // ListSubpages: renamed pages to maxpages
165 // Revision 1.33 2004/11/01 10:43:59 rurban
166 // seperate PassUser methods into seperate dir (memory usage)
167 // fix WikiUser (old) overlarge data session
168 // remove wikidb arg from various page class methods, use global ->_dbi instead
171 // Revision 1.32 2004/10/05 17:00:04 rurban
172 // support paging for simple lists
173 // fix RatingDb sql backend.
174 // remove pages from AllPages (this is ListPages then)
176 // Revision 1.31 2004/09/17 14:25:45 rurban
179 // Revision 1.30 2004/07/09 10:06:50 rurban
180 // Use backend specific sortby and sortable_columns method, to be able to
181 // select between native (Db backend) and custom (PageList) sorting.
182 // Fixed PageList::AddPageList (missed the first)
183 // Added the author/creator.. name to AllPagesBy...
184 // display no pages if none matched.
185 // Improved dba and file sortby().
186 // Use &$request reference
188 // Revision 1.29 2004/07/08 21:32:36 rurban
189 // Prevent from more warnings, minor db and sort optimizations
191 // Revision 1.28 2004/07/08 20:30:07 rurban
192 // plugin->run consistency: request as reference, added basepage.
193 // encountered strange bug in AllPages (and the test) which destroys ->_dbi
195 // Revision 1.27 2004/07/08 17:31:43 rurban
196 // improve numPages for file (fixing AllPagesTest)
198 // Revision 1.26 2004/06/21 16:22:32 rurban
199 // add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
200 // fixed dumping buttons locally (images/buttons/),
201 // support pages arg for dumphtml,
202 // optional directory arg for dumpserial + dumphtml,
203 // fix a AllPages warning,
204 // show dump warnings/errors on DEBUG,
205 // don't warn just ignore on wikilens pagelist columns, if not loaded.
206 // RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
208 // Revision 1.25 2004/06/14 11:31:38 rurban
209 // renamed global $Theme to $WikiTheme (gforge nameclash)
210 // inherit PageList default options from PageList
211 // default sortby=pagename
212 // use options in PageList_Selectable (limit, sortby, ...)
213 // added action revert, with button at action=diff
214 // added option regex to WikiAdminSearchReplace
216 // Revision 1.24 2004/06/13 16:02:12 rurban
217 // empty list of pages if user=[] and not authenticated.
219 // Revision 1.23 2004/06/13 15:51:37 rurban
220 // Support pagelist filter for current author,owner,creator by []
222 // Revision 1.22 2004/06/13 15:33:20 rurban
223 // new support for arguments owner, author, creator in most relevant
224 // PageList plugins. in WikiAdmin* via preSelectS()
226 // Revision 1.21 2004/04/20 00:06:53 rurban
229 // Revision 1.20 2004/02/22 23:20:33 rurban
230 // fixed DumpHtmlToDir,
231 // enhanced sortby handling in PageList
232 // new button_heading th style (enabled),
233 // added sortby and limit support to the db backends and plugins
234 // for paging support (<<prev, next>> links on long lists)
236 // Revision 1.19 2004/02/17 12:11:36 rurban
237 // 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, ...)
239 // Revision 1.18 2004/01/25 07:58:30 rurban
240 // PageList sortby support in PearDB and ADODB backends
242 // Revision 1.17 2003/02/27 20:10:30 dairiki
243 // Disable profiling output when DEBUG is defined but false.
245 // Revision 1.16 2003/02/21 04:08:26 dairiki
246 // New class DebugTimer in prepend.php to help report timing.
248 // Revision 1.15 2003/01/18 21:19:25 carstenklapp
250 // Reformatting; added copyleft, getVersion, getDescription
257 // c-hanging-comment-ender-p: nil
258 // indent-tabs-mode: nil