# HG changeset patch # User HIROSE Yuuji # Date 1437359439 -32400 # Node ID 3db7524d3deacb9921b5ae95ea2e16291af07cb2 # Parent 67a1bb482ce11695f7956376e23f634831e83ad2 Add default images diff -r 67a1bb482ce1 -r 3db7524d3dea mpsplit.rb --- a/mpsplit.rb Sun Jul 19 17:02:46 2015 +0900 +++ b/mpsplit.rb Mon Jul 20 11:30:39 2015 +0900 @@ -5,8 +5,9 @@ Encoding.default_internal = Encoding::BINARY boundary="--"+ARGV[0] # +"\r\n" -tmpdir=(ARGV[1] || "tmp") -test(?d, tmpdir) || Dir.mkdir("tmp") +tmpdir=(ARGV[1] || "tmp").dup +tmpdir.untaint +test(?d, tmpdir) or Dir.mkdir(tmpdir) stream=STDIN.readlines.join stream.split(boundary)[1..-2].each do |x| header = x.sub(/\r\n\r\n.*/, "") @@ -15,7 +16,8 @@ STDERR.printf("body[%s]=[%s]\n", name, body.length) if /filename=(['\"]?)(.*?)\1/ =~ header && $2 > "" fn = $2 - open(File.expand_path(fn, tmpdir), "w") do |out| + fn.untaint if File.dirname(fn)=="." + open(File.expand_path(fn, tmpdir).untaint, "w") do |out| out.write body end printf("%s:filename=%s\n", name, fn) diff -r 67a1bb482ce1 -r 3db7524d3dea y4-blog.sh --- a/y4-blog.sh Sun Jul 19 17:02:46 2015 +0900 +++ b/y4-blog.sh Mon Jul 20 11:30:39 2015 +0900 @@ -252,7 +252,7 @@ dir=`printf $bd/%03d $i` mkdir $dir query "select quote(bin) from article_m where rowid=$rowid;" \ - | xxd -r -p > $dir/$filename + | unhexize > $dir/$filename done if [ ! -d $bd/001 ]; then contenttype; echo diff -r 67a1bb482ce1 -r 3db7524d3dea y4-funcs.sh --- a/y4-funcs.sh Sun Jul 19 17:02:46 2015 +0900 +++ b/y4-funcs.sh Mon Jul 20 11:30:39 2015 +0900 @@ -6,7 +6,7 @@ myargs="$@" #bindir=`(cd $mydir/bin; pwd)` # :$bindir -PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/local/ImageMagick/bin:$PATH +PATH=/usr/local/sqlite3/bin:/usr/local/vim7/bin:/usr/iekei/ImageMagick/bin:/usr/local/ImageMagick/bin:$PATH tmpdir=${TMPDIR:-tmp} dbdir=${DBDIR:-db} tmpfiles="" @@ -517,7 +517,7 @@ #file=$td/$val file=$td/`query "select val from $cond $slice;"` ####tmp [ -s $file -a -s $td/$fn.rowid ] && continue - sq $db< $file + sq $db< $file .output $td/$fn.rowid select rowid from $cond $slice; .output $td/$fn @@ -559,7 +559,7 @@ if [ ! -s $file ]; then ## sq $db "select quote(bin) from $cond and val=\"$fn\"" \ query "select quote(bin) from $cond and val=\"$fn\";" \ - | xxd -r -p > $file + | unhexize > $file echo ${type#file:} > $file.content-type # err TTTTTTTTTTTTTTTT: $type case $type in @@ -631,11 +631,31 @@ if type xxd >/dev/null 2>&1; then hexize="xxd -p" else - hexize="hexdump -ve '1/1 \"%.2x\"'" + hexize_hd() { + hexdump -ve '1/1 "%.2x"' + } + hexize="hexize_hd" fi fi cat $1 | $hexize | tr -d '\n' } +unhexize() { + if [ -z "$unhex" ]; then + if type xxd >/dev/null 2>&1; then + unhex="xxd -p -r" + elif type perl >/dev/null 2>&1; then + cat >$tmpd/unhex.pl<テーブル定義ファイルが見付かりません

" exit 1 @@ -1785,7 +1806,7 @@ $forms
$hiddens - ${rowid:+} + ${rowid:+} EOF if [ -z $GF_VIEWONLY ]; then cat<"; gencookie "user=$user" "skey=$skey"; echo "" - # echo "
`env|sort -u`
" - ;; - "diary") + # "") + # contenttype; echo + # m4 -D_SITE_="S System" $layout/welcome.m4.html + # # echo "
"; gencookie "user=$user" "skey=$skey"; echo "
" + # # echo "
`env|sort -u`
" + # ;; + "home"|"") contenttype; echo - title=`getpar title` #diary=`getpar diary` wday=`getpar wday` - [ -n "$title" ] && par2table $formdir/diary.def - m4 -D_TITLE_="$title" -D_DIARY_="$diary" \ - -D_FORM_="`genform templ/form/diary.def`" \ - -D_FORM2_="syscmd(\`genform templ/form/diary.def')" \ - -D_DUMPTABLE_="`dumptable html diary title,wday,diary`" \ - $layout/html.m4.html $layout/diary.m4.html +err HOME: just in rowid=`getpar rowid` + [ -n "`getpar rowid`" ] && par2table $formdir/user.def + showhome ${2:-$user} ;; + # "diary") + # contenttype; echo + # title=`getpar title` #diary=`getpar diary` wday=`getpar wday` + # [ -n "$title" ] && par2table $formdir/diary.def + # m4 -D_TITLE_="$title" -D_DIARY_="$diary" \ + # -D_FORM_="`genform templ/form/diary.def`" \ + # -D_FORM2_="syscmd(\`genform templ/form/diary.def')" \ + # -D_DUMPTABLE_="`dumptable html diary title,wday,diary`" \ + # $layout/html.m4.html $layout/diary.m4.html + # ;; "invite") contenttype; echo invite ;; - "home") - contenttype; echo - [ -n "`getpar rowid`" ] && par2table $formdir/user.def - showhome ${2:-$user} - ;; "groupman") contenttype; echo gname=`getpar gname`