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