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 along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
33 function getDescription()
35 return _("List all pages in this wiki.");
38 function getDefaultArguments()
42 PageList::supportedArgs(),
45 'include_empty' => false,
52 // info arg allows multiple columns
53 // info=mtime,hits,summary,version,author,locked,minor,markup or all
54 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
55 // sortby: [+|-] pagename|mtime|hits
57 // 2004-07-08 22:05:35 rurban: turned off &$request to prevent from strange bug below
58 function run($dbi, $argstr, $request, $basepage)
60 $args = $this->getArgs($argstr, $request);
63 // Todo: extend given _GET args
64 if (DEBUG && $args['debug']) {
65 $timer = new DebugTimer;
67 $caption = _("All pages in this wiki (%d total):");
69 if (!empty($args['userpages'])) {
70 $pages = PageList::allUserPages($args['include_empty'],
73 $caption = _("List of user-created pages (%d total):");
74 $args['count'] = $request->getArg('count');
75 } elseif (!empty($args['owner'])) {
76 $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'],
79 $args['count'] = $request->getArg('count');
81 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
82 $caption = fmt("List of pages owned by [%s] (%d total):",
83 WikiLink($args['owner'] == '[]'
84 ? $request->_user->getAuthenticatedId()
86 'if_known'), $args['count']);
87 } elseif (!empty($args['author'])) {
88 $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'],
91 $args['count'] = $request->getArg('count');
93 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
94 $caption = fmt("List of pages last edited by [%s] (%d total):",
95 WikiLink($args['author'] == '[]'
96 ? $request->_user->getAuthenticatedId()
98 'if_known'), $args['count']);
99 } elseif (!empty($args['creator'])) {
100 $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'],
103 $args['count'] = $request->getArg('count');
105 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
106 $caption = fmt("List of pages created by [%s] (%d total):",
107 WikiLink($args['creator'] == '[]'
108 ? $request->_user->getAuthenticatedId()
110 'if_known'), $args['count']);
111 //} elseif ($pages) {
112 // $args['count'] = count($pages);
114 if (!$request->getArg('count'))
115 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
117 $args['count'] = $request->getArg('count');
119 if (empty($args['count']) and !empty($pages))
120 $args['count'] = count($pages);
121 $pagelist = new PageList($args['info'], $args['exclude'], $args);
122 if (!$args['noheader']) $pagelist->setCaption($caption);
124 // deleted pages show up as version 0.
125 //if ($args['include_empty'])
126 // $pagelist->_addColumn('version');
128 if ($pages !== false)
129 $pagelist->addPageList($pages);
131 $pagelist->addPages($dbi->getAllPages($args['include_empty'], $args['sortby'],
133 if (DEBUG && $args['debug']) {
134 return HTML($pagelist,
135 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
146 // c-hanging-comment-ender-p: nil
147 // indent-tabs-mode: nil