Mercurial > hgrepos > hgweb.cgi > s4
comparison y4.cgi @ 11:3565d93c2fb1
add mpsplit.pl
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 20 Jul 2015 18:09:20 +0900 |
parents | 63c0e22870bb |
children | f2204bd941d5 |
comparison
equal
deleted
inserted
replaced
10:63c0e22870bb | 11:3565d93c2fb1 |
---|---|
252 contenttype; echo | 252 contenttype; echo |
253 echo "<p>このファイルは管理者のみしか見られません</p>" | 253 echo "<p>このファイルは管理者のみしか見られません</p>" |
254 putfooter; exit | 254 putfooter; exit |
255 fi | 255 fi |
256 idir=`umask 002; mktempd` || exit 1 | 256 idir=`umask 002; mktempd` || exit 1 |
257 tmpfiles=$tmpfiles"${tmpfiles+ }$idir" | 257 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
258 bin=$idir/$myname-$$.bin | 258 bin=$idir/$myname-$$.bin |
259 ##sql="select quote(bin) from $2 where id='$3' and val='$4'" | 259 sql="select quote(bin) from $2 where rowid='$3';" |
260 sql="select quote(bin) from $2 where rowid='$3'" | 260 sq $db "$sql" | unhexize > $bin |
261 sq $db "$sql" | xxd -r -p > $bin | 261 tv=`query "select type,val from $2 where rowid='$3';"` |
262 # type=`sq $db "select type from $2 where id='$3' and val='$4'"` | |
263 tv=`sq $db "select type,val from $2 where rowid='$3'"` | |
264 type=${tv%|*} fn=${tv#*|} | 262 type=${tv%|*} fn=${tv#*|} |
265 err tv=$tv type=$type fn=$fn | 263 err tv=$tv type=$type fn=$fn |
266 ct=${type#file:} | 264 ct=${type#file:} |
267 case $ct in # all text/* changed to text/plain | 265 case $ct in # all text/* changed to text/plain |
268 text/*) | 266 text/*) |
282 ;; | 280 ;; |
283 "gallery") | 281 "gallery") |
284 ## contenttype "Image/jpeg" | 282 ## contenttype "Image/jpeg" |
285 sql="select quote(b) from te where a='${2:-mikan.jpg}'" | 283 sql="select quote(b) from te where a='${2:-mikan.jpg}'" |
286 idir=`umask 002; mktempd` || exit 1 | 284 idir=`umask 002; mktempd` || exit 1 |
287 tmpfiles=$tmpfiles"${tmpfiles+ }$idir" | 285 # tmpfiles=$tmpfiles"${tmpfiles+ }$idir" |
288 img=$idir/$myname-$$.bin | 286 img=$idir/$myname-$$.bin |
289 db=b.sq3 | 287 db=b.sq3 |
290 sqlite3 $db "$sql" | xxd -r -p > $img | 288 sqlite3 $db "$sql" | xxd -r -p > $img |
291 len=`cat $img | wc -c` | 289 len=`cat $img | wc -c` |
292 echo "Content-Length: $len" | 290 echo "Content-Length: $len" |