From 0ef7d4c107832e7ef033159be49159c51331a9b1 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 1 May 2023 22:42:14 -0400 Subject: [PATCH] Apply patches sent by Harlow Solutions -- for WebCit MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix missing parenthesis in Edit Bio and Wiki empty page Fix multiple pages and code to start/end
sections properly. In the Summary page, add line breaks to the “About this server” widget to make it more readable. In contact view (msg_display) fix missing address label title (invalid variable used) and use variables for other labels instead of hard coding. When displaying Contact address, remove blank lines if P.O. Box or street fields are blank. subst.c: Expand ITEM format X to allow appending text after a non-blank ITEM value. Used to add line breaks only on non-blank lines, etc. download.c and static.c: Fix invalid reference to blank gif because the output function added the request line from original image to the link which is invalid. --- citadel/utils/ctdl3264.c | 12 ++- webcit/downloads.c | 5 +- webcit/static.c | 7 +- webcit/static/t/aide/display_menu.html | 9 ++- webcit/static/t/aide/global_config.html | 2 +- webcit/static/t/display_main_menu.html | 3 - webcit/static/t/msg_listview.html | 3 +- webcit/static/t/summary/page.html | 103 ++++++++++++------------ webcit/static/t/trailing.html | 1 + webcit/static/t/user/edit_bio.html | 2 +- webcit/static/t/user/show.html | 50 +++++++----- webcit/static/t/vcard/list/item.html | 14 ++-- webcit/static/t/vcard/msg_display.html | 48 +++++------ webcit/static/t/wiki/empty.html | 2 +- webcit/subst.c | 7 +- webcit/vcard_edit.c | 1 - 16 files changed, 139 insertions(+), 130 deletions(-) diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c index 6f412c342..57ddfcc0e 100644 --- a/citadel/utils/ctdl3264.c +++ b/citadel/utils/ctdl3264.c @@ -30,7 +30,7 @@ #include "ctdl3264_structs.h" // Open a database environment -DB_ENV *open_dbenv(char *src_dir) { +DB_ENV *open_dbenv(char *dirname) { DB_ENV *dbenv = NULL; @@ -83,8 +83,8 @@ DB_ENV *open_dbenv(char *src_dir) { } flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_LOG; - printf("db: dbenv open(dir=%s, flags=%d)\n", src_dir, flags); - ret = dbenv->open(dbenv, src_dir, flags, 0); + printf("db: dbenv open(dir=%s, flags=%d)\n", dirname, flags); + ret = dbenv->open(dbenv, dirname, flags, 0); if (ret) { printf("db: dbenv->open: %s\n", db_strerror(ret)); dbenv->close(dbenv, 0); @@ -570,7 +570,7 @@ void convert_table(int which_cdb, DB_ENV *src_dbenv, DB_ENV *dst_dbenv) { // open the file containing the source table snprintf(dbfilename, sizeof dbfilename, "cdb.%02x", which_cdb); - printf("\033[33m\033[1mdb: opening %s\033[0m\n", dbfilename); + printf("\033[33m\033[1mdb: opening source %s\033[0m\n", dbfilename); ret = src_dbp->open(src_dbp, NULL, dbfilename, NULL, DB_BTREE, 0, 0600); if (ret) { printf("db: db_open: %s\n", db_strerror(ret)); @@ -588,7 +588,7 @@ void convert_table(int which_cdb, DB_ENV *src_dbenv, DB_ENV *dst_dbenv) { // open the file containing the destination table snprintf(dbfilename, sizeof dbfilename, "cdb.%02x", which_cdb); - printf("\033[33m\033[1mdb: opening %s\033[0m\n", dbfilename); + printf("\033[33m\033[1mdb: opening destination %s\033[0m\n", dbfilename); ret = dst_dbp->open(dst_dbp, NULL, dbfilename, NULL, DB_BTREE, (DB_CREATE | DB_TRUNCATE), 0600); if (ret) { printf("db: db_open: %s\n", db_strerror(ret)); @@ -659,7 +659,6 @@ void convert_table(int which_cdb, DB_ENV *src_dbenv, DB_ENV *dst_dbenv) { // write the converted record to the target database if (out_key.size > 0) { - // If we compressed the output, write recomp_data instead of out_data if (compressed) { printf("DB: %02x , out_keylen: %-3d , out_datalen: %-10d , dataptr: %012lx \033[31m(compressed)\033[0m\n", which_cdb, (int)out_key.size, (int)recomp_data.size, (long unsigned int)recomp_data.data); @@ -670,7 +669,6 @@ void convert_table(int which_cdb, DB_ENV *src_dbenv, DB_ENV *dst_dbenv) { ret = dst_dbp->put(dst_dbp, NULL, &out_key, &out_data, 0); } - if (ret) { printf("db: cdb_put(%d): %s", which_cdb, db_strerror(ret)); exit(CTDLEXIT_DB); diff --git a/webcit/downloads.c b/webcit/downloads.c index 6e6c9b981..0decb250a 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -414,10 +414,9 @@ void output_image(void) /* * Instead of an ugly 404, send a 1x1 transparent GIF - * when there's no such image on the server. + * when there's no such image on the server display blank */ - StrBufPrintf (Buf, "%s%s", static_dirs[0], "/webcit_icons/blank.gif"); - output_static(ChrPtr(Buf)); + output_static(NULL); FreeStrBuf(&Buf); } diff --git a/webcit/static.c b/webcit/static.c index ccae7d297..e729d7479 100644 --- a/webcit/static.c +++ b/webcit/static.c @@ -45,7 +45,12 @@ void output_static(char *prefix) { int len; const char *Err; char what[SIZ]; - snprintf(what, sizeof what, "./%s/%s", prefix, (char *)ChrPtr(WC->Hdr->HR.ReqLine)); + if (prefix==NULL) { + // Force blank.gif Overrides the request line. + strcpy(what,"./static/webcit_icons/blank.gif"); + } else { + snprintf(what, sizeof what, "./%s/%s", prefix, (char *)ChrPtr(WC->Hdr->HR.ReqLine)); + } syslog(LOG_DEBUG, "output_static(%s)", what); len = strlen (what); diff --git a/webcit/static/t/aide/display_menu.html b/webcit/static/t/aide/display_menu.html index b1a60718b..6f6d68a9c 100644 --- a/webcit/static/t/aide/display_menu.html +++ b/webcit/static/t/aide/display_menu.html @@ -8,13 +8,14 @@
-
+
- + -
+
- +
+
diff --git a/webcit/static/t/aide/global_config.html b/webcit/static/t/aide/global_config.html index 80106a1cd..c175a10a9 100644 --- a/webcit/static/t/aide/global_config.html +++ b/webcit/static/t/aide/global_config.html @@ -1,6 +1,6 @@ diff --git a/webcit/static/t/display_main_menu.html b/webcit/static/t/display_main_menu.html index c02ea4dc6..f7de02d64 100644 --- a/webcit/static/t/display_main_menu.html +++ b/webcit/static/t/display_main_menu.html @@ -15,7 +15,4 @@ - - - diff --git a/webcit/static/t/msg_listview.html b/webcit/static/t/msg_listview.html index 3d8f0545c..3ef676d8c 100644 --- a/webcit/static/t/msg_listview.html +++ b/webcit/static/t/msg_listview.html @@ -27,5 +27,4 @@

- - + diff --git a/webcit/static/t/summary/page.html b/webcit/static/t/summary/page.html index 6daa3be86..3a5d4fa9a 100644 --- a/webcit/static/t/summary/page.html +++ b/webcit/static/t/summary/page.html @@ -1,6 +1,6 @@
- + + + - - + + + + - + diff --git a/webcit/static/t/vcard/msg_display.html b/webcit/static/t/vcard/msg_display.html index a55b03dca..4a7c57db0 100644 --- a/webcit/static/t/vcard/msg_display.html +++ b/webcit/static/t/vcard/msg_display.html @@ -1,44 +1,44 @@ -
+ +

@@ -13,70 +13,67 @@ * instead of the whole thing. ")>
- - - +
+ + + - + - + - - + + + - - + -
-
- -
-
- +
+ +
+
+
-
+
-
- -
-
- +
+ +
+
+
-
+
-
- -
-
- +
+ +
+
+
-
+
-
- -
-
- -
-
+
+ +
+
+ +
+
-
- -
-
- , - - , - - . - +
+ +
+
+
+
+
+
+
-
- - +
diff --git a/webcit/static/t/trailing.html b/webcit/static/t/trailing.html index 5bbd0822f..c821185a0 100644 --- a/webcit/static/t/trailing.html +++ b/webcit/static/t/trailing.html @@ -1,4 +1,5 @@ +
style="visibility: hidden;" diff --git a/webcit/static/t/user/edit_bio.html b/webcit/static/t/user/edit_bio.html index 11ca66880..aec5ef9b3 100644 --- a/webcit/static/t/user/edit_bio.html +++ b/webcit/static/t/user/edit_bio.html @@ -8,7 +8,7 @@ - +
diff --git a/webcit/static/t/user/show.html b/webcit/static/t/user/show.html index c9c599f1b..390aee38a 100644 --- a/webcit/static/t/user/show.html +++ b/webcit/static/t/user/show.html @@ -1,27 +1,35 @@
- - -
-
- - +
- " alt="" border=0> -

- -

+ + +
+
+ + + + + +
" alt="" border=0> +

+
+
+ +
-
- -
+
diff --git a/webcit/static/t/vcard/list/item.html b/webcit/static/t/vcard/list/item.html index 7f04d0b68..0e2cc29ca 100644 --- a/webcit/static/t/vcard/list/item.html +++ b/webcit/static/t/vcard/list/item.html @@ -1,10 +1,10 @@ - - - -

,
+ + +
+
+ - - + + - - + + - - + - - + + -
- - -
-
-
Telephone: - -
E-mail: - -
: -
-
-
- -
+ ")> + ")> + ")> +
+ +
+ + + + diff --git a/webcit/static/t/wiki/empty.html b/webcit/static/t/wiki/empty.html index 742b42da6..facc973cd 100644 --- a/webcit/static/t/wiki/empty.html +++ b/webcit/static/t/wiki/empty.html @@ -2,7 +2,7 @@
-
. +
.



diff --git a/webcit/subst.c b/webcit/subst.c index 0cd7615f2..baaa5460c 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -639,7 +639,12 @@ void StrBufAppendTemplate(StrBuf *Target, StrEscAppend(Target, Source, NULL, 0, 2); break; case 'X': - StrEscAppend(Target, Source, NULL, 0, 0); + if (!IsEmptyStr(ChrPtr(Source))) { + StrEscAppend(Target, Source, NULL, 0, 0); + if (pFmt[1]) { + StrBufAppendBufPlain(Target, pFmt, -1, 1); + } + } break; case 'J': StrECMAEscAppend(Target, Source, NULL); diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index d1a16d383..8bd4a7841 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -1027,7 +1027,6 @@ void do_addrbook_view(vcardview_struct* VS) { UnStackContext(&SubTP); DeleteHash(&headlines); free(tablabels); - StrBufAppendBufPlain(WC->WBuf, HKEY(""), 0);/* closes: id=global */ } -- 2.30.2