s4

changeset 730:2c0c25fc9f68

Workaround for reposting from resuming browsers
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 01 Jun 2020 19:31:36 +0900
parents 01be32e89ccd
children 33df7d50532e
files s4-funcs.sh
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Sun May 31 19:06:46 2020 +0900
     1.2 +++ b/s4-funcs.sh	Mon Jun 01 19:31:36 2020 +0900
     1.3 @@ -1459,9 +1459,6 @@
     1.4  		mogrify -quality 75 -resize $maximagexy'>' "$tmpd/$v"
     1.5  		err "Mogrified: `ls -lF $tmpd/$v`"	# 2020-05-31
     1.6  		;;
     1.7 -	      [Aa]pplication/*-empty)
     1.8 -		err "Stream-Empty found: [$v]"; cp "$tmpf" tmp/
     1.9 -		;;
    1.10  	    esac
    1.11  	    if ! echo "$mimetype" | egrep "$file_accept_egrep" >/dev/null 2>&1
    1.12  	    then
    1.13 @@ -3645,6 +3642,7 @@
    1.14    #	6: Password length too short
    1.15    #	7: Password mismatch
    1.16    #	8: Old password incorrect
    1.17 +  #	9: Duplicated post
    1.18    rowid=`getpar rowid`
    1.19    if [ ! -e $1 ]; then
    1.20      echo "テーブル定義ファイルが見付かりません" | html p
    1.21 @@ -3731,6 +3729,22 @@
    1.22      done
    1.23    else
    1.24      # New entry
    1.25 +    # XXX: WORK-AROUND FOR SOME STUPID BROWSER
    1.26 +    #      Avoid empty repost of article.
    1.27 +    if [ x"$tbl" = x"article" ]; then
    1.28 +      # If rowid is empty and ID exists in article-table, that is REPOST!
    1.29 +      aid=`getpar id`
    1.30 +      xaid=`query "SELECT id FROM $tbl WHERE id='$aid';"`
    1.31 +      if [ -n "$xaid" ]; then
    1.32 +	# REPOST of article
    1.33 +	html p <<-EOF
    1.34 +	書き込み直後のリロードなので上書きを回避します。
    1.35 +	最新記事は末尾の「再読み込み」ボタンから見てください。
    1.36 +	EOF
    1.37 +	err "Repost aid=$aid Browser=[$HTTP_USER_AGENT]"
    1.38 +	return 9			# STOP Duplicated posting
    1.39 +      fi
    1.40 +    fi
    1.41      # Generate values() for primary keys
    1.42      for col in `gettblpkey $tbl`; do
    1.43        # Genuine primary keys for _m and _s