From 027a8ec4289dfb85013fb70c8baff3140e6d179b Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 23 Oct 2018 23:28:45 +0000 Subject: [PATCH] added to HTMLFilter: - now we can parse " and ' in html attributes - we can skip html tags and commentaries, added method: void SkipAllTags(bool skip_all_tags, bool skip_commentaries); - there is virtual method: virtual void ItemFound(); which is called when a html tag is parsed git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1129 e52654a7-88a9-db11-a3e9-0013d4bc506e --- winixd/Makefile.dep | 2 +- winixd/core/htmlfilter.cpp | 180 ++++++++++++++++++++++++------------- winixd/core/htmlfilter.h | 17 ++-- 3 files changed, 130 insertions(+), 69 deletions(-) diff --git a/winixd/Makefile.dep b/winixd/Makefile.dep index fcffbd4..bb1352f 100644 --- a/winixd/Makefile.dep +++ b/winixd/Makefile.dep @@ -1 +1 @@ -winix.src.files = ./core/synchro.h ./core/sessioncontainer.h ./core/cookieparser.h ./core/misc.cpp ./core/item.cpp ./core/error.h ./core/timezone.h ./core/compress.h ./core/crypt.cpp ./core/dirs.cpp ./core/slog.cpp ./core/config.cpp ./core/lastcontainer.cpp ./core/users.h ./core/httpsimpleparser.cpp ./core/threadmanager.h ./core/postparser.h ./core/pluginmsg.h ./core/acceptbaseparser.h ./core/loadavg.cpp ./core/job.h ./core/mountparser.cpp ./core/timezones.h ./core/sessionmanager.h ./core/groups.h ./core/system.cpp ./core/rebus.h ./core/synchro.cpp ./core/lock.cpp ./core/acceptencodingparser.h ./core/version.h ./core/compress.cpp ./core/ipbancontainer.cpp ./core/request.h ./core/plugindata.h ./core/plugin.cpp ./core/sessionparser.cpp ./core/bbcodeparser.h ./core/users.cpp ./core/mount.cpp ./core/item.h ./core/slog.h ./core/threadmanager.cpp ./core/acceptbaseparser.cpp ./core/lastcontainer.h ./core/httpsimpleparser.h ./core/timezones.cpp ./core/groups.cpp ./core/requesttypes.h ./core/system.h ./core/bbcodeparser.cpp ./core/lock.h ./core/ipbancontainer.h ./core/group.h ./core/plugin.h ./core/run.cpp ./core/textstream.h ./core/sessionparser.h ./core/basethread.h ./core/mount.h ./core/htmlfilter.cpp ./core/user.cpp ./core/app.cpp ./core/image.cpp ./core/ugcontainer.h ./core/postmultiparser.h ./core/logmanipulators.h ./core/sessioncontainer.cpp ./core/dircontainer.h ./core/log.h ./core/session.h ./core/timezone.cpp ./core/mounts.h ./core/ipban.h ./core/cur.h ./core/misc.h ./core/dirs.h ./core/crypt.h ./core/run.h ./core/config.h ./core/job.cpp ./core/postmultiparser.cpp ./core/sessionmanager.cpp ./core/htmlfilter.h ./core/rebus.cpp ./core/dircontainer.cpp ./core/log.cpp ./core/user.h ./core/loadavg.h ./core/session.cpp ./core/mountparser.h ./core/mounts.cpp ./core/image.h ./core/plugindata.cpp ./core/request.cpp ./core/app.h ./core/basethread.cpp ./core/sessionidmanager.h ./core/winix_const.h ./core/sessionidmanager.cpp ./db/dbconn.cpp ./db/db.cpp ./db/dbbase.h ./db/dbitemcolumns.cpp ./db/dbtextstream.cpp ./db/dbconn.h ./db/db.h ./db/dbitemcolumns.h ./db/dbitemquery.cpp ./db/dbtextstream.h ./db/dbitemquery.h ./db/dbbase.cpp ./functions/upload.cpp ./functions/priv.h ./functions/env.cpp ./functions/default.h ./functions/node.h ./functions/specialdefault.h ./functions/timezone.cpp ./functions/pw.h ./functions/adduser.h ./functions/chmod.h ./functions/imgcrop.cpp ./functions/vim.h ./functions/account.h ./functions/mount.cpp ./functions/uptime.cpp ./functions/ckeditor.cpp ./functions/mkdir.cpp ./functions/reload.cpp ./functions/functionparser.h ./functions/logout.cpp ./functions/rmuser.cpp ./functions/rm.cpp ./functions/chown.h ./functions/nicedit.h ./functions/mv.h ./functions/node.cpp ./functions/specialdefault.cpp ./functions/adduser.cpp ./functions/upload.h ./functions/vim.cpp ./functions/env.h ./functions/timezone.h ./functions/who.h ./functions/cp.cpp ./functions/run.cpp ./functions/locale.h ./functions/imgcrop.h ./functions/passwd.h ./functions/mount.h ./functions/privchanger.cpp ./functions/functions.cpp ./functions/last.h ./functions/ckeditor.h ./functions/mkdir.h ./functions/reload.h ./functions/cat.h ./functions/download.h ./functions/ln.h ./functions/nicedit.cpp ./functions/functionbase.cpp ./functions/man.h ./functions/rm.h ./functions/meta.cpp ./functions/emacs.cpp ./functions/sort.h ./functions/who.cpp ./functions/ipban.h ./functions/locale.cpp ./functions/passwd.cpp ./functions/last.cpp ./functions/subject.h ./functions/download.cpp ./functions/cp.h ./functions/cat.cpp ./functions/login.cpp ./functions/tinymce.cpp ./functions/ln.cpp ./functions/run.h ./functions/uname.h ./functions/man.cpp ./functions/functions.h ./functions/privchanger.h ./functions/ls.cpp ./functions/template.h ./functions/stat.h ./functions/priv.cpp ./functions/default.cpp ./functions/functionbase.h ./functions/pw.cpp ./functions/sort.cpp ./functions/ipban.cpp ./functions/chmod.cpp ./functions/meta.h ./functions/account.cpp ./functions/emacs.h ./functions/subject.cpp ./functions/functionparser.cpp ./functions/uname.cpp ./functions/uptime.h ./functions/template.cpp ./functions/stat.cpp ./functions/tinymce.h ./functions/login.h ./functions/chown.cpp ./functions/logout.h ./functions/mv.cpp ./functions/rmuser.h ./functions/ls.h ./main/main.cpp ./notify/notifypool.h ./notify/templatesnotify.cpp ./notify/notify.cpp ./notify/templatesnotify.h ./notify/notify.h ./notify/notifythread.cpp ./notify/notifypool.cpp ./notify/notifythread.h ./plugins/group/init.cpp ./plugins/group/groups.h ./plugins/group/groupinfo.cpp ./plugins/group/groupinfo.h ./plugins/group/templates.cpp ./plugins/group/groups.cpp ./plugins/stats/statssession.h ./plugins/stats/bot.h ./plugins/stats/stats.cpp ./plugins/stats/templates.cpp ./plugins/stats/init.cpp ./plugins/stats/stats.h ./plugins/stats/templates.h ./plugins/stats/bot.cpp ./plugins/gallery/galleryinfo.cpp ./plugins/gallery/templates.cpp ./plugins/gallery/gallery.cpp ./plugins/gallery/galleryinfo.h ./plugins/gallery/init.cpp ./plugins/gallery/gallery.h ./plugins/export/init.cpp ./plugins/export/export.h ./plugins/export/exportthread.cpp ./plugins/export/message.h ./plugins/export/edb.cpp ./plugins/export/funexport.cpp ./plugins/export/exportinfo.cpp ./plugins/export/exportthread.h ./plugins/export/edb.h ./plugins/export/funexport.h ./plugins/export/exportinfo.h ./plugins/ticket/funticket.h ./plugins/ticket/init.cpp ./plugins/ticket/ticketinfo.h ./plugins/ticket/showtickets.cpp ./plugins/ticket/createticket.cpp ./plugins/ticket/tdb.cpp ./plugins/ticket/pluginmsg.h ./plugins/ticket/createticket.h ./plugins/ticket/showtickets.h ./plugins/ticket/sessiondata.cpp ./plugins/ticket/tdb.h ./plugins/ticket/sessiondata.h ./plugins/ticket/ticket.h ./plugins/ticket/editticket.cpp ./plugins/ticket/funticket.cpp ./plugins/ticket/templates.cpp ./plugins/ticket/editticket.h ./plugins/ticket/ticketinfo.cpp ./plugins/menu/cache.cpp ./plugins/menu/init.cpp ./plugins/menu/cache.h ./plugins/menu/templates.cpp ./plugins/thread/funthread.cpp ./plugins/thread/threadinfo.cpp ./plugins/thread/funthread.h ./plugins/thread/threadinfo.h ./plugins/thread/createthread.cpp ./plugins/thread/reply.cpp ./plugins/thread/showthreads.cpp ./plugins/thread/templates.cpp ./plugins/thread/createthread.h ./plugins/thread/reply.h ./plugins/thread/showthreads.h ./plugins/thread/init.cpp ./plugins/thread/templates.h ./plugins/thread/tdb.cpp ./plugins/thread/pluginmsg.h ./plugins/thread/thread.h ./plugins/thread/tdb.h ./plugins/mailregister/funregistermail.h ./plugins/mailregister/mdb.h ./plugins/mailregister/funregistermail.cpp ./plugins/mailregister/mdb.cpp ./plugins/mailregister/init.cpp ./plugins/mailregister/templates.cpp ./plugins/mailregister/registermail_info.h ./plugins/mailregister/funregistermail_showusers.h ./plugins/mailregister/funregistermail_showusers.cpp ./plugins/mailregister/registermail_info.cpp ./templates/who.cpp ./templates/item.cpp ./templates/mount.cpp ./templates/templates.h ./templates/locale.h ./templates/slog.cpp ./templates/doc.cpp ./templates/localefilter.cpp ./templates/config.cpp ./templates/patterns.h ./templates/miscspace.cpp ./templates/filters.cpp ./templates/login.cpp ./templates/man.cpp ./templates/changepatterns.h ./templates/stat.cpp ./templates/template.cpp ./templates/dir.cpp ./templates/user.cpp ./templates/rebus.cpp ./templates/patterncacher.cpp ./templates/upload.cpp ./templates/textextstream.h ./templates/adduser.cpp ./templates/ipban.cpp ./templates/htmltextstream.h ./templates/indexpatterns.h ./templates/templates.cpp ./templates/winix.cpp ./templates/locale.cpp ./templates/misc.h ./templates/patterns.cpp ./templates/passwd.cpp ./templates/last.cpp ./templates/uptime.cpp ./templates/insert.cpp ./templates/changepatterns.cpp ./templates/localefilter.h ./templates/miscspace.h ./templates/ls.cpp ./templates/sys.cpp ./templates/priv.cpp ./templates/textextstream.cpp ./templates/htmltextstream.cpp ./templates/env.cpp ./templates/indexpatterns.cpp ./templates/patterncacher.h ./templates/misc.cpp ./templates/generic.cpp ./templates/currentdate.cpp ./templates/server.cpp ./templates/antispam.cpp ../../ezc/src/blocks.cpp ../../ezc/src/blocks.h ../../ezc/src/cache.cpp ../../ezc/src/cache.h ../../ezc/src/ezc.h ../../ezc/src/functions.h ../../ezc/src/funinfo.h ../../ezc/src/generator.h ../../ezc/src/item.cpp ../../ezc/src/item.h ../../ezc/src/objects.h ../../ezc/src/outstreams.h ../../ezc/src/pattern.cpp ../../ezc/src/pattern.h ../../ezc/src/patternparser.cpp ../../ezc/src/patternparser.h ../../tito/src/crypto.cpp ../../tito/src/misc.h ../../tito/src/base64.cpp ../../tito/src/crypto.h ../../tito/src/aes.cpp ../../tito/src/base64.h ../../tito/src/misc.cpp ../../tito/src/aes.h ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h ../../pikotools/convert/text.h ../../pikotools/convert/text.cpp ../../pikotools/convert/strtoint.h ../../pikotools/convert/misc.h ../../pikotools/convert/misc.cpp ../../pikotools/date/date.cpp ../../pikotools/date/date.h ../../pikotools/mainparser/sample/sample.cpp ../../pikotools/mainparser/mainparser.cpp ../../pikotools/mainparser/mainparser.h ../../pikotools/mainspaceparser/mainspaceparser.cpp ../../pikotools/mainspaceparser/mainspaceparser.h ../../pikotools/membuffer/membuffer.h ../../pikotools/space/jsontospaceparser.cpp ../../pikotools/space/jsontospaceparser.h ../../pikotools/space/space.cpp ../../pikotools/space/space.h ../../pikotools/space/spaceparser.cpp ../../pikotools/space/spaceparser.h ../../pikotools/space/spacetojson.cpp ../../pikotools/space/spacetojson.h ../../pikotools/textstream/textstream.h ../../pikotools/textstream/types.h ../../pikotools/utf8/utf8.cpp ../../pikotools/utf8/utf8.h ../../pikotools/logger/logger.cpp ../../pikotools/logger/logger.h ../../morm/src/finder.h ../../morm/src/model.cpp ../../morm/src/model.h ../../morm/src/modelconnector.cpp ../../morm/src/modelconnector.h ../../morm/src/morm.h ../../morm/src/morm_types.h ../../morm/src/outstream.h ../../morm/src/flatconnector.h ../../morm/src/flatconnector.cpp ../../morm/src/dbconnector.cpp ../../morm/src/jsonconnector.h ../../morm/src/jsonconnector.cpp ../../morm/src/dbconnector.h ../../morm/src/postgresqlconnector.h ../../morm/src/postgresqlconnector.cpp ../../morm/src/baseexpression.cpp ../../morm/src/baseexpression.h ../../morm/src/flatexpression.cpp ../../morm/src/postgresqlexpression.h ../../morm/src/dbexpression.h ../../morm/src/dbexpression.cpp ../../morm/src/flatexpression.h ../../morm/src/postgresqlexpression.cpp ../../morm/src/clearer.cpp ../../morm/src/jsonexpression.h ../../morm/src/jsonexpression.cpp ../../morm/src/clearer.h \ No newline at end of file +winix.src.files = ./templates/miscspace.h ./templates/generic.cpp ./templates/sys.cpp ./templates/user.cpp ./templates/currentdate.cpp ./templates/textextstream.cpp ./templates/upload.cpp ./templates/patterncacher.h ./templates/env.cpp ./templates/indexpatterns.cpp ./templates/htmltextstream.h ./templates/who.cpp ./templates/locale.cpp ./templates/misc.h ./templates/patterns.cpp ./templates/passwd.cpp ./templates/mount.cpp ./templates/templates.h ./templates/last.cpp ./templates/uptime.cpp ./templates/insert.cpp ./templates/doc.cpp ./templates/changepatterns.cpp ./templates/server.cpp ./templates/miscspace.cpp ./templates/login.cpp ./templates/filters.cpp ./templates/localefilter.h ./templates/man.cpp ./templates/ls.cpp ./templates/dir.cpp ./templates/priv.cpp ./templates/rebus.cpp ./templates/patterncacher.cpp ./templates/htmltextstream.cpp ./templates/textextstream.h ./templates/adduser.cpp ./templates/ipban.cpp ./templates/misc.cpp ./templates/indexpatterns.h ./templates/item.cpp ./templates/templates.cpp ./templates/winix.cpp ./templates/slog.cpp ./templates/locale.h ./templates/patterns.h ./templates/config.cpp ./templates/localefilter.cpp ./templates/changepatterns.h ./templates/stat.cpp ./templates/template.cpp ./templates/antispam.cpp ./plugins/mailregister/funregistermail_showusers.h ./plugins/mailregister/mdb.h ./plugins/mailregister/registermail_info.h ./plugins/mailregister/templates.cpp ./plugins/mailregister/funregistermail.cpp ./plugins/mailregister/funregistermail_showusers.cpp ./plugins/mailregister/mdb.cpp ./plugins/mailregister/registermail_info.cpp ./plugins/mailregister/init.cpp ./plugins/mailregister/funregistermail.h ./plugins/thread/tdb.cpp ./plugins/thread/pluginmsg.h ./plugins/thread/thread.h ./plugins/thread/tdb.h ./plugins/thread/funthread.cpp ./plugins/thread/threadinfo.cpp ./plugins/thread/funthread.h ./plugins/thread/threadinfo.h ./plugins/thread/createthread.cpp ./plugins/thread/reply.cpp ./plugins/thread/showthreads.cpp ./plugins/thread/templates.cpp ./plugins/thread/createthread.h ./plugins/thread/reply.h ./plugins/thread/showthreads.h ./plugins/thread/init.cpp ./plugins/thread/templates.h ./plugins/group/groupinfo.h ./plugins/group/templates.cpp ./plugins/group/groups.cpp ./plugins/group/init.cpp ./plugins/group/groups.h ./plugins/group/groupinfo.cpp ./plugins/stats/bot.cpp ./plugins/stats/statssession.h ./plugins/stats/bot.h ./plugins/stats/stats.cpp ./plugins/stats/templates.cpp ./plugins/stats/init.cpp ./plugins/stats/stats.h ./plugins/stats/templates.h ./plugins/gallery/gallery.h ./plugins/gallery/galleryinfo.cpp ./plugins/gallery/templates.cpp ./plugins/gallery/gallery.cpp ./plugins/gallery/galleryinfo.h ./plugins/gallery/init.cpp ./plugins/export/init.cpp ./plugins/export/export.h ./plugins/export/exportthread.cpp ./plugins/export/message.h ./plugins/export/edb.cpp ./plugins/export/funexport.cpp ./plugins/export/exportinfo.cpp ./plugins/export/exportthread.h ./plugins/export/edb.h ./plugins/export/funexport.h ./plugins/export/exportinfo.h ./plugins/ticket/sessiondata.h ./plugins/ticket/ticket.h ./plugins/ticket/editticket.cpp ./plugins/ticket/funticket.cpp ./plugins/ticket/templates.cpp ./plugins/ticket/editticket.h ./plugins/ticket/ticketinfo.cpp ./plugins/ticket/funticket.h ./plugins/ticket/init.cpp ./plugins/ticket/ticketinfo.h ./plugins/ticket/createticket.cpp ./plugins/ticket/showtickets.cpp ./plugins/ticket/tdb.cpp ./plugins/ticket/pluginmsg.h ./plugins/ticket/showtickets.h ./plugins/ticket/createticket.h ./plugins/ticket/sessiondata.cpp ./plugins/ticket/tdb.h ./plugins/menu/cache.cpp ./plugins/menu/init.cpp ./plugins/menu/cache.h ./plugins/menu/templates.cpp ./main/main.cpp ./db/dbbase.cpp ./db/dbconn.cpp ./db/db.cpp ./db/dbbase.h ./db/dbitemcolumns.cpp ./db/dbtextstream.cpp ./db/dbconn.h ./db/db.h ./db/dbitemcolumns.h ./db/dbitemquery.cpp ./db/dbtextstream.h ./db/dbitemquery.h ./core/loadavg.h ./core/session.cpp ./core/user.h ./core/mountparser.h ./core/mounts.cpp ./core/app.h ./core/image.h ./core/plugindata.cpp ./core/request.cpp ./core/synchro.h ./core/sessioncontainer.h ./core/cookieparser.h ./core/misc.cpp ./core/error.h ./core/item.cpp ./core/timezone.h ./core/compress.h ./core/dirs.cpp ./core/crypt.cpp ./core/slog.cpp ./core/config.cpp ./core/users.h ./core/lastcontainer.cpp ./core/httpsimpleparser.cpp ./core/postparser.h ./core/threadmanager.h ./core/pluginmsg.h ./core/acceptbaseparser.h ./core/loadavg.cpp ./core/mountparser.cpp ./core/job.h ./core/timezones.h ./core/sessionmanager.h ./core/groups.h ./core/system.cpp ./core/rebus.h ./core/synchro.cpp ./core/lock.cpp ./core/acceptencodingparser.h ./core/version.h ./core/compress.cpp ./core/ipbancontainer.cpp ./core/request.h ./core/plugindata.h ./core/plugin.cpp ./core/sessionparser.cpp ./core/sessionidmanager.h ./core/bbcodeparser.h ./core/users.cpp ./core/basethread.cpp ./core/mount.cpp ./core/item.h ./core/acceptbaseparser.cpp ./core/slog.h ./core/httpsimpleparser.h ./core/lastcontainer.h ./core/timezones.cpp ./core/groups.cpp ./core/requesttypes.h ./core/system.h ./core/sessionidmanager.cpp ./core/bbcodeparser.cpp ./core/lock.h ./core/group.h ./core/ipbancontainer.h ./core/plugin.h ./core/run.cpp ./core/textstream.h ./core/sessionparser.h ./core/mount.h ./core/basethread.h ./core/winix_const.h ./core/htmlfilter.cpp ./core/user.cpp ./core/app.cpp ./core/image.cpp ./core/postmultiparser.h ./core/ugcontainer.h ./core/logmanipulators.h ./core/log.h ./core/dircontainer.h ./core/sessioncontainer.cpp ./core/session.h ./core/mounts.h ./core/timezone.cpp ./core/ipban.h ./core/cur.h ./core/misc.h ./core/crypt.h ./core/threadmanager.cpp ./core/dirs.h ./core/run.h ./core/job.cpp ./core/config.h ./core/postmultiparser.cpp ./core/sessionmanager.cpp ./core/htmlfilter.h ./core/rebus.cpp ./core/log.cpp ./core/dircontainer.cpp ./functions/download.cpp ./functions/cp.h ./functions/functions.cpp ./functions/logout.cpp ./functions/cat.h ./functions/rmuser.cpp ./functions/login.h ./functions/rm.cpp ./functions/priv.cpp ./functions/man.h ./functions/specialdefault.cpp ./functions/sort.cpp ./functions/emacs.cpp ./functions/env.cpp ./functions/timezone.h ./functions/chmod.h ./functions/imgcrop.cpp ./functions/cp.cpp ./functions/subject.h ./functions/login.cpp ./functions/last.h ./functions/uptime.h ./functions/run.h ./functions/ckeditor.h ./functions/stat.cpp ./functions/template.cpp ./functions/download.h ./functions/privchanger.h ./functions/logout.h ./functions/rmuser.h ./functions/chown.h ./functions/ls.h ./functions/adduser.cpp ./functions/ipban.cpp ./functions/chmod.cpp ./functions/specialdefault.h ./functions/timezone.cpp ./functions/vim.cpp ./functions/pw.h ./functions/sort.h ./functions/locale.cpp ./functions/passwd.cpp ./functions/ckeditor.cpp ./functions/run.cpp ./functions/uname.cpp ./functions/functionparser.h ./functions/mount.h ./functions/privchanger.cpp ./functions/ln.cpp ./functions/mkdir.h ./functions/tinymce.h ./functions/ls.cpp ./functions/chown.cpp ./functions/nicedit.cpp ./functions/template.h ./functions/stat.h ./functions/node.cpp ./functions/functionbase.h ./functions/pw.cpp ./functions/mv.h ./functions/upload.h ./functions/default.h ./functions/meta.h ./functions/adduser.h ./functions/who.cpp ./functions/ipban.h ./functions/vim.h ./functions/account.h ./functions/functionparser.cpp ./functions/mount.cpp ./functions/locale.h ./functions/mkdir.cpp ./functions/passwd.h ./functions/cat.cpp ./functions/tinymce.cpp ./functions/uname.h ./functions/man.cpp ./functions/reload.h ./functions/functions.h ./functions/ln.h ./functions/functionbase.cpp ./functions/mv.cpp ./functions/rm.h ./functions/default.cpp ./functions/nicedit.h ./functions/upload.cpp ./functions/priv.h ./functions/meta.cpp ./functions/node.h ./functions/account.cpp ./functions/env.h ./functions/emacs.h ./functions/subject.cpp ./functions/who.h ./functions/last.cpp ./functions/uptime.cpp ./functions/imgcrop.h ./functions/reload.cpp ./notify/templatesnotify.h ./notify/notify.h ./notify/notifythread.cpp ./notify/notifypool.cpp ./notify/notifythread.h ./notify/notifypool.h ./notify/templatesnotify.cpp ./notify/notify.cpp ../../ezc/src/funinfo.h ../../ezc/src/patternparser.cpp ../../ezc/src/generator.h ../../ezc/src/functions.h ../../ezc/src/pattern.cpp ../../ezc/src/item.cpp ../../ezc/src/patternparser.h ../../ezc/src/pattern.h ../../ezc/src/item.h ../../ezc/src/ezc.h ../../ezc/src/cache.cpp ../../ezc/src/cache.h ../../ezc/src/blocks.h ../../ezc/src/blocks.cpp ../../ezc/src/objects.h ../../ezc/src/outstreams.h ../../tito/src/crypto.cpp ../../tito/src/misc.h ../../tito/src/base64.cpp ../../tito/src/crypto.h ../../tito/src/aes.cpp ../../tito/src/base64.h ../../tito/src/misc.cpp ../../tito/src/aes.h ../../pikotools/mainparser/sample/sample.cpp ../../pikotools/mainparser/mainparser.cpp ../../pikotools/mainparser/mainparser.h ../../pikotools/space/space.h ../../pikotools/space/spaceparser.cpp ../../pikotools/space/space.cpp ../../pikotools/space/spaceparser.h ../../pikotools/space/jsontospaceparser.cpp ../../pikotools/space/spacetojson.cpp ../../pikotools/space/jsontospaceparser.h ../../pikotools/space/spacetojson.h ../../pikotools/date/date.h ../../pikotools/date/date.cpp ../../pikotools/membuffer/membuffer.h ../../pikotools/utf8/utf8.cpp ../../pikotools/utf8/utf8.h ../../pikotools/textstream/textstream.h ../../pikotools/textstream/types.h ../../pikotools/convert/convert.h ../../pikotools/convert/inttostr.h ../../pikotools/convert/misc.cpp ../../pikotools/convert/misc.h ../../pikotools/convert/strtoint.h ../../pikotools/convert/text.cpp ../../pikotools/convert/text.h ../../pikotools/mainspaceparser/mainspaceparser.cpp ../../pikotools/mainspaceparser/mainspaceparser.h ../../pikotools/logger/logger.cpp ../../pikotools/logger/logger.h ../../morm/src/dbconnector.cpp ../../morm/src/finder.h ../../morm/src/model.cpp ../../morm/src/model.h ../../morm/src/modelconnector.cpp ../../morm/src/modelconnector.h ../../morm/src/morm.h ../../morm/src/morm_types.h ../../morm/src/outstream.h ../../morm/src/baseexpression.cpp ../../morm/src/baseexpression.h ../../morm/src/dochtmlexpression.h ../../morm/src/dbconnector.h ../../morm/src/dbexpression.cpp ../../morm/src/dbexpression.h ../../morm/src/flatconnector.cpp ../../morm/src/flatconnector.h ../../morm/src/flatexpression.cpp ../../morm/src/flatexpression.h ../../morm/src/jsonconnector.cpp ../../morm/src/jsonconnector.h ../../morm/src/jsonexpression.cpp ../../morm/src/jsonexpression.h ../../morm/src/postgresqlconnector.cpp ../../morm/src/postgresqlconnector.h ../../morm/src/postgresqlexpression.cpp ../../morm/src/postgresqlexpression.h ../../morm/src/dochtmlconnector.h ../../morm/src/dochtmlconnector.cpp ../../morm/src/dochtmlexpression.cpp ../../morm/src/clearer.cpp ../../morm/src/clearer.h \ No newline at end of file diff --git a/winixd/core/htmlfilter.cpp b/winixd/core/htmlfilter.cpp index 20803f1..e6c216b 100644 --- a/winixd/core/htmlfilter.cpp +++ b/winixd/core/htmlfilter.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2014, Tomasz Sowa + * Copyright (c) 2008-2018, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,17 +97,25 @@ size_t out_projected_len = in.size() * 2 + 1; } -HTMLFilter::HTMLFilter() +void HTMLFilter::SetSomeDefaults() { - pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN]; - buffer = new wchar_t[WINIX_HTMLFILTER_BUFFER_MAXLEN]; - tab_size = 2; trim_white = false; break_after = 0; wrap_line = 0; orphan_mode = orphan_nbsp; safe_mode = false; + skip_all_tags = false; + skip_commentaries = false; +} + + +HTMLFilter::HTMLFilter() +{ + pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN]; + buffer = new wchar_t[WINIX_HTMLFILTER_BUFFER_MAXLEN]; + + SetSomeDefaults(); } @@ -116,6 +124,8 @@ HTMLFilter::HTMLFilter(const HTMLFilter & f) // don't need to copy the stack pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN]; buffer = new wchar_t[WINIX_HTMLFILTER_BUFFER_MAXLEN]; + + SetSomeDefaults(); } @@ -125,6 +135,8 @@ HTMLFilter & HTMLFilter::operator=(const HTMLFilter & f) pstack = new Item[WINIX_HTMLFILTER_STACK_MAXLEN]; buffer = new wchar_t[WINIX_HTMLFILTER_BUFFER_MAXLEN]; + // we can copy some fields from f + return *this; } @@ -136,6 +148,8 @@ HTMLFilter::~HTMLFilter() } + + void HTMLFilter::BreakWord(size_t break_after_) { break_after = break_after_; @@ -224,6 +238,13 @@ void HTMLFilter::SafeMode(bool safe_mode_) } +void HTMLFilter::SkipAllTags(bool skip_all_tags, bool skip_commentaries) +{ + this->skip_all_tags = skip_all_tags; + this->skip_commentaries = skip_commentaries; +} + + void HTMLFilter::SetNoFilterTag(const std::wstring & tag_name) { no_filter_tag = tag_name; @@ -374,9 +395,10 @@ return false; // used for such tags as: script, pre, textarea -void HTMLFilter::PutLastTagWithClosingTag() +void HTMLFilter::PutEverythingUntilClosingTag(bool put_closing_tag_as_well) { const wchar_t * start = pchar; +const wchar_t * end = pchar; while( *pchar != 0 ) { @@ -384,32 +406,9 @@ const wchar_t * start = pchar; { if( IsClosingTagForLastItem() ) { - PopStack(); - CheckNewLine(); - break; - } - } - else - { - pchar += 1; - } - } + if( put_closing_tag_as_well ) + end = pchar; - Put(start, pchar); -} - - -// used with tags -void HTMLFilter::PutTextBetweenLastTagWithClosingTag() -{ -const wchar_t * start = pchar, * end = pchar; - - while( *pchar != 0 ) - { - if( IsOpeningTagMark() ) - { - if( IsClosingTagForLastItem() ) - { PopStack(); CheckNewLine(); break; @@ -427,16 +426,36 @@ const wchar_t * start = pchar, * end = pchar; + void HTMLFilter::SkipAndCheckClosingTag() { + bool is_quoted = false; + wchar_t quote_char = 0; + for( ; *pchar ; ++pchar ) { - if( LastItem().type == Item::opening && IsClosingXmlSimpleTagMark() ) // closing xml tag: default '/' + if( *pchar == '"' || *pchar == '\'' ) + { + if( is_quoted ) + { + if( *pchar == quote_char ) + { + is_quoted = false; + } + } + else + { + is_quoted = true; + quote_char = *pchar; + } + } + else + if( !is_quoted && LastItem().type == Item::opening && IsClosingXmlSimpleTagMark() ) // closing xml tag: default '/' { LastItem().type = Item::simple; } - - if( IsClosingTagMark() ) + else + if( !is_quoted && IsClosingTagMark() ) { ++pchar; break; @@ -502,18 +521,26 @@ size_t i; -void HTMLFilter::ReadItemAttrValue(bool has_quote) +void HTMLFilter::ReadItemAttrValue(bool has_quote, wchar_t quote_char) { size_t i; - // sprawdzic to wszedzie bo teraz jest tablica attr_value.clear(); attr_value_temp.clear(); - // !! dodac obsluge pojedynczego cudzyslowu - - for(i=0 ; *pchar && *pchar != '\"' && !IsClosingTagMark() && (has_quote || (*pchar!=10 && !IsWhite(*pchar)) ); ++i ) + for(i=0 ; *pchar ; ++i, ++pchar ) { + if( has_quote ) + { + if( *pchar == quote_char ) + break; + } + else + { + if( IsClosingTagMark() || *pchar == 10 || IsWhite(*pchar) ) + break; + } + if( *pchar==10 || IsWhite(*pchar) ) { if( !attr_value_temp.empty() ) @@ -524,9 +551,9 @@ size_t i; } else if( i < WINIX_HTMLFILTER_ATTR_VALUE_MAXLEN ) + { attr_value_temp += *pchar; - - ++pchar; + } } if( !attr_value_temp.empty() ) @@ -795,8 +822,8 @@ void HTMLFilter::PutClosingTagMark() -// !! zmienic na lepsza nazwe -// bo to nie zwraca true jesli tag jest safe +// !! IMPROVE ME change to a better name +// this functions does not return true when the tag is safe bool HTMLFilter::IsTagSafe(const wchar_t * tag) { if( !safe_mode ) @@ -838,9 +865,10 @@ bool HTMLFilter::IsTagSafe(const std::wstring & tag) bool HTMLFilter::PutOpeningTag() { if( !IsTagSafe(LastItem().name) ) - // !! IMPROVE ME - // !! dodac tutaj skipniecie calego tagu + { + SkipAndCheckClosingTag(); return false; + } PutOpeningTagMark(); Put(LastItem().name); @@ -852,7 +880,7 @@ return true; void HTMLFilter::PutClosingTag(const wchar_t * tag) { - if( !IsTagSafe(tag) ) + if( skip_all_tags || !IsTagSafe(tag) ) return; PutOpeningTagMark(); @@ -1005,9 +1033,19 @@ const wchar_t * last_non_white = pchar; while( *pchar != 0 ) { + const wchar_t * commentary_start = pchar; + if( SkipCommentaryTagIfExists() ) { last_non_white = pchar - 1; // pointing at the last '>' from a commentary + PutNormalText(start, commentary_start); + + if( !skip_commentaries ) + { + PutNormalText(commentary_start, pchar); + } + + start = pchar; } else { @@ -1029,7 +1067,7 @@ const wchar_t * last_non_white = pchar; bool HTMLFilter::PrintOpeningItem() { - if( IsNameEqual(no_filter_tag, LastItem().name) ) + if( skip_all_tags || IsNameEqual(no_filter_tag, LastItem().name) ) return true; if( last_new_line ) @@ -1068,16 +1106,15 @@ bool HTMLFilter::ReadItemAttr() pchar += 1; // skipping '=' SkipWhiteLines(); - - // !! dodac obsluge pojedynczego cudzyslowu - bool has_quote = (*pchar == '\"'); + bool has_quote = (*pchar == '\"' || *pchar == '\''); + wchar_t quote_char = *pchar; if( has_quote ) pchar += 1; // skipping the first quote mark - ReadItemAttrValue(has_quote); + ReadItemAttrValue(has_quote, quote_char); - if( *pchar == '\"' ) + if( has_quote && *pchar == quote_char ) pchar += 1; // skipping the last quote mark return true; @@ -1112,7 +1149,7 @@ void HTMLFilter::PrintItemAttr() { size_t i; - if( IsNameEqual(no_filter_tag, LastItem().name) ) + if( skip_all_tags || IsNameEqual(no_filter_tag, LastItem().name) ) return; Put(' '); @@ -1150,11 +1187,17 @@ void HTMLFilter::ReadItemClosing() void HTMLFilter::ReadItemSpecial() { LastItem().type = Item::special; - PutOpeningTagMark(); + + if( !skip_all_tags ) + PutOpeningTagMark(); + const wchar_t * start = pchar; + pchar += 1; // skipping '!' + + ReadItemName(); SkipAndCheckClosingTag(); - if( pchar > start ) + if( !skip_all_tags && pchar > start ) Put(start, pchar); // closing tag mark is printed directly from the source @@ -1176,7 +1219,7 @@ void HTMLFilter::ReadItemOpening() SkipAndCheckClosingTag(); // here LastItem().type can be changed to 'simple' - if( !IsNameEqual(no_filter_tag, LastItem().name) ) + if( !skip_all_tags && !IsNameEqual(no_filter_tag, LastItem().name) ) { if( LastItem().type == Item::simple ) Put(L" /"); @@ -1187,6 +1230,11 @@ void HTMLFilter::ReadItemOpening() } +void HTMLFilter::ItemFound() +{ +} + + bool HTMLFilter::ReadItem() { if( *pchar == 0 ) @@ -1209,6 +1257,8 @@ bool HTMLFilter::ReadItem() CheckNewLine(); LastItem().new_line = last_new_line; + ItemFound(); + return true; } @@ -1332,13 +1382,13 @@ void HTMLFilter::CheckExceptions() // in safe_mode the script tag is ignored if( !safe_mode && IsLastTag(L"script") ) - PutLastTagWithClosingTag(); + PutEverythingUntilClosingTag(!skip_all_tags); if( IsLastTag(L"pre") || IsLastTag(L"textarea") ) - PutLastTagWithClosingTag(); + PutEverythingUntilClosingTag(!skip_all_tags); if( IsLastTag(no_filter_tag) ) - PutTextBetweenLastTagWithClosingTag(); + PutEverythingUntilClosingTag(false); if( IsLastTag(L"body") ) LastItem().has_body_tag = true; @@ -1371,7 +1421,7 @@ int i; for(int z=(int)stack_len-2 ; z>=i ; --z) { - if( pstack[z].new_line ) + if( !skip_all_tags && pstack[z].new_line ) { PutNewLine(); PutTabs(z); @@ -1421,7 +1471,7 @@ void HTMLFilter::CheckClosingTags() if( IsNameEqual(pstack[stack_len-1].name, pstack[stack_len-2].name) ) { // last closing tag is from the previous one - if( pstack[stack_len-2].new_line ) + if( !skip_all_tags && pstack[stack_len-2].new_line ) { PutNewLine(); PutTabs(stack_len-2); @@ -1444,7 +1494,7 @@ bool HTMLFilter::PrintRest() const wchar_t * start = pchar; // in safe mode we do not print the rest html code - if( safe_mode ) + if( safe_mode || skip_all_tags ) return false; while( *pchar ) @@ -1474,7 +1524,7 @@ void HTMLFilter::ReadLoop() { if( stack_len > 1 ) { - pstack[stack_len-2].new_line = LastItem().new_line; + //pstack[stack_len-2].new_line = LastItem().new_line; } else if( trim_white ) @@ -1492,6 +1542,10 @@ void HTMLFilter::ReadLoop() { CheckClosingTags(); } + else + { + PopStack(); + } ReadNormalText(); } diff --git a/winixd/core/htmlfilter.h b/winixd/core/htmlfilter.h index 2c1d282..d7f3009 100644 --- a/winixd/core/htmlfilter.h +++ b/winixd/core/htmlfilter.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2014, Tomasz Sowa + * Copyright (c) 2008-2018, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,7 +99,7 @@ public: HTMLFilter(); HTMLFilter(const HTMLFilter & f); HTMLFilter & operator=(const HTMLFilter & f); - ~HTMLFilter(); + virtual ~HTMLFilter(); // main methods used for filtering @@ -156,6 +156,9 @@ public: // (script, iframe, frame, frameset, applet, head, meta, html, link, body, ...) void SafeMode(bool safe_mode_); + // skip all html tags + // gives only text without markup + void SkipAllTags(bool skip_all_tags, bool skip_commentaries); protected: @@ -239,10 +242,13 @@ protected: virtual void PutNormalText(const wchar_t * str, const wchar_t * end); virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white); + virtual void ItemFound(); /* others */ + void SetSomeDefaults(); + Item & GetItem(size_t i); Item & LastItem(); @@ -288,7 +294,7 @@ protected: bool PrintOpeningItem(); void ReadItemName(); void ReadItemAttrName(); - void ReadItemAttrValue(bool has_quote); + void ReadItemAttrValue(bool has_quote, wchar_t quote_char); bool ReadItemAttr(); bool CheckItemAttr(); @@ -307,8 +313,7 @@ protected: bool HasSemiloconAround(const wchar_t * str, const wchar_t * end); void PutNormalNonWhite(const wchar_t * & str, const wchar_t * end); void PutNormalWhite(const wchar_t * & str, const wchar_t * end); - void PutLastTagWithClosingTag(); - void PutTextBetweenLastTagWithClosingTag(); + void PutEverythingUntilClosingTag(bool put_closing_tag_as_well); void PutTabs(size_t len); void PutNonBreakingSpace(); void PutNewLine(); @@ -335,6 +340,8 @@ protected: size_t line_len; //length of the current line (without first spaces which create the html tree) bool safe_mode; // skipping some unsafe tags Orphans orphans_temp; + bool skip_all_tags; + bool skip_commentaries; };