diff --git a/Makefile b/Makefile index 7edbb78..5b26c13 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CXX = g++ endif ifndef CXXFLAGS -CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER +CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER -DEZC_HAS_SPECIAL_STREAM endif diff --git a/core/misc.cpp b/core/misc.cpp index c0ff04b..aa529a4 100755 --- a/core/misc.cpp +++ b/core/misc.cpp @@ -986,7 +986,7 @@ void QEncodeAddChar(wchar_t c, std::string & out) /* this encoding is used in mails headers - encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" + encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" http://www.faqs.org/rfcs/rfc1522.html we have: @@ -995,7 +995,7 @@ void QEncodeAddChar(wchar_t c, std::string & out) current limitation: we do not support checking the maximum length: - "An encoded-word may not be more than 75 characters long, including + "An encoded-word may not be more than 75 characters long, including charset, encoding, encoded-text, and delimiters." */ void QEncode(const std::wstring & in, std::string & out, bool clear) diff --git a/functions/emacs.cpp b/functions/emacs.cpp index 6c5b0e3..e5bf008 100755 --- a/functions/emacs.cpp +++ b/functions/emacs.cpp @@ -74,10 +74,11 @@ return true; } - +// !! zmienic nazwy +// albo w ogole te metody nie sa potrzebne teraz (byly zmiany) void Emacs::PostFunEmacsModifyMountPoint(bool adding) { - system->RedirectToLastItem(); + system->RedirectTo(cur->request->item); } @@ -89,7 +90,7 @@ int Emacs::NotifyCodeEdit() // if( system->mounts.pmount->type == system->mounts.MountTypeThread() ) // return WINIX_NOTIFY_CODE_THREAD_POST_CHANGED; -return WINIX_NOTIFY_CODE_FILE_EDIT; +return WINIX_NOTIFY_CODE_EDIT; } @@ -101,7 +102,7 @@ int Emacs::NotifyCodeAdd() // if( system->mounts.pmount->type == system->mounts.MountTypeThread() ) // return WINIX_NOTIFY_CODE_THREAD_REPLAYED; -return WINIX_NOTIFY_CODE_FILE_ADD; +return WINIX_NOTIFY_CODE_ADD; } diff --git a/html/fun_thread.html b/html/fun_thread.html index 64ff499..9e62824 100755 --- a/html/fun_thread.html +++ b/html/fun_thread.html @@ -8,7 +8,6 @@ [end] - [if-no thread_mount_arg_is "sort_desc"]
[if item_can_write]\[{edit}\][end] diff --git a/locale/en b/locale/en index da78443..b3112c8 100755 --- a/locale/en +++ b/locale/en @@ -268,17 +268,20 @@ uname_header = Uname # notifications notify_new = News notify_change = Changes -notify_from = winix notifications +notify_reply = Reply +notify_from_name = winix notifications +notify_from_email = dontreply@winix.org notify_content_type = text/plain; charset="UTF-8" notify_header = Welcome notify_msg1 = We would like to inform you that notify_msg2 = someone created a new thread: notify_msg2b = someone created a new ticket: -notify_msg3 = someone replayed in a thread: +notify_msg3 = someone replied in a thread: notify_msg4 = someone has changed its post: notify_msg5 = a post has been deleted from a thread: notify_msg6 = a new page has been added: notify_msg7 = a page has been modified: +notify_msg7b = a ticket has been modified: notify_msg8 = a page has been deleted: notify_msg9 = We invite you to read. notify_msg9b = Have a good day. Bye. diff --git a/locale/pl b/locale/pl index b2b2fe8..253000a 100755 --- a/locale/pl +++ b/locale/pl @@ -269,19 +269,22 @@ uname_header = Nazwa systemu # notifications # subjects should be coded in a special way: http://tools.ietf.org/html/rfc2047 # we don't use it at the moment -notify_new = Cos nowego +notify_new = Coś nowego notify_change = Zmiany -notify_from = winix notifications +notify_reply = Odpowiedź +notify_from_name = winix notifications +notify_from_email = dontreply@winix.org notify_content_type = text/plain; charset="UTF-8" notify_header = Witamy notify_msg1 = Chcielibyśmy powiadomić że właśnie notify_msg2 = ktoś rozpoczął nowy wątek: -notify_msg2b = ktoś rozpoczął nowy ticket: +notify_msg2b = ktoś założył nowy ticket: notify_msg3 = ktoś odpowiedział w wątku: notify_msg4 = ktoś zmienił swoją odpowiedź w wątku: notify_msg5 = czyjaś odpowiedź została skasowana z wątku: notify_msg6 = pojawiła się nowa pozycja do poczytania: notify_msg7 = zmieniono coś na: +notify_msg7b = zmieniony został ticket: notify_msg8 = skasowano następującą pozycję: notify_msg9 = Życzymy miłego dnia i zapraszamy do lektury. notify_msg9b = "" diff --git a/notify/notify.cpp b/notify/notify.cpp index 4f215d1..7b505ec 100755 --- a/notify/notify.cpp +++ b/notify/notify.cpp @@ -64,8 +64,7 @@ void Notify::Init() notify_thread.SetPatterns(&patterns); notify_thread.SetSynchro(synchro); - notify_template_cms = AddTemplate(L"notify_email_cms.txt"); // !! do konfiga - notify_template_thread = AddTemplate(L"notify_email_thread.txt"); + notify_template_cms = AddTemplate(L"notify_email_cms.txt"); plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE); } @@ -109,19 +108,9 @@ void Notify::ItemChanged(int notify_code, const Item & item) return; msg.code = notify_code; + msg.template_index = notify_template_cms; CreateItemLink(item, msg.item_link, msg.dir_link); - if( msg.code >=0 && msg.code <= WINIX_NOTIFY_CODE_FILE_DELETE ) - msg.template_index = notify_template_cms; - else - if( msg.code >= WINIX_NOTIFY_CODE_THREAD_ADD && msg.code <= WINIX_NOTIFY_CODE_THREAD_DELETE ) - msg.template_index = notify_template_thread; - else - { - log << log1 << "Notify: don't know what to do with this mount point (skipping)" << logend; - return; - } - ItemChanged(msg); } diff --git a/notify/notify.h b/notify/notify.h index 943b479..52fe8cc 100755 --- a/notify/notify.h +++ b/notify/notify.h @@ -61,7 +61,6 @@ private: NotifyPool notify_pool; size_t notify_template_cms; - size_t notify_template_thread; // templates file names std::vector templates_names; diff --git a/notify/notifypool.h b/notify/notifypool.h index 3179e1b..74f25b6 100755 --- a/notify/notifypool.h +++ b/notify/notifypool.h @@ -15,33 +15,16 @@ #include "templates/locale.h" - -#define WINIX_NOTIFY_CODE_DIR_ADD 1 -#define WINIX_NOTIFY_CODE_DIR_EDIT 2 -#define WINIX_NOTIFY_CODE_DIR_DELETE 4 - -#define WINIX_NOTIFY_CODE_FILE_ADD 8 -#define WINIX_NOTIFY_CODE_FILE_EDIT 16 -#define WINIX_NOTIFY_CODE_FILE_DELETE 32 - -// new thread has been starded -#define WINIX_NOTIFY_CODE_THREAD_ADD 64 - -// someone replayed in a thread -#define WINIX_NOTIFY_CODE_THREAD_REPLAYED 128 - -// someone edited its post -#define WINIX_NOTIFY_CODE_THREAD_POST_CHANGED 256 - - -#define WINIX_NOTIFY_CODE_THREAD_DELETE 512 +#define WINIX_NOTIFY_CODE_ADD 1 +#define WINIX_NOTIFY_CODE_EDIT 2 +#define WINIX_NOTIFY_CODE_DELETE 4 +#define WINIX_NOTIFY_CODE_REPLY 8 // additional codes, use it of your own // you should prepare NotifyMsg structure and use it with ItemChanged method of notify object -// remember that from this code an appropirate user is selected (db->core->user notify value) -// and ezc templates may behave differently +/* temporarily not used #define WINIX_NOTIFY_CODE_USER1 1024 #define WINIX_NOTIFY_CODE_USER2 2048 #define WINIX_NOTIFY_CODE_USER3 4096 @@ -50,7 +33,7 @@ #define WINIX_NOTIFY_CODE_USER6 32768 #define WINIX_NOTIFY_CODE_USER7 65536 #define WINIX_NOTIFY_CODE_USER8 131072 - +*/ struct NotifyMsg diff --git a/notify/templatesnotify.cpp b/notify/templatesnotify.cpp index 80a1f54..b9d28d4 100755 --- a/notify/templatesnotify.cpp +++ b/notify/templatesnotify.cpp @@ -23,56 +23,44 @@ Ezc::Functions ezc_functions; NotifyUserMsg notify_user_msg; NotifyMsg notify_msg; -// name in qencoding -static std::string name_q; +static std::string qencode_tmp; -void notify_file_added(Info & i) +void fil_qencode(Info & i) { - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_ADD) != 0; + // QEncode can be used in other threads + QEncode(i.in.Str(), qencode_tmp); + i.out << qencode_tmp; } -void notify_file_edited(Info & i) +void notify_add(Info & i) { - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_EDIT) != 0; + i.res = (notify_msg.code & WINIX_NOTIFY_CODE_ADD) != 0; } -void notify_file_deleted(Info & i) +void notify_edit(Info & i) { - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_DELETE) != 0; + i.res = (notify_msg.code & WINIX_NOTIFY_CODE_EDIT) != 0; } -void notify_dir_added(Info & i) +void notify_delete(Info & i) { - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DIR_ADD) != 0; + i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DELETE) != 0; } -void notify_thread_added(Info & i) +void notify_reply(Info & i) { - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_ADD) != 0; + i.res = (notify_msg.code & WINIX_NOTIFY_CODE_REPLY) != 0; } -void notify_thread_replayed(Info & i) -{ - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_REPLAYED) != 0; -} - - -void notify_thread_post_changed(Info & i) -{ - i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_POST_CHANGED) != 0; -} - - - void notify_to_email(Info & i) { i.out << notify_user_msg.email; @@ -81,8 +69,7 @@ void notify_to_email(Info & i) void notify_to_name(Info & i) { - QEncode(notify_user_msg.name, name_q); - i.out << name_q; + i.out << notify_user_msg.name; } @@ -104,19 +91,17 @@ void CreateFunctions() { ezc_functions.Clear(); - ezc_functions.Insert("notify_file_added", notify_file_added); - ezc_functions.Insert("notify_file_edited", notify_file_edited); - ezc_functions.Insert("notify_file_deleted", notify_file_deleted); - ezc_functions.Insert("notify_dir_added", notify_dir_added); + ezc_functions.Insert("fil_qencode", fil_qencode); - ezc_functions.Insert("notify_thread_added", notify_thread_added); - ezc_functions.Insert("notify_thread_replayed", notify_thread_replayed); - ezc_functions.Insert("notify_thread_post_changed", notify_thread_post_changed); + ezc_functions.Insert("notify_add", notify_add); + ezc_functions.Insert("notify_edit", notify_edit); + ezc_functions.Insert("notify_delete", notify_delete); + ezc_functions.Insert("notify_reply", notify_reply); - ezc_functions.Insert("notify_to_email", notify_to_email); - ezc_functions.Insert("notify_to_name", notify_to_name); - ezc_functions.Insert("notify_item_link", notify_item_link); - ezc_functions.Insert("notify_dir_link", notify_dir_link); + ezc_functions.Insert("notify_to_email", notify_to_email); + ezc_functions.Insert("notify_to_name", notify_to_name); + ezc_functions.Insert("notify_item_link", notify_item_link); + ezc_functions.Insert("notify_dir_link", notify_dir_link); plugin.Call(WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &ezc_functions); } diff --git a/plugins/thread/createthread.cpp b/plugins/thread/createthread.cpp index 3992413..e736621 100755 --- a/plugins/thread/createthread.cpp +++ b/plugins/thread/createthread.cpp @@ -50,6 +50,18 @@ return true; } +void CreateThread::SendNotify(const Item & item) +{ + // sending notification + notify_msg.code = WINIX_NOTIFY_CODE_ADD; + notify_msg.template_index = thread_info->template_index; + notify_msg.dir_link = config->base_url; + system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); + notify_msg.item_link = notify_msg.dir_link; + notify_msg.item_link += item.url; + + system->notify.ItemChanged(notify_msg); +} void CreateThread::MakePost() @@ -77,6 +89,7 @@ void CreateThread::MakePost() { log << log2 << "CreateThread: added a new thread" << logend; system->RedirectTo(cur->request->item); + SendNotify(cur->request->item); } else { diff --git a/plugins/thread/createthread.h b/plugins/thread/createthread.h index e17b585..4c07dc3 100755 --- a/plugins/thread/createthread.h +++ b/plugins/thread/createthread.h @@ -13,6 +13,7 @@ #include "functions/functionbase.h" #include "tdb.h" #include "threadinfo.h" +#include "notify/notify.h" namespace Thread @@ -35,7 +36,9 @@ private: TDb * tdb; ThreadInfo * thread_info; Thread thread; + NotifyMsg notify_msg; + void SendNotify(const Item & item); }; diff --git a/plugins/thread/reply.cpp b/plugins/thread/reply.cpp index b8db9fd..443a173 100755 --- a/plugins/thread/reply.cpp +++ b/plugins/thread/reply.cpp @@ -56,6 +56,19 @@ return true; } +void Reply::SendNotify(const Item & item) +{ + // sending notification + notify_msg.code = WINIX_NOTIFY_CODE_REPLY; + notify_msg.template_index = thread_info->template_index; + notify_msg.dir_link = config->base_url; + system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); + notify_msg.item_link = notify_msg.dir_link; + notify_msg.item_link += item.url; + + system->notify.ItemChanged(notify_msg); +} + void Reply::MakePost() { @@ -93,6 +106,7 @@ void Reply::MakePost() { log << log2 << "Reply: added an answer in a thread" << logend; system->RedirectTo(cur->request->item); + SendNotify(cur->request->item); } else { diff --git a/plugins/thread/reply.h b/plugins/thread/reply.h index 4454832..839ab51 100755 --- a/plugins/thread/reply.h +++ b/plugins/thread/reply.h @@ -13,6 +13,7 @@ #include "functions/functionbase.h" #include "tdb.h" #include "threadinfo.h" +#include "notify/notify.h" @@ -39,7 +40,9 @@ private: Item answer; Thread thread; Item * files_dir; + NotifyMsg notify_msg; + void SendNotify(const Item & item); }; diff --git a/plugins/ticket/createticket.cpp b/plugins/ticket/createticket.cpp index a4f0c72..1b7feec 100755 --- a/plugins/ticket/createticket.cpp +++ b/plugins/ticket/createticket.cpp @@ -59,7 +59,7 @@ void CreateTicket::AddTicket(Ticket & ticket, Item & item) if( cur->request->status == WINIX_ERR_OK ) { // sending notification - notify_msg.code = WINIX_NOTIFY_CODE_USER1; + notify_msg.code = WINIX_NOTIFY_CODE_ADD; notify_msg.template_index = ticket_info->template_index; notify_msg.dir_link = config->base_url; system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); diff --git a/plugins/ticket/editticket.cpp b/plugins/ticket/editticket.cpp index e440e34..4daeb25 100755 --- a/plugins/ticket/editticket.cpp +++ b/plugins/ticket/editticket.cpp @@ -63,8 +63,8 @@ void EditTicket::ChangeTicket(Ticket & ticket, Item & item) if( cur->request->status == WINIX_ERR_OK ) { // sending notification - /* - notify_msg.code = WINIX_NOTIFY_CODE_USER1; + + notify_msg.code = WINIX_NOTIFY_CODE_EDIT; notify_msg.template_index = ticket_info->template_index; notify_msg.dir_link = config->base_url; system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); @@ -72,7 +72,6 @@ void EditTicket::ChangeTicket(Ticket & ticket, Item & item) notify_msg.item_link += item.url; system->notify.ItemChanged(notify_msg); - */ } } diff --git a/plugins/ticket/editticket.h b/plugins/ticket/editticket.h index 1bf01b9..146160a 100755 --- a/plugins/ticket/editticket.h +++ b/plugins/ticket/editticket.h @@ -14,6 +14,8 @@ #include "ticket.h" #include "ticketinfo.h" #include "functions/functionbase.h" +#include "notify/notify.h" + namespace Ticket @@ -34,16 +36,17 @@ public: private: + TDb * tdb; + TicketInfo * ticket_info; + std::wstring old_url; + NotifyMsg notify_msg; + void RemoveTmpTicket(); Ticket & PrepareTicket(); std::vector & PrepareFileMap(); - std::wstring old_url; - void ChangeTicket(Ticket & ticket, Item & item); void Submit(Ticket & ticket, Item & item); - TDb * tdb; - TicketInfo * ticket_info; }; diff --git a/plugins/ticket/ticketinfo.cpp b/plugins/ticket/ticketinfo.cpp index bf02e17..18788ae 100755 --- a/plugins/ticket/ticketinfo.cpp +++ b/plugins/ticket/ticketinfo.cpp @@ -336,8 +336,6 @@ bool exists = false; ticket_param.Clear(); - log << log1 << "szukamy dla param_id: " << param_id << logend; - for(size_t i=0 ; itab.size() ; ++i) { if( param_id == cur_conf->tab[i].id ) diff --git a/templates/Makefile.dep b/templates/Makefile.dep index cc7ffaa..e8c46c2 100755 --- a/templates/Makefile.dep +++ b/templates/Makefile.dep @@ -85,6 +85,31 @@ doc.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h doc.o: ../core/thumb.h ../core/basethread.h ../core/sessionmanager.h doc.o: ../core/sessioncontainer.h ../core/system.h ../core/request.h doc.o: ../core/misc.h +filters.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h +filters.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h +filters.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h +filters.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h misc.h +filters.o: localefilter.h locale.h ../core/confparser.h htmltextstream.h +filters.o: ../core/textstream.h ../core/user.h patterncacher.h ../core/item.h +filters.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h +filters.o: ../core/textstream.h indexpatterns.h ../core/config.h +filters.o: ../core/confparser.h ../core/htmlfilter.h ../db/db.h +filters.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h +filters.o: ../core/log.h ../db/dbitemquery.h ../db/dbitemcolumns.h +filters.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h +filters.o: ../core/cur.h ../core/request.h ../core/requesttypes.h +filters.o: ../core/error.h ../core/config.h ../templates/htmltextstream.h +filters.o: ../core/session.h ../core/user.h ../core/plugindata.h +filters.o: ../core/rebus.h ../core/system.h ../core/dirs.h +filters.o: ../core/dircontainer.h ../notify/notify.h ../notify/notifypool.h +filters.o: ../templates/locale.h ../templates/misc.h ../notify/notifythread.h +filters.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +filters.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +filters.o: ../core/cur.h ../core/mounts.h ../core/mount.h +filters.o: ../core/mountparser.h ../core/users.h ../core/groups.h +filters.o: ../core/group.h ../core/loadavg.h ../core/thumb.h +filters.o: ../core/basethread.h ../core/sessionmanager.h +filters.o: ../core/sessioncontainer.h ../core/system.h ../core/misc.h htmltextstream.o: htmltextstream.h ../core/textstream.h misc.h localefilter.h htmltextstream.o: locale.h ../core/confparser.h ../../ezc/src/ezc.h htmltextstream.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h diff --git a/templates/Makefile.o.dep b/templates/Makefile.o.dep index 4464500..ca9edf2 100755 --- a/templates/Makefile.o.dep +++ b/templates/Makefile.o.dep @@ -1 +1 @@ -o = adduser.o dir.o doc.o htmltextstream.o indexpatterns.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o +o = adduser.o dir.o doc.o filters.o htmltextstream.o indexpatterns.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o diff --git a/templates/filters.cpp b/templates/filters.cpp new file mode 100755 index 0000000..64b4aa4 --- /dev/null +++ b/templates/filters.cpp @@ -0,0 +1,64 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2008-2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "templates.h" +#include "core/misc.h" + + +namespace TemplatesFunctions +{ +static std::string urlencode_tmp; +static std::string qencode_tmp; + + +void fil_urlencode(Info & i) +{ + UrlEncode(i.in.Str(), urlencode_tmp); + i.out << R(urlencode_tmp); +} + + +void fil_qencode(Info & i) +{ + QEncode(i.in.Str(), qencode_tmp); + i.out << R(qencode_tmp); +} + + +void fil_capitalize(Info & i) +{ + const std::wstring & str = i.in.Str(); + + for(size_t a=0 ; a='a' && str[a]<='z' ) + i.out << R(wchar_t(str[a] - 'a' + 'A')); + else + i.out << R(str[a]); + } +} + + +void fil_tosmall(Info & i) +{ + const std::wstring & str = i.in.Str(); + + for(size_t a=0 ; a='A' && str[a]<='Z' ) + i.out << R(wchar_t(str[a] - 'A' + 'a')); + else + i.out << R(str[a]); + } +} + + + + +} // namespace diff --git a/templates/htmltextstream.h b/templates/htmltextstream.h index e4c954f..02017e5 100755 --- a/templates/htmltextstream.h +++ b/templates/htmltextstream.h @@ -17,7 +17,7 @@ /* HtmlTextStream is used as a buffer for creating a html page - By default all operators<< escape its string artuments. If you don't want + By default all operators<< escape its string arguments. If you don't want to escape an argument you should use a helper function R() (raw argument) note: you have to define the function yourself, we do not provide it because such a short name would make a mess in namespaces diff --git a/templates/templates.cpp b/templates/templates.cpp index 2e14da0..9fe6972 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -29,7 +29,9 @@ CKEditorGetParser ckeditor_getparser; // used by GenerateRunRaw() std::vector empty_pars; -const std::wstring empty_string; +const std::wstring empty_string; +const HtmlTextStream empty_stream; + Db * db; Cur * cur; @@ -39,6 +41,10 @@ Functions * functions; SessionManager * session_manager; +// generator used by content() function +static EzcGen content_gen; + + Ezc::Pattern * content_for_function() { @@ -109,15 +115,9 @@ Ezc::Pattern * p = 0; if( p ) - { - EzcGen gen; - //gen.Generate(i.out, *p, ezc_functions); - gen.Generate(i.out, *p); - } + content_gen.Generate(i.out, *p); else - { i.out << ""; - } } @@ -182,6 +182,15 @@ void Templates::CreateFunctions() ezc_functions.Insert("dir_last_has_html_template", dir_last_has_html_template); + /* + filters + */ + ezc_functions.Insert("fil_urlencode", fil_urlencode); + ezc_functions.Insert("fil_qencode", fil_qencode); + ezc_functions.Insert("fil_capitalize", fil_capitalize); + ezc_functions.Insert("fil_tosmall", fil_tosmall); + + /* doc */ @@ -614,8 +623,6 @@ using namespace TemplatesFunctions; if( !index ) index = &patterns[locale.GetLang()][pat_index]; - EzcGen generator; - //generator.Generate(cur->request->page, *index, ezc_functions); generator.Generate(cur->request->page, *index); } @@ -628,7 +635,7 @@ using namespace TemplatesFunctions; if( !empty_pars.empty() ) empty_pars.clear(); - Info info(cur->request->page, empty_pars, empty_string); + Info info(cur->request->page, empty_pars, empty_string, empty_stream); info.iter = 0; info.res = false; diff --git a/templates/templates.h b/templates/templates.h index 11e5510..aa62b2c 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -122,6 +122,15 @@ namespace TemplatesFunctions void doc_current_url(Info & i); + /* + filters + */ + void fil_urlencode(Info & i); + void fil_qencode(Info & i); + void fil_capitalize(Info & i); + void fil_tosmall(Info & i); + + /* item */ @@ -387,6 +396,7 @@ private: void ReadFunctionsTemplates(); void SetLocale(); + TemplatesFunctions::EzcGen generator; std::wstring temp; std::wstring fun_file; }; diff --git a/txt/notify_email_cms.txt b/txt/notify_email_cms.txt index 5aa0e47..fa58ed3 100755 --- a/txt/notify_email_cms.txt +++ b/txt/notify_email_cms.txt @@ -1,24 +1,27 @@ -Subject: [if notify_file_added]{notify_new}[else]{notify_change}[end]\n -From: {notify_from}\n -To: [notify_to_name] <[notify_to_email]>\n +Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_change}[end][end]\n +From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n +To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n Content-Type: {notify_content_type} \n\n + + {notify_header} \n\n {notify_msg1}\s -[if-one notify_file_added notify_dir_added] + +[if notify_add] {notify_msg6}\n [notify_item_link]\n\n [end] -[if notify_file_edited] +[if notify_edit] {notify_msg7}\n [notify_item_link]\n\n [end] -[if notify_file_deleted] +[if notify_delete] {notify_msg8}\n [notify_item_link]\n\n [end] diff --git a/txt/notify_email_thread.txt b/txt/notify_email_thread.txt index 8ab7e5f..21a6b02 100755 --- a/txt/notify_email_thread.txt +++ b/txt/notify_email_thread.txt @@ -1,34 +1,23 @@ -Subject: [if notify_thread_added]{notify_new}[else]{notify_change}[end]\n -From: {notify_from}\n -To: [notify_to_name] <[notify_to_email]>\n +Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_reply}[end][end]\n +From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n +To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n Content-Type: {notify_content_type} \n\n + + {notify_header} \n\n {notify_msg1}\s -[if notify_thread_added] +[if notify_add] {notify_msg2}\n - [notify_dir_link]\n\n -[end] - -[if notify_thread_replayed] - {notify_msg3}\n - [notify_dir_link]\n\n -[end] - -[if notify_thread_post_changed] - {notify_msg4}\n [notify_item_link]\n\n - - [# dodac drugi link typu: caly watek i adres url] [end] -[# tu bedzie jakos inaczej] -[if notify_file_deleted] - {notify_msg5}\n +[if notify_reply] + {notify_msg3}\n [notify_item_link]\n\n [end] diff --git a/txt/notify_email_ticket.txt b/txt/notify_email_ticket.txt index 46bbefa..9e60392 100755 --- a/txt/notify_email_ticket.txt +++ b/txt/notify_email_ticket.txt @@ -1,15 +1,25 @@ -Subject: {notify_new}\n -From: {notify_from}\n -To: [notify_to_name] <[notify_to_email]>\n +Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_change}[end][end]\n +From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n +To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n Content-Type: {notify_content_type} \n\n + + {notify_header} \n\n {notify_msg1}\s -{notify_msg2b}\n -[notify_item_link]\n\n + +[if notify_add] + {notify_msg2b}\n + [notify_item_link]\n\n +[end] + +[if notify_edit] + {notify_msg7b}\n + [notify_item_link]\n\n +[end] {notify_msg9}\n