From 1063236ba6d30a573b708cf3f2344e46564a5c5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 22 Feb 2009 16:37:00 +0000 Subject: [PATCH] * fix file upload * add file delete --- webcit/downloads.c | 26 ++++++++++++++++++++++ webcit/static/t/section_files_onefile.html | 1 + 2 files changed, 27 insertions(+) diff --git a/webcit/downloads.c b/webcit/downloads.c index 24276dc98..65ea69bb4 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -278,6 +278,27 @@ void download_file(void) +void delete_file(void) +{ + StrBuf *Buf; + char buf[256]; + + safestrncpy(buf, bstr("file"), sizeof buf); + unescape_input(buf); + serv_printf("DELF %s", buf); + Buf = NewStrBuf(); + StrBuf_ServGetln(Buf); + GetServerStatus(Buf, NULL); + StrBufCutLeft(Buf, 4); + strcpy(WC->ImportantMessage, ChrPtr(Buf)); + do_template("files", CTX_NONE); + output_headers(0, 0, 0, 0, 0, 0); + end_burst(); + FreeStrBuf(&Buf); +} + + + void upload_file(void) { const char *MimeType; @@ -293,6 +314,8 @@ void upload_file(void) { strcpy(WCC->ImportantMessage, &buf[4]); do_template("files", NULL); + output_headers(0, 0, 0, 0, 0, 0); + end_burst(); return; } @@ -317,6 +340,8 @@ void upload_file(void) serv_getln(buf, sizeof buf); strcpy(WCC->ImportantMessage, &buf[4]); do_template("files", CTX_NONE); + output_headers(0, 0, 0, 0, 0, 0); + end_burst(); } @@ -414,5 +439,6 @@ InitModule_DOWNLOAD WebcitAddUrlHandler(HKEY("image"), output_image, 0); WebcitAddUrlHandler(HKEY("display_mime_icon"), display_mime_icon , 0); WebcitAddUrlHandler(HKEY("download_file"), download_file, NEED_URL); + WebcitAddUrlHandler(HKEY("delete_file"), delete_file, NEED_URL); WebcitAddUrlHandler(HKEY("upload_file"), upload_file, 0); } diff --git a/webcit/static/t/section_files_onefile.html b/webcit/static/t/section_files_onefile.html index 3beb8d4dd..545ef00a9 100644 --- a/webcit/static/t/section_files_onefile.html +++ b/webcit/static/t/section_files_onefile.html @@ -11,6 +11,7 @@ +"><?_("> -- 2.30.2