tazbug view web/plugins/mybugs/user.sh @ 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 # This script display bug for a given user. A copy is used on SCN to
4 # display user bugs on profile page with a custom config file to set
5 # $bugdir.
6 #
7 [ -f "$plugins/mybugs/bugdir.conf" ] && . $plugins/mybugs/bugdir.conf
8 [ "$(GET user)" ] && user="$(GET user)"
9 url="http://bugs.slitaz.org/"
11 if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then
12 show_more="0"
13 echo "<h3>Latest bugs</h3>"
14 echo "<pre>"
15 for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \
16 xargs ls -lt | awk '{print $9}' | head -n 4)
17 do
18 . ${bug}
19 id=$(basename $(dirname $bug))
20 cat << EOT
21 <img src='images/bug.png' alt='' /> \
22 Bug $id: <a href="${url}?id=$id">$BUG</a> <span class="date">- $DATE</span>
23 EOT
24 done
25 echo "</pre>"
26 fi
28 if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then
29 show_more="0"
30 echo "<h3>Latest debug messages</h3>"
31 echo "<pre>"
33 for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \
34 xargs ls -lt | awk '{print $9}' | head -n 4)
35 do
36 . ${msg}
37 id=$(basename $(dirname $msg))
38 msgid=$(echo $msg | cut -d "." -f 2)
39 msg="$(echo $MSG | cut -c 1-40)"
40 cat << EOT
41 <img src='images/bug.png' alt='' /> msg $msgid \
42 <a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \
43 <a href="?id=$id#msg${msgid}">${msg}...</a>
44 EOT
45 unset USER DATE MSG
46 done
47 echo "</pre>"
48 fi
50 if [ "$show_more" ]; then
51 echo "<p>"
52 if [ "$HTTP_HOST" == "bugs.slitaz.org" ]; then
53 echo "<a href='?mybugs&user=$user'>$(gettext 'View all bugs and messages')</a>"
54 else
55 echo "$(gettext 'View all my bugs and debug messages on:') "
56 echo "<a href='?mybugs&user=$user'>bugs.slitaz.org</a>"
57 fi
58 echo "</p>"
59 fi