From: b
Date: Thu, 15 Feb 2024 21:48:01 +0000 (+0000)
Subject: add minimal edit time; preserve forbidden text field
X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=ee463e95c9a86e350ffaa81085084895fdd86824;p=ott%2Fmirror
add minimal edit time; preserve forbidden text field
---
diff --git a/config b/config
index 1c21433..cc70d0d 160000
--- a/config
+++ b/config
@@ -1 +1 @@
-Subproject commit 1c21433837c5bc34100f04bbfeb8ce403844e91d
+Subproject commit cc70d0da5dd780e2b7b97672cc0638fd91196ee3
diff --git a/makefile b/makefile
index 0fd343d..29e570b 100644
--- a/makefile
+++ b/makefile
@@ -1,5 +1,5 @@
# OTT mirror
-# Copyright (C) 2022, 2023 Balthasar SzczepaÅski
+# Copyright (C) 2022, 2023, 2024 Balthasar SzczepaÅski
# "makefile" is automatically generated from "makefile.1.mak"
# This file is part of OTT mirror.
@@ -17,13 +17,8 @@
# You should have received a copy of the GNU Affreo General Public License
# along with OTT mirror. If not, see .
-
-
-CC =gcc
-CF =-g -Wall -Wno-format-truncation
-L_CGI=-lcgi
-# AI=mawk -f
-
+# TODO: create a debug target and make it default
+DEFAULT_TARGET = release
ifndef TARGET
TARGET =release
# when want to change target run this first:
@@ -31,7 +26,18 @@ TARGET =release
endif
PERL = perl
+CC =gcc
+CF =-g -Wall -Wno-format-truncation
+L_CGI=-lcgi
+# AI=mawk -f
+
CONFIGFILE = settings-$(TARGET).txt settings.txt
+DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
+
+# The configuration tool
+# http://bicyclesonthemoon.info/git/botm-config
+CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
+
PERL =/usr/bin/perl
MKDIR=/usr/bin/mkdir
@@ -63,11 +69,6 @@ WWW_DESC_PATH = /botm/www/1190/ottmirror
CONF = /botm/etc/www/conf/1190/ottmirror.conf
CRON = /etc/cron.d/ottmirror
-
-# The configuration tool
-# http://bicyclesonthemoon.info/git/botm-config
-CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
-
# keep these 2 lists in the same order!:
GENERATE_FROM=\
bot2.1.awk\
@@ -281,6 +282,7 @@ install: cp_bin cp_www cp_www_desc cp_src cp_conf cp_cron
clean:
$(RM) -f configure.pl $(TO_GENERATE) $(C) $(C_CGI)
+ $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
PHONY: all clean setuid mktree cp_bin co_conf cp_cron cp_src cp_www cp_www_desc install
diff --git a/makefile.1.mak b/makefile.1.mak
index 83fd594..ab5c974 100644
--- a/makefile.1.mak
+++ b/makefile.1.mak
@@ -1,5 +1,5 @@
# OTT mirror
-# Copyright (C) 2022, 2023 Balthasar SzczepaÅski
+# Copyright (C) 2022, 2023, 2024 Balthasar SzczepaÅski
# "makefile" is automatically generated from "makefile.1.mak"
# This file is part of OTT mirror.
@@ -17,21 +17,27 @@
# You should have received a copy of the GNU Affreo General Public License
# along with OTT mirror. If not, see .
-
-
-###MAKE_CC: CC=gcc
-###MAKE_CF: CF=-g -Wall
-###MAKE_L_CGI: L_CGI=-lcgi
-# AI=mawk -f
-
+# TODO: create a debug target and make it default
+DEFAULT_TARGET = release
ifndef TARGET
-TARGET = debug ###MAKE_TARGET:
+TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET:
# when want to change target run this first:
# make -B TARGET=target_name makefile
endif
PERL = perl
+###MAKE_CC: CC=gcc
+###MAKE_CF: CF=-g -Wall
+###MAKE_L_CGI: L_CGI=-lcgi
+# AI=mawk -f
+
CONFIGFILE = settings-$(TARGET).txt settings.txt
+DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
+
+# The configuration tool
+# http://bicyclesonthemoon.info/git/botm-config
+CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
+
###MAKE_PERL: PERL = perl
###MAKE_MKDIR: MKDIR = mkdir
@@ -63,11 +69,6 @@ CONFIGFILE = settings-$(TARGET).txt settings.txt
###MAKE_CONF: CONF = /botm/etc/www/conf/1190/ottmirror.conf
###MAKE_CRON: CRON = /etc/cron.d/ottmirror
-
-# The configuration tool
-# http://bicyclesonthemoon.info/git/botm-config
-CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
-
# keep these 2 lists in the same order!:
GENERATE_FROM=\
bot2.1.awk\
@@ -281,6 +282,7 @@ install: cp_bin cp_www cp_www_desc cp_src cp_conf cp_cron
clean:
$(RM) -f configure.pl $(TO_GENERATE) $(C) $(C_CGI)
+ $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
PHONY: all clean setuid mktree cp_bin co_conf cp_cron cp_src cp_www cp_www_desc install
diff --git a/post.1.c b/post.1.c
index 124f667..3ab643c 100644
--- a/post.1.c
+++ b/post.1.c
@@ -1,5 +1,5 @@
// OTT mirror
-// Copyright (C) 2014, 2022, 2023 Balthasar SzczepaÅski
+// Copyright (C) 2014, 2022, 2023, 2024 Balthasar SzczepaÅski
// post.c automatically generated from post.1.c
// write posts from the mirror.
//
@@ -50,6 +50,7 @@
#define N_STRBUF 256
#define N_STRBUF_SH 32
+#define MIN_EDIT_TIME 5
s_cgi *cgi;
pid_t sub;
@@ -64,6 +65,7 @@ char postpath[N_STRBUF]="";
char zero='\0';
char *username = &zero;
char *password = &zero;
+char *password2 = &zero;
char *subject = &zero;
char *message = &zero;
char *addbbcode20 = &zero;
@@ -77,8 +79,11 @@ char *post =&zero;
char *addquote =&zero;
char *edit =&zero;
char *forceID =&zero;
+char *st =&zero;
char wrong[N_STRBUF];
+unsigned char force_starttime = 0;
+
void submit();
void preview (const char *text);
void writeArgA(FILE *file,const char *name,const char *value, char all);
@@ -220,6 +225,7 @@ void writeArgH(FILE *file,const char *value)
void submit()
{
+ time_t starttime;
time_t posttime;
char timetext[N_STRBUF_SH];
char timenumber[N_STRBUF_SH];
@@ -231,8 +237,27 @@ void submit()
unsigned short postslast;
char listpath[N_STRBUF];
long long time_n;
+ long long time_s;
posttime=time(NULL);
+ if(st[0]!='\0')
+ {
+ time_s = atoll(st);
+ if (time_s != 0)
+ starttime = (time_t) time_s;
+ else
+ {
+ starttime = posttime;
+ st = &zero;
+ }
+ }
+ else
+ starttime = posttime;
+ if((posttime-starttime)%s
\n"
subject="\n"
username="\n"
+ password2="\n"
message="\n"
disable_bbcode="\n"
disable_smilies="\n"
@@ -38,6 +38,7 @@ BEGIN{
attach_sig="\n"
notify="\n"
forceID="\n"
+ st="\n"
title0="Post a reply
"
title1="Edit post m%s
\n"
@@ -156,6 +157,10 @@ BEGIN{
printf(attach_sig,(argtab["attach_sig"]=="on")?"checked=\"checked\"":"")
else if ($0 ~ /^###notify/)
printf(notify,(argtab["notify"]=="on")?"checked=\"checked\"":"")
+ else if ($0 ~ /^###password2/)
+ printf(password2,argtab["password2"])
+ else if ($0 ~ /^###st_/)
+ printf(st,argtab["st"])
else if ($0 ~ /^###debug/)
{
gsub(/###nl;/,"\n",argtab["debug"])
diff --git a/www/ott/post.htm b/www/ott/post.htm
index 913fc88..166e0d8 100644
--- a/www/ott/post.htm
+++ b/www/ott/post.htm
@@ -170,7 +170,8 @@
-
+
+###password2
@@ -427,6 +428,9 @@
+
+###st_
+