4 * Copyright 2002,2004 $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 * Based on AllPages and WikiGroup.
29 * either homepage users (prefs stored in a page),
30 * users with db prefs and
31 * externally authenticated users with a db users table, if auth_user_exists is defined.
33 class WikiPlugin_AllUsers
40 function getDescription() {
41 return _("List all once authenticated users.");
44 function getDefaultArguments() {
47 PageList::supportedArgs(),
48 array('noheader' => false,
49 'include_empty' => true,
53 // info arg allows multiple columns
54 // info=mtime,hits,summary,version,author,locked,minor,markup or all
55 // exclude arg allows multiple pagenames exclude=WikiAdmin,.SecretUser
57 // include_empty shows also users which stored their preferences,
58 // but never saved their homepage
60 // sortby: [+|-] pagename|mtime|hits
62 function run($dbi, $argstr, &$request, $basepage) {
63 $args = $this->getArgs($argstr, $request);
66 if (defined('DEBUG') && DEBUG && $debug) {
67 $timer = new DebugTimer;
70 $group = $request->getGroup();
71 if (method_exists($group,'_allUsers')) {
72 $allusers = $group->_allUsers();
76 $args['count'] = count($allusers);
77 // deleted pages show up as version 0.
78 $pagelist = new PageList($info, $exclude, $args);
80 $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
81 if ($include_empty and empty($info))
82 $pagelist->_addColumn('version');
83 list($offset, $pagesize) = $pagelist->limit($args['limit']);
85 $pagelist->addPageList($allusers);
87 for ($i=$offset; $i < $offset + $pagesize - 1; $i++) {
88 if ($i >= $args['count']) break;
89 $pagelist->addPage(trim($allusers[$i]));
93 $page_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
94 while ($page = $page_iter->next()) {
95 if ($page->isUserPage($include_empty))
96 $pagelist->addPage($page);
100 if (defined('DEBUG') && DEBUG and $debug) {
101 return HTML($pagelist,
102 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
113 // c-hanging-comment-ender-p: nil
114 // indent-tabs-mode: nil