changeset 1042:99ba706d5fdb draft default tip

Update ctime on (un)set frozen on blog
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 02 May 2024 10:23:10 +0900
parents 8682149ed229
children
files s4-blog.sh s4-funcs.sh
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Sun Apr 21 12:16:44 2024 +0900
+++ b/s4-blog.sh	Thu May 02 10:23:10 2024 +0900
@@ -582,7 +582,7 @@
       else
 	mv -f $cachefile.$$ $cachefile
       fi
-      test -n "$stampfile" && date "+%F %T" > $stampfile
+      test -n "$stampfile" && curtimestamp > $stampfile
     fi
     if [ -n "$fa" ]; then
       replhref="s/a href=[^>]*>/a>/"
@@ -1397,6 +1397,7 @@
   else	# With full permission
     blogid=`query "SELECT id FROM blog WHERE rowid=$rid;"`
     dbsetbyid blog "$blogid" "$2" "$3"
+    dbsetbyid blog "$blogid" ctime "`curtimestamp`" # Update ctime 2024-05-02
     code=0
   fi
   # echo "{\"code\": $code, \"message\": \"foo\"}"; exit
@@ -1581,9 +1582,9 @@
 	  blog_notify_reply $rowid $user "$text" $act
 	if [ -n "$grprowid" ]; then
 	  qgrp=$(sqlquote "$owner")
-	  dbsetbyid grp "$owner" wtime "`date '+%F %T'`"
+	  dbsetbyid grp "$owner" wtime "`curtimestamp`"
 	else
-	  dbsetbyid user "$user" wtime "`date '+%F %T'`"
+	  dbsetbyid user "$user" wtime "`curtimestamp`"
 	fi
 	;;
       esac
--- a/s4-funcs.sh	Sun Apr 21 12:16:44 2024 +0900
+++ b/s4-funcs.sh	Thu May 02 10:23:10 2024 +0900
@@ -504,6 +504,9 @@
     fi
   }
 fi >/dev/null 2>&1
+curtimestamp() {
+  date "${*:-+%F %T}"
+}
 ismember() {
   # $1=user, $2=group
 #err ismem: "select user from grp_mem where gname=$(sqlquote $2) and user='$1';"
@@ -807,7 +810,7 @@
   # $1=table, $2=rowid
   n=${2%%[!-0-9]*}	# Remove non-digit chars from $2(should be rowid)
   if [ -n "$n" ]; then
-    now=`date +"%F %T"`
+    now=`curtimestamp`
     #query "replace into acclog values('$user', '$1', '$n', '$now');"
     #query "replace into acclog values('$user', '$1', $n, '$now');"
     query "replace into tblaccesses values('$user', '$1', $n, '$now');"
@@ -941,7 +944,7 @@
     user|author)		# author added 2015-06-18 for article(author)
       echo "$user" ;;
     stamp|datetime)
-      date "+%F %T" ;;
+      curtimestamp ;;
     serial)
       (s=`getpar $2`
        if [ -n "$s" ]; then echo $s; else echo "`date +%s`x$$"; fi) ;;
@@ -1553,7 +1556,7 @@
   if pwcheck "$pswd"; then
     newsession=`genrandom 34`
     if setskey "$user" "$newsession" &&
-	dbsetbyid user "$user" login "`date '+%F %T'`"; then
+	dbsetbyid user "$user" login "`curtimestamp`"; then
       gencookie "user=$user" "skey=$newsession"
       return 0
     else

yatex.org