Mercurial > hgrepos > hgweb.cgi > s4
diff s4-blog.sh @ 352:dd0c70353869
More HELP text for search form. Add search result report.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 26 Oct 2016 12:25:05 +0859 |
parents | 7ff49d1c2987 |
children | c087423c8234 |
line wrap: on
line diff
--- a/s4-blog.sh Tue Oct 25 23:00:46 2016 +0859 +++ b/s4-blog.sh Wed Oct 26 12:25:05 2016 +0859 @@ -490,6 +490,12 @@ elif [ x"$k" = x"@week" ]; then ctime=`query "SELECT datetime('now', 'localtime', '-7 days');"` kc=$kc${kc:+" AND "}"ctime > '${ctime}'" + elif [ x"$k" = x"@month" ]; then + ctime=`query "SELECT datetime('now', 'localtime', '-1 month');"` + kc=$kc${kc:+" AND "}"ctime > '${ctime}'" + elif [ x"$k" = x"@year" ]; then + ctime=`query "SELECT datetime('now', 'localtime', '-1 year');"` + kc=$kc${kc:+" AND "}"ctime > '${ctime}'" else kc=$kc${kc:+" AND "}"content LIKE '%$k%'" fi @@ -560,11 +566,20 @@ sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ href=\"?replyblog+\1\">VIEW</a></TD>," # echo "$sql2" > tmp/sql.out + result=$tmpd/result.$$ cat<<EOF <table class="b searchart"> -`sq -header -html $db "$sql2"|sed "$sedopt"` +`sq -header -html $db "$sql2"|sed "$sedopt"|tee $result` </table> EOF + if [ -s "$result" ]; then + found=`grep "^<TR><TD>" $result | wc -l` + found=$((found+0)) + one=${found%1} + echo "$found match${one:+es} found" + else + echo orz... + fi } listblog() ( # $1={user,group}