]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllUsers.php
Code cleanup:
[SourceForge/phpwiki.git] / lib / plugin / AllUsers.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllUsers.php,v 1.4 2003-01-18 21:19:25 carstenklapp Exp $');
3 /*
4  Copyright 2002 $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.4 $");
45     }
46
47     function getDefaultArguments() {
48         return array('noheader'      => false,
49                      'include_empty' => true,
50                      'exclude'       => '',
51                      'info'          => '',
52                      'sortby'        => '',   // +mtime,-pagename
53                      'debug'         => false
54                      );
55     }
56     // info arg allows multiple columns
57     // info=mtime,hits,summary,version,author,locked,minor,markup or all
58     // exclude arg allows multiple pagenames exclude=WikiAdmin,.SecretUser
59     //
60     // include_empty shows also users which stored their preferences,
61     // but never saved their homepage
62     //
63     // sortby: [+|-] pagename|mtime|hits
64
65     function run($dbi, $argstr, $request) {
66         extract($this->getArgs($argstr, $request));
67         // Todo: extend given _GET args
68         if ($sortby)
69             $request->setArg('sortby',$sortby);
70
71         $pagelist = new PageList($info, $exclude);
72         if (!$noheader)
73             $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
74
75         // deleted pages show up as version 0.
76         if ($include_empty)
77             $pagelist->_addColumn('version');
78
79         if (defined('DEBUG'))
80             $debug = true;
81
82         if ($debug)
83             $time_start = $this->getmicrotime();
84
85         $page_iter = $dbi->getAllPages($include_empty);
86         while ($page = $page_iter->next()) {
87             if ($page->isUserPage($include_empty))
88                 $pagelist->addPage($page);
89         }
90
91         if ($debug)
92             $time_end = $this->getmicrotime();
93
94         if ($debug) {
95             $time = round($time_end - $time_start, 3);
96             return HTML($pagelist,HTML::p(fmt("Elapsed time: %s s", $time)));
97         } else {
98             return $pagelist;
99         }
100     }
101
102     function getmicrotime(){
103         list($usec, $sec) = explode(" ", microtime());
104         return (float)$usec + (float)$sec;
105     }
106 };
107
108 // $Log: not supported by cvs2svn $
109
110 // Local Variables:
111 // mode: php
112 // tab-width: 8
113 // c-basic-offset: 4
114 // c-hanging-comment-ender-p: nil
115 // indent-tabs-mode: nil
116 // End:
117 ?>