tazbug view web/plugins/users/users.cgi @ rev 82
web: plugins dont need to source httphelper.sh
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Feb 17 23:16:08 2014 +0100 (2014-02-17) |
parents | 00b8f6d05cd7 |
children | 0a2f403934e5 |
line source
1 #!/bin/sh
2 #
3 # TinyCM/TazBug Plugin - Users Admin
4 #
6 case " $(GET) " in
7 *\ users\ *)
8 d="Users"
9 header
10 html_header
11 user_box
12 if check_auth && ! admin_user; then
13 gettext "You must be admin to manage users"
14 exit 0
15 fi
16 users=$(ls -1 $PEOPLE | wc -l)
17 cat << EOT
18 <h2>Users: $users</h2>
19 <div id="tools">
20 <a href="$script?dashboard">Dashboard</a>
21 <a href='?logged'>Logged users</a>
22 </div>
23 <pre>
24 EOT
25 for u in $(ls $PEOPLE)
26 do
27 . "${PEOPLE}/${u}/account.conf"
28 cat << EOT
29 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL
30 EOT
31 # deluser link
32 #: <a href="?users&deluser=$USER">$(gettext "delete")</a>
33 unset NAME USER
34 done
35 echo "</pre>" && exit 0 ;;
37 *\ logged\ *)
38 # Show online users based on sessions files.
39 d="Logged users"
40 header
41 html_header
42 user_box
43 if ! check_auth; then
44 gettext "You must be logged in to view online users"
45 exit 0
46 fi
47 cat << EOT
48 <h2>Logged users</h2>
49 <div id="tools">
50 <a href="$script?dashboard">Dashboard</a>
51 </div>
52 <pre>
53 EOT
54 for u in $(ls $sessions)
55 do
56 . "${PEOPLE}/${u}/account.conf"
57 cat << EOT
58 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME
59 EOT
60 done
61 echo "</pre>"
62 html_footer && exit 0 ;;
63 esac