From: Wilfried Göesgens Date: Sun, 22 Feb 2009 16:37:00 +0000 (+0000) Subject: * fix file upload X-Git-Tag: v7.86~1415 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=1063236ba6d30a573b708cf3f2344e46564a5c5d * fix file upload * add file delete --- 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 @@ +"><?_(">