Mercurial > hgrepos > hgweb.cgi > s4
annotate s4.cgi @ 37:5cfad2c7eef8
group-id based argument handling
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 22 Jul 2015 13:28:11 +0900 |
parents | 18b4d56a6206 |
children | 0c26f4461d0b |
rev | line source |
---|---|
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1 #!/bin/sh |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
2 # 愛 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3 PATH=/usr/local/sqlite3/bin:$PATH |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
4 myname=`basename $0` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
5 mydir=`dirname $0` |
17 | 6 . $mydir/s4-funcs.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
7 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
8 cgiinit |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
9 if [ x"$1" = x"reg" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
10 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
11 regist $2 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
12 putfooter |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
13 exit |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
14 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
15 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
16 dologin |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
17 #gencookie; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
18 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
19 case ${SERVER_SOFTWARE} in |
27 | 20 bozohttp*) # Ugly workaround for bozohttpd, which can't send |
21 # two or more arguments. | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
22 set -- `echo "$@"|(IFS=+ read a b c d e f g; echo $a $b $c $d $e $f $g)` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
23 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
24 esac |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
25 |
13 | 26 err 1=$1 2=$2 3=$3 4=$4 |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
27 stage=`getpar stage` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
28 stage=${stage:-$1} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
29 case ${stage} in |
8 | 30 # "") |
31 # contenttype; echo | |
32 # m4 -D_SITE_="S System" $layout/welcome.m4.html | |
33 # # echo "<pre>"; gencookie "user=$user" "skey=$skey"; echo "</pre>" | |
34 # # echo "<pre>`env|sort -u`</pre>" | |
35 # ;; | |
36 "home"|"") | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
37 contenttype; echo |
8 | 38 err HOME: just in rowid=`getpar rowid` |
39 [ -n "`getpar rowid`" ] && par2table $formdir/user.def | |
40 showhome ${2:-$user} | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
41 ;; |
8 | 42 # "diary") |
43 # contenttype; echo | |
44 # title=`getpar title` #diary=`getpar diary` wday=`getpar wday` | |
45 # [ -n "$title" ] && par2table $formdir/diary.def | |
46 # m4 -D_TITLE_="$title" -D_DIARY_="$diary" \ | |
47 # -D_FORM_="`genform templ/form/diary.def`" \ | |
48 # -D_FORM2_="syscmd(\`genform templ/form/diary.def')" \ | |
49 # -D_DUMPTABLE_="`dumptable html diary title,wday,diary`" \ | |
50 # $layout/html.m4.html $layout/diary.m4.html | |
51 # ;; | |
27 | 52 "login") |
53 contenttype; echo | |
54 myargs="" | |
55 showlogin | |
56 ;; | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
57 "invite") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
58 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
59 invite |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
60 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
61 "groupman") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
62 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
63 gname=`getpar gname` |
13 | 64 if [ -n "$gname" ]; then |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
65 #gname=${gname%%[!-A-Z0-9a-z_.!#$%^&()=:/*]*} |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
66 #newgname=`echo "$gname"|tr -dc '\-0-9A-Za-z#=:/_.,'` |
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
67 newgname=`echo "$gname"|tr -d '\"'` |
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
68 newgname=$gname |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
69 if [ x"$newgname" != x"$gname" ]; then |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
70 err NewGNAME: gname=$newgname |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
71 echo "<p>使用禁止文字を除去し $gname としました。</p>" |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
72 gname=$newgname |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
73 replpar gname string "$gname" |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
74 fi |
13 | 75 par2table $formdir/grp.def |
76 joingrp "$gname" "$user" yes "$user" as-admin | |
77 fi | |
78 GF_STAGE=groupman | |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
79 note="<p>グループ名に使用できない文字は自動的に削除されます。</p>" |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
80 m4 -D_TITLE_="グループ作成" \ |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
81 -D_FORM_="$note`genform $formdir/grp.def`" \ |
13 | 82 -D_DUMPTABLE_="`DT_VIEW=grp dumptable html grp 'gname gecos:DESC mtime:TIME' 'order by b.TIME desc'`" \ |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
83 $layout/html.m4.html $layout/groupman.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
84 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
85 "edittable") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
86 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
87 m4 -D_TITLE_="グループ編集/削除" $layout/html.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
88 edittable "$formdir/$2.def" "$2" "$3" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
89 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
90 "userconf") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
91 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
92 [ -n "`getpar rowid`" ] && par2table $formdir/user.def |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
93 userconf |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
94 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
95 "groupconf") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
96 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
97 [ -n "`getpar rowid`" ] && par2table $formdir/grp.def |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
98 groupconf "$2" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
99 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
100 "mems") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
101 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
102 m4 -D_TITLE_="参加者一覧" -D_BODYCLASS_=listmember $layout/html.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
103 kwd=`getpar kwd` |
13 | 104 listmember $kwd |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
105 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
106 "grps") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
107 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
108 m4 -D_TITLE_="グループ一覧" -D_BODYCLASS_=listgroup $layout/html.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
109 kwd=`getpar kwd` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
110 listgroup $kwd \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
111 | m4 -D_DUMPTABLE_="syscmd(\`cat')" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
112 -D_TITLE_="グループ関連操作" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
113 -D_FORM_="<a href=\"?groupman\">新規グループ作成</a>" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
114 $layout/groupman.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
115 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
116 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
117 "grps2") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
118 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
119 m4 -D_TITLE_="グループ一覧" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
120 -D_FORM_="`listgroup2 $formdir/grp.def`" -D_DUMPTABLE_= \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
121 $layout/html.m4.html \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
122 $layout/groupman.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
123 ;; |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
124 "grp") # $2=group-rowid |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
125 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
126 gpg=`getpar grp` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
127 grp=${2:-$gpg} |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
128 grp=`getgroupbyid "$grp"` |
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
129 err grp: getpar-grp"(gpg)=[$grp]" |
17 | 130 ## . ./s4-blog.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
131 jg=`getpar joingrp` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
132 if [ -n "$jg" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
133 err jg=$jg, grp=$grp |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
134 [ -n "$jg" -a -n "$grp" ] && |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
135 joingrp "$grp" "$user" "$jg" "`getpar email`" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
136 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
137 m4 -D_TITLE_="グループ $grp" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
138 $layout/html.m4.html |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
139 showgroup "$2" |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
140 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
141 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
142 "commission") |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
143 # $2=grp-rowid $3=user-rowid |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
144 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
145 err commission: "$@" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
146 m4 -D_TITLE_="グループ $2 管理者委任" $layout/html.m4.html |
37
5cfad2c7eef8
group-id based argument handling
HIROSE Yuuji <yuuji@gentei.org>
parents:
27
diff
changeset
|
147 shift # $1=grp-rowid $2=user-rowid |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
148 if [ -n "$2" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
149 grp_reg_adm "$@" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
150 else |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
151 echo "<p>無効な指定です。普通のアクセスならここに来ないはず。</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
152 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
153 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
154 "blog") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
155 contenttype; echo |
17 | 156 . ./s4-blog.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
157 blog_addentry $2 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
158 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
159 "replyblog") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
160 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
161 rowid=${2%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
162 ## err ROWid=$rowid, '$2'=$2 |
17 | 163 . ./s4-blog.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
164 err blog_reply $rowid |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
165 blog_reply $rowid |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
166 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
167 "editheading") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
168 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
169 rowid=${2%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
170 # blogrowid=${3%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
171 if [ -z "$rowid" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
172 echo "<p>話題番号が未指定です。</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
173 return |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
174 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
175 owner=`getvalbyid blog owner $2` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
176 title=`getvalbyid blog title $2` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
177 m4 -D_TITLE_="修正" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
178 -D_SUBTITLE_="[$title]@$owner" -D_DIARY_="" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
179 -D_BLOGS_="" -D_DUMPTABLE_="" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
180 -D_FORM_="`GF_ACTION=\"?blog\" edittable $formdir/blog.def blog $rowid`" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
181 $layout/html.m4.html $layout/diary.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
182 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
183 "editart") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
184 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
185 rowid=${2%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
186 blogrowid=${3%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
187 if [ -z "$rowid" -o -z "$blogrowid" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
188 echo "<p>表示する記事番号が未指定です。</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
189 return |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
190 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
191 owner=`getvalbyid blog owner $blogrowid` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
192 title=`getvalbyid blog title $blogrowid` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
193 author=`getvalbyid article author $rowid` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
194 err EDITart: owner=$owner, author=$author |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
195 if isgrpowner $user $owner; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
196 : EDIT OK |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
197 elif [ x"$owner" != x"$user" -a x"$author" != x"$user" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
198 echo "<p>本人か所有者しか編集できません.</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
199 return |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
200 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
201 aid=`query "select id from article where rowid=$rowid;"` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
202 # title=`getvalbyid blog title $2` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
203 m4 -D_TITLE_="コメントの修正" -D_DIARY_="" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
204 -D_FORM_="`GF_ACTION=\"?replyblog+$blogrowid#$aid\" edittable $formdir/article.def article $rowid`" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
205 -D_SUBTITLE_="`gecos $owner`の「$title」" \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
206 -D_BLOGS_= -D_DUMPTABLE_= \ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
207 $layout/html.m4.html $layout/diary.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
208 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
209 "lshandout") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
210 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
211 rowid=${2%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
212 if [ -z "$rowid" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
213 echo "<p>話題番号が未指定です。</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
214 return |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
215 fi |
17 | 216 . ./s4-blog.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
217 lshandout $rowid |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
218 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
219 "gethandout") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
220 rowid=${2%%[!A-Z0-9a-z_]*} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
221 if [ -z "$rowid" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
222 echo "<p>話題番号が未指定です。</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
223 return |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
224 fi |
17 | 225 . ./s4-blog.sh |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
226 gethandout $rowid |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
227 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
228 "searchart") # $2=blogowner |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
229 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
230 m4 -D_TITLE_="検索結果" $layout/html.m4.html |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
231 kwd=`getpar kwd` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
232 if [ -z "$kwd" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
233 echo "<p>検索語を指定してください</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
234 else |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
235 owner=`getpar owner` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
236 owner=${owner:-$2} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
237 echo "<h2>「$kwd」による検索結果</h2>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
238 if [ -n "$owner" ]; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
239 cond="where key='owner' and val='$owner'" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
240 if isuser $owner; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
241 echo "<p>(`linkhome $owner` さんの記録からの検索)</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
242 else |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
243 linkhome $owner 1>&3 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
244 echo "<p>(`linkhome $owner` グループからの検索)</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
245 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
246 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
247 # article_s: id=article-id, key='text', val='TEXT' |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
248 # article: id=article-id, blogid=blogkd |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
249 # blog: id=blog-id, author=LeaderAuthor |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
250 # blog_s: id=blog-id, key='title', val='BLOG-TITLE' |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
251 # WANT: blog-ROWid,article-id,val(TEXT) |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
252 sql="select b.rowid||'#'||x.id as '', |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
253 b.title as TITLE, |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
254 substr(x.val, 0, 80) as TEXT |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
255 from (select blog.rowid,blog.*,bs.val as title from blog join blog_s bs |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
256 on blog.id=bs.id and bs.key='title') b |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
257 join |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
258 (select a.id,a.blogid,s.val from article a join article_s s |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
259 on a.id=s.id where s.val like '%$kwd%') |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
260 x on b.id=x.blogid |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
261 where b.id in (select id from blog_s |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
262 $cond);" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
263 sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
264 href=\"?replyblog+\1\">VIEW</a></TD>," |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
265 cat<<EOF |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
266 <table class="b searchart"> |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
267 `sq -header -html $db "$sql"|sed "$sedopt"` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
268 </table> |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
269 EOF |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
270 fi |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
271 ;; |
27 | 272 "send2mem") |
273 contenttype; echo | |
274 send2grpmember | |
275 ;; | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
276 "showattc") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
277 # $2=table_m $3=rowid $4=val |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
278 if ! isfilereadable $user $2 $3; then |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
279 contenttype; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
280 echo "<p>このファイルは管理者のみしか見られません</p>" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
281 putfooter; exit |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
282 fi |
10
63c0e22870bb
Use mktempd() instead of mktemp directly
HIROSE Yuuji <yuuji@gentei.org>
parents:
8
diff
changeset
|
283 idir=`umask 002; mktempd` || exit 1 |
11 | 284 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
285 bin=$idir/$myname-$$.bin |
11 | 286 sql="select quote(bin) from $2 where rowid='$3';" |
287 sq $db "$sql" | unhexize > $bin | |
288 tv=`query "select type,val from $2 where rowid='$3';"` | |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
289 type=${tv%|*} fn=${tv#*|} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
290 err tv=$tv type=$type fn=$fn |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
291 ct=${type#file:} |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
292 case $ct in # all text/* changed to text/plain |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
293 text/*) |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
294 charset=`nkf -g $bin|cut -d' ' -f1` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
295 case $charset in |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
296 ASCII*) charset="" ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
297 esac |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
298 ct="text/plain${charset:+; charset=$charset}" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
299 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
300 esac |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
301 contenttype "$ct" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
302 echo "Content-Disposition: filename=\"$fn\"" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
303 echo "Content-Length: " `cat $bin | wc -c`; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
304 #echo "Content-Type: " ${type#file:}; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
305 cat $bin |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
306 exit 0 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
307 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
308 "gallery") |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
309 ## contenttype "Image/jpeg" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
310 sql="select quote(b) from te where a='${2:-mikan.jpg}'" |
10
63c0e22870bb
Use mktempd() instead of mktemp directly
HIROSE Yuuji <yuuji@gentei.org>
parents:
8
diff
changeset
|
311 idir=`umask 002; mktempd` || exit 1 |
11 | 312 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
4
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
313 img=$idir/$myname-$$.bin |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
314 db=b.sq3 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
315 sqlite3 $db "$sql" | xxd -r -p > $img |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
316 len=`cat $img | wc -c` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
317 echo "Content-Length: $len" |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
318 type=`file --mime-type $img | cut -d' ' -f2` |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
319 echo 'Content-type: $type'; echo |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
320 cat $img |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
321 ;; |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
322 esac |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
323 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
324 |
6822f4362bf9
New system name declared as yas4
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
325 putfooter |