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
38 function getDescription()
40 return _("List all pages in this wiki.");
43 function getDefaultArguments()
47 PageList::supportedArgs(),
50 'include_empty' => false,
57 // info arg allows multiple columns
58 // info=mtime,hits,summary,version,author,locked,minor,markup or all
59 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
60 // sortby: [+|-] pagename|mtime|hits
62 // 2004-07-08 22:05:35 rurban: turned off &$request to prevent from strange bug below
63 function run($dbi, $argstr, $request, $basepage)
65 $args = $this->getArgs($argstr, $request);
68 // Todo: extend given _GET args
69 if (DEBUG && $args['debug']) {
70 $timer = new DebugTimer;
72 $caption = _("All pages in this wiki (%d total):");
74 if (!empty($args['userpages'])) {
75 $pages = PageList::allUserPages($args['include_empty'],
78 $caption = _("List of user-created pages (%d total):");
79 $args['count'] = $request->getArg('count');
80 } elseif (!empty($args['owner'])) {
81 $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'],
84 $args['count'] = $request->getArg('count');
86 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
87 $caption = fmt("List of pages owned by [%s] (%d total):",
88 WikiLink($args['owner'] == '[]'
89 ? $request->_user->getAuthenticatedId()
91 'if_known'), $args['count']);
92 $pages->_options['count'] = $args['count'];
93 } elseif (!empty($args['author'])) {
94 $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'],
97 $args['count'] = $request->getArg('count');
99 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
100 $caption = fmt("List of pages last edited by [%s] (%d total):",
101 WikiLink($args['author'] == '[]'
102 ? $request->_user->getAuthenticatedId()
104 'if_known'), $args['count']);
105 $pages->_options['count'] = $args['count'];
106 } elseif (!empty($args['creator'])) {
107 $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'],
110 $args['count'] = $request->getArg('count');
112 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
113 $caption = fmt("List of pages created by [%s] (%d total):",
114 WikiLink($args['creator'] == '[]'
115 ? $request->_user->getAuthenticatedId()
117 'if_known'), $args['count']);
118 $pages->_options['count'] = $args['count'];
119 //} elseif ($pages) {
120 // $args['count'] = count($pages);
122 if (!$request->getArg('count'))
123 $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
125 $args['count'] = $request->getArg('count');
127 if (empty($args['count']) and !empty($pages))
128 $args['count'] = count($pages);
129 $pagelist = new PageList($args['info'], $args['exclude'], $args);
130 if (!$args['noheader']) $pagelist->setCaption($caption);
132 // deleted pages show up as version 0.
133 //if ($args['include_empty'])
134 // $pagelist->_addColumn('version');
136 if ($pages !== false)
137 $pagelist->addPageList($pages);
139 $pagelist->addPages($dbi->getAllPages($args['include_empty'], $args['sortby'],
141 if (DEBUG && $args['debug']) {
142 return HTML($pagelist,
143 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
156 // c-hanging-comment-ender-p: nil
157 // indent-tabs-mode: nil