tazbug view web/plugins/mybugs/mybugs.cgi @ rev 146
mybugs plugin: fix if * is used in MSG (again)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 22 23:53:25 2017 +0100 (2017-02-22) |
parents | b964fe0ab828 |
children | 2b7f0070810d |
line source
1 #!/bin/sh
2 #
3 # TinyCM/TazBug Plugin - List bugs and messages for a given user
4 #
6 if [ "$(GET mybugs)" ]; then
7 d="My bugs"
8 header
9 html_header
10 user_box
11 if ! check_auth; then
12 echo "You must be logged to view user bugs"
13 html_footer && exit 0
14 fi
15 if [ "$(GET user)" ]; then
16 user="$(GET user)"
17 . $PEOPLE/$user/account.conf
18 fi
19 echo "<h2><a href='?user=$USER'>$(get_gravatar "$MAIL" 48)</a> $NAME</h2>"
21 if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then
22 echo "<h3>$(gettext 'My bugs')</h3>"
23 echo "<pre>"
24 for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \
25 xargs ls -lt | awk '{print $9}' | head -n 4)
26 do
27 . ${bug}
28 id=$(basename $(dirname $bug))
29 cat << EOT
30 <img src='images/bug.png' alt='' /> \
31 Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span>
32 EOT
33 done
34 echo "</pre>"
35 fi
37 if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then
38 echo "<h3>Debug messages</h3>"
39 echo "<pre>"
40 for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \
41 xargs ls -lt | awk '{print $9}' | head -n 4)
42 do
43 . ${msg}
44 id=$(basename $(dirname $msg))
45 msgid=$(echo $msg | cut -d "." -f 2)
46 msg="$(echo $MSG | cut -c 1-40)"
47 cat << EOT
48 <img src='images/bug.png' alt='' /> \
49 <a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \
50 <a href="?id=$id#msg${msgid}">${msg}...</a>
51 EOT
52 done
53 echo "</pre>"
54 fi
56 html_footer && exit 0
57 fi