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.
60 // info arg allows multiple columns
61 // info=mtime,hits,summary,version,author,locked,minor,markup or all
62 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
63 // sortby: [+|-] pagename|mtime|hits
65 // 2004-07-08 22:05:35 rurban: turned off &$request to prevent from strange bug below
66 function run($dbi, $argstr, $request, $basepage) {
67 $args = $this->getArgs($argstr, $request);
69 // Todo: extend given _GET args
71 $timer = new DebugTimer;
72 $caption = _("All pages in this wiki ({total} total):");
74 if ( !empty($args['userpages']) ) {
75 $pages = PageList::allUserPages($args['include_empty'],
78 $caption = _("List of user-created pages ({total} total):");
79 $args['count'] = $request->getArg('count');
80 } elseif ( !empty($args['owner']) ) {
81 $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'],
84 $caption = fmt("List of pages owned by [%s] ({total} total):",
85 WikiLink($args['owner'] == '[]'
86 ? $request->_user->getAuthenticatedId()
89 $args['count'] = $request->getArg('count');
90 $pages->_options['count'] = $args['count'];
91 } elseif ( !empty($args['author']) ) {
92 $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'],
95 $caption = fmt("List of pages last edited by [%s] ({total} total):",
96 WikiLink($args['author'] == '[]'
97 ? $request->_user->getAuthenticatedId()
100 $args['count'] = $request->getArg('count');
101 $pages->_options['count'] = $args['count'];
102 } elseif ( !empty($args['creator']) ) {
103 $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'],
106 $caption = fmt("List of pages created by [%s] ({total} total):",
107 WikiLink($args['creator'] == '[]'
108 ? $request->_user->getAuthenticatedId()
111 $args['count'] = $request->getArg('count');
112 $pages->_options['count'] = $args['count'];
113 //} elseif ($pages) {
114 // $args['count'] = count($pages);
116 if (! $request->getArg('count'))
117 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
119 $args['count'] = $request->getArg('count');
121 if (empty($args['count']) and !empty($pages))
122 $args['count'] = count($pages);
123 $pagelist = new PageList($args['info'], $args['exclude'], $args);
124 if (!$args['noheader']) $pagelist->setCaption($caption);
126 // deleted pages show up as version 0.
127 if ($args['include_empty'])
128 $pagelist->_addColumn('version');
130 if ($pages !== false)
131 $pagelist->addPageList($pages);
133 $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'],
135 if ($args['debug']) {
136 return HTML($pagelist,
137 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
148 // c-hanging-comment-ender-p: nil
149 // indent-tabs-mode: nil