]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllUsers.php
fixed Theme->getButtonURL
[SourceForge/phpwiki.git] / lib / plugin / AllUsers.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllUsers.php,v 1.10 2004-03-08 19:30:01 rurban Exp $');
3 /*
4  Copyright 2002,2004 $ThePhpWikiProgrammingTeam
5
6  This file is part of PhpWiki.
7
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.
12
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.
17
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
21  */
22
23 require_once('lib/PageList.php');
24
25 /**
26  * Based on AllPages.
27  *
28  * We currently don't get externally authenticated users which didn't
29  * store their Preferences.
30  */
31 class WikiPlugin_AllUsers
32 extends WikiPlugin
33 {
34     function getName () {
35         return _("AllUsers");
36     }
37
38     function getDescription() {
39         return _("With external authentication all users which stored their Preferences. Without external authentication all once signed-in users (from version 1.3.4 on).");
40     }
41
42     function getVersion() {
43         return preg_replace("/[Revision: $]/", '',
44                             "\$Revision: 1.10 $");
45     }
46
47     function getDefaultArguments() {
48         return array('noheader'      => false,
49                      'include_empty' => true,
50                      'exclude'       => '',
51                      'info'          => '',   // which columns? default: list of pagenames only
52                      'sortby'        => '',   // +mtime,-pagename
53                      'limit'         => 0,
54                      'debug'         => false
55                      );
56     }
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=WikiAdmin,.SecretUser
60     //
61     // include_empty shows also users which stored their preferences,
62     // but never saved their homepage
63     //
64     // sortby: [+|-] pagename|mtime|hits
65
66     function run($dbi, $argstr, &$request, $basepage) {
67         extract($this->getArgs($argstr, $request));
68         if ($sorted = $request->getArg('sortby'))
69             $sortby = $sorted;
70         elseif ($sortby)
71             $request->setArg('sortby',$sortby);
72
73         $pagelist = new PageList($info, $exclude, $this->getArgs($argstr, $request));
74         if (!$noheader)
75             $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
76
77         // deleted pages show up as version 0.
78         if ($include_empty and empty($info))
79             $pagelist->_addColumn('version');
80
81         //if (defined('DEBUG') and DEBUG) $debug = true;
82         if ($debug)
83             $timer = new DebugTimer;
84
85         $group = WikiGroup::getGroup($request);
86         foreach ($group->_allUsers() as $user) {
87             $pagelist->addPage($user);
88         }
89         /*
90         $page_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
91         while ($page = $page_iter->next()) {
92             if ($page->isUserPage($include_empty))
93                 $pagelist->addPage($page);
94         }
95         */
96
97         if ($debug) {
98             return HTML($pagelist,
99                         HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
100         } else {
101             return $pagelist;
102         }
103     }
104 };
105
106 // $Log: not supported by cvs2svn $
107 // Revision 1.9  2004/02/22 23:20:33  rurban
108 // fixed DumpHtmlToDir,
109 // enhanced sortby handling in PageList
110 //   new button_heading th style (enabled),
111 // added sortby and limit support to the db backends and plugins
112 //   for paging support (<<prev, next>> links on long lists)
113 //
114 // Revision 1.8  2004/02/17 12:11:36  rurban
115 // 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, ...)
116 //
117 // Revision 1.7  2003/12/21 00:29:45  carstenklapp
118 // Minor bugfix: Fixed broken debug argument.
119 //
120 // Internal changes: Only create a DebugTimer when actually called for;
121 // moved debug message out of page content and into deferred page error
122 // notification via trigger_error. Memory management: Only include_once
123 // lib/PageList when absolutely necessary (at this time, this will
124 // probably only benefit the PluginManager as an incremental speedup &
125 // slightly reduced memory).
126 //
127 // Revision 1.6  2003/02/27 20:10:31  dairiki
128 // Disable profiling output when DEBUG is defined but false.
129 //
130 // Revision 1.5  2003/02/21 04:08:26  dairiki
131 // New class DebugTimer in prepend.php to help report timing.
132 //
133 // Revision 1.4  2003/01/18 21:19:25  carstenklapp
134 // Code cleanup:
135 // Reformatting; added copyleft, getVersion, getDescription
136 //
137
138 // Local Variables:
139 // mode: php
140 // tab-width: 8
141 // c-basic-offset: 4
142 // c-hanging-comment-ender-p: nil
143 // indent-tabs-mode: nil
144 // End:
145 ?>