2 rcs_id('$Id: AllUsers.php,v 1.18 2004-11-23 15:17:19 rurban Exp $');
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 getVersion() {
45 return preg_replace("/[Revision: $]/", '',
46 "\$Revision: 1.18 $");
49 function getDefaultArguments() {
52 PageList::supportedArgs(),
53 array('noheader' => false,
54 'include_empty' => true,
58 // info arg allows multiple columns
59 // info=mtime,hits,summary,version,author,locked,minor,markup or all
60 // exclude arg allows multiple pagenames exclude=WikiAdmin,.SecretUser
62 // include_empty shows also users which stored their preferences,
63 // but never saved their homepage
65 // sortby: [+|-] pagename|mtime|hits
67 function run($dbi, $argstr, &$request, $basepage) {
68 $args = $this->getArgs($argstr, $request);
71 $timer = new DebugTimer;
73 $group = $request->getGroup();
74 if (method_exists($group,'_allUsers')) {
75 $allusers = $group->_allUsers();
79 $args['count'] = count($allusers);
80 // deleted pages show up as version 0.
81 $pagelist = new PageList($info, $exclude, $args);
83 $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
84 if ($include_empty and empty($info))
85 $pagelist->_addColumn('version');
86 list($offset, $pagesize) = $pagelist->limit($args['limit']);
88 $pagelist->addPageList($allusers);
90 for ($i=$offset; $i < $offset + $pagesize - 1; $i++) {
91 if ($i >= $args['count']) break;
92 $pagelist->addPage($allusers[$i]);
96 $page_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
97 while ($page = $page_iter->next()) {
98 if ($page->isUserPage($include_empty))
99 $pagelist->addPage($page);
104 return HTML($pagelist,
105 HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
112 // $Log: not supported by cvs2svn $
113 // Revision 1.17 2004/11/19 13:25:31 rurban
116 // Revision 1.16 2004/09/25 16:37:18 rurban
117 // add support for all PageList options
119 // Revision 1.15 2004/07/08 13:50:33 rurban
120 // various unit test fixes: print error backtrace on _DEBUG_TRACE; allusers fix; new PHPWIKI_NOMAIN constant for omitting the mainloop
122 // Revision 1.14 2004/06/25 14:29:22 rurban
123 // WikiGroup refactoring:
124 // global group attached to user, code for not_current user.
125 // improved helpers for special groups (avoid double invocations)
126 // new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
127 // fixed a XHTML validation error on userprefs.tmpl
129 // Revision 1.13 2004/06/16 10:38:59 rurban
130 // Disallow refernces in calls if the declaration is a reference
131 // ("allow_call_time_pass_reference clean").
132 // PhpWiki is now allow_call_time_pass_reference = Off clean,
133 // but several external libraries may not.
134 // In detail these libs look to be affected (not tested):
138 // Revision 1.12 2004/04/20 00:56:00 rurban
139 // more paging support and paging fix for shorter lists
141 // Revision 1.11 2004/03/10 13:54:54 rurban
142 // adodb WikiGroup fix
144 // Revision 1.10 2004/03/08 19:30:01 rurban
145 // fixed Theme->getButtonURL
146 // AllUsers uses now WikiGroup (also DB User and DB Pref users)
147 // PageList fix for empty pagenames
149 // Revision 1.9 2004/02/22 23:20:33 rurban
150 // fixed DumpHtmlToDir,
151 // enhanced sortby handling in PageList
152 // new button_heading th style (enabled),
153 // added sortby and limit support to the db backends and plugins
154 // for paging support (<<prev, next>> links on long lists)
156 // Revision 1.8 2004/02/17 12:11:36 rurban
157 // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...)
159 // Revision 1.7 2003/12/21 00:29:45 carstenklapp
160 // Minor bugfix: Fixed broken debug argument.
162 // Internal changes: Only create a DebugTimer when actually called for;
163 // moved debug message out of page content and into deferred page error
164 // notification via trigger_error. Memory management: Only include_once
165 // lib/PageList when absolutely necessary (at this time, this will
166 // probably only benefit the PluginManager as an incremental speedup &
167 // slightly reduced memory).
169 // Revision 1.6 2003/02/27 20:10:31 dairiki
170 // Disable profiling output when DEBUG is defined but false.
172 // Revision 1.5 2003/02/21 04:08:26 dairiki
173 // New class DebugTimer in prepend.php to help report timing.
175 // Revision 1.4 2003/01/18 21:19:25 carstenklapp
177 // Reformatting; added copyleft, getVersion, getDescription
184 // c-hanging-comment-ender-p: nil
185 // indent-tabs-mode: nil