s4
changeset 64:54bbd7ce3766
Inhibit non-group-member from *handout
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 27 Jul 2015 22:12:16 +0900 |
parents | da23cad20e4a |
children | 3229b05617a3 |
files | s4-blog.sh |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/s4-blog.sh Mon Jul 27 17:37:30 2015 +0900 1.2 +++ b/s4-blog.sh Mon Jul 27 22:12:16 2015 +0900 1.3 @@ -58,6 +58,7 @@ 1.4 ts=${tbl}_s tm=${tbl}_m 1.5 at=article as=article_s am=article_m 1.6 serial=$(($(date +%s)-1420038000))s$$ 1.7 + blog_writable $rowid $user && iswritable=true || iswritable=false 1.8 # This function grasps blog entry definiton directly. 1.9 # blog: id 1.10 # blog_s: title,ctime,heading 1.11 @@ -76,8 +77,10 @@ 1.12 EOF 1.13 1.14 href="<a href=\"?editheading+$rowid\"> 編集 </a>" 1.15 - href2="<a href=\"?lshandout+$rowid\"> 提出状況 </a>" 1.16 - href3="(<a href=\"?gethandout+$rowid\">ファイル取得</a>)" 1.17 + if $iswritable; then 1.18 + href2="<a href=\"?lshandout+$rowid\"> 提出状況 </a>" 1.19 + href3="(<a href=\"?gethandout+$rowid\">ファイル取得</a>)" 1.20 + fi 1.21 cat<<EOF | sq -html $db \ 1.22 | sed -e "s|\(<TR><TD>\),e,|\1 $href |" \ 1.23 -e "s|,s,\(</TD>\)|$href2$href3\1|" 1.24 @@ -191,7 +194,7 @@ 1.25 echo "</table>" 1.26 1.27 1.28 - blog_writable $rowid $user && cat<<EOF 1.29 + $iswritable && cat<<EOF 1.30 <div class="blogcomment"> 1.31 <p>コメント記入</p> 1.32 <input type="hidden" name="blogid" value="$id"> 1.33 @@ -208,6 +211,9 @@ 1.34 1.35 lshandout() { 1.36 # $1=rowid of blog 1.37 + if ! blog_writable $1 $user; then 1.38 + echo "メンバー以外は利用できません。" | html p; return 1.39 + fi 1.40 time=`getvalbyid blog ctime $1|colrm 11` 1.41 owner=`getvalbyid blog owner $1` 1.42 title=`getvalbyid blog title $1` 1.43 @@ -251,6 +257,9 @@ 1.44 } 1.45 gethandout() { 1.46 # $1=rowid of blog 1.47 + if ! blog_writable $1 $user; then 1.48 + echo "メンバー以外は利用できません。" | html p; return 1.49 + fi 1.50 i=0 1.51 bd=$tmpd/archive.$$ 1.52 mkdir $bd