]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllUsers.php
FileFinder: added OS specific code. Just for testing. Will be changed to seperate...
[SourceForge/phpwiki.git] / lib / plugin / AllUsers.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllUsers.php,v 1.3 2002-09-09 08:38:19 rurban 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  * We currently don't get externally authenticated users which didn't store their Preferences.
28  */
29 class WikiPlugin_AllUsers
30 extends WikiPlugin
31 {
32     function getName () {
33         return _("AllUsers");
34     }
35
36     function getDescription () {
37         return _("With external authentication all users which stored their Preferences. Without external authentication all once signed-in users (from version 1.3.4 on).");
38     }
39
40     function getDefaultArguments() {
41         return array('noheader'      => false,
42                      'include_empty' => true,
43                      'exclude'       => '',
44                      'info'          => '',
45                      'sortby'        => '',   // +mtime,-pagename
46                      'debug'         => false
47                      );
48     }
49     // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor,markup or all
50     // exclude arg allows multiple pagenames exclude=WikiAdmin,.SecretUser
51     // include_empty shows also users which stored their preferences, but never saved their homepage
52     // sortby: [+|-] pagename|mtime|hits
53
54     function run($dbi, $argstr, $request) {
55         extract($this->getArgs($argstr, $request));
56         // Todo: extend given _GET args
57         if ($sortby) $request->setArg('sortby',$sortby);
58
59         $pagelist = new PageList($info, $exclude);
60         if (!$noheader)
61             $pagelist->setCaption(_("Authenticated users on this wiki (%d total):"));
62
63         // deleted pages show up as version 0.
64         if ($include_empty)
65             $pagelist->_addColumn('version');
66
67         if (defined('DEBUG'))
68             $debug = true;
69
70         if ($debug) $time_start = $this->getmicrotime();
71         $page_iter = $dbi->getAllPages($include_empty);
72         while ($page = $page_iter->next()) {
73             if ($page->isUserPage($include_empty))
74                 $pagelist->addPage($page);
75         }
76
77         if ($debug) $time_end = $this->getmicrotime();
78
79         if ($debug) {
80             $time = round($time_end - $time_start, 3);
81             return HTML($pagelist,HTML::p(fmt("Elapsed time: %s s", $time)));
82         } else {
83             return $pagelist;
84         }
85     }
86
87     function getmicrotime(){
88         list($usec, $sec) = explode(" ",microtime());
89         return (float)$usec + (float)$sec;
90     }
91 };
92
93 // Local Variables:
94 // mode: php
95 // tab-width: 8
96 // c-basic-offset: 4
97 // c-hanging-comment-ender-p: nil
98 // indent-tabs-mode: nil
99 // End:
100 ?>