3 * Copyright 2002,2004 $ThePhpWikiProgrammingTeam
5 * This file is part of PhpWiki.
7 * PhpWiki is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * PhpWiki is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 require_once('lib/PageList.php');
25 * Based on AllPages and WikiGroup.
28 * either homepage users (prefs stored in a page),
29 * users with db prefs and
30 * externally authenticated users with a db users table, if auth_user_exists is defined.
32 class WikiPlugin_AllUsers
39 function getDescription() {
40 return _("List all once authenticated users.");
43 function getDefaultArguments() {
46 PageList::supportedArgs(),
47 array('noheader' => false,
48 'include_empty' => true,
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=WikiAdmin,.SecretUser
56 // include_empty shows also users which stored their preferences,
57 // but never saved their homepage
59 // sortby: [+|-] pagename|mtime|hits
61 function run($dbi, $argstr, &$request, $basepage) {
62 $args = $this->getArgs($argstr, $request);
65 if (defined('DEBUG') && DEBUG && $debug) {
66 $timer = new DebugTimer;
69 $group = $request->getGroup();
70 if (method_exists($group,'_allUsers')) {
71 $allusers = $group->_allUsers();
75 $args['count'] = count($allusers);
76 // deleted pages show up as version 0.
77 $pagelist = new PageList($info, $exclude, $args);
79 $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
80 if ($include_empty and empty($info))
81 $pagelist->_addColumn('version');
82 list($offset, $pagesize) = $pagelist->limit($args['limit']);
84 $pagelist->addPageList($allusers);
86 for ($i=$offset; $i < $offset + $pagesize - 1; $i++) {
87 if ($i >= $args['count']) break;
88 $pagelist->addPage(trim($allusers[$i]));
92 $page_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
93 while ($page = $page_iter->next()) {
94 if ($page->isUserPage($include_empty))
95 $pagelist->addPage($page);
99 if (defined('DEBUG') && DEBUG and $debug) {
100 return HTML($pagelist,
101 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
112 // c-hanging-comment-ender-p: nil
113 // indent-tabs-mode: nil