# HG changeset patch # User HIROSE Yuuji # Date 1437556613 -32400 # Node ID c37cbb154e01b638899ad87acdc60f7f17c52d54 # Parent 42a017fc168a038266d9c1616952d652507ee406 collectemail can take multiple arguments diff -r 42a017fc168a -r c37cbb154e01 s4-funcs.sh --- a/s4-funcs.sh Wed Jul 22 18:16:37 2015 +0900 +++ b/s4-funcs.sh Wed Jul 22 18:16:53 2015 +0900 @@ -542,6 +542,7 @@ file:*) #file=$td/$val file=$td/`query "select val from $cond $slice;"` + # FOR SPEED: Skip file generation if imgcache exists [ -s $file -a -s $td/$fn.rowid ] && continue sq $db< $file .output $td/$fn.rowid @@ -1013,12 +1014,13 @@ ;; esac } -collectemail() { +collectemail() ( # Collect email addresses for group $1 - if isuser "$1"; then - em=`query "select val from user_m where name='$1' and key='email';"` - [ -n "$em" ] && echo "$em" || echo "$1" - else + for e; do + if isuser "$e"; then + em=`query "select val from user_m where name='$e' and key='email';"` + [ -n "$em" ] && echo "$em" || echo "$e" + else # sql="with recursive allmem as # (select gname,val from grp_m where gname='$1' # union all select grp_m.gname,grp_m.val from grp_m,allmem @@ -1027,15 +1029,16 @@ # from allmem a left join grp_mem_s b # on a.gname=b.gname and a.val=b.user and b.key='email' # where a.val in (select name from user) limit 10000;" - # tmp tmp tmp tmp tmp tmp tmp - qgrp=`sqlquote $1` - sql="select coalesce(s.val,g.user) from grp_mem g left join grp_mem_s s + # tmp tmp tmp tmp tmp tmp tmp + qgrp=`sqlquote $e` + sql="select coalesce(s.val,g.user) from grp_mem g left join grp_mem_s s on g.gname=s.gname and g.user=s.user and s.key='email' where g.gname=$qgrp;" - err CollectEmail: `echo "$sql"` - query "$sql" - fi -} + err CollectEmail: `echo "$sql"` + query "$sql" + fi + done +) sendinvitation() ( # $1=email iss="invite-`date +%s`-$user" @@ -1741,8 +1744,8 @@ if pwcheck "$pswd"; then if [ x"$p1" = x"$p2" ]; then case "$p1" in - ????????*) ;; - *) echo "

8字以上にしてください。

" + ??????????*) ;; + *) echo "

10字以上にしてください。

" return ;; esac val="\"`echo $p1|mypwhash`\""