tazbug view web/plugins/users/users.cgi @ rev 106
List last messages on main page
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Feb 10 19:24:09 2017 +0100 (2017-02-10) |
parents | 0a2f403934e5 |
children | 0dfc02021c92 |
line source
1 #!/bin/sh
2 #
3 # TinyCM/TazBug Plugin - Users profile and 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 # Skip corrupted accounts
28 if ! [ -f "${PEOPLE}/${u}/account.conf" ]; then
29 echo "${u} : Missing account.conf"
30 continue
31 fi
32 . "${PEOPLE}/${u}/account.conf"
33 cat << EOT
34 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL
35 EOT
36 # deluser link
37 #: <a href="?users&deluser=$USER">$(gettext "delete")</a>
38 unset NAME USER
39 done
40 echo "</pre>"
41 html_footer && exit 0 ;;
43 *\ logged\ *)
44 # Show online users based on sessions files.
45 d="Logged users"
46 header
47 html_header
48 user_box
49 if ! check_auth; then
50 gettext "You must be logged in to view online users"
51 exit 0
52 fi
53 cat << EOT
54 <h2>Logged users</h2>
55 <div id="tools">
56 <a href="$script?dashboard">Dashboard</a>
57 </div>
58 <pre>
59 EOT
60 for u in $(ls $sessions)
61 do
62 . "${PEOPLE}/${u}/account.conf"
63 cat << EOT
64 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME
65 EOT
66 done
67 echo "</pre>"
68 html_footer && exit 0 ;;
69 esac