From aa71abd7254de02aeabc9798083a95ce4b8cf095 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 27 May 2021 10:29:26 +0200 Subject: [PATCH] some workarounds in Thread plugin (don't show stale info in html forms) --- winixd/plugins/thread/createthread.cpp | 18 ++++++++++++++++++ winixd/plugins/thread/createthread.h | 4 +++- winixd/plugins/thread/reply.cpp | 23 +++++++++++++++++++++++ winixd/plugins/thread/reply.h | 4 +++- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/winixd/plugins/thread/createthread.cpp b/winixd/plugins/thread/createthread.cpp index 342295a..c393223 100644 --- a/winixd/plugins/thread/createthread.cpp +++ b/winixd/plugins/thread/createthread.cpp @@ -102,6 +102,13 @@ void CreateThread::MakePost() cur->request->item.parent_id = cur->request->dir_tab.back()->id; cur->request->item.item_content.privileges = system->NewFilePrivileges(); + /* + * temporary + * html templates are using last_item, and if CheckAbuse() returned true + * then the form would be empty + */ + cur->request->last_item = &cur->request->item; + if( functions->CheckAbuse() ) return; @@ -134,6 +141,17 @@ void CreateThread::MakePost() } +void CreateThread::MakeGet() +{ + /* + * workaround: + * html form showed the title from the last directory + * this will be removed when new ezc object templates will be implemented + */ + empty_item.Clear(); + cur->request->last_item = &empty_item; + +} diff --git a/winixd/plugins/thread/createthread.h b/winixd/plugins/thread/createthread.h index 896a3dd..1697fa4 100644 --- a/winixd/plugins/thread/createthread.h +++ b/winixd/plugins/thread/createthread.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2010-2014, Tomasz Sowa + * Copyright (c) 2010-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,7 @@ public: CreateThread(); bool HasAccess(); void MakePost(); + void MakeGet(); void SetTDb(TDb * ptdb); void SetThreadInfo(ThreadInfo * pthread_info); @@ -64,6 +65,7 @@ private: ThreadInfo * thread_info; Thread thread; NotifyMsg notify_msg; + Item empty_item; void SendNotify(const Item & item); }; diff --git a/winixd/plugins/thread/reply.cpp b/winixd/plugins/thread/reply.cpp index 04c0f80..b9dadec 100644 --- a/winixd/plugins/thread/reply.cpp +++ b/winixd/plugins/thread/reply.cpp @@ -132,6 +132,17 @@ void Reply::MakePost() answer.parent_id = files_dir->id; answer.item_content.privileges = system->NewFilePrivileges(); + /* + * temporary + * html templates are using last_item, and if CheckAbuse() returned true + * then the form would be empty + * + * here would be better to have something like last_item pointing to answer + * so when CheckAbuse() returned true thew we would show provieded values in the html form + */ + cur->request->last_item = &cur->request->item; + cur->request->item.item_content.guest_name.clear(); + if( functions->CheckAbuse() ) return; @@ -157,6 +168,18 @@ void Reply::MakePost() } +void Reply::MakeGet() +{ + /* + * workaround: + * html form showed the nick name from item + * this will be removed when new ezc object templates will be implemented + * we can provide two item templates: one for [item_url] and the rest for the html form + * [item_url] is used in + */ + cur->request->item.item_content.guest_name.clear(); +} + } // namespace diff --git a/winixd/plugins/thread/reply.h b/winixd/plugins/thread/reply.h index 49499d7..a2d162b 100644 --- a/winixd/plugins/thread/reply.h +++ b/winixd/plugins/thread/reply.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2010-2014, Tomasz Sowa + * Copyright (c) 2010-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ public: Reply(); bool HasAccess(); void MakePost(); + void MakeGet(); void SetTDb(TDb * ptdb); void SetThreadInfo(ThreadInfo * pthread_info); @@ -68,6 +69,7 @@ private: Thread thread; Item * files_dir; NotifyMsg notify_msg; + Item empty_item; void SendNotify(const Item & item); };