25 Commits
0.4.6 ... 0.4.8

Author SHA1 Message Date
0a7432b059 added: SLog class -- session logger
messages are displayed in the browser (with locales)
changed: MountParser
         now if there is an error in a line -- the line is simply skipped
         


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@741 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-19 20:59:58 +00:00
b369fda1d9 deleted some log info
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@740 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-19 10:40:09 +00:00
c49c35cfbd added: a new mount type: static
some path in winix can be redirected to a specified static directory


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@738 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-14 23:45:42 +00:00
fb4742e165 added: nicedit: a new wysiwyg javascript editor
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@737 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-13 01:06:10 +00:00
fce45b93a2 fixed: users: flag 'super_user' was not correctly read ftom the database
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@736 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-09 23:00:00 +00:00
18ecd46a01 changed: when winix demonizes it creates a three new descriptors (0, 1 and 3)
pointing to /dev/null
added:   DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result)
         it reads binary (bytea) data
added:   DbTextStream can handle 'bool' types now
         (is puts 'true' of 'false' to the stream)
changed: now passwords can be stored either as plain text, a hash or can be encrypted
         with RSA
         currently we have following hashes:
         md4, md5, sha1, sha224, sha256, sha384, sha512
         we are using openssl to manage them
         (look at config options for more info)
changed: winix version to 0.4.7         
added:   class Run - you can run any program from os and send a buffer to its standard input
         and read what the program put on its standard output
added:   class Crypt (in System) - calculating hashes, and crypting/decrypting




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@734 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-09 21:22:08 +00:00
af8fbdae72 added: now winix will not log post parameters with 'pass' in names (at the beginning)
changed: only first few characters are logged (from POST)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@733 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-06 22:47:34 +00:00
c84997be30 small changes in Makefiles
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@731 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-06 20:35:56 +00:00
06551d6084 added: "str" "strnc" ezc functions
changed: ezc functions:
         "winix_false" to "false"
         "winix_true"  to "true"


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@730 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-04-26 17:19:08 +00:00
84145d7cc8 fixed: BBCODEParser incorrectly worked with the latest changes in HTMLFilter
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@729 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-04-16 11:27:54 +00:00
426beae796 renamed: config option 'html_filter_break_lines' to 'html_filter_break_word'
added:   config option 'html_filter_wrap_line'
         this wraps the whole line (line calculated with html tags as well)
changed: orphans (for html filter) are read from locale files now
         ('language_orphans' value )



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@728 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-04-16 08:42:22 +00:00
aadf12c7b3 added support for gzip compression
new config option: compression_encoding (integer)
 1  - use deflate if available (or raw deflate for Internet Explorer) or don't compress
 2  - use gzip if available or don't compress
 10 - prefer deflate -- use deflate (or raw deflate for IE) if both deflate and gzip are available
 20 - prefer gzip    -- use gzip if both deflate and gzip are available
 default: 20

		   


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@727 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-04-02 00:10:16 +00:00
1b60935d08 updated 'galleria' js plugin
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@726 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-04-01 16:30:14 +00:00
d68731fd55 fixed: thread plugin didn't correctly set the last item and replies (in 'thread' table)
when deleting an answer
added: ThreadInfo::Repair() method
       will be used by 'fsck' winix function       
added: plugins/groupitem 
       directory for a new plugin: 'groupitem'
       


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@725 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-03-23 17:54:53 +00:00
ba63c8c661 changed: removed Languages::Land enum
now we set the languages in the config file: option locale_files, sample:
  locale_files = ( en, pl )
it represents the name of locale files (those from locale_dir directory)
renamed config option: locale to locale_default


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@722 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-24 17:06:12 +00:00
15487b347f added ezc function: winix_function_param_is_not
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@721 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-22 04:14:26 +00:00
e7e90c6527 txt templates (a new line was missing)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@720 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-18 09:35:35 +00:00
ca5421347a fixed: a new created session doesn't have a correct time set
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@719 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-18 09:33:15 +00:00
c8a57f2046 added: to gallery plugin: gallery_theme() mount option
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@718 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-15 23:20:12 +00:00
583df13139 added: mount options: thumb_size(cx, cy)
size of a generated thumbnail (size in pixels)
added: plugin gallery: mount option gallery_type
       it can be:
       "lightbox"
       "galleria"
       "galleriathumb"


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@717 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-02-11 21:37:28 +00:00
5049961e17 added a new plugin: "gallery"
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@716 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-31 15:51:53 +00:00
18492e5d61 changed templates
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@715 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-27 14:35:25 +00:00
d4d9f89d1d changed: ticket templates
added: new plugin message (WINIX_END_REQUEST)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@714 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-27 12:24:45 +00:00
ecf19034ae added: winix uses now [filter] statement from ezc
added: notifications to threads (were temporarily disabled)
changed: templates in notifications



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@712 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-26 12:45:38 +00:00
00521c490e added: Q encoding in misc: QEncode()
for mails headers encoding



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@711 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-25 11:54:46 +00:00
158 changed files with 8028 additions and 2919 deletions

View File

@@ -1,70 +1,84 @@
# Makefile for GNU make
ifndef CXX
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
export CXX
export CXXFLAGS
all: winix.so plugins winix
all: winix
winix: FORCE
winix.so: FORCE
@cd core ; $(MAKE) -e
@cd db ; $(MAKE) -e
@cd functions ; $(MAKE) -e
@cd notify ; $(MAKE) -e
@cd templates ; $(MAKE) -e
@cd notify ; $(MAKE) -e
@cd plugins/stats ; $(MAKE) -e
@cd plugins/thread ; $(MAKE) -e
@cd plugins/ticket ; $(MAKE) -e
@cd ../ezc/src ; $(MAKE) -e
$(CXX) -shared -o winix.so $(CXXFLAGS) core/*.o db/*.o functions/*.o templates/*.o notify/*.o ../ezc/src/ezc.a -lfcgi -lpq -lz -lpthread -lfetch
winix: FORCE
@cd main ; $(MAKE) -e
# use the full path with winix.so
$(CXX) -o winix $(CXXFLAGS) main/*.o /home/tomek/roboczy/winix/winix.so
$(CXX) -o winix $(CXXFLAGS) main/*.o /home/tomek/roboczy/winix/winix.so
clean:
@cd core ; $(MAKE) -e clean
@cd db ; $(MAKE) -e clean
@cd functions ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd notify ; $(MAKE) -e clean
@cd plugins/stats ; $(MAKE) -e clean
@cd plugins/thread ; $(MAKE) -e clean
@cd plugins/ticket ; $(MAKE) -e clean
@cd ../ezc/src ; $(MAKE) -e clean
@cd main ; $(MAKE) -e clean
rm -f winix.so
rm -f winix
plugins: FORCE
@cd plugins/stats ; $(MAKE) -e
@cd plugins/thread ; $(MAKE) -e
@cd plugins/ticket ; $(MAKE) -e
@cd plugins/gallery ; $(MAKE) -e
@cd plugins/groupitem ; $(MAKE) -e
FORCE:
clean:
@cd core ; $(MAKE) -e clean
@cd db ; $(MAKE) -e clean
@cd functions ; $(MAKE) -e clean
@cd templates ; $(MAKE) -e clean
@cd notify ; $(MAKE) -e clean
@cd plugins/stats ; $(MAKE) -e clean
@cd plugins/thread ; $(MAKE) -e clean
@cd plugins/ticket ; $(MAKE) -e clean
@cd plugins/gallery ; $(MAKE) -e clean
@cd plugins/groupitem ; $(MAKE) -e clean
@cd ../ezc/src ; $(MAKE) -e clean
@cd main ; $(MAKE) -e clean
rm -f winix.so
rm -f winix
depend:
@cd core ; $(MAKE) -e depend
@cd db ; $(MAKE) -e depend
@cd functions ; $(MAKE) -e depend
@cd templates ; $(MAKE) -e depend
@cd notify ; $(MAKE) -e depend
@cd plugins/stats ; $(MAKE) -e depend
@cd plugins/thread ; $(MAKE) -e depend
@cd plugins/ticket ; $(MAKE) -e depend
@cd ../ezc/src ; $(MAKE) -e depend
@cd main ; $(MAKE) -e depend
@cd core ; $(MAKE) -e depend
@cd db ; $(MAKE) -e depend
@cd functions ; $(MAKE) -e depend
@cd templates ; $(MAKE) -e depend
@cd notify ; $(MAKE) -e depend
@cd plugins/stats ; $(MAKE) -e depend
@cd plugins/thread ; $(MAKE) -e depend
@cd plugins/ticket ; $(MAKE) -e depend
@cd plugins/gallery ; $(MAKE) -e depend
@cd plugins/groupitem ; $(MAKE) -e depend
@cd ../ezc/src ; $(MAKE) -e depend
@cd main ; $(MAKE) -e depend
install: all

View File

@@ -4,13 +4,10 @@ include Makefile.o.dep
all: $(o)
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep

View File

@@ -3,32 +3,32 @@
acceptbaseparser.o: acceptbaseparser.h
app.o: app.h config.h confparser.h htmlfilter.h system.h dirs.h item.h
app.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
app.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h log.h
app.o: textstream.h ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
app.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h
app.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
app.o: ../core/user.h ../core/group.h ../core/dircontainer.h
app.o: ../core/ugcontainer.h request.h requesttypes.h error.h
app.o: ../templates/htmltextstream.h ../notify/notify.h
app.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
app.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
app.o: cur.h request.h requesttypes.h error.h ../templates/htmltextstream.h
app.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
app.o: ../core/confparser.h ../notify/notify.h ../notify/notifypool.h
app.o: ../templates/misc.h ../templates/localefilter.h ../templates/locale.h
app.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
app.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
app.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
app.o: ../templates/htmltextstream.h ../notify/notifythread.h
app.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
app.o: ../core/config.h ../core/users.h user.h ugcontainer.h lastcontainer.h
app.o: cur.h session.h plugindata.h rebus.h mounts.h mount.h mountparser.h
app.o: users.h groups.h group.h loadavg.h thumb.h basethread.h
app.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
app.o: ../functions/functionbase.h ../core/request.h ../core/system.h
app.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
app.o: ../functions/privchanger.h ../functions/chown.h
app.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
app.o: mounts.h mount.h mountparser.h crypt.h run.h users.h groups.h group.h
app.o: loadavg.h thumb.h basethread.h sessionmanager.h sessioncontainer.h
app.o: ../functions/functions.h ../functions/functionbase.h ../core/request.h
app.o: ../core/system.h ../core/synchro.h ../functions/functionparser.h
app.o: ../core/cur.h ../functions/adduser.h ../functions/cat.h
app.o: ../functions/chmod.h ../functions/privchanger.h ../functions/chown.h
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
app.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
app.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
app.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
app.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
app.o: ../functions/rm.h ../functions/run.h ../functions/specialdefault.h
app.o: ../functions/nicedit.h ../functions/node.h ../functions/priv.h
app.o: ../functions/reload.h ../functions/rm.h ../functions/specialdefault.h
app.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
app.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
app.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
@@ -38,37 +38,47 @@ app.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
app.o: ../core/sessionmanager.h compress.h getparser.h httpsimpleparser.h
app.o: postparser.h cookieparser.h postmultiparser.h acceptencodingparser.h
app.o: acceptbaseparser.h plugin.h pluginmsg.h
basethread.o: basethread.h log.h textstream.h
basethread.o: basethread.h log.h textstream.h logmanipulators.h slog.h cur.h
basethread.o: request.h requesttypes.h item.h error.h config.h confparser.h
basethread.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
basethread.o: misc.h session.h user.h plugindata.h rebus.h
basethread.o: ../templates/locale.h ../core/confparser.h
bbcodeparser.o: bbcodeparser.h htmlfilter.h
compress.o: compress.h log.h textstream.h
config.o: config.h confparser.h htmlfilter.h log.h textstream.h plugin.h
config.o: pluginmsg.h plugindata.h request.h requesttypes.h item.h error.h
config.o: ../templates/htmltextstream.h ../core/textstream.h misc.h system.h
config.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
compress.o: compress.h log.h textstream.h logmanipulators.h slog.h cur.h
compress.o: request.h requesttypes.h item.h error.h config.h confparser.h
compress.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
compress.o: misc.h session.h user.h plugindata.h rebus.h
compress.o: ../templates/locale.h ../core/confparser.h
config.o: config.h confparser.h htmlfilter.h log.h textstream.h
config.o: logmanipulators.h slog.h cur.h request.h requesttypes.h item.h
config.o: error.h ../templates/htmltextstream.h ../core/textstream.h misc.h
config.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
config.o: ../core/confparser.h plugin.h pluginmsg.h system.h dirs.h
config.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
config.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
config.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
config.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
config.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
config.o: ../templates/misc.h ../templates/localefilter.h
config.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
config.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
config.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
config.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
config.o: ../notify/notifythread.h ../core/basethread.h synchro.h
config.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
config.o: ugcontainer.h lastcontainer.h cur.h session.h rebus.h mounts.h
config.o: mount.h mountparser.h users.h groups.h group.h loadavg.h thumb.h
config.o: basethread.h sessionmanager.h sessioncontainer.h
config.o: ../functions/functions.h ../functions/functionbase.h
config.o: ../core/request.h ../core/system.h ../core/synchro.h
config.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
config.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
config.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
config.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
config.o: ../functions/last.h ../functions/login.h ../functions/logout.h
config.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
config.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
config.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
config.o: ../notify/notifypool.h ../templates/misc.h
config.o: ../templates/localefilter.h ../templates/locale.h
config.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
config.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
config.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
config.o: ../templates/htmltextstream.h ../notify/notifythread.h
config.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
config.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
config.o: mounts.h mount.h mountparser.h crypt.h run.h users.h groups.h
config.o: group.h loadavg.h thumb.h basethread.h sessionmanager.h
config.o: sessioncontainer.h ../functions/functions.h
config.o: ../functions/functionbase.h ../core/request.h ../core/system.h
config.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
config.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
config.o: ../functions/privchanger.h ../functions/chown.h
config.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
config.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
config.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
config.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
config.o: ../functions/nicedit.h ../functions/node.h ../functions/priv.h
config.o: ../functions/reload.h ../functions/rm.h
config.o: ../functions/specialdefault.h ../functions/stat.h
config.o: ../functions/subject.h ../functions/template.h
config.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
@@ -78,86 +88,113 @@ config.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
config.o: ../core/httpsimpleparser.h ../core/log.h
config.o: ../templates/indexpatterns.h ../core/sessionmanager.h
confparser.o: confparser.h misc.h item.h ../../ezc/src/utf8.h
dircontainer.o: dircontainer.h item.h log.h textstream.h
crypt.o: crypt.h run.h config.h confparser.h htmlfilter.h user.h
crypt.o: ../../ezc/src/utf8.h misc.h item.h log.h textstream.h
crypt.o: logmanipulators.h slog.h cur.h request.h requesttypes.h error.h
crypt.o: ../templates/htmltextstream.h ../core/textstream.h session.h
crypt.o: plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
dircontainer.o: dircontainer.h item.h log.h textstream.h logmanipulators.h
dircontainer.o: slog.h cur.h request.h requesttypes.h error.h config.h
dircontainer.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
dircontainer.o: ../core/textstream.h misc.h session.h user.h plugindata.h
dircontainer.o: rebus.h ../templates/locale.h ../core/confparser.h
dirs.o: dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
dirs.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h
dirs.o: log.h textstream.h ../db/dbitemquery.h ../core/item.h
dirs.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
dirs.o: ../core/dircontainer.h ../core/ugcontainer.h request.h requesttypes.h
dirs.o: error.h config.h confparser.h htmlfilter.h
dirs.o: ../templates/htmltextstream.h ../notify/notify.h
dirs.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
dirs.o: ../templates/misc.h ../templates/localefilter.h ../templates/locale.h
dirs.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
dirs.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
dirs.o: ../core/user.h ../core/group.h ../core/dircontainer.h
dirs.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h slog.h
dirs.o: cur.h request.h requesttypes.h error.h config.h confparser.h
dirs.o: htmlfilter.h ../templates/htmltextstream.h session.h user.h
dirs.o: plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
dirs.o: ../notify/notify.h ../notify/notifypool.h ../templates/misc.h
dirs.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
dirs.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
dirs.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
dirs.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
dirs.o: ../templates/htmltextstream.h ../notify/notifythread.h
dirs.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
dirs.o: ../core/config.h ../core/users.h user.h ugcontainer.h lastcontainer.h
dirs.o: cur.h session.h plugindata.h rebus.h
dirs.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
groups.o: groups.h group.h ugcontainer.h ../db/db.h ../db/dbbase.h
groups.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
groups.o: item.h ../core/error.h log.h textstream.h ../db/dbitemquery.h
groups.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
groups.o: ../core/dircontainer.h ../core/ugcontainer.h
groups.o: item.h ../core/error.h ../db/dbitemquery.h ../core/item.h
groups.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
groups.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
groups.o: logmanipulators.h slog.h cur.h request.h requesttypes.h error.h
groups.o: config.h confparser.h htmlfilter.h ../templates/htmltextstream.h
groups.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
groups.o: ../core/confparser.h
htmlfilter.o: htmlfilter.h
httpsimpleparser.o: httpsimpleparser.h
item.o: item.h misc.h
lastcontainer.o: lastcontainer.h log.h textstream.h misc.h item.h
loadavg.o: loadavg.h log.h textstream.h
log.o: log.h textstream.h ../../ezc/src/utf8.h
misc.o: misc.h item.h log.h textstream.h ../templates/templates.h
misc.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
misc.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
misc.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
misc.o: ../templates/patterncacher.h ../core/item.h
misc.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
misc.o: ../core/log.h ../templates/indexpatterns.h
lastcontainer.o: lastcontainer.h log.h textstream.h logmanipulators.h slog.h
lastcontainer.o: cur.h request.h requesttypes.h item.h error.h config.h
lastcontainer.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
lastcontainer.o: ../core/textstream.h misc.h session.h user.h plugindata.h
lastcontainer.o: rebus.h ../templates/locale.h ../core/confparser.h
loadavg.o: loadavg.h log.h textstream.h logmanipulators.h slog.h cur.h
loadavg.o: request.h requesttypes.h item.h error.h config.h confparser.h
loadavg.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
loadavg.o: misc.h session.h user.h plugindata.h rebus.h ../templates/locale.h
loadavg.o: ../core/confparser.h
log.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
log.o: requesttypes.h item.h error.h config.h confparser.h htmlfilter.h
log.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
log.o: user.h plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
log.o: ../../ezc/src/utf8.h
misc.o: misc.h item.h log.h textstream.h logmanipulators.h slog.h cur.h
misc.o: request.h requesttypes.h error.h config.h confparser.h htmlfilter.h
misc.o: ../templates/htmltextstream.h ../core/textstream.h session.h user.h
misc.o: plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
misc.o: ../templates/templates.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
misc.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
misc.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
misc.o: ../../ezc/src/stringconv.h ../templates/patterncacher.h
misc.o: ../core/item.h ../templates/ckeditorgetparser.h
misc.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
misc.o: ../templates/localefilter.h ../templates/locale.h ../core/config.h
misc.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
misc.o: ../core/textstream.h ../core/error.h ../db/dbitemquery.h
misc.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
misc.o: ../core/dircontainer.h ../core/ugcontainer.h
misc.o: ../templates/htmltextstream.h ../core/cur.h ../core/system.h
misc.o: ../core/sessionmanager.h
misc.o: ../core/sessionmanager.h ../core/htmlfilter.h ../db/db.h
misc.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
misc.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
misc.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
mount.o: mount.h misc.h item.h
mountparser.o: mountparser.h mount.h item.h error.h dirs.h dircontainer.h
mountparser.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mountparser.o: ../core/textstream.h misc.h ../core/error.h log.h textstream.h
mountparser.o: mountparser.h mount.h item.h dirs.h dircontainer.h ../db/db.h
mountparser.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mountparser.o: ../core/textstream.h misc.h ../core/error.h
mountparser.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
mountparser.o: ../core/user.h ../core/group.h ../core/dircontainer.h
mountparser.o: ../core/ugcontainer.h request.h requesttypes.h config.h
mountparser.o: ../core/ugcontainer.h log.h textstream.h logmanipulators.h
mountparser.o: slog.h cur.h request.h requesttypes.h error.h config.h
mountparser.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
mountparser.o: ../notify/notify.h ../notify/notifypool.h
mountparser.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
mountparser.o: ../templates/localefilter.h ../templates/locale.h
mountparser.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
mountparser.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
mountparser.o: ../core/confparser.h ../notify/notify.h ../notify/notifypool.h
mountparser.o: ../templates/misc.h ../templates/localefilter.h
mountparser.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
mountparser.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
mountparser.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
mountparser.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
mountparser.o: ../notify/notifythread.h ../core/basethread.h synchro.h
mountparser.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
mountparser.o: user.h ugcontainer.h lastcontainer.h cur.h session.h
mountparser.o: plugindata.h rebus.h
mountparser.o: ugcontainer.h lastcontainer.h
mounts.o: mounts.h mount.h error.h dirs.h item.h dircontainer.h ../db/db.h
mounts.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mounts.o: ../core/textstream.h misc.h ../core/error.h log.h textstream.h
mounts.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
mounts.o: ../core/user.h ../core/group.h ../core/dircontainer.h
mounts.o: ../core/ugcontainer.h request.h requesttypes.h config.h
mounts.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
mounts.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
mounts.o: ../core/confparser.h ../templates/misc.h
mounts.o: ../templates/localefilter.h ../templates/locale.h
mounts.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
mounts.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
mounts.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
mounts.o: ../templates/htmltextstream.h ../notify/notifythread.h
mounts.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
mounts.o: ../core/config.h ../core/users.h user.h ugcontainer.h
mounts.o: lastcontainer.h cur.h session.h plugindata.h rebus.h mountparser.h
mounts.o: plugin.h pluginmsg.h system.h users.h groups.h group.h loadavg.h
mounts.o: thumb.h basethread.h sessionmanager.h sessioncontainer.h
mounts.o: ../core/textstream.h misc.h ../core/error.h ../db/dbitemquery.h
mounts.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
mounts.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
mounts.o: logmanipulators.h slog.h cur.h request.h requesttypes.h config.h
mounts.o: confparser.h htmlfilter.h ../templates/htmltextstream.h session.h
mounts.o: user.h plugindata.h rebus.h ../templates/locale.h
mounts.o: ../core/confparser.h ../notify/notify.h ../notify/notifypool.h
mounts.o: ../templates/misc.h ../templates/localefilter.h
mounts.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
mounts.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
mounts.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
mounts.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
mounts.o: ../notify/notifythread.h ../core/basethread.h synchro.h
mounts.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
mounts.o: ugcontainer.h lastcontainer.h mountparser.h plugin.h pluginmsg.h
mounts.o: system.h crypt.h run.h users.h groups.h group.h loadavg.h thumb.h
mounts.o: basethread.h sessionmanager.h sessioncontainer.h
mounts.o: ../functions/functions.h ../functions/functionbase.h
mounts.o: ../core/request.h ../core/system.h ../core/synchro.h
mounts.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
@@ -166,8 +203,8 @@ mounts.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
mounts.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
mounts.o: ../functions/last.h ../functions/login.h ../functions/logout.h
mounts.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
mounts.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
mounts.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
mounts.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
mounts.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
mounts.o: ../functions/specialdefault.h ../functions/stat.h
mounts.o: ../functions/subject.h ../functions/template.h
mounts.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
@@ -176,23 +213,24 @@ mounts.o: ../core/htmlfilter.h ../templates/templates.h
mounts.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
mounts.o: ../core/httpsimpleparser.h ../core/log.h
mounts.o: ../templates/indexpatterns.h ../core/sessionmanager.h
plugin.o: plugin.h pluginmsg.h log.h textstream.h plugindata.h config.h
plugin.o: confparser.h htmlfilter.h request.h requesttypes.h item.h error.h
plugin.o: ../templates/htmltextstream.h ../core/textstream.h misc.h system.h
plugin.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
plugin.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
plugin.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugin.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
plugin.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
plugin.o: plugin.h pluginmsg.h log.h textstream.h logmanipulators.h slog.h
plugin.o: cur.h request.h requesttypes.h item.h error.h config.h confparser.h
plugin.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
plugin.o: misc.h session.h user.h plugindata.h rebus.h ../templates/locale.h
plugin.o: ../core/confparser.h system.h dirs.h dircontainer.h ../db/db.h
plugin.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
plugin.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
plugin.o: ../core/user.h ../core/group.h ../core/dircontainer.h
plugin.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
plugin.o: ../templates/misc.h ../templates/localefilter.h
plugin.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
plugin.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
plugin.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
plugin.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
plugin.o: ../notify/notifythread.h ../core/basethread.h synchro.h
plugin.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
plugin.o: ugcontainer.h lastcontainer.h cur.h session.h rebus.h mounts.h
plugin.o: mount.h mountparser.h users.h groups.h group.h loadavg.h thumb.h
plugin.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
plugin.o: ugcontainer.h lastcontainer.h mounts.h mount.h mountparser.h
plugin.o: crypt.h run.h users.h groups.h group.h loadavg.h thumb.h
plugin.o: basethread.h sessionmanager.h sessioncontainer.h
plugin.o: ../functions/functions.h ../functions/functionbase.h
plugin.o: ../core/request.h ../core/system.h ../core/synchro.h
@@ -202,8 +240,8 @@ plugin.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
plugin.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h
plugin.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
plugin.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
plugin.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
plugin.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
plugin.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
plugin.o: ../functions/specialdefault.h ../functions/stat.h
plugin.o: ../functions/subject.h ../functions/template.h
plugin.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
@@ -212,15 +250,17 @@ plugin.o: ../core/htmlfilter.h ../templates/templates.h
plugin.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
plugin.o: ../core/httpsimpleparser.h ../core/log.h
plugin.o: ../templates/indexpatterns.h ../core/sessionmanager.h
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h config.h
plugindata.o: confparser.h htmlfilter.h request.h requesttypes.h item.h
plugindata.o: error.h ../templates/htmltextstream.h ../core/textstream.h
plugindata.o: misc.h system.h dirs.h dircontainer.h ../db/db.h ../db/dbbase.h
plugindata.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
plugindata.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
plugindata.o: ../core/user.h ../core/group.h ../core/dircontainer.h
plugindata.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
plugindata.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h
plugindata.o: logmanipulators.h slog.h cur.h request.h requesttypes.h item.h
plugindata.o: error.h config.h confparser.h htmlfilter.h
plugindata.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
plugindata.o: session.h user.h rebus.h ../templates/locale.h
plugindata.o: ../core/confparser.h system.h dirs.h dircontainer.h ../db/db.h
plugindata.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
plugindata.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
plugindata.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugindata.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
plugindata.o: ../notify/notifypool.h ../templates/misc.h
plugindata.o: ../templates/localefilter.h ../templates/locale.h
plugindata.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
plugindata.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
@@ -228,21 +268,21 @@ plugindata.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
plugindata.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
plugindata.o: ../notify/notifythread.h ../core/basethread.h synchro.h
plugindata.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
plugindata.o: user.h ugcontainer.h lastcontainer.h cur.h session.h rebus.h
plugindata.o: mounts.h mount.h mountparser.h users.h groups.h group.h
plugindata.o: loadavg.h thumb.h basethread.h sessionmanager.h
plugindata.o: sessioncontainer.h ../functions/functions.h
plugindata.o: ../functions/functionbase.h ../core/request.h ../core/system.h
plugindata.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
plugindata.o: ugcontainer.h lastcontainer.h mounts.h mount.h mountparser.h
plugindata.o: crypt.h run.h users.h groups.h group.h loadavg.h thumb.h
plugindata.o: basethread.h sessionmanager.h sessioncontainer.h
plugindata.o: ../functions/functions.h ../functions/functionbase.h
plugindata.o: ../core/request.h ../core/system.h ../core/synchro.h
plugindata.o: ../functions/functionparser.h ../core/cur.h
plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
plugindata.o: ../functions/privchanger.h ../functions/chown.h
plugindata.o: ../functions/ckeditor.h ../functions/cp.h
plugindata.o: ../functions/default.h ../functions/download.h
plugindata.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
plugindata.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
plugindata.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
plugindata.o: ../functions/run.h ../functions/specialdefault.h
plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
plugindata.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
plugindata.o: ../functions/rm.h ../functions/specialdefault.h
plugindata.o: ../functions/stat.h ../functions/subject.h
plugindata.o: ../functions/template.h ../functions/tinymce.h
plugindata.o: ../functions/uname.h ../functions/upload.h
@@ -253,66 +293,78 @@ plugindata.o: ../core/httpsimpleparser.h ../core/log.h
plugindata.o: ../templates/indexpatterns.h ../core/sessionmanager.h
postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h
postmultiparser.o: confparser.h htmlfilter.h log.h textstream.h
postmultiparser.o: ../../ezc/src/utf8.h misc.h item.h
rebus.o: log.h textstream.h rebus.h misc.h item.h cur.h request.h
rebus.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
rebus.o: ../templates/htmltextstream.h ../core/textstream.h session.h user.h
rebus.o: plugindata.h
postmultiparser.o: logmanipulators.h slog.h cur.h request.h item.h
postmultiparser.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
postmultiparser.o: session.h user.h plugindata.h rebus.h
postmultiparser.o: ../templates/locale.h ../core/confparser.h
postmultiparser.o: ../../ezc/src/utf8.h
rebus.o: log.h textstream.h logmanipulators.h slog.h cur.h request.h
rebus.o: requesttypes.h item.h error.h config.h confparser.h htmlfilter.h
rebus.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
rebus.o: user.h plugindata.h rebus.h ../templates/locale.h
rebus.o: ../core/confparser.h
request.o: request.h requesttypes.h item.h error.h config.h confparser.h
request.o: htmlfilter.h textstream.h ../templates/htmltextstream.h
request.o: ../core/textstream.h misc.h log.h plugin.h pluginmsg.h
request.o: plugindata.h system.h dirs.h dircontainer.h ../db/db.h
request.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
request.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
request.o: ../core/user.h ../core/group.h ../core/dircontainer.h
request.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
request.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
request.o: ../core/textstream.h misc.h log.h logmanipulators.h slog.h cur.h
request.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
request.o: ../core/confparser.h plugin.h pluginmsg.h system.h dirs.h
request.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
request.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
request.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h
request.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
request.o: ../notify/notify.h ../notify/notifypool.h ../templates/misc.h
request.o: ../templates/localefilter.h ../templates/locale.h
request.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
request.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
request.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
request.o: ../templates/htmltextstream.h ../notify/notifythread.h
request.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
request.o: ../core/config.h ../core/users.h user.h ugcontainer.h
request.o: lastcontainer.h cur.h session.h rebus.h mounts.h mount.h
request.o: mountparser.h users.h groups.h group.h loadavg.h thumb.h
request.o: basethread.h sessionmanager.h sessioncontainer.h
request.o: ../functions/functions.h ../functions/functionbase.h
request.o: ../core/request.h ../core/system.h ../core/synchro.h
request.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
request.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
request.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
request.o: ../functions/default.h ../functions/download.h
request.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
request.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
request.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
request.o: ../functions/run.h ../functions/specialdefault.h
request.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
request.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
request.o: mounts.h mount.h mountparser.h crypt.h run.h users.h groups.h
request.o: group.h loadavg.h thumb.h basethread.h sessionmanager.h
request.o: sessioncontainer.h ../functions/functions.h
request.o: ../functions/functionbase.h ../core/request.h ../core/system.h
request.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
request.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
request.o: ../functions/privchanger.h ../functions/chown.h
request.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
request.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
request.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
request.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
request.o: ../functions/nicedit.h ../functions/node.h ../functions/priv.h
request.o: ../functions/reload.h ../functions/rm.h
request.o: ../functions/specialdefault.h ../functions/stat.h
request.o: ../functions/subject.h ../functions/template.h
request.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
request.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
request.o: ../core/htmlfilter.h ../templates/templates.h
request.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
request.o: ../core/httpsimpleparser.h ../core/log.h
request.o: ../templates/indexpatterns.h ../core/sessionmanager.h
session.o: session.h item.h error.h user.h plugindata.h rebus.h misc.h
run.o: run.h log.h textstream.h logmanipulators.h slog.h cur.h request.h
run.o: requesttypes.h item.h error.h config.h confparser.h htmlfilter.h
run.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
run.o: user.h plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
session.o: session.h item.h error.h user.h plugindata.h rebus.h textstream.h
session.o: misc.h
sessioncontainer.o: sessioncontainer.h session.h item.h error.h user.h
sessioncontainer.o: plugindata.h rebus.h cur.h request.h requesttypes.h
sessioncontainer.o: config.h confparser.h htmlfilter.h textstream.h
sessioncontainer.o: plugindata.h rebus.h textstream.h cur.h request.h
sessioncontainer.o: requesttypes.h config.h confparser.h htmlfilter.h
sessioncontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessioncontainer.o: log.h
sessioncontainer.o: log.h logmanipulators.h slog.h ../templates/locale.h
sessioncontainer.o: ../core/confparser.h
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
sessionmanager.o: error.h user.h plugindata.h rebus.h cur.h request.h
sessionmanager.o: requesttypes.h config.h confparser.h htmlfilter.h
sessionmanager.o: textstream.h ../templates/htmltextstream.h
sessionmanager.o: ../core/textstream.h misc.h lastcontainer.h system.h dirs.h
sessionmanager.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
sessionmanager.o: ../db/dbtextstream.h ../core/error.h log.h
sessionmanager.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
sessionmanager.o: ../core/user.h ../core/group.h ../core/dircontainer.h
sessionmanager.o: ../core/ugcontainer.h ../notify/notify.h
sessionmanager.o: ../notify/notifypool.h ../templates/locale.h
sessionmanager.o: ../core/confparser.h ../templates/misc.h
sessionmanager.o: error.h user.h plugindata.h rebus.h textstream.h cur.h
sessionmanager.o: request.h requesttypes.h config.h confparser.h htmlfilter.h
sessionmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionmanager.o: lastcontainer.h system.h dirs.h dircontainer.h ../db/db.h
sessionmanager.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
sessionmanager.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
sessionmanager.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
sessionmanager.o: ../core/dircontainer.h ../core/ugcontainer.h log.h
sessionmanager.o: logmanipulators.h slog.h ../templates/locale.h
sessionmanager.o: ../core/confparser.h ../notify/notify.h
sessionmanager.o: ../notify/notifypool.h ../templates/misc.h
sessionmanager.o: ../templates/localefilter.h ../templates/locale.h
sessionmanager.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
sessionmanager.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
@@ -321,10 +373,11 @@ sessionmanager.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
sessionmanager.o: ../notify/notifythread.h ../core/basethread.h synchro.h
sessionmanager.o: ../notify/templatesnotify.h ../core/config.h
sessionmanager.o: ../core/users.h ugcontainer.h mounts.h mount.h
sessionmanager.o: mountparser.h users.h groups.h group.h loadavg.h thumb.h
sessionmanager.o: basethread.h sessionparser.h plugin.h pluginmsg.h
sessionmanager.o: ../functions/functions.h ../functions/functionbase.h
sessionmanager.o: ../core/request.h ../core/system.h ../core/synchro.h
sessionmanager.o: mountparser.h crypt.h run.h users.h groups.h group.h
sessionmanager.o: loadavg.h thumb.h basethread.h sessionparser.h plugin.h
sessionmanager.o: pluginmsg.h ../functions/functions.h
sessionmanager.o: ../functions/functionbase.h ../core/request.h
sessionmanager.o: ../core/system.h ../core/synchro.h
sessionmanager.o: ../functions/functionparser.h ../core/cur.h
sessionmanager.o: ../functions/adduser.h ../functions/cat.h
sessionmanager.o: ../functions/chmod.h ../functions/privchanger.h
@@ -333,64 +386,69 @@ sessionmanager.o: ../functions/cp.h ../functions/default.h
sessionmanager.o: ../functions/download.h ../functions/emacs.h
sessionmanager.o: ../functions/last.h ../functions/login.h
sessionmanager.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
sessionmanager.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
sessionmanager.o: ../functions/mkdir.h ../functions/mv.h
sessionmanager.o: ../functions/nicedit.h ../functions/node.h
sessionmanager.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
sessionmanager.o: ../functions/run.h ../functions/specialdefault.h
sessionmanager.o: ../functions/stat.h ../functions/subject.h
sessionmanager.o: ../functions/template.h ../functions/tinymce.h
sessionmanager.o: ../functions/uname.h ../functions/upload.h
sessionmanager.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
sessionmanager.o: ../core/htmlfilter.h ../templates/templates.h
sessionmanager.o: ../templates/patterncacher.h
sessionmanager.o: ../functions/specialdefault.h ../functions/stat.h
sessionmanager.o: ../functions/subject.h ../functions/template.h
sessionmanager.o: ../functions/tinymce.h ../functions/uname.h
sessionmanager.o: ../functions/upload.h ../functions/uptime.h
sessionmanager.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
sessionmanager.o: ../templates/templates.h ../templates/patterncacher.h
sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
sessionmanager.o: ../core/log.h ../templates/indexpatterns.h
sessionmanager.o: ../core/sessionmanager.h
sessionparser.o: sessionparser.h session.h item.h error.h user.h plugindata.h
sessionparser.o: rebus.h sessioncontainer.h cur.h request.h requesttypes.h
sessionparser.o: config.h confparser.h htmlfilter.h textstream.h
sessionparser.o: rebus.h textstream.h sessioncontainer.h cur.h request.h
sessionparser.o: requesttypes.h config.h confparser.h htmlfilter.h
sessionparser.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
sessionparser.o: users.h log.h
sessionparser.o: users.h log.h logmanipulators.h slog.h ../templates/locale.h
sessionparser.o: ../core/confparser.h
slog.o: slog.h cur.h request.h requesttypes.h item.h error.h config.h
slog.o: confparser.h htmlfilter.h textstream.h ../templates/htmltextstream.h
slog.o: ../core/textstream.h misc.h session.h user.h plugindata.h rebus.h
slog.o: logmanipulators.h ../templates/locale.h ../core/confparser.h
synchro.o: synchro.h
system.o: system.h dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h
system.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
system.o: ../core/error.h log.h textstream.h ../db/dbitemquery.h
system.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
system.o: ../core/dircontainer.h ../core/ugcontainer.h request.h
system.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
system.o: ../templates/htmltextstream.h ../notify/notify.h
system.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
system.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
system.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
system.o: ../core/dircontainer.h ../core/ugcontainer.h log.h textstream.h
system.o: logmanipulators.h slog.h cur.h request.h requesttypes.h error.h
system.o: config.h confparser.h htmlfilter.h ../templates/htmltextstream.h
system.o: session.h user.h plugindata.h rebus.h ../templates/locale.h
system.o: ../core/confparser.h ../notify/notify.h ../notify/notifypool.h
system.o: ../templates/misc.h ../templates/localefilter.h
system.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
system.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
system.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
system.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
system.o: ../notify/notifythread.h ../core/basethread.h synchro.h
system.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
system.o: ugcontainer.h lastcontainer.h cur.h session.h plugindata.h rebus.h
system.o: mounts.h mount.h mountparser.h users.h groups.h group.h loadavg.h
system.o: thumb.h basethread.h ../templates/templates.h
system.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
system.o: ../core/httpsimpleparser.h ../core/log.h
system.o: ../templates/indexpatterns.h ../core/cur.h ../core/system.h
system.o: ../core/sessionmanager.h ../functions/functionbase.h
system.o: ../core/request.h ../core/synchro.h
system.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
system.o: ugcontainer.h lastcontainer.h mounts.h mount.h mountparser.h
system.o: crypt.h run.h users.h groups.h group.h loadavg.h thumb.h
system.o: basethread.h ../templates/templates.h ../templates/patterncacher.h
system.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
system.o: ../core/log.h ../templates/indexpatterns.h ../core/cur.h
system.o: ../core/system.h ../core/sessionmanager.h ../core/htmlfilter.h
system.o: ../functions/functionbase.h ../core/request.h ../core/synchro.h
textstream.o: textstream.h misc.h item.h
thumb.o: thumb.h basethread.h textstream.h ../db/db.h ../db/dbbase.h
thumb.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
thumb.o: item.h ../core/error.h log.h ../db/dbitemquery.h ../core/item.h
thumb.o: item.h ../core/error.h ../db/dbitemquery.h ../core/item.h
thumb.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
thumb.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/config.h
thumb.o: ../../ezc/src/utf8.h system.h dirs.h dircontainer.h request.h
thumb.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
thumb.o: ../templates/htmltextstream.h ../notify/notify.h
thumb.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
thumb.o: ../templates/misc.h ../templates/localefilter.h
thumb.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
thumb.o: ../core/dircontainer.h ../core/ugcontainer.h log.h logmanipulators.h
thumb.o: slog.h cur.h request.h requesttypes.h error.h config.h confparser.h
thumb.o: htmlfilter.h ../templates/htmltextstream.h session.h user.h
thumb.o: plugindata.h rebus.h ../templates/locale.h ../core/confparser.h
thumb.o: ../core/config.h ../../ezc/src/utf8.h system.h dirs.h dircontainer.h
thumb.o: ../notify/notify.h ../notify/notifypool.h ../templates/misc.h
thumb.o: ../templates/localefilter.h ../templates/locale.h
thumb.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
thumb.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
thumb.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
thumb.o: ../templates/htmltextstream.h ../notify/notifythread.h
thumb.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
thumb.o: ../core/users.h user.h ugcontainer.h lastcontainer.h cur.h session.h
thumb.o: plugindata.h rebus.h mounts.h mount.h mountparser.h users.h groups.h
thumb.o: group.h loadavg.h
thumb.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h mount.h
thumb.o: mountparser.h crypt.h run.h users.h groups.h group.h loadavg.h
users.o: users.h

View File

@@ -1 +1 @@
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o confparser.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o item.o lastcontainer.o loadavg.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o session.o sessioncontainer.o sessionmanager.o sessionparser.o synchro.o system.o textstream.o thumb.o users.o
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o confparser.o crypt.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o item.o lastcontainer.o loadavg.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionmanager.o sessionparser.o slog.o synchro.o system.o textstream.o thumb.o users.o

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -24,24 +24,60 @@ public:
}
bool AcceptGzip()
{
return accept_gzip;
}
void ParseAndLog(const char * str)
{
Parse(str);
if( accept_deflate || accept_gzip )
{
log << log3 << "AEP: ";
if( accept_deflate )
{
log << "accept deflate";
if( accept_gzip )
log << ", ";
}
if( accept_gzip )
log << "accept gzip";
log << logend;
}
}
private:
void Init()
{
accept_deflate = false;
accept_gzip = false;
}
void Param(const std::string & param, double q)
{
if( param=="deflate" && q!=0 )
if( param=="deflate" && q!=0.0 )
{
accept_deflate = true;
log << log3 << "AEP: accept deflate" << logend;
}
if( param=="gzip" && q!=0.0 )
{
accept_gzip = true;
}
}
bool accept_deflate;
bool accept_gzip;
};

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -74,6 +74,9 @@ App::App()
session_manager.SetSynchro(&synchro);
post_multi_parser.SetConfig(&config);
slog.SetCur(&cur);
slog.SetLocale(&TemplatesFunctions::locale);
}
@@ -152,6 +155,11 @@ bool App::Init()
CreateStaticTree();
get_parser.UTF8(config.utf8);
post_parser.UTF8(config.utf8);
post_parser.LogValueSize(config.log_post_value_size);
// post_multi_parser has a pointer to the config
plugin.Call(WINIX_PLUGIN_INIT);
return true;
@@ -206,10 +214,11 @@ void App::ProcessRequestThrow()
plugin.Call(WINIX_SESSION_CHANGED);
functions.Parse();
functions.Parse(); // parsing directories,files,functions and parameters
system.mounts.CalcCurMount();
Make();
if( system.mounts.pmount->type != system.mounts.MountTypeStatic() )
Make();
}
SendAnswer();
@@ -242,6 +251,17 @@ void App::ProcessRequest()
log << log1 << "App: there was an unknown exception" << logend;
}
try
{
plugin.Call(WINIX_END_REQUEST);
}
catch(...)
{
log << log1 << "App: an exception when clearing the request (from a plugin)" << logend;
}
cur.request->Clear();
cur.session = session_manager.GetTmpSession();
}
@@ -374,7 +394,7 @@ void App::ReadRequest()
ReadGetPostVars();
cookie_parser.Parse(cur.request->env_http_cookie, cur.request->cookie_tab);
accept_encoding_parser.Parse(cur.request->env_http_accept_encoding);
accept_encoding_parser.ParseAndLog(cur.request->env_http_accept_encoding);
CheckIE();
CheckKonqueror();
@@ -402,15 +422,15 @@ void App::ReadEnvVariables()
// we store that values because FCGX_GetParam has O(n) complexity
// with this variables (env_*) we have O(1)
SetEnv(cur.request->env_request_method, "REQUEST_METHOD"); // !! mozna nie uzywac tego, teraz mamy w strukturze fcgi_request
SetEnv(cur.request->env_request_method, "REQUEST_METHOD"); // !! mozna nie uzywac tego, teraz mamy w strukturze fcgi_request
SetEnv(cur.request->env_request_uri, "REQUEST_URI");
SetEnv(cur.request->env_http_cookie, "HTTP_COOKIE");
SetEnv(cur.request->env_remote_addr, "REMOTE_ADDR");
SetEnv(cur.request->env_http_host, "HTTP_HOST");
SetEnv(cur.request->env_http_host, "HTTP_HOST");
SetEnv(cur.request->env_http_user_agent, "HTTP_USER_AGENT");
SetEnv(cur.request->env_fcgi_role, "FCGI_ROLE");
SetEnv(cur.request->env_content_type, "CONTENT_TYPE");
SetEnv(cur.request->env_http_accept_encoding,"HTTP_ACCEPT_ENCODING");
SetEnv(cur.request->env_fcgi_role, "FCGI_ROLE");
SetEnv(cur.request->env_content_type, "CONTENT_TYPE");
SetEnv(cur.request->env_http_accept_encoding, "HTTP_ACCEPT_ENCODING");
}
@@ -458,7 +478,6 @@ void App::LogAccess()
void App::ReadGetPostVars()
{
// get parameters we have always
get_parser.UTF8(config.utf8);
get_parser.Parse(cur.request->env_request_uri, cur.request->get_tab);
if( cur.request->method == Request::post )
@@ -466,14 +485,10 @@ void App::ReadGetPostVars()
if( IsSubStringNoCase("multipart/form-data", cur.request->env_content_type) )
{
log << log3 << "Request: post content type: multipart/form-data" << logend;
// !! dodac metode UTF8 do post_multi_parsera
// (narazie bierze bezposrednio z konfigu)
// w ogole wywalic zaleznosc od konfiga
post_multi_parser.Parse(fcgi_request.in, cur.request->post_tab, cur.request->post_file_tab);
}
else
{
post_parser.UTF8(config.utf8);
post_parser.Parse(fcgi_request.in, cur.request->post_tab);
}
}
@@ -528,8 +543,61 @@ void App::PrepareSessionCookie()
void App::SendHeadersStatic()
{
if( PathHasUpDir(cur.request->env_request_uri) )
{
log << log1 << "App: incorrect path for a static file" << logend;
SendHeadersForbidden();
return;
}
void App::SendHeaders(bool compressing, Header header)
const std::wstring & index_str = system.mounts.pmount->FirstArg(system.mounts.MountParStatic());
size_t index = Toi(index_str);
if( index >= config.static_dirs.size() )
{
log << log1 << "App: static dir with index " << index << " is not defined in the config" << logend;
SendHeadersForbidden();
return;
}
Ezc::WideToUTF8(config.http_header_send_file, sendheadersstatic_t);
Ezc::WideToUTF8(config.static_dirs[index], sendheadersstatic_t2);
Item * dir = system.dirs.GetDir(system.mounts.pmount->dir_id);
if( !dir )
{
log << log1 << "App: cannot find the mount directory" << logend;
SendHeadersForbidden();
return;
}
size_t how_many_dirs = system.dirs.DirLevel(dir->id);
const char * path = SkipDirs(cur.request->env_request_uri, how_many_dirs);
// the path begins with a slash only if how_many_dirs is zero
while( *path == '/' )
path += 1;
FCGX_FPrintF(fcgi_request.out, "%s: %s/%s\r\n", sendheadersstatic_t.c_str(), sendheadersstatic_t2.c_str(), path);
FCGX_PutS("Status: 200 OK\r\n", fcgi_request.out);
log << log2 << "Sending file from a static mountpoint: " << sendheadersstatic_t2 << "/" << path << logend;
}
void App::SendHeadersForbidden()
{
FCGX_PutS("Status: 403 Forbidden\r\n", fcgi_request.out);
FCGX_PutS("Content-Type: text/html\r\n", fcgi_request.out);
log << log2 << "Request: response: 403 Forbidden" << logend;
}
void App::SendHeaders(bool compressing, int compress_encoding, Header header)
{
PrepareSessionCookie();
@@ -544,6 +612,11 @@ void App::SendHeaders(bool compressing, Header header)
log << log2 << "Redirect to: " << cur.request->aredirect_to << logend;
}
else
if( system.mounts.pmount->type == system.mounts.MountTypeStatic() )
{
SendHeadersStatic();
}
else
if( !cur.request->x_sendfile.empty() )
{
static std::string temp, temp2; // !! wrzucic gdzies to
@@ -566,9 +639,7 @@ void App::SendHeaders(bool compressing, Header header)
break;
case h_403:
FCGX_PutS("Status: 403 Forbidden\r\n", fcgi_request.out);
FCGX_PutS("Content-Type: text/html\r\n", fcgi_request.out);
log << log2 << "Request: response: 403 Forbidden" << logend;
SendHeadersForbidden();
break;
default:
@@ -579,8 +650,13 @@ void App::SendHeaders(bool compressing, Header header)
}
}
if( compressing )
FCGX_PutS("Content-Encoding: deflate\r\n", fcgi_request.out);
if( compressing )
{
if( compress_encoding == 0 || compress_encoding == 1 )
FCGX_PutS("Content-Encoding: deflate\r\n", fcgi_request.out);
else
FCGX_PutS("Content-Encoding: gzip\r\n", fcgi_request.out);
}
FCGX_PutS(cur.request->headers.CStr(), fcgi_request.out);
FCGX_PutS("\r\n", fcgi_request.out);
@@ -588,30 +664,17 @@ void App::SendHeaders(bool compressing, Header header)
void App::SetHtmlFilterConf()
{
html_filter.TrimWhite(config.html_filter_trim_white);
html_filter.BreakLines(config.html_filter_break_lines);
html_filter.InsertTabs(config.html_filter_tabs);
if( config.html_filter_orphans )
html_filter.CheckOrphans(config.html_filter_orphans_lang, config.html_filter_orphans_mode);
}
// !! kopiowanie tych stringow bedzie zmienione
// gdy bedziemy korzystac w przyszlosci z wlasnego stringstream
void App::FilterCompressSend(bool compressing, const std::wstring & source_ref)
void App::FilterCompressSend(bool compressing, int compress_encoding, const std::wstring & source_ref)
{
const std::wstring * source = &source_ref;
bool raw = cur.request->is_item && cur.request->item.content_type == Item::ct_raw && cur.request->status == WINIX_ERR_OK &&
cur.request->function && (cur.request->function == &functions.fun_cat || cur.request->function == &functions.fun_run);
cur.request->function && (cur.request->function == &functions.fun_cat || cur.request->function == &functions.fun_run);
if( config.html_filter && !raw )
{
SetHtmlFilterConf();
html_filter.Filter(*source, clean_html);
TemplatesFunctions::html_filter.Filter(*source, clean_html);
AddDebugInfo(clean_html);
source = &clean_html;
}
@@ -622,32 +685,76 @@ void App::FilterCompressSend(bool compressing, const std::wstring & source_ref)
source = &html_with_debug;
}
// !! zrobic z tym porzadek
std::string temp;
Ezc::WideToUTF8(*source, temp);
if( config.utf8 )
Ezc::WideToUTF8(*source, source_a);
else
AssignString(*source, source_a);
if( compressing )
compress.CompressAndPut(temp.c_str(), temp.length(), fcgi_request.out);
compress.CompressAndPut(source_a.c_str(), source_a.length(), fcgi_request.out, compress_encoding);
else
FCGX_PutS(temp.c_str(), fcgi_request.out);
FCGX_PutS(source_a.c_str(), fcgi_request.out);
}
bool App::IsCompressionAllowed(const std::wstring & source)
int App::SelectDeflateVersion()
{
return( config.compression &&
cur.request->role == Request::responder &&
cur.request->redirect_to.empty() &&
cur.request->x_sendfile.empty() &&
!cur.request->browser_msie &&
!cur.request->browser_konqueror &&
accept_encoding_parser.AcceptDeflate() &&
source.size() >= (size_t)config.compression_page_min_size );
if( cur.request->browser_msie )
return 0; // raw deflate
else
return 1; // deflate
}
void App::SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding)
{
compression_allowed = false;
compression_encoding = 0;
if( config.compression &&
cur.request->role == Request::responder &&
cur.request->redirect_to.empty() &&
cur.request->x_sendfile.empty() &&
!cur.request->browser_konqueror && /* !! sprawdzic czy Konqueror bedzie obslugiwal raw deflate */
source_len >= config.compression_page_min_size )
{
if( config.compression_encoding == 1 || config.compression_encoding == 10 )
{
if( accept_encoding_parser.AcceptDeflate() )
{
compression_allowed = true;
compression_encoding = SelectDeflateVersion();
}
else
if( config.compression_encoding == 10 && accept_encoding_parser.AcceptGzip() )
{
compression_allowed = true;
compression_encoding = 2; // gzip
}
}
if( config.compression_encoding == 2 || config.compression_encoding == 20 )
{
if( accept_encoding_parser.AcceptGzip() )
{
compression_allowed = true;
compression_encoding = 2; // gzip
}
else
if( config.compression_encoding == 20 && accept_encoding_parser.AcceptDeflate() )
{
compression_allowed = true;
compression_encoding = SelectDeflateVersion();
}
}
}
}
bool App::CanSendContent(Header header)
{
if( !cur.request->redirect_to.empty() || !cur.request->x_sendfile.empty() )
@@ -687,9 +794,12 @@ void App::AddDebugInfo(std::wstring & out)
void App::SendAnswer()
{
const std::wstring & source = cur.request->page.Str();
Header header = h_200;
bool compressing = IsCompressionAllowed(source);
Error status = cur.request->status;
Header header = h_200;
Error status = cur.request->status;
bool compressing;
int compress_encoding;
SelectCompression(source.length(), compressing, compress_encoding);
if( status == WINIX_ERR_NO_ITEM || status == WINIX_ERR_NO_FUNCTION || status == WINIX_ERR_UNKNOWN_PARAM )
header = h_404;
@@ -697,12 +807,12 @@ Error status = cur.request->status;
if( status == WINIX_ERR_PERMISSION_DENIED || status == WINIX_ERR_CANT_CHANGE_USER || status == WINIX_ERR_CANT_CHANGE_GROUP )
header = h_403;
SendHeaders(compressing, header);
SendHeaders(compressing, compress_encoding, header);
if( CanSendContent(header) )
{
// filtering (html), compressing (deflate) and sending back to the web browser
FilterCompressSend(compressing, source);
// filtering (html), compressing and sending back to the web browser
FilterCompressSend(compressing, compress_encoding, source);
}
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -30,7 +30,6 @@
#include "functions/functions.h"
#include "templates/templates.h"
#include "compress.h"
#include "htmlfilter.h"
#include "getparser.h"
#include "postparser.h"
#include "cookieparser.h"
@@ -124,14 +123,14 @@ private:
CookieParser cookie_parser;
AcceptEncodingParser accept_encoding_parser;
Compress compress;
HTMLFilter html_filter;
std::wstring clean_html, html_with_debug;
FCGX_Request fcgi_request;
int fcgi_socket;
Synchro synchro;
pthread_t signal_thread;
std::string url_to_fetch_on_exit;
std::string source_a;
std::string sendheadersstatic_t, sendheadersstatic_t2;
void ProcessRequestThrow();
void ProcessRequest();
@@ -153,12 +152,14 @@ private:
void CheckRequestMethod();
void CheckFCGIRole();
void SetHtmlFilterConf();
void PrepareSessionCookie();
void AddDebugInfo(std::wstring & out);
void FilterCompressSend(bool compressing, const std::wstring & source_ref);
void SendHeaders(bool compressing, Header header);
bool IsCompressionAllowed(const std::wstring & source);
void FilterCompressSend(bool compressing, int compress_encoding, const std::wstring & source_ref);
void SendHeadersStatic();
void SendHeadersForbidden();
void SendHeaders(bool compressing, int compress_encoding, Header header);
int SelectDeflateVersion();
void SelectCompression(size_t source_len, bool & compression_allowed, int & compression_encoding);
bool CanSendContent(Header header);
void LogUser(const char * msg, uid_t id);

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -10,6 +10,8 @@
#include "bbcodeparser.h"
bool BBCODEParser::Equal(const wchar_t * str1, const wchar_t * str2)
{
while( *str1 == *str2 && *str1 != 0 )
@@ -67,6 +69,10 @@ bool BBCODEParser::IsClosingXmlSimpleTagMark()
// one enter will generate one <br>
// two enters or more will generate only two br (<br><br>)
void BBCODEParser::PutNormalText(const wchar_t * str, const wchar_t * end)
@@ -116,12 +122,6 @@ int br_len;
}
void BBCODEParser::PutNormalTextTrim(const wchar_t * str, const wchar_t * end)
{
// we don't use trimming in bbcode parser
PutNormalText(str, end);
}
void BBCODEParser::ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white)
{
@@ -201,6 +201,12 @@ const BBCODEParser::Tags * BBCODEParser::FindTag(const wchar_t * tag)
return 0;
}
const BBCODEParser::Tags * BBCODEParser::FindTag(const std::wstring & tag)
{
return FindTag(tag.c_str());
}
void BBCODEParser::PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end)
{
@@ -361,19 +367,21 @@ void BBCODEParser::PrintEncode(const wchar_t * start, const wchar_t * end)
void BBCODEParser::PutOpeningTagFromEzc(const wchar_t * start, const wchar_t * end)
void BBCODEParser::PutOpeningTagFromEzc()
{
// this can be a tag from Ezc templates system
(*out_string) += '[';
(*out_string) += LastItem().name;
if( start != end )
{
(*out_string) += ' ';
PrintEscape(start, end);
}
const wchar_t * start = pchar;
(*out_string) += ']';
while( *pchar && *pchar!=']' )
++pchar;
if( *pchar == ']' )
++pchar;
Put(start, pchar);
}
@@ -489,33 +497,40 @@ bool has_u;
}
void BBCODEParser::PutOpeningTagFromBBCode(const Tags * tag, const wchar_t * start, const wchar_t * end)
void BBCODEParser::PutOpeningTagFromBBCode(const Tags * tag)
{
CheckOpeningTag(tag);
PutOpeningTagMark();
(*out_string) += tag->html_tag;
PutHtmlArgument(tag, start, end);
Put(tag->html_tag);
const wchar_t * start = pchar;
while( *pchar && *pchar != ']' )
++pchar;
PutHtmlArgument(tag, start, pchar);
if( *pchar == ']' )
++pchar;
if( !tag->inline_tag )
{
(*out_string) += L"\n";
Put(10);
SkipWhiteLines();
}
}
void BBCODEParser::PutOpeningTag(const wchar_t * start, const wchar_t * end)
bool BBCODEParser::PutOpeningTag()
{
const Tags * tag = FindTag(LastItem().name);
if( !tag )
{
PutOpeningTagFromEzc(start, end);
}
PutOpeningTagFromEzc();
else
{
PutOpeningTagFromBBCode(tag, start, end);
}
PutOpeningTagFromBBCode(tag);
return false;
}
@@ -564,7 +579,7 @@ void BBCODEParser::Init()
}
void BBCODEParser::Deinit()
void BBCODEParser::Uninit()
{
if( has_open_li_tag )
(*out_string) += L"</li>\n";

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -13,54 +13,60 @@
#include "htmlfilter.h"
class BBCODEParser : public HTMLFilter
{
//using HTMLFilter::pchar;
struct Tags
{
/*
const wchar_t * bbcode;
const wchar_t * html_tag;
const wchar_t * html_arg_prefix;
const wchar_t * html_arg_postfix;
const wchar_t * additional_html_tag_prefix;
const wchar_t * additional_html_tag_postfix;
bool inline_tag;
*/
const wchar_t * bbcode;
const wchar_t * html_tag;
const wchar_t * html_argument; // with closing '>'
bool inline_tag;
};
bool Equal(const wchar_t * str1, const wchar_t * str2);
virtual bool IsValidCharForName(int c);
/*
virtual methods
(from HTMLFilter class)
*/
virtual void Init();
virtual void Uninit();
virtual bool IsOpeningTagMark();
virtual bool IsOpeningCommentaryTagMark();
virtual bool SkipCommentaryTagIfExists();
virtual bool IsClosingTagMark();
virtual bool IsClosingXmlSimpleTagMark();
virtual bool IsValidCharForName(int c);
virtual void CheckExceptions();
virtual bool SkipCommentaryTagIfExists();
virtual bool PutOpeningTag();
virtual void PutClosingTag(const wchar_t * tag);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
/*
others
*/
bool Equal(const wchar_t * str1, const wchar_t * str2);
void PutHtmlArgument1(const wchar_t * arg_start, const wchar_t * arg_end, bool has_u);
void PutHtmlArgument2(const Tags * tag, bool has_u);
void PutHtmlArgument(const Tags * tag, const wchar_t * arg_start, const wchar_t * arg_end);
void PutOpeningTagFromEzc(const wchar_t * start, const wchar_t * end);
void PutOpeningTagFromBBCode(const Tags * tag, const wchar_t * start, const wchar_t * end);
virtual void PutOpeningTag(const wchar_t * start, const wchar_t * end);
virtual void PutClosingTag(const wchar_t * tag);
void PutOpeningTagFromEzc();
void PutOpeningTagFromBBCode(const Tags * tag);
const Tags * FindTag(const wchar_t * tag);
const Tags * FindTag(const std::wstring & tag);
void PrintArgumentCheckQuotes(const wchar_t * & start, const wchar_t * & end);
void PrintEscape(int c, bool change_quote = false);
void PrintEncode(int c);
@@ -70,28 +76,18 @@ class BBCODEParser : public HTMLFilter
void PrintArgumentEncode(const wchar_t * start, const wchar_t * end);
void PrintArgumentEscape(const wchar_t * start, const wchar_t * end);
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void PutNormalTextTrim(const wchar_t * str, const wchar_t * end);
virtual void CheckExceptions();
virtual void Init();
virtual void Deinit();
void PutClosingTag(const Tags * tag);
void CheckOpeningTag(const Tags * tag, const wchar_t * tag_name, bool & condition);
void CheckOpeningTag(const Tags * tag);
void TrimWhiteWithNewLines(const wchar_t * & start, const wchar_t * & end);
bool has_open_ol_tag; // has open html <ol> tag
bool has_open_ul_tag; // has open html <ul> tag
bool has_open_li_tag; // has open html <li> tag
};
#endif

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -15,9 +15,13 @@
Compress::Compress()
{
buffer = 0;
buffer_max_len = 65536; // 64KB
buffer = 0;
buffer_max_len = 65536; // 64KB
ready_for_compress = false;
compress_level = 6;
raw_deflate_inited = false;
deflate_inited = false;
gzip_inited = false;
}
@@ -25,6 +29,15 @@ Compress::~Compress()
{
if( buffer )
delete [] buffer;
if( raw_deflate_inited )
deflateEnd(&strm_raw_deflate);
if( deflate_inited )
deflateEnd(&strm_deflate);
if( gzip_inited )
deflateEnd(&strm_gzip);
}
@@ -33,7 +46,6 @@ bool Compress::AllocateMemory()
if( buffer )
delete [] buffer;
try
{
buffer = new char[buffer_max_len];
@@ -41,7 +53,6 @@ bool Compress::AllocateMemory()
catch(const std::bad_alloc &)
{
log << log1 << "Compress: can't allocate memory" << logend;
buffer = 0;
return false;
}
@@ -50,39 +61,93 @@ return true;
}
bool Compress::InitRawDeflate()
{
raw_deflate_inited = false;
strm_raw_deflate.next_in = 0;
strm_raw_deflate.zalloc = Z_NULL;
strm_raw_deflate.zfree = Z_NULL;
strm_raw_deflate.opaque = Z_NULL;
int ret = deflateInit2(&strm_raw_deflate, compress_level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
if( ret != Z_OK )
log << log1 << "Compress: problem with deflateInit2() for raw deflate" << logend;
else
raw_deflate_inited = true;
return ret == Z_OK;
}
bool Compress::InitDeflate()
{
deflate_inited = false;
strm_deflate.next_in = 0;
strm_deflate.zalloc = Z_NULL;
strm_deflate.zfree = Z_NULL;
strm_deflate.opaque = Z_NULL;
int ret = deflateInit2(&strm_deflate, compress_level, Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
if( ret != Z_OK )
log << log1 << "Compress: problem with deflateInit2() for deflate" << logend;
else
deflate_inited = true;
return ret == Z_OK;
}
bool Compress::InitGzip()
{
gzip_inited = false;
strm_gzip.next_in = 0;
strm_gzip.zalloc = Z_NULL;
strm_gzip.zfree = Z_NULL;
strm_gzip.opaque = Z_NULL;
int ret = deflateInit2(&strm_gzip, compress_level, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY);
if( ret != Z_OK )
log << log1 << "Compress: problem with deflateInit2() for gzip" << logend;
else
gzip_inited = true;
return ret == Z_OK;
}
/*
return:
0 - ok;
1 - can't allocate memory
100 - unknown
0 - ok
1 - can't allocate memory
100 - unknown error
*/
int Compress::Init(int compress_level)
int Compress::Init(int compress_level_)
{
compress_level = compress_level_;
if( buffer == 0 )
if( !AllocateMemory() )
return 1;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
int ret = deflateInit(&strm, compress_level);
if( ret != Z_OK )
log << log1 << "Compress: problem with deflateInit()" << logend;
if( ret == Z_MEM_ERROR )
return 1;
if( ret != Z_OK )
return 100;
ready_for_compress = true;
if( InitRawDeflate() && InitDeflate() && InitGzip() )
ready_for_compress = true;
else
return 100;
return 0;
}
int Compress::MakeCompress(const char * source, size_t source_len, FCGX_Stream * out_stream)
int Compress::MakeCompress(z_stream & strm, const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding)
{
int ret, flush;
size_t have;
@@ -133,6 +198,62 @@ return 0;
z_stream * Compress::SelectStream(int encoding)
{
z_stream * pstrm;
if( encoding == 0 )
pstrm = &strm_raw_deflate;
else
if( encoding == 1 )
pstrm = &strm_deflate;
else
pstrm = &strm_gzip;
return pstrm;
}
void Compress::ResetStream(z_stream * pstrm, int encoding)
{
if( deflateReset(pstrm) != Z_OK )
{
log << log1 << "Compress: problem with deflateReset()" << logend;
deflateEnd(pstrm);
if( encoding == 0 )
InitRawDeflate();
else
if( encoding == 1 )
InitDeflate();
else
InitGzip();
}
}
void Compress::PutLog(size_t source_len, int encoding)
{
double ratio = 100.0 - (double(last_out_size) / double(source_len) * 100.0);
char buffer[30];
sprintf(buffer, "%.1f", ratio);
log << log2 << "Compress: ";
if( encoding == 0 )
log << "raw deflate";
else
if( encoding == 1 )
log << "deflate";
else
log << "gzip";
log << ", original size: " << source_len << ", size after compressing: "
<< (int)last_out_size << ", ratio: " << buffer << "%" << logend;
}
/*
return:
@@ -142,10 +263,11 @@ return 0;
3 - not inited (use Init() first)
100 - unknown
*/
int Compress::CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int level)
int Compress::CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding)
{
int ret;
z_stream * pstrm;
last_out_size = 0;
if( !ready_for_compress )
@@ -156,17 +278,11 @@ int ret;
if( source_len == 0 )
return 0;
ret = MakeCompress(source, source_len, out_stream);
if( deflateReset(&strm) != Z_OK )
log << log1 << "Compress: problem with deflateReset()" << logend;
double ratio = 100.0 - (double(last_out_size) / double(source_len) * 100.0);
char buffer[30];
sprintf(buffer, "%.1f", ratio);
log << log2 << "Compress: original size: " << source_len << ", compress size: " << (int)last_out_size << ", ratio: " << buffer << "%" << logend;
pstrm = SelectStream(encoding);
ret = MakeCompress(*pstrm, source, source_len, out_stream, encoding);
ResetStream(pstrm, encoding);
PutLog(source_len, encoding);
return ret;
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -23,18 +23,35 @@ public:
Compress();
~Compress();
int Init(int compress_level = 6);
int CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int level = 6);
int Init(int compress_level_ = 6);
/*
encoding:
0 - raw deflate data with no zlib header or trailer, and will not compute an adler32 check value
(for Internet Explorer)
1 - deflate
2 - gzip
*/
int CompressAndPut(const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding = 2);
size_t last_out_size;
private:
bool AllocateMemory();
int MakeCompress(const char * source, size_t source_len, FCGX_Stream * out_stream);
bool InitRawDeflate();
bool InitDeflate();
bool InitGzip();
int MakeCompress(z_stream & strm, const char * source, size_t source_len, FCGX_Stream * out_stream, int encoding);
z_stream * SelectStream(int encoding);
void ResetStream(z_stream * pstrm, int encoding);
void PutLog(size_t source_len, int encoding);
int compress_level;
size_t buffer_max_len;
char * buffer;
z_stream strm;
z_stream strm_raw_deflate, strm_deflate, strm_gzip;
bool raw_deflate_inited, deflate_inited, gzip_inited;
bool ready_for_compress;
};

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -11,6 +11,7 @@
#include "log.h"
#include "plugin.h"
#include "misc.h"
#include "crypt.h"
@@ -109,11 +110,14 @@ void Config::AssignValues(bool stdout_is_closed)
log_stdout = Bool(L"log_stdout", false);
log_db_query = Bool(L"log_db_query", false);
log_plugin_call = Bool(L"log_plugin_call", false);
log_post_value_size = Size(L"log_post_value_size", 80);
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
upload_dir = Text(L"upload_dir");
upload_dirs_chmod = Int(L"upload_dirs_chmod", 0750);
upload_files_chmod = Int(L"upload_files_chmod", 0640);
ListText(L"static_dirs", static_dirs);
dont_use_static_dirs = Bool(L"dont_use_static_dirs", false);
create_thumb = Bool(L"create_thumb", true);
thumb_mode = Int(L"thumb_mode", 2);
thumb_cx = Size(L"thumb_cx", 150);
@@ -153,25 +157,26 @@ void Config::AssignValues(bool stdout_is_closed)
session_file = AText(L"session_file");
session_max = Size(L"session_max", 1000000);
compression = Bool(L"compression", true);
compression_page_min_size = Int(L"compression_page_min_size", 512);
compression = Bool(L"compression", true);
compression_page_min_size = Size(L"compression_page_min_size", 512);
compression_encoding = Int(L"compression_encoding", 20);
html_filter = Bool(L"html_filter", true);
html_filter_trim_white = Bool(L"html_filter_trim_white", true);
html_filter_break_lines = Int(L"html_filter_break_lines", 60);
html_filter_break_word = Int(L"html_filter_break_word", 60);
html_filter_wrap_line = Int(L"html_filter_wrap_line", 110);
html_filter_tabs = Size(L"html_filter_tabs", 2);
html_filter_orphans = Bool(L"html_filter_orphans", false);
html_filter_orphans_lang_str = AText(L"html_filter_orphans_lang", L"pl");
html_filter_orphans = Bool(L"html_filter_orphans", true);
html_filter_orphans_mode_str = AText(L"html_filter_orphans_mode_str", L"nbsp");
locale_str = Text(L"locale", L"en");
locale_dir = Text(L"locale_dir");
locale_dir_default = Text(L"locale_dir_default");
locale_default = Text(L"locale_default");
ListText(L"locale_files", locale_files);
title_separator = Text(L"title_separator", L" / ");
http_header_send_file = Text(L"http_header_send_file", L"X-LIGHTTPD-send-file");
password_min_size = Size(L"password_min_size", 5);
debug_info = Bool(L"debug_info", false);
editors_html_safe_mode = Bool(L"editors_html_safe_mode", true);
@@ -179,7 +184,7 @@ void Config::AssignValues(bool stdout_is_closed)
plugins_dir = Text(L"plugins_dir", L"/usr/local/winix/plugins");
NoLastSlash(plugins_dir);
parser.ListText(L"plugins", plugin_file);
ListText(L"plugins", plugin_file);
time_zone_offset = Int(L"time_zone_offset", 0);
time_zone_offset_guest = Int(L"time_zone_offset_guest", 0);
@@ -188,32 +193,87 @@ void Config::AssignValues(bool stdout_is_closed)
symlinks_follow_max = Size(L"symlinks_follow_max", 20);
ticket_form_prefix = Text(L"ticket_form_prefix", L"ticketparam");
pass_min_size = Size(L"pass_min_size", 5);
pass_type = Int(L"pass_type", 12);
pass_hash_use_salt = Bool(L"pass_hash_use_salt", false);
pass_hash_salt = Text(L"pass_hash_salt");
pass_use_rsa = Bool(L"pass_use_rsa", false);
pass_rsa_private_key = Text(L"pass_rsa_private_key");
opensll_path = Text(L"opensll_path", L"/usr/bin/openssl");
}
void Config::SetAdditionalVariables()
{
SetHttpHost(base_url, base_url_http_host);
if( html_filter_orphans_lang_str == "pl" )
html_filter_orphans_lang = HTMLFilter::lang_pl;
else
if( html_filter_orphans_lang_str == "cz" )
html_filter_orphans_lang = HTMLFilter::lang_cz;
else
if( html_filter_orphans_lang_str == "sk" )
html_filter_orphans_lang = HTMLFilter::lang_sk;
else
html_filter_orphans_lang = HTMLFilter::lang_none;
if( html_filter_orphans_mode_str == "160" )
html_filter_orphans_mode = HTMLFilter::orphan_160space;
else
html_filter_orphans_mode = HTMLFilter::orphan_nbsp;
for(size_t i=0 ; i<static_dirs.size() ; ++i)
NoLastSlash(static_dirs[i]);
CheckLocale();
CheckPasswd();
}
void Config::CheckLocale()
{
bool found = false;
if( locale_files.empty() )
locale_files.push_back(L"en");
if( locale_default.empty() )
locale_default = locale_files[0];
for(size_t i=0 ; i<locale_files.size() ; ++i)
{
if( locale_files[i] == locale_default )
{
locale_default_index = i;
found = true;
break;
}
}
if( !found )
{
// we have at least one item
locale_default = locale_files[0];
locale_default_index = 0;
}
}
void Config::CheckPasswd()
{
switch(pass_type)
{
case WINIX_CRYPT_HASH_PLAIN:
case WINIX_CRYPT_HASH_MD4:
case WINIX_CRYPT_HASH_MD5:
case WINIX_CRYPT_HASH_SHA1:
case WINIX_CRYPT_HASH_SHA224:
case WINIX_CRYPT_HASH_SHA256:
case WINIX_CRYPT_HASH_SHA384:
case WINIX_CRYPT_HASH_SHA512:
break;
default:
pass_type = WINIX_CRYPT_HASH_SHA256;
}
}
void Config::SetHttpHost(const std::wstring & in, std::wstring & out)
{

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -72,6 +72,11 @@ public:
// default: false
bool log_plugin_call;
// how many characters in values should be logged from POST parameters
// default: 80
// set to 0 to turn off
size_t log_post_value_size;
// request delimiter in the log file, default "---------"
std::wstring log_delimiter;
@@ -137,11 +142,20 @@ public:
// default: 1000000 (one milion)
size_t session_max;
// allow the html ouput to be compressed
// allow the html output to be compressed
// default: true
bool compression;
// if the output is shorter than this value then it will not be compressed
int compression_page_min_size;
// default: 512 bytes
size_t compression_page_min_size;
// 1 - use deflate if available (or raw deflate for Internet Explorer) or don't compress
// 2 - use gzip if available or don't compress
// 10 - prefer deflate -- use deflate (or raw deflate for IE) if both deflate and gzip are available
// 20 - prefer gzip -- use gzip if both deflate and gzip are available
// default: 20
int compression_encoding;
// plugins directory
// default: /usr/local/winix/plugins
@@ -158,25 +172,24 @@ public:
// should white characters be trimmed
bool html_filter_trim_white;
// when long lines (lines without a white character) should be break (inserted a space)
// when long words should be broken (a space will be inserted)
// default: after 60 non white characters will be put a space
// set zero to turn off
int html_filter_break_lines;
size_t html_filter_break_word;
// when long lines should be broken (a new line character will be inserted)
// default: 80
// set zero to turn off
size_t html_filter_wrap_line;
// how many spaces will be put at one tree level
// default: 2
size_t html_filter_tabs;
// use checking for 'orphans' for a specicic language
// default: false
// default: true
bool html_filter_orphans;
// language for html orphans
// default: pl
// can be either: "pl" or "cz" or "sk"
std::string html_filter_orphans_lang_str;
HTMLFilter::Lang html_filter_orphans_lang;
// orphans mode
// either: "nbsp" or "160"
// default: "nbsp"
@@ -193,6 +206,24 @@ public:
// directory for static files
std::wstring upload_dir;
// additional static directories *not* managed by winix
// you can refer to this directories by using 'static' mount point
// e.g.
// let we say in the config you have:
// static_dirs = ("/home/a", "/home/b", "/home/c")
// and in /etc/fstab (in winix) you have such a line:
// "static /my/dir simplefs static(2)"
// above line in /etc/fstab means that when a user enters http://domain.com/my/dir/file.txt
// then "file.txt" will be taken from "/home/c/file.txt"
// this is useful for some javascript files which are protected from running from other domains
std::vector<std::wstring> static_dirs;
// sometimes you can have trouble when you have set an incorrect static path in /etc/fstab
// in such a case set dont_use_static_dirs to true
// and winix will behave as there are not any static directories
// so you can correct your mistake and then set this value to false
bool dont_use_static_dirs;
// chmod of newly created directories (under upload_dir)
// default: 0750
int upload_dirs_chmod;
@@ -229,16 +260,24 @@ public:
// default: /usr/local/bin/convert
std::wstring convert_cmd;
// locale: en, pl
// default: en
std::wstring locale_str;
// directory with locale files
std::wstring locale_dir;
// directory with default locale files (those from winix)
std::wstring locale_dir_default;
// locale files (e.g. "en", "pl")
// default: only one item: en
std::vector<std::wstring> locale_files;
// default locale
// default: the first item from locale_files
std::wstring locale_default;
// default locale - index to locale_files
// not available in config -- set automatically based on locale_default
size_t locale_default_index;
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
std::wstring base_server;
@@ -258,10 +297,6 @@ public:
// default: X-LIGHTTPD-send-file
std::wstring http_header_send_file;
// the minimum size of a password for new users (function: adduser)
// default: 5
size_t password_min_size;
// prints additional information (in the end of the html page as a commentary)
bool debug_info;
@@ -298,6 +333,48 @@ public:
// default: ticketparam
std::wstring ticket_form_prefix;
// the minimal size of a user's password
// default: 5
size_t pass_min_size;
// how passwords should be stored
// 0 - plain text
// 1 - md4 hash
// 2 - md5 hash
// 10 - sha1 hash
// 11 - sha224 hash
// 12 - sha256 hash (default)
// 13 - sha384 hash
// 14 - sha512 hash
int pass_type;
// whether the passwords' hashes should be salted or not
// this affects newly created accounts
// default: false
bool pass_hash_use_salt;
// salt to a password's hash
// default empty
// !! once you set this salt don't change it any more (people wouldn't be allowed to login)
std::wstring pass_hash_salt;
// whether the passwords' hashes should be encrypted
// this affects newly created accounts
// default: false
bool pass_use_rsa;
// path to a RSA private key
// this is actually private + public key in one file
// generated by "openssl genrsa"
// default empty which means encryption will not be used
// !! once you set these keys don't change it any more (people wouldn't be allowed to login)
std::wstring pass_rsa_private_key;
// path to 'openssl'
// default: /usr/bin/openssl
std::wstring opensll_path;
/*
*/
@@ -337,6 +414,8 @@ private:
void AssignValues(bool stdout_is_closed);
void SetHttpHost(const std::wstring & in, std::wstring & out);
void SetAdditionalVariables();
void CheckLocale();
void CheckPasswd();
ConfParser parser;

273
core/crypt.cpp Executable file
View File

@@ -0,0 +1,273 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include <cstring>
#include "crypt.h"
#include "utf8.h"
#include "misc.h"
#include "log.h"
void Crypt::SetConfig(Config * pconfig)
{
config = pconfig;
}
void Crypt::TrimLastWhite(std::string & str)
{
if( str.empty() )
return;
size_t i = str.size();
while( i > 0 && (IsWhite(str[i-1]) || str[i-1]==10) )
i -= 1;
if( i < str.size() )
str.erase(i);
}
bool Crypt::Hash(int hash, const char * in, size_t inlen, std::string & out)
{
out.clear();
if( !config )
return false;
run.Clear();
Ezc::WideToUTF8(config->opensll_path, command);
run.Cmd(command);
run.Par("dgst");
switch(hash)
{
case WINIX_CRYPT_HASH_MD4: run.Par("-md4"); break;
case WINIX_CRYPT_HASH_MD5: run.Par("-md5"); break;
case WINIX_CRYPT_HASH_SHA1: run.Par("-sha1"); break;
case WINIX_CRYPT_HASH_SHA224: run.Par("-sha224"); break;
case WINIX_CRYPT_HASH_SHA256: run.Par("-sha256"); break;
case WINIX_CRYPT_HASH_SHA384: run.Par("-sha384"); break;
case WINIX_CRYPT_HASH_SHA512: run.Par("-sha512"); break;
default:
return false;
}
bool result = run.Go(in, inlen, out) == 0;
TrimLastWhite(out);
return result;
}
bool Crypt::Hash(int hash, const char * in, std::string & out)
{
size_t len = strlen(in);
return Hash(hash, in, len, out);
}
bool Crypt::Hash(int hash, const std::string & in, std::string & out)
{
return Hash(hash, in.c_str(), in.size(), out);
}
bool Crypt::Hash(int hash, const wchar_t * in, size_t inlen, std::wstring & out)
{
Ezc::WideToUTF8(in, inlen, bufina);
int res = Hash(hash, bufina.c_str(), bufina.size(), bufouta);
// the output hash is not a UTF8 string
// it consists only from ascii letters
AssignString(bufouta, out);
return res;
}
bool Crypt::Hash(int hash, const wchar_t * in, std::wstring & out)
{
size_t len = wcslen(in);
return Hash(hash, in, len, out);
}
bool Crypt::Hash(int hash, const std::wstring & in, std::wstring & out)
{
return Hash(hash, in.c_str(), in.size(), out);
}
bool IsAllWhite(const char * str)
{
for( ; *str ; ++str)
{
if( !(IsWhite(*str) || *str==10) )
return false;
}
return true;
}
bool Crypt::RSA(bool encrypt, const char * keypath, const char * in, size_t inlen, std::string & out)
{
out.clear();
if( !config || IsAllWhite(keypath) )
return false;
run.Clear();
Ezc::WideToUTF8(config->opensll_path, command);
run.Cmd(command);
run.Par("rsautl");
run.Par("-inkey");
run.Par(keypath);
if(encrypt)
run.Par("-encrypt");
else
run.Par("-decrypt");
return run.Go(in, inlen, out) == 0;
}
bool Crypt::RSA(bool encrypt, const char * keypath, const std::string & in, std::string & out)
{
return RSA(encrypt, keypath, in.c_str(), in.size(), out);
}
bool Crypt::RSA(bool encrypt, const std::string & keypath, const std::string & in, std::string & out)
{
return RSA(encrypt, keypath.c_str(), in.c_str(), in.size(), out);
}
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out)
{
Ezc::WideToUTF8(keypath, keypatha);
return RSA(encrypt, keypatha.c_str(), in, inlen, out);
}
bool Crypt::RSA(bool encrypt, const wchar_t * keypath, const std::string & in, std::string & out)
{
return RSA(encrypt, keypath, in.c_str(), in.size(), out);
}
bool Crypt::RSA(bool encrypt, const std::wstring & keypath, const std::string & in, std::string & out)
{
return RSA(encrypt, keypath.c_str(), in.c_str(), in.size(), out);
}
bool Crypt::PassHash(const std::wstring & salt, UserPass & up)
{
bool result = true;
up.pass_hash_salted = false;
if( up.pass_type != WINIX_CRYPT_HASH_PLAIN )
{
pass_org = up.pass;
pass_salted = up.pass;
pass_salted += salt;
if( Hash(up.pass_type, pass_salted, up.pass) )
{
if( !salt.empty() )
up.pass_hash_salted = true;
}
else
{
log << log1 << "Crypt: problem with generating a hash, the password will not be hashed" << logend;
up.pass = pass_org;
up.pass_type = WINIX_CRYPT_HASH_PLAIN;
result = false;
}
ClearString(pass_salted);
ClearString(pass_org);
}
return result;
}
bool Crypt::PassCrypt(const std::wstring & path_to_rsa_private_key, UserPass & up)
{
bool result = false;
ClearString(up.pass_encrypted);
if( !path_to_rsa_private_key.empty() )
{
Ezc::WideToUTF8(up.pass, passa);
if( RSA(true, path_to_rsa_private_key, passa, up.pass_encrypted) )
{
result = true;
}
else
{
ClearString(up.pass_encrypted);
log << log1 << "AddUser: problem with encrypting, the password will not be encrypted!" << logend;
}
ClearString(passa);
}
return result;
}
void Crypt::PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, UserPass & up)
{
PassHash(salt, up);
PassCrypt(path_to_rsa_private_key, up);
}
void Crypt::PassHashCrypt(UserPass & up)
{
up.pass_type = config->pass_type;
empty.clear();
if( config->pass_hash_use_salt && !config->pass_hash_salt.empty() )
PassHash(config->pass_hash_salt, up);
else
PassHash(empty, up);
if( config->pass_use_rsa && !config->pass_rsa_private_key.empty() )
PassCrypt(config->pass_rsa_private_key, up);
}

209
core/crypt.h Executable file
View File

@@ -0,0 +1,209 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_crypt
#define headerfile_winix_core_crypt
#include <string>
#include "run.h"
#include "config.h"
#include "user.h"
/*
the kind of hashes we are able to obtain in winix
*/
#define WINIX_CRYPT_HASH_PLAIN 0
#define WINIX_CRYPT_HASH_MD4 1
#define WINIX_CRYPT_HASH_MD5 2
#define WINIX_CRYPT_HASH_SHA1 10
#define WINIX_CRYPT_HASH_SHA224 11
#define WINIX_CRYPT_HASH_SHA256 12
#define WINIX_CRYPT_HASH_SHA384 13
#define WINIX_CRYPT_HASH_SHA512 14
/*
calculating hashes, encrypting and decrypting with RSA
*/
class Crypt
{
public:
void SetConfig(Config * pconfig);
/*
calculating a hash from a given input
input:
hash - the kind of the hash - WINIX_CRYPT_HASH_*
in - input buffer
inlen - the length of the buffer
output:
out - the hash
*/
bool Hash(int hash, const char * in, size_t inlen, std::string & out);
bool Hash(int hash, const char * in, std::string & out);
bool Hash(int hash, const std::string & in, std::string & out);
/*
calculating a hash from a given input
the input string is first changed to UTF8 and then hash is calculated
input:
hash - the kind of the hash - WINIX_CRYPT_HASH_*
in - input buffer
inlen - the length of the buffer
output:
out - the hash
*/
bool Hash(int hash, const wchar_t * in, size_t inlen, std::wstring & out);
bool Hash(int hash, const wchar_t * in, std::wstring & out);
bool Hash(int hash, const std::wstring & in, std::wstring & out);
/*
encrypt/decrypt by using RSA algorithm
input:
encrypt - true means encrypting, false means decrypting
keypath - path to a RSA private key (this is a private and public key in one file)
in - input buffer
inlen - the size of the buffer
output:
out - encrypted or decrypted buffer
*/
bool RSA(bool encrypt, const char * keypath, const char * in, size_t inlen, std::string & out);
bool RSA(bool encrypt, const char * keypath, const std::string & in, std::string & out);
bool RSA(bool encrypt, const std::string & keypath, const std::string & in, std::string & out);
bool RSA(bool encrypt, const wchar_t * keypath, const char * in, size_t inlen, std::string & out);
bool RSA(bool encrypt, const wchar_t * keypath, const std::string & in, std::string & out);
bool RSA(bool encrypt, const std::wstring & keypath, const std::string & in, std::string & out);
/*
this method creates a hash from the given plain text password
input.
salt - salt for the hash
up.pass_type - what kind of hash do you want - look at WINIX_CRYPT_HASH_* macros (in crypt.h)
up.pass - plain text password
if salt is empty then the hash will not be salted
output:
up.pass_type - (can be changed to 0 when there is a problem with generating a hash)
up.pass - hash from the password (or plain text if up.pass_type was zero)
up.pass_hash_salted (true if the hash is salted - when salt was not empty)
if there is a problem with generating a hash the method stores a plain text password
and changes up.pass_type to zero (plain text passwords are not salted)
*/
bool PassHash(const std::wstring & salt, UserPass & up);
/*
this method encrypts the given password
input:
path_to_rsa_private_key - a path to rsa private key (this are a private and public keys both in one file)
up.pass - given password (can be a plain text or a hash)
if path_to_rsa_private_key is empty then the password will not be encrypted
output:
up.pass_encrypted
if there is a problem (or the path to the key is empty) then up.pass_encrypted will be empty
and the method returns false
*/
bool PassCrypt(const std::wstring & path_to_rsa_private_key, UserPass & up);
/*
this method creates a hash from the given plain text password and then encrypts it
input:
salt - salt for the hash
path_to_rsa_private_key - a path to rsa private key (this are a private and public keys both in one file)
up.pass_type - what kind of hash do you want - look at WINIX_CRYPT_HASH_* macros (in crypt.h)
up.pass - plain text password
if salt is empty then the hash will not be salted
if path_to_rsa_private_key is empty then the password will not be encrypted
output:
up.pass_type - (can be changed to 0 when there is a problem with generating a hash)
up.pass - hash from the password (or plain text if up.pass_type was zero)
up.pass_hash_salted (true if the hash is salted - when salt was not empty)
up.pass_encrypted - encrypted password (if not empty)
*/
void PassHashCrypt(const std::wstring & salt, const std::wstring & path_to_rsa_private_key, UserPass & up);
/*
this method creates a hash from the given plain text password and then encrypts it
input:
up.pass - plain text password
output:
up.pass_type - what kind of hash there is in up.pass
up.pass - hash from the password (or plain text if up.pass_type is zero)
up.pass_hash_salted - true if the hash is salted (plain text are never salted)
up.pass_encrypted - encrypted password (if not empty)
*/
void PassHashCrypt(UserPass & up);
/*
putting some characters into the string and then calling clear()
*/
template<class StringType>
void ClearString(StringType & str);
private:
void TrimLastWhite(std::string & str);
Config * config;
Run run;
std::string command, bufina, bufouta, keypatha;
//std::wstring pass_salted;//, pass_hashed;
//std::string pass_hasheda, pass_encrypteda;
std::wstring pass_salted, pass_org;
std::string passa;
std::wstring empty;
};
template<class StringType>
void Crypt::ClearString(StringType & str)
{
for(size_t i=0 ; i<str.size() ; ++i)
str[i] = 0x0c;
str.clear();
}
#endif

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -13,6 +13,7 @@
void Dirs::SetDb(Db * pdb)
{
db = pdb;
@@ -195,6 +196,30 @@ DirContainer::Iterator i;
}
size_t Dirs::DirLevel(long id)
{
DirContainer::Iterator i;
size_t level = 0;
while( true )
{
i = dir_tab.FindId(id);
if( i == dir_tab.End() ||
i->parent_id == id ) // means a loop (something wrong in the db)
{
// we don't change path if there is no such a directory
return level;
}
if( i->parent_id == -1 )
return level;
id = i->parent_id;
level += 1;
}
}
bool Dirs::ChangeParent(long dir_id, long new_parent_id)
{

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -77,6 +77,12 @@ public:
// !! jak juz wczesniejsze nazwy beda zmienione to tutaj damy AddDir() /AddDir() juz istnieje przeciez?/
Error AddDirectory(Item & item, bool add_to_dir_tab = false, Item ** pdir = 0, int notify_code = 0);
// returns how many levels of directories there are
// "/" -> 0 (root dir)
// "/abc" -> 1
// "/abc/def" -> 2
size_t DirLevel(long id);
private:
Cur * cur;

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -10,8 +10,8 @@
#ifndef headerfile_winix_core_error
#define headerfile_winix_core_error
#include <iostream>
#include "log.h"
#define WINIX_ERR_OK 0
//#define WINIX_ERR_INCORRECT_PATH 1

View File

@@ -14,6 +14,7 @@
#include "requesttypes.h"
#include "misc.h"
#include "utf8.h"
#include "log.h"
class GetParser : public HttpSimpleParser

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -11,18 +11,31 @@
#define headerfile_winix_core_htmlfilter
#include <string>
#include <map>
#include <vector>
#include <algorithm>
// max length of a name of a html tag (with terminating null)
#define WINIX_HTMLFILTER_ITEM_MAXLEN 30
#define WINIX_HTMLFILTER_ITEM_NAME_MAXLEN 30
// max length of a html lang attribute (e.g. "en", "pl")
#define WINIX_HTMLFILTER_ITEM_LANG_MAXLEN 10
#define WINIX_HTMLFILTER_ATTR_NAME_MAXLEN 40
#define WINIX_HTMLFILTER_ATTR_VALUE_MAXLEN 500
// depth of the html tree
#define WINIX_HTMLFILTER_STACK_MAXLEN 100
#define WINIX_HTMLFILTER_STACK_MAXLEN 100
// length of a buffer used for printing
// it should be at least: WINIX_HTMLFILTER_ITEM_MAXLEN+3
// it should be at least: WINIX_HTMLFILTER_ITEM_NAME_MAXLEN+3
#define WINIX_HTMLFILTER_BUFFER_MAXLEN 2048
@@ -48,23 +61,12 @@ class HTMLFilter
{
public:
// for checking orphans
enum Lang
{
lang_pl,
lang_cz,
lang_sk,
lang_none
};
enum OrphanMode
{
orphan_nbsp, // putting "&nbsp;" string
orphan_160space // putting 160 ascii code
};
HTMLFilter();
HTMLFilter(const HTMLFilter & f);
HTMLFilter & operator=(const HTMLFilter & f);
@@ -76,12 +78,18 @@ public:
void Filter(const std::wstring & in, std::wstring & out);
// insert a white space into long lines
// only between html tags
// insert a white space into long words
// (only between html tags)
// skipped in such tags: script, pre, textarea
// break_after - after how many characters insert a space (0 - off)
void BreakLines(size_t break_after_);
void BreakWord(size_t break_after_);
// insert a new line character into long lines
// (only between html tags)
// skipped in such tags: script, pre, textarea
// wrap_line - after how many characters wrap a line (0 - off)
// lines are wrapped only in 'body' tag (useful for text in 'title' tag which is in 'head' section)
void WrapLine(size_t wrap_line_);
// trimming white characters (with new lines)
// at the beginning, at the end and in the middle of a string
@@ -98,10 +106,16 @@ public:
void InsertTabs(size_t tabsize);
// orphans are checked only in 'body' tag
void AssignOrphans(const wchar_t * lang_code, const std::vector<std::wstring> & otab);
void AssignOrphans(const std::wstring & lang_code, const std::vector<std::wstring> & otab);
void ClearOrphans();
// check 'orphans' for the specicic language
// if an orphan is detected then the non-break space ("&nbsp;" or ascii 160 code) will be put
// default disable (lang_none)
void CheckOrphans(Lang lang_, OrphanMode mode = orphan_nbsp);
void OrphansMode(OrphanMode mode = orphan_nbsp);
// skipping some unsafe tags
@@ -112,107 +126,171 @@ public:
protected:
// orphans for one language
struct Orphans
{
std::vector<std::wstring> tab;
size_t max_len;
};
// orphans for all languages
// map<language_code, Orphans>
typedef std::map<std::wstring, Orphans> OrphansTab;
OrphansTab orphans_tab;
struct Item
{
wchar_t name[WINIX_HTMLFILTER_ITEM_MAXLEN];
size_t name_len;
std::wstring name; // max size: WINIX_HTMLFILTER_ITEM_NAME_MAXLEN
enum Type
{
opening,
closing,
simple,
special,
opening, /* sample: <h1> */
closing, /* sample: </h1> */
simple, /* sample: <br/> */
special, /* sample: <!doctype> */
none
} type;
// is there a new line after this tag
bool new_line;
// current orphans table
// (will be propagated)
Orphans * porphans;
// this item or one from its parents is a 'body' html tag
// (will be propagated)
bool has_body_tag;
void Clear();
Item();
};
// only this method have direct access to the output string
// you can easily change the output from a std::wstring to something else
/*
virtual methods
*/
virtual void Init();
virtual void Uninit();
virtual bool IsOpeningTagMark();
virtual bool IsOpeningCommentaryTagMark();
virtual bool IsClosingTagMark();
virtual bool IsClosingXmlSimpleTagMark();
virtual bool IsValidCharForName(int c);
virtual bool IsValidCharForAttrName(int c);
virtual void CheckExceptions();
virtual bool SkipCommentaryTagIfExists();
virtual void Put(wchar_t c);
virtual void Put(const wchar_t * str);
virtual void Put(const wchar_t * str, const wchar_t * end);
virtual void Put(const std::wstring & str);
virtual void PutOpeningTagMark();
virtual void PutClosingTagMark();
virtual bool PutOpeningTag();
virtual void PutClosingTag(const wchar_t * tag);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
/*
others
*/
Item & GetItem(size_t i);
Item & LastItem();
wchar_t ToLower(wchar_t c);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2, size_t len);
void ToLower(std::wstring & str);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2);
bool IsNameEqual(const wchar_t * name1, const std::wstring & name2);
bool IsNameEqual(const std::wstring & name1, const wchar_t * name2);
bool IsNameEqual(const std::wstring & name1, const std::wstring & name2);
bool IsNameEqual(const wchar_t * name1, const wchar_t * name2, size_t len);
bool IsNameEqual(const wchar_t * name1, const std::wstring & name2, size_t len);
bool IsNameEqual(const std::wstring & name1, const wchar_t * name2, size_t len);
bool IsNameEqual(const std::wstring & name1, const std::wstring & name2, size_t len);
bool IsLastTag(const wchar_t * name);
bool IsTagSafe(const wchar_t * tag);
bool IsTagSafe(const std::wstring & tag);
int CheckOrphan(const wchar_t * str, const wchar_t * end, const wchar_t * orphan);
bool CheckOrphanTable(const wchar_t * str, const wchar_t * end, const wchar_t ** table, size_t o1, size_t o2);
bool CheckOrphanLangPl(const wchar_t * str, const wchar_t * end);
bool CheckOrphanLangCz(const wchar_t * str, const wchar_t * end);
int CheckOrphan(const wchar_t * str, const wchar_t * end, const std::wstring & orphan_str);
bool CheckOrphan(const wchar_t * str, const wchar_t * end, const std::vector<std::wstring> & orphans);
bool CheckOrphan(const wchar_t * str, const wchar_t * end);
bool IsWhite(int c);
void SkipWhite();
void SkipWhiteLines();
void SkipWhiteWithFirstNewLine();
void SkipWhiteLines(const wchar_t * & str, const wchar_t * end);
bool IsClosingTagForLastItem();
virtual bool IsOpeningTagMark();
virtual bool IsOpeningCommentaryTagMark();
size_t OpeningCommentaryTagMarkSize();
virtual bool IsClosingTagMark();
virtual bool IsClosingXmlSimpleTagMark();
bool SkipCommentaryTagIfExists();
const wchar_t * SkipItemCheckXmlSimple();
void SkipAndCheckClosingTag();
void PopStack();
bool PushStack();
virtual bool IsValidCharForName(int c);
void CheckNewLine();
virtual void CheckExceptions();
void CheckStackPrintRest();
void AddForgottenTags();
void CheckClosingTags();
virtual void ReadNormalTextSkipWhite(const wchar_t * & start, const wchar_t * & last_non_white);
void ReadNormalText();
bool PrintRest();
void PrintItem(const wchar_t * start, const wchar_t * end);
bool PrintOpeningItem();
void ReadItemName();
void ReadItemAttrName();
void ReadItemAttrValue(bool has_quote);
bool ReadItemAttr();
bool CheckItemAttr();
void PrinItemAttr();
void ReadItemClosing();
void ReadItemSpecial();
void ReadItemOpening();
bool ReadItem();
virtual void Init();
virtual void Deinit();
void ReadLoop();
void Read();
size_t PutNormalTextTrimFillBuffer(const wchar_t * & str, const wchar_t * & end);
size_t PutNormalTextFillBuffer(const wchar_t * & str, const wchar_t * & end);
virtual void PutNormalText(const wchar_t * str, const wchar_t * end);
virtual void PutNormalTextTrim(const wchar_t * str, const wchar_t * end);
void CheckChar(wchar_t c);
void CheckLineWrap();
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();
virtual void PutOpeningTagMark();
virtual void PutClosingTagMark();
virtual void PutTagName(const wchar_t * name);
virtual void PutOpeningTag(const wchar_t * start, const wchar_t * end);
virtual void PutClosingTag(const wchar_t * tag);
size_t PutTabsToBuffer(size_t index, size_t len);
size_t PutNonBreakSpaceToBuffer(size_t index);
void PutTabs(size_t len);
void PutNonBreakingSpace();
void PutNewLine();
void CalcOrphansMaxLen(Orphans & orphans);
const wchar_t * pchar;
Item empty;
Item * pstack; // stack pointer
size_t stack_len; // length of the stack
Item * pstack; // stack pointer
size_t stack_len; // length of the stack
wchar_t * buffer; // buffer used when printing
std::wstring * out_string;
bool last_new_line;
size_t break_after; // insert a space into long lines after break_after characters
bool trim_white; // trimming white characters
size_t break_after; // insert a space into long words after 'break_after' characters
size_t wrap_line; // insert a new line character into long lines
bool trim_white; // trimming white characters
size_t tab_size;
Lang lang; // current language for checking orphans
OrphanMode orphan_mode;
bool safe_mode; // skipping some unsafe tags
std::wstring attr_name;
std::wstring attr_value;
std::wstring attr_value_lower;
bool attr_has_value;
std::wstring lang_code_lower;
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;
};

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -54,7 +54,7 @@ void Log::OpenFile()
}
void Log::PutDate(Manipulators m)
void Log::PutDate(LogManipulators m)
{
// logs are related to localtime
@@ -199,6 +199,16 @@ Log & Log::operator<<(char s)
}
Log & Log::operator<<(wchar_t s)
{
if( current_level <= log_level )
{
buffer << s;
}
return *this;
}
Log & Log::operator<<(size_t s)
{
@@ -224,7 +234,7 @@ Log & Log::operator<<(double s)
Log & Log::operator<<(Manipulators m)
Log & Log::operator<<(LogManipulators m)
{
switch(m)
{
@@ -263,12 +273,16 @@ Log & Log::operator<<(Manipulators m)
case log4:
current_level = 4;
break;
default:
break;
}
return *this;
}
void Log::SystemErr(int err)
{
(*this) << "errno: " << err;

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -16,17 +16,9 @@
#include <iostream>
#include <string>
#include "textstream.h"
#include "logmanipulators.h"
// log1 - the first level
// log2
// log3
// log4 - the last level (debug level)
// logend - the end of a line
// logendrequest - end of a current request
// logsave - current log buffer is saved and cleared
enum Manipulators { log1, log2, log3, log4, logend, logendrequest, logsave };
class Log
{
@@ -37,7 +29,7 @@ public:
void Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests);
void PutDate(Manipulators m);
void PutDate(LogManipulators m);
Log & operator<<(const void * s);
Log & operator<<(const char * s);
Log & operator<<(const std::string * s);
@@ -48,10 +40,14 @@ public:
Log & operator<<(int s);
Log & operator<<(long s);
Log & operator<<(char s);
Log & operator<<(wchar_t s);
Log & operator<<(size_t s);
Log & operator<<(double s);
Log & operator<<(Manipulators m);
Log & operator<<(LogManipulators m);
template<class StringType>
void LogString(const StringType & value, size_t max_size);
void SystemErr(int err);
void SaveLog();
void SaveLogAndClear();
@@ -100,9 +96,30 @@ private:
template<class StringType>
void Log::LogString(const StringType & value, size_t max_size)
{
size_t min_size = value.size() < max_size ? value.size() : max_size;
if( current_level <= log_level )
{
for(size_t i=0 ; i<min_size ; ++i)
{
if( value[i] < 32 )
buffer << '.';
else
buffer << value[i];
}
}
}
extern Log log;
extern Log nlog;
// for convenience, we have to use only #include "log.h" in the winix
#include "slog.h"
#endif

48
core/logmanipulators.h Executable file
View File

@@ -0,0 +1,48 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_logmanipulators
#define headerfile_winix_core_logmanipulators
/*
log1 - the first level
log2
log3
log4 - the last level (debug level)
logend - the end of a line
logendrequest - end of a current request
logsave - current log buffer is saved and cleared
manipulators used by the session logger (SLog)
loginfo - normal info to a user
logerror - we are reporting an error
logwarning - we are reporting a warning
make sure that loginfo, logerror and logwarning have values less than 32 (space)
their are used as control codes in a string
*/
enum LogManipulators
{
log1,
log2,
log3,
log4,
logend,
logendrequest,
logsave,
loginfo,
logerror,
logwarning
};
#endif

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -952,3 +952,67 @@ static std::string ain;
UrlEncode(ain, out, clear_out);
}
void QEncodeAddChar(wchar_t c, std::string & out)
{
if( (c>='A' && c<='Z') ||
(c>='a' && c<='z') ||
(c>='0' && c<='9') )
{
out += char(c);
}
else
{
char buf1[10];
char buf2[10];
size_t len1 = sizeof(buf1) / sizeof(char);
size_t len2 = sizeof(buf2) / sizeof(char);
size_t len = Ezc::IntToUTF8(int(c), buf1, len1);
for(size_t i=0 ; i<len ; ++i)
{
// make sure that it produces *capital* letters (ABC...)
Toa((unsigned long)(unsigned char)buf1[i], buf2, len2, 16);
out += '=';
out += buf2;
}
}
}
/*
this encoding is used in mails headers
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
http://www.faqs.org/rfcs/rfc1522.html
we have:
charset = UTF-8
encoding = Q
current limitation:
we do not support checking the maximum length:
"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)
{
if( clear )
out.clear();
out += "=?UTF-8?Q?";
for(size_t i=0 ; i<in.size() ; ++i)
QEncodeAddChar(in[i], out);
out += "?=";
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -389,6 +389,160 @@ void NoFirstHttp(StringType & s)
/*
this method returns true if there are two dots meaning 'go up' somewhere in the path
for example such paths return true:
".."
"test/../path"
"test/where/../"
"test/where/.."
"../abc"
*/
template<class StringType>
bool PathHasUpDir(const StringType * str)
{
size_t i = 0;
while( str[i] )
{
if( str[i]=='.' && str[i+1]=='.' )
{
i += 2;
if( str[i]=='/' || str[i]==0 )
return true;
}
// skipping until to next slash
while( str[i] && str[i]!='/' )
i += 1;
// skipping the slash (or slashes)
while( str[i]=='/' )
i += 1;
}
return false;
}
template<class StringType>
bool PathHasUpDir(const StringType & str)
{
return PathHasUpDir(str.c_str());
}
/*
this method calculates how many directories there are in the given path
input:
str - path
last_is_dir - true if the last part of the path should be treated as a directory too
samples:
HowManyDirs("", false) -> 0
HowManyDirs("", true) -> 0
HowManyDirs("abc", false) -> 0
HowManyDirs("abc", true) -> 1
HowManyDirs("/abc/", true) -> 1
HowManyDirs("////", false) -> 0
HowManyDirs("////", true) -> 0
HowManyDirs("////abc", false) -> 0
HowManyDirs("////abc", true) -> 1
HowManyDirs("/var/static", false) -> 1
HowManyDirs("/var/static", true) -> 2
HowManyDirs("/var/static/", false) -> 2
HowManyDirs("/var/static/", true) -> 2
*/
template<class StringType>
size_t HowManyDirs(const StringType * str, bool is_last_dir = false)
{
size_t res = 0;
size_t i = 0;
// first slash (root dir) is not calculated
while( str[i]=='/' )
i += 1;
while( str[i] )
{
if( str[i]=='/' )
{
res += 1;
while( str[i]=='/' )
i += 1;
}
else
{
i += 1;
}
}
if( is_last_dir && i>0 && str[i-1]!='/' )
res += 1;
return res;
}
template<class StringType>
size_t HowManyDirs(const StringType & str, bool is_last_dir = false)
{
return HowManyDirs(str.c_str(), is_last_dir);
}
/*
this method skips some first directories from given path
samples:
SkipDirs("/var/test", 1) -> "test"
SkipDirs("/var/test/somewhere", 1) -> "test/somewhere"
SkipDirs("/var/test/somewhere", 2) -> "somewhere"
SkipDirs("/var/test/somewhere", 10) -> ""
*/
template<class StringType>
const StringType * SkipDirs(const StringType * str, size_t how_many_skip)
{
size_t i = 0;
size_t skipped = 0;
if( how_many_skip == 0 )
return str;
// first slash (root dir) is not calculated
while( str[i]=='/' )
i += 1;
while( str[i] )
{
if( str[i]=='/' )
{
skipped += 1;
while( str[i]=='/' )
i += 1;
if( skipped == how_many_skip )
return str+i;
}
else
{
i += 1;
}
}
return str + i;
}
bool ValidateEmail(const std::wstring & email);
@@ -426,5 +580,8 @@ tm Time(time_t par);
void UrlEncode(const std::string & in, std::string & out, bool clear_out = true);
void UrlEncode(const std::wstring & in, std::string & out, bool clear_out = true);
void QEncode(const std::wstring & in, std::string & out, bool clear = true);
#endif

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -15,9 +15,24 @@
MountParser::MountParser()
{
dirs = 0;
mount_type_tab = 0;
mount_fs_tab = 0;
mount_par_tab = 0;
skip_static = false;
mount_type_tab = 0;
mount_fs_tab = 0;
mount_par_tab = 0;
static_mount_id = -1;
}
void MountParser::SkipStaticDirs(bool skip)
{
skip_static = skip;
}
void MountParser::SetStaticMountId(int id)
{
static_mount_id = id;
}
@@ -233,15 +248,14 @@ return -1;
}
void MountParser::ReadMountType()
bool MountParser::ReadMountType()
{
ReadWord(temp);
if( temp.empty() )
{
// an empty line (some white characters only)
err = WINIX_ERR_EMPTY;
return;
return false;
}
mount.type = FindIndex(mount_type_tab, temp);
@@ -252,34 +266,38 @@ void MountParser::ReadMountType()
}
else
{
err = WINIX_ERR_MOUNT_UNKNOWN;
log << log1 << "MP: unknown mount type: " << temp << logend;
slog << logerror << T("unknown_mount_type") << ": " << temp << logend;
}
return mount.type != -1;
}
void MountParser::ReadMountPoint()
bool MountParser::ReadMountPoint()
{
ReadWord(temp);
ReadWord(last_dir);
pdir = dirs->GetDir(temp);
pdir = dirs->GetDir(last_dir);
if( pdir )
{
mount.dir_id = pdir->id;
log << log3 << "MP: mount point (directory): " << temp << logend;
log << log3 << "MP: mount point (directory): " << last_dir << logend;
}
else
{
err = WINIX_ERR_NO_MOUNTPOINT;
log << log1 << "MP: there is no such a mount point (directory): " << temp << logend;
log << log1 << "MP: there is no such a mount point (directory): " << last_dir << logend;
slog << logerror << T("no_such_dir") << ": " << last_dir << logend;
}
return pdir != 0;
}
void MountParser::ReadFs()
bool MountParser::ReadFs()
{
ReadWord(temp);
mount.fs = FindIndex(mount_fs_tab, temp);
@@ -290,9 +308,11 @@ void MountParser::ReadFs()
}
else
{
err = WINIX_ERR_UNKNOWN_FILESYSTEM;
log << log1 << "MP: unknown filesystem: " << temp << logend;
slog << logerror << T("unknown_filesystem") << ": " << temp << " (" << last_dir << ")" << logend;
}
return mount.fs != -1;
}
@@ -332,7 +352,8 @@ void MountParser::ReadMountParams()
}
else
{
log << log1 << "MP: unknown mount param: " << temp << " (skipped)" << logend;
log << log1 << "MP: unknown mount param: " << temp << logend;
slog << logwarning << T("unknown_mount_param") << ": " << temp << " (" << T("skipped") << ")" << logend;
}
}
}
@@ -341,30 +362,25 @@ void MountParser::ReadMountParams()
void MountParser::ReadRow(std::map<long, Mount> & output)
{
ReadMountType();
if( err == WINIX_ERR_EMPTY )
if( ReadMountType() && ReadMountPoint() && ReadFs() )
{
err = WINIX_ERR_OK;
SkipLine();
return;
}
if( err == WINIX_ERR_OK )
ReadMountPoint();
if( err == WINIX_ERR_OK )
ReadFs();
if( err == WINIX_ERR_OK )
ReadMountParams();
if( err == WINIX_ERR_OK )
{
std::pair<std::map<long, Mount>::iterator, bool> res = output.insert( std::make_pair(mount.dir_id, mount) );
if( !res.second )
log << log1 << "MP: this mount point exists (skipped)" << logend;
if( skip_static && mount.type==static_mount_id )
{
log << log1 << "MP: static mount points are skipped (dont_use_static_dirs in config is true)" << logend;
slog << logwarning << T("skipped_static_mount") << ": " << last_dir << logend;
}
else
{
std::pair<std::map<long, Mount>::iterator, bool> res = output.insert( std::make_pair(mount.dir_id, mount) );
if( !res.second )
{
log << log1 << "MP: this mount point exists (skipped)" << logend;
slog << logwarning << T("mount_exists") << ": " << last_dir << " (" << T("skipped") << ")" << logend;
}
}
}
SkipLine();
@@ -373,31 +389,21 @@ void MountParser::ReadRow(std::map<long, Mount> & output)
Error MountParser::Parse(const std::wstring & input, std::map<long, Mount> & output)
void MountParser::Parse(const std::wstring & input, std::map<long, Mount> & output)
{
if( !dirs || !mount_type_tab || !mount_fs_tab || !mount_par_tab )
{
log << log1 << "pdir: " << pdir << logend;
log << log1 << "type: " << mount_type_tab << logend;
log << log1 << "fs: " << mount_fs_tab << logend;
log << log1 << "par: " << mount_par_tab << logend;
log << log1 << "MP: input tables not set" << logend;
return WINIX_NOTHING_TO_DO; // !! may a better code?
return;
}
pinput = input.c_str();
err = WINIX_ERR_OK;
mount.param.resize(mount_par_tab->size());
mount.ClearParams();
output.clear();
while( *pinput && err == WINIX_ERR_OK )
while( *pinput )
ReadRow(output);
return err;
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -18,7 +18,6 @@
#include "mount.h"
#include "item.h"
#include "error.h"
#include "dirs.h"
@@ -28,7 +27,11 @@ class MountParser
public:
MountParser();
Error Parse(const std::wstring & input, std::map<long, Mount> & output);
void SkipStaticDirs(bool skip);
void SetStaticMountId(int id);
void Parse(const std::wstring & input, std::map<long, Mount> & output);
void SetDirs(Dirs * pdirs);
void SetMountTypeTab(const std::vector<std::wstring> & tab);
void SetMountFsTab(const std::vector<std::wstring> & tab);
@@ -37,6 +40,8 @@ public:
private:
Dirs * dirs;
bool skip_static;
int static_mount_id;
const std::vector<std::wstring> * mount_type_tab;
const std::vector<std::wstring> * mount_fs_tab;
@@ -54,23 +59,20 @@ private:
void ReadParamName(std::wstring & res);
void ReadParam(std::wstring & res, Mount::ParamRow::ParamArg & args);
int FindIndex(const std::vector<std::wstring> * tab, const std::wstring & value);
void ReadMountType();
void ReadMountPoint();
void ReadFs();
bool ReadMountType();
bool ReadMountPoint();
bool ReadFs();
void LogMountParams();
void ReadMountParams();
void ReadRow(std::map<long, Mount> & output);
const wchar_t * pinput;
std::wstring temp;
std::wstring last_dir;
std::wstring temp_arg;
Mount::ParamRow::ParamArg param_args;
Mount mount;
Item * pdir;
Error err;
};

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009-2010, Tomasz Sowa
* Copyright (c) 2009-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -19,12 +19,21 @@
Mounts::Mounts()
{
pmount = &empty_mount;
skip_static = false;
}
void Mounts::SkipStaticDirs(bool skip)
{
skip_static = skip;
}
void Mounts::CreateMountType()
{
mount_type_cms = AddMountType(L"cms");
mount_type_cms = AddMountType(L"cms");
mount_type_static = AddMountType(L"static");
}
@@ -38,6 +47,8 @@ void Mounts::CreateMountFs()
void Mounts::CreateMountPar()
{
mount_par_page = AddMountPar(L"page");
mount_par_thumb_size = AddMountPar(L"thumb_size");
mount_par_thumb_mode = AddMountPar(L"thumb_mode");
//mount_par_thread = AddMountPar(L"thread");
//mount_par_createthread_on = AddMountPar(L"createthread_on");
mount_par_only_root_remove = AddMountPar(L"only_root_remove");
@@ -45,6 +56,8 @@ void Mounts::CreateMountPar()
mount_par_mkdir_on = AddMountPar(L"mkdir_on");
mount_par_app = AddMountPar(L"app");
mount_par_html_template = AddMountPar(L"html_template");
mount_par_static = AddMountPar(L"static");
mount_par_css = AddMountPar(L"css");
}
@@ -163,25 +176,19 @@ const std::wstring & Mounts::GetMountPar(int id)
// reading from 'mounts'
Error Mounts::ReadMounts(const std::wstring & mounts)
void Mounts::ReadMounts(const std::wstring & mounts)
{
mount_parser.SkipStaticDirs(skip_static);
mount_parser.SetStaticMountId(mount_type_static);
mount_parser.SetDirs(dirs);
mount_parser.SetMountTypeTab(mount_type_tab);
mount_parser.SetMountFsTab(mount_fs_tab);
mount_parser.SetMountParTab(mount_par_tab);
Error err = mount_parser.Parse(mounts, mount_tab);
if( err != WINIX_ERR_OK )
{
log << log1 << "M: some problems with mountpoints (mountpoints table will be empty)" << logend;
mount_tab.clear();
}
mount_parser.Parse(mounts, mount_tab);
CalcCurMount();
plugin.Call(WINIX_FSTAB_CHANGED);
return err;
}
@@ -214,7 +221,9 @@ Error Mounts::ReadMounts()
return err;
}
return ReadMounts(fstab.content);
ReadMounts(fstab.content);
return WINIX_ERR_OK;
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009-2010, Tomasz Sowa
* Copyright (c) 2009-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -28,6 +28,9 @@ class Mounts
{
public:
void SkipStaticDirs(bool skip);
/*
mount point's types
*/
@@ -37,6 +40,7 @@ public:
// id of a specific mount type (the id is always valid)
int MountTypeCms() { return mount_type_cms; }
int MountTypeStatic() { return mount_type_static; }
// return -1 if there is no such a mount type
// or index otherwhise
@@ -63,6 +67,8 @@ public:
const std::wstring & GetMountPar(int id);
int MountParPage() { return mount_par_page; }
int MountParThumbSize() { return mount_par_thumb_size; }
int MountParThumbMode() { return mount_par_thumb_mode; }
//int MountParThread() { return mount_par_thread; }
//int MountParCreatethreadOn() { return mount_par_createthread_on; }
int MountParOnlyRootRemove() { return mount_par_only_root_remove; }
@@ -70,7 +76,8 @@ public:
int MountParMkdirOn() { return mount_par_mkdir_on; }
int MountParApp() { return mount_par_app; }
int MountParHtmlTemplate() { return mount_par_html_template; }
int MountParStatic() { return mount_par_static; }
int MountParCss() { return mount_par_css; }
void SetDirs(Dirs * pdirs);
void SetDb(Db * pdb);
@@ -82,7 +89,7 @@ public:
Mounts();
void CreateMounts();
Error ReadMounts(const std::wstring & mounts);
void ReadMounts(const std::wstring & mounts);
Error ReadMounts();
void CalcCurMount();
@@ -101,6 +108,8 @@ private:
Dirs * dirs;
Cur * cur;
bool skip_static;
Mount empty_mount;
const std::wstring empty_str;
@@ -109,6 +118,7 @@ private:
std::vector<std::wstring> mount_type_tab;
int mount_type_cms;
int mount_type_static;
// simplefs
// hashfs
@@ -120,6 +130,8 @@ private:
std::vector<std::wstring> mount_par_tab;
int mount_par_page;
int mount_par_thumb_size;
int mount_par_thumb_mode;
//int mount_par_thread;
//int mount_par_createthread_on;
int mount_par_only_root_remove;
@@ -127,6 +139,8 @@ private:
int mount_par_mkdir_on;
int mount_par_app;
int mount_par_html_template;
int mount_par_static;
int mount_par_css;
MountTab mount_tab;

View File

@@ -148,6 +148,7 @@ void Plugin::LoadPlugin(const std::string & filename)
}
void * Plugin::LoadInitFun(const char * filename, Fun1 & fun_init)
{
void * p = dlopen(filename, RTLD_NOW | RTLD_LOCAL);

View File

@@ -8,8 +8,8 @@
*/
#ifndef headerfilecmsluplugin
#define headerfilecmsluplugin
#ifndef headerfile_winix_core_plugin
#define headerfile_winix_core_plugin
#include <vector>
#include <string>

View File

@@ -2,14 +2,14 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslupluginmsg
#define headerfilecmslupluginmsg
#ifndef headerfile_winix_core_pluginmsg
#define headerfile_winix_core_pluginmsg
// here you can add your own EZC functions ([function])
// PluginInfo.p1 is a pointer to Ezc::Functions object
@@ -94,6 +94,9 @@
#define WINIX_NOTIFY_ADD_TEMPLATE 3013
// the request is ended
// you can clear some of your object here
#define WINIX_END_REQUEST 3014
// values from 4000 - 4099 reserved for 'thread' plugin
// see plugins/thread/pluginmsg.h

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -211,8 +211,6 @@ return true;
void PostMultiParser::LogFirst(const std::string & to_log, size_t len)
{
size_t i;
if( len > to_log.size() )
len = to_log.size();
@@ -224,15 +222,7 @@ size_t i;
log << "empty";
log << "): \"";
for(i=0 ; i<len ; ++i)
{
if( to_log[i] < 32 )
log << '.';
else
log << to_log[i];
}
log.LogString(to_log, len);
log << "\"" << logend;
}
@@ -312,7 +302,7 @@ time_t t1, t2;
content.clear();
content.reserve(WINIX_POSTMULTI_OUTPUT_BUFFER);
content_len = 0;
t1 = time(0);
t1 = time(0);
ReadContentToFileLoop();
@@ -357,7 +347,9 @@ void PostMultiParser::ReadContent()
ReadContentLoop();
log << log2 << "PMP: content size: " << content_len << " bytes" << logend;
LogFirst(content, 200);
if( !IsSubStringNoCase("pass", name.c_str()) )
LogFirst(content, config->log_post_value_size);
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -15,6 +15,9 @@
#include "httpsimpleparser.h"
#include "requesttypes.h"
#include "misc.h"
#include "utf8.h"
#include "log.h"
#include "config.h"
@@ -25,6 +28,8 @@ class PostParser : public HttpSimpleParser
PostTab * post_tab;
std::wstring temp_name, temp_value;
bool input_as_utf8;
size_t log_value_size;
protected:
@@ -35,6 +40,29 @@ protected:
}
void CreateLog(bool param_added)
{
log << log2 << "Method POST, name: \"" << temp_name << "\"";
if( log_value_size > 0 && !IsSubStringNoCase(L"pass", temp_name.c_str()) )
{
log << ", value: ";
if( temp_value.size() > log_value_size )
log << "(first " << log_value_size << " characters) ";
log << "\"";
log.LogString(temp_value, log_value_size);
log << "\" (size: " << temp_value.size() << ")";
}
if( param_added == false )
log << log2 << " (skipped)";
log << log2 << logend;
}
virtual void Parameter(std::string & name, std::string & value)
{
if( input_as_utf8 )
@@ -49,13 +77,7 @@ protected:
}
std::pair<PostTab::iterator, bool> res = post_tab->insert( std::make_pair(temp_name, temp_value) );
log << log2 << "Method POST, name: \"" << temp_name << "\", value: \"" << temp_value << "\"";
if( res.second == false )
log << log2 << " (skipped)";
log << log2 << logend;
CreateLog(res.second);
}
@@ -63,7 +85,8 @@ public:
PostParser()
{
input_as_utf8 = false;
input_as_utf8 = false;
log_value_size = 0;
}
@@ -72,6 +95,10 @@ public:
input_as_utf8 = utf;
}
void LogValueSize(size_t s)
{
log_value_size = s;
}
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
{

View File

@@ -261,6 +261,11 @@ return str_empty;
}
const std::wstring & Request::ParamValue(const std::wstring & param_name)
{
return ParamValue(param_name.c_str());
}

View File

@@ -115,7 +115,8 @@ struct Request
bool IsParam(const wchar_t * param_name);
bool IsParam(const std::wstring & param_name);
const std::wstring & ParamValue(const wchar_t * param_name); // returns empty string if there is no such a parameter
const std::wstring & ParamValue(const wchar_t * param_name); // returns empty string if there is no such a parameter
const std::wstring & ParamValue(const std::wstring & param_name); // returns empty string if there is no such a parameter
void SetCookie(const char * name, const char * value, tm * expires = 0);
void SetCookie(const char * name, long value, tm * expires = 0);

385
core/run.cpp Executable file
View File

@@ -0,0 +1,385 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/wait.h>
#include "run.h"
#include "log.h"
Run::Run()
{
Clear();
}
void Run::Clear()
{
parlen = 0;
envlen = 0;
command = 0;
last_status = 0;
last_return = 255;
}
void Run::SetName()
{
size_t i=0;
while( command[i] )
i += 1;
while( i>0 && command[i-1]!='/' )
i -= 1;
par[0] = const_cast<char*>(command + i);
}
void Run::Par(const char * p)
{
if( parlen < WINIX_RUN_MAX_PARAMETERS )
{
// they will be copied (fork)
// the first (zero) parameter is a program name
par[1 + parlen++] = const_cast<char*>(p);
}
}
void Run::Env(const char * e)
{
if( envlen < WINIX_RUN_MAX_PARAMETERS )
{
// they will be copied (fork)
env[envlen++] = const_cast<char*>(e);
}
}
void Run::Cmd(const char * c)
{
command = c;
SetName();
}
void Run::Par(const std::string & p)
{
Par(p.c_str());
}
void Run::Env(const std::string & e)
{
Env(e.c_str());
}
void Run::Cmd(const std::string & c)
{
Cmd(c.c_str());
}
int Run::LastStatus()
{
return last_status;
}
int Run::LastReturn()
{
return last_return;
}
void Run::Write(const char * in, size_t inlen)
{
ssize_t len;
while( inlen > 0 )
{
len = write(desout[1], in, inlen);
if( len < 0 || len > (ssize_t)inlen )
{
// something wrong
last_status = 3;
break;
}
in += len;
inlen -= len;
}
}
void Run::Read(std::string & out)
{
char buf[1024];
size_t buflen = sizeof(buf) / sizeof(char);
ssize_t len;
do
{
len = read(desin[0], buf, buflen);
if( len < 0 || len > (ssize_t)buflen )
{
// something wrong
last_status = 4;
break;
}
if( len > 0 )
out.append(buf, len);
}
while( len > 0 );
}
void Run::ChildThrow()
{
if( dup2(desout[0], 0) == -1 )
return;
if( dup2(desin[1], 1) == -1 )
return;
close(2);
close(desin[0]);
close(desout[1]);
par[parlen+1] = 0;
env[envlen] = 0;
execve(command, par, env);
// if we are here then there is something wrong (execve failed)
}
void Run::Child()
{
try
{
ChildThrow();
}
catch(...)
{
}
exit(255);
}
bool Run::CreatePipes()
{
int res = pipe(desin);
if( res != 0 )
{
log << log1 << "Run: pipe failed (desin)" << logend;
last_status = 1;
return false;
}
res = pipe(desout);
if( res != 0 )
{
log << log1 << "Run: pipe failed (desout)" << logend;
last_status = 1;
close(desin[0]);
close(desin[1]);
return false;
}
return true;
}
bool Run::Fork()
{
childpid = fork();
if( childpid == -1 )
{
log << log1 << "Run: fork failed" << logend;
last_status = 2;
close(desin[0]);
close(desin[1]);
close(desout[0]);
close(desout[1]);
return false;
}
if( childpid == 0 )
Child();
return true;
}
void Run::WriteRead(const char * in, size_t inlen, std::string * out)
{
if( in && inlen>0 )
Write(in, inlen);
close(desout[1]);
if( out )
Read(*out);
close(desin[0]);
}
void Run::CheckStatus()
{
int status;
pid_t res = waitpid(childpid, &status, 0);
if( res == -1 )
{
log << log1 << "Run: waitpid failed" << logend;
last_status = 6;
}
else
{
if( WIFEXITED(status) )
{
last_return = WEXITSTATUS(status);
}
else
{
if( WIFCONTINUED(status) )
log << log1 << "Run: child error: WIFCONTINUED" << logend;
else
if( WIFSIGNALED(status) )
log << log1 << "Run: child error: WIFSIGNALED" << logend;
else
if( WIFSTOPPED(status) )
log << log1 << "Run: child error: WIFSTOPPED" << logend;
last_status = 5;
}
}
}
int Run::Go(const char * in, size_t inlen, std::string * out)
{
last_status = 0;
last_return = 255;
if( out )
out->clear();
if( !command )
{
last_status = 7;
return last_return;
}
if( !CreatePipes() )
return last_return;
if( !Fork() )
return last_return;
// here goes the parent
close(desin[1]);
close(desout[0]);
WriteRead(in, inlen, out);
CheckStatus();
if( last_status != 0 )
log << log1 << "Run: a problem with the command, last_status: " << last_status << logend;
return last_return;
}
int Run::Go(const char * in, size_t inlen, std::string & out)
{
return Go(in, inlen, &out);
}
int Run::Go(const char * in, std::string & out)
{
size_t len = strlen(in);
return Go(in, len, &out);
}
int Run::Go(const char * in, size_t inlen)
{
return Go(in, inlen, 0);
}
int Run::Go(const char * in)
{
size_t len = strlen(in);
return Go(in, len, 0);
}
int Run::Go()
{
return Go(0, 0, 0);
}
int Run::Go(const std::string in, std::string & out)
{
return Go(in.c_str(), in.size(), &out);
}
int Run::Go(const std::string in)
{
return Go(in.c_str(), in.size(), 0);
}
int Run::Go(std::string & out)
{
return Go(0, 0, &out);
}

163
core/run.h Executable file
View File

@@ -0,0 +1,163 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_run
#define headerfile_winix_core_run
#include <string>
#include <cstdio>
/*
how many parameters and environment variables can be passed to a program
*/
#define WINIX_RUN_MAX_PARAMETERS 30
/*
objects of this class allows you to run an external program
when you call Go() then:
1. winix creates pipes for communicating with a child process
2. then winix fork()
3. the child process execve() the specified command
4. winix (parent) sends 'in' to the standard input of the child process
5. after sending it closes the descriptor so the child sees it as end-of-file
6. now winix reads what the child sends to standard output (until EOF)
7. winix waitpid() for the child
8. Go() returns
*/
class Run
{
public:
Run();
/*
clearing parameters, environment variables and the command
(and clearing LastStatus and LastResult)
so you can call another different program now
*/
void Clear();
/*
setting parameters
each parameter should be passed in different call to Par() method
sample:
if you want to call from your shell:
$ myprog -a -b -f "test file"
you should call Par() in this way:
Par("-a");
Par("-b");
Par("test file"); // apostrophes are not needed here
arguments passed to Par() should not be changed afterwards, this method does not copy them anywhere
it uses only the pointer
*/
void Par(const char * p);
void Par(const std::string & p);
/*
setting environment variables
one variable per one Env() call
arguments passed to Env() should not be changed afterwards, this method does not copy them anywhere
it uses only the pointer
*/
void Env(const char * e);
void Env(const std::string & e);
/*
full path to command you want to execute
arguments passed to Cmd() should not be changed afterwards, this method does not copy them anywhere
it uses only the pointer
*/
void Cmd(const char * c);
void Cmd(const std::string & c);
/*
executing the command
you should call Par(), Env() and Cmd() beforehand
*/
int Go(const char * in, size_t inlen, std::string & out);
int Go(const char * in, std::string & out);
int Go(const char * in, size_t inlen);
int Go(const char * in);
int Go(const std::string in, std::string & out);
int Go(const std::string in);
int Go(std::string & out);
int Go();
/*
last status:
0 - ok (program was successfully called)
1 - pipe failed
2 - fork failed
3 - write failed
4 - read failed
5 - child process has done something wrong (caught a signal etc.)
6 - waitpid failed
7 - the command is not set (call Cmd method first)
*/
int LastStatus();
/*
the code which the command returned (usually "0" means no errors found)
if LastStatus is different from zero then LastReturn always returns 255
(so you don't have to check LastStatus() first)
*/
int LastReturn();
private:
int Go(const char * in, size_t inlen, std::string * out);
void SetName();
void CheckStatus();
void WriteRead(const char * in, size_t inlen, std::string * out);
bool CreatePipes();
bool Fork();
void ChildThrow();
void Child();
void Write(const char * in, size_t inlen);
void Read(std::string & out);
int last_status;
// the return code returned by a program (if last_status==0)
// if last_status!=0 then last_return is 255
int last_return;
int desin[2];
int desout[2];
char * par[WINIX_RUN_MAX_PARAMETERS + 2];
char * env[WINIX_RUN_MAX_PARAMETERS + 1];
const char * command;
size_t parlen;
size_t envlen;
pid_t childpid;
};
#endif

View File

@@ -15,8 +15,13 @@
Session::Session()
{
SetTimeToNow();
Clear();
}
void Session::SetTimeToNow()
{
time = std::time(0);
tm_time = Time(time);
@@ -28,6 +33,7 @@ Session::Session()
}
// this doesn't clear times
void Session::Clear()
{
id = 0;

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -16,6 +16,7 @@
#include "user.h"
#include "plugindata.h"
#include "rebus.h"
#include "textstream.h"
// when deleting Sessions you should set request.session into the session object as well
@@ -62,9 +63,12 @@ struct Session
PluginData plugin_data;
// buffer for the session log
TextStream<std::wstring> log_buffer;
Session();
void SetTimeToNow();
void Clear();
};

View File

@@ -111,6 +111,7 @@ void SessionManager::CreateSession()
int attempts = 100;
bool added = false;
new_session.SetTimeToNow();
new_session.Clear();
if( config->session_max == 0 || session_tab.Size() < config->session_max )
@@ -137,7 +138,8 @@ bool added = false;
// there is a problem with generating a new session id
// we do not set a session cookie
session = &temporary_session;
session->Clear();
session->SetTimeToNow();
session->Clear(); // !! uwaga ten Clear wyczysci plugins data
session->new_session = false; // temporary session was initialized at the beginning
log << log1 << "SM: cannot create a session id (temporary used: with id 0)" << logend;
}

216
core/slog.cpp Executable file
View File

@@ -0,0 +1,216 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "slog.h"
SLog::SLog()
{
cur = 0;
locale = 0;
}
void SLog::SetCur(Cur * pcur)
{
cur = pcur;
}
void SLog::SetLocale(Locale * plocale)
{
locale = plocale;
}
SLog & SLog::operator<<(const void * s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const char * s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const std::string * s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const std::string & s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const wchar_t * s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const std::wstring * s)
{
return PutLog(s);
}
SLog & SLog::operator<<(const std::wstring & s)
{
return PutLog(s);
}
SLog & SLog::operator<<(int s)
{
return PutLog(s);
}
SLog & SLog::operator<<(long s)
{
return PutLog(s);
}
SLog & SLog::operator<<(char s)
{
return PutLog(s);
}
SLog & SLog::operator<<(wchar_t s)
{
return PutLog(s);
}
SLog & SLog::operator<<(size_t s)
{
return PutLog(s);
}
SLog & SLog::operator<<(double s)
{
return PutLog(s);
}
SLog & SLog::operator<<(LogManipulators m)
{
if( cur && cur->session )
{
TextStream<std::wstring> & buf = cur->session->log_buffer;
switch(m)
{
case logend:
buf << '\n';
if( buf.Size() > WINIX_SLOG_MAX_LOG_SIZE )
{
buf.Clear();
(*this) << logwarning << T("slog_turn_over") << " " << WINIX_SLOG_MAX_LOG_SIZE << logend;
}
break;
case loginfo:
case logwarning:
case logerror:
buf << (wchar_t)(int)m;
break;
default:
break;
}
}
return *this;
}
SLog & SLog::TranslateText(const char * str)
{
AssignString(str, key_temp);
return TranslateText(key_temp.c_str());
}
SLog & SLog::TranslateText(const wchar_t * str)
{
if( cur && cur->session )
{
const std::wstring * trans = 0;
if( locale )
trans = &locale->Get(str);
if( !trans || trans->empty() )
cur->session->log_buffer << "Not translated: " << str;
else
cur->session->log_buffer << trans;
}
return *this;
}
SLog & SLog::operator<<(const TranslateTextHelper<const char*> & raw)
{
return TranslateText(raw.par);
}
SLog & SLog::operator<<(const TranslateTextHelper<const wchar_t*> & raw)
{
return TranslateText(raw.par);
}
SLog & SLog::operator<<(TranslateTextHelper<const std::string*> raw)
{
return TranslateText(raw.par->c_str());
}
SLog & SLog::operator<<(TranslateTextHelper<const std::wstring*> raw)
{
return TranslateText(raw.par->c_str());
}
SLog & SLog::operator<<(TranslateTextHelper<std::string> raw)
{
return TranslateText(raw.par.c_str());
}
SLog & SLog::operator<<(TranslateTextHelper<std::wstring> raw)
{
return TranslateText(raw.par.c_str());
}

122
core/slog.h Executable file
View File

@@ -0,0 +1,122 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_slog
#define headerfile_winix_core_slog
#include "cur.h"
#include "logmanipulators.h"
#include "templates/locale.h"
#define WINIX_SLOG_MAX_LOG_SIZE 10240
/*
session logger
sample:
#include "log.h" (or slog.h)
slog << logerror << "message" << "something" << logend;
slog << logwarning << T("message_to_translate") << x << logend;
if the latter example "message_to_translate" will be taken from locales
currently following manipulators are taken into account:
loginfo - the message in a normal info
logwarning - this is a warning
logerror - this is an error
logend - end of a line -- we have one kind of a message (info, warning, error) per line
loginfo, logwarning, logerror should be specified at the beginning of a line
(other manipulators are skipped)
*/
class SLog
{
public:
SLog();
void SetCur(Cur * pcur);
void SetLocale(Locale * plocale);
template<class RawType>
struct TranslateTextHelper
{
const RawType & par;
TranslateTextHelper(const TranslateTextHelper<RawType> & p) : par(p.par) {}
TranslateTextHelper(const RawType & p) : par(p) {}
};
SLog & operator<<(const void * s);
SLog & operator<<(const char * s);
SLog & operator<<(const std::string * s);
SLog & operator<<(const std::string & s);
SLog & operator<<(const wchar_t * s);
SLog & operator<<(const std::wstring * s);
SLog & operator<<(const std::wstring & s);
SLog & operator<<(int s);
SLog & operator<<(long s);
SLog & operator<<(char s);
SLog & operator<<(wchar_t s);
SLog & operator<<(size_t s);
SLog & operator<<(double s);
SLog & operator<<(LogManipulators m);
SLog & TranslateText(const char * str);
SLog & TranslateText(const wchar_t * str);
template<size_t str_size>
SLog & operator<<(const TranslateTextHelper<char [str_size]> & raw) { return TranslateText(raw.par); }
template<size_t str_size>
SLog & operator<<(const TranslateTextHelper<wchar_t [str_size]> & raw){ return TranslateText(raw.par); }
SLog & operator<<(const TranslateTextHelper<const char*> & raw);
SLog & operator<<(const TranslateTextHelper<const wchar_t*> & raw);
SLog & operator<<(TranslateTextHelper<const std::string*> raw);
SLog & operator<<(TranslateTextHelper<const std::wstring*> raw);
SLog & operator<<(TranslateTextHelper<std::string> raw);
SLog & operator<<(TranslateTextHelper<std::wstring> raw);
private:
template<class LogParam>
SLog & PutLog(LogParam par);
Cur * cur;
Locale * locale;
std::wstring key_temp;
};
template<class RawType>
SLog::TranslateTextHelper<RawType> T(const RawType & par)
{
return SLog::TranslateTextHelper<RawType>(par);
}
template<class LogParam>
SLog & SLog::PutLog(LogParam par)
{
if( cur && cur->session )
cur->session->log_buffer << par;
return *this;
}
extern SLog slog;
#endif

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -48,6 +48,7 @@ void System::Init()
dirs.SetNotify(&notify);
dirs.ReadDirs();
mounts.SkipStaticDirs(config->dont_use_static_dirs);
mounts.SetDirs(&dirs);
mounts.SetDb(db);
mounts.SetCur(cur);
@@ -73,6 +74,8 @@ void System::Init()
thumb.SetDb(db);
thumb.SetConfig(config);
thumb.SetSystem(this);
crypt.SetConfig(config);
}

View File

@@ -16,6 +16,7 @@
#include "db/db.h"
#include "request.h"
#include "config.h"
#include "crypt.h"
#include "users.h"
#include "groups.h"
#include "rebus.h"
@@ -59,6 +60,8 @@ public:
// the time when the winix starts
time_t system_start;
// cryptography and hashes
Crypt crypt;
void SetCur(Cur * pcur);
void SetConfig(Config * pconfig);

View File

@@ -37,6 +37,8 @@ public:
const StringType & Str() const;
const CharType * CStr() const;
CharType operator[](size_t index);
TextStream & operator<<(const char * str);
TextStream & operator<<(const std::string * str);
TextStream & operator<<(const std::string & str);
@@ -106,6 +108,13 @@ const typename TextStream<StringType>::CharType * TextStream<StringType>::CStr()
}
template<class StringType>
typename TextStream<StringType>::CharType TextStream<StringType>::operator[](size_t index)
{
return buffer[index];
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const char * str)

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -14,6 +14,20 @@
#include <vector>
/*
a temporary struct used for hashing and encrypting a user's password
*/
struct UserPass
{
int pass_type; // the kind of hash (WINIX_CRYPT_HASH_* see crypt.h)
std::wstring pass; // password hashed or plain text if pass_type==0
std::string pass_encrypted; // password encrypted
bool pass_hash_salted; // true when the hash was salted (plain text passwords are never salted)
};
struct User
{
long id;

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -13,7 +13,7 @@
#define WINIX_VER_MAJOR 0
#define WINIX_VER_MINOR 4
#define WINIX_VER_REVISION 6
#define WINIX_VER_REVISION 8
#endif

View File

@@ -4,13 +4,10 @@ include Makefile.o.dep
all: $(o)
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep

View File

@@ -1,21 +1,23 @@
# DO NOT DELETE
db.o: db.h dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
db.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
db.o: ../core/textstream.h dbitemquery.h ../core/item.h dbitemcolumns.h
db.o: ../core/user.h ../core/group.h ../core/dircontainer.h
db.o: ../core/ugcontainer.h ../core/log.h ../core/misc.h
db.o: ../core/misc.h ../core/item.h ../core/error.h dbitemquery.h
db.o: ../core/item.h dbitemcolumns.h ../core/user.h ../core/group.h
db.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/log.h
db.o: ../core/textstream.h ../core/logmanipulators.h ../core/slog.h
db.o: ../core/cur.h ../core/request.h ../core/requesttypes.h ../core/error.h
db.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
db.o: ../templates/htmltextstream.h ../core/session.h ../core/user.h
db.o: ../core/plugindata.h ../core/rebus.h ../templates/locale.h
db.o: ../core/confparser.h ../core/log.h ../core/misc.h
dbbase.o: dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
dbbase.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
dbbase.o: ../core/textstream.h ../core/log.h ../core/misc.h
dbbase.o: ../../ezc/src/utf8.h
dbbase.o: ../core/misc.h ../../ezc/src/utf8.h
dbconn.o: dbconn.h dbtextstream.h ../core/textstream.h ../core/misc.h
dbconn.o: ../core/item.h ../core/log.h ../core/error.h ../core/log.h
dbconn.o: ../core/textstream.h
dbconn.o: ../core/item.h ../core/log.h ../core/error.h
dbitemcolumns.o: dbitemcolumns.h ../core/item.h dbbase.h dbconn.h
dbitemcolumns.o: dbtextstream.h ../core/textstream.h ../core/misc.h
dbitemcolumns.o: ../core/item.h ../core/error.h ../core/log.h
dbitemcolumns.o: ../core/textstream.h
dbitemcolumns.o: ../core/item.h ../core/error.h
dbitemquery.o: dbitemquery.h ../core/item.h
dbtextstream.o: dbtextstream.h ../core/textstream.h ../core/misc.h
dbtextstream.o: ../core/item.h ../../ezc/src/utf8.h

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -15,18 +15,17 @@
bool Db::CheckUser(const std::wstring & login, const std::wstring & password, long & user_id)
bool Db::GetUserPass(const std::wstring & login, long & user_id, UserPass & up)
{
PGresult * r = 0;
bool user_ok = false;
user_id = -1;
try
{
query.Clear();
query << R("select id from core.user where login=")
query << R("select id, password, pass_encrypted, pass_type, pass_hash_salted from core.user where login=")
<< login
<< R(" and password=")
<< password
<< R(";");
r = AssertQuery(query);
@@ -39,13 +38,22 @@ bool Db::CheckUser(const std::wstring & login, const std::wstring & password, lo
if( rows > 1 )
{
log << log1 << "Db: there is more than one user: " << login << " (with the same password)" << logend;
log << log1 << "Db: there is more than one user: " << login << logend;
throw Error(WINIX_ERR_DB_MORE_THAN_ONE_LOGIN);
}
int cuser_id = AssertColumn(r, "id");
user_id = AssertValueLong(r, 0, cuser_id);
int cuser_id = AssertColumn(r, "id");
int cpass_type = AssertColumn(r, "pass_type");
int csalted = AssertColumn(r, "pass_hash_salted");
int cpassword = AssertColumn(r, "password");
int cpass_encrypted = AssertColumn(r, "pass_encrypted");
user_ok = true;
user_id = AssertValueLong(r, 0, cuser_id);
up.pass_type = AssertValueInt(r, 0, cpass_type);
up.pass_hash_salted = AssertValueBool(r, 0, csalted);
AssertValueWide(r, 0, cpassword, up.pass);
AssertValueBin(r, 0, cpass_encrypted, up.pass_encrypted);
}
catch(const Error &)
{
@@ -60,7 +68,8 @@ return user_ok;
Error Db::AddUser(User & user, const std::wstring & password)
Error Db::AddUser(User & user, const std::wstring & password, const std::string & password_encrypted,
int pass_type, bool pass_hash_salted)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
@@ -68,12 +77,23 @@ Error Db::AddUser(User & user, const std::wstring & password)
try
{
query.Clear();
query << R("insert into core.user (login, password, super_user, email, notify) values (")
<< user.name
<< password
<< static_cast<int>(user.super_user)
query << R("insert into core.user (login, password, pass_encrypted, super_user, email,"
"notify, pass_type, pass_hash_salted) values (")
<< user.name;
// for safety
if( password_encrypted.empty() )
query << password;
else
query << "";
query.EPutBin(password_encrypted);
query << user.super_user
<< user.email
<< user.notify
<< pass_type
<< pass_hash_salted
<< R(");");
r = AssertQuery(query);
@@ -1399,7 +1419,7 @@ void Db::GetUsers(UGContainer<User> & user_tab)
if( u.id != last_id )
{
u.name = AssertValueWide(r, i, cname);
u.super_user = static_cast<bool>(AssertValueInt(r, i, csuper_user));
u.super_user = AssertValueBool(r, i, csuper_user);
u.email = AssertValueWide(r, i, cemail);
u.notify = AssertValueInt(r, i, cnotify);

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -41,8 +41,8 @@ public:
bool CheckUser(const std::wstring & login, const std::wstring & password, long & user_id);
Error AddUser(User & user, const std::wstring & password);
bool GetUserPass(const std::wstring & login, long & user_id, UserPass & up);
Error AddUser(User & user, const std::wstring & password, const std::string & password_encrypted, int pass_type, bool pass_hash_salted);
Error AddItem(Item & item);
Error EditItemById(Item & item, bool with_url = true);

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -151,6 +151,21 @@ return temp_wide_value;
}
void DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result)
{
result.clear();
const char * res = AssertValue(r, row, col);
int len = PQgetlength(r, row, col);
if( len <= 0 )
return;
UnescapeBin(res, len, result);
}
void DbBase::AssertValueWide(PGresult * r, int row, int col, std::wstring & result)
{
const char * res = AssertValue(r, row, col);
@@ -172,7 +187,8 @@ int DbBase::AssertValueInt(PGresult * r, int row, int col)
bool DbBase::AssertValueBool(PGresult * r, int row, int col)
{
return strtol( AssertValue(r, row, col), 0, 10 ) != 0;
const char * s = AssertValue(r, row, col);
return (s[0]=='t' || s[0]=='y' || s[0]=='1');
}
@@ -429,3 +445,85 @@ Error DbBase::EndTrans(Error err)
return err;
}
/*
converting from a bytea
*/
int DbBase::CharToInt(char c)
{
return (int)(unsigned char)(c-'0');
}
bool DbBase::IsCorrectOctalDigit(char c)
{
return c>='0' && c<='7';
}
// moves 'i' at least once
// return -1 if there is en error
int DbBase::UnescapeBin(const char * str, size_t & i, size_t len)
{
if( str[i] != '\\' )
return str[i++];
i += 1;
if( i >= len )
return -1;
if( str[i] == '\\' )
return str[i++];
if( i+2 >= len )
{
i = len;
return -1;
}
if( !IsCorrectOctalDigit(str[i]) ||
!IsCorrectOctalDigit(str[i+1]) ||
!IsCorrectOctalDigit(str[i+2]) )
{
i += 3;
return -1;
}
int c = 8*8*CharToInt(str[i]) + 8*CharToInt(str[i+1]) + CharToInt(str[i+2]);
i += 3;
if( c<0 || c>255 )
return -1;
return c;
}
void DbBase::UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out)
{
int c;
size_t i = 0;
if( clear_out )
out.clear();
while( i < len )
{
c = UnescapeBin(str, i, len);
if( c != -1 )
out += c;
}
}
/*
end of converting from bytea
*/

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -39,6 +39,7 @@ public:
static const char * AssertValue(PGresult * r, int row, int col);
static const std::wstring & AssertValueWide(PGresult * r, int row, int col); // warning: this method uses a static buffer
static void AssertValueWide(PGresult * r, int row, int col, std::wstring & result);
static void AssertValueBin(PGresult * r, int row, int col, std::string & result);
static long AssertValueLong(PGresult * r, int row, int col);
static int AssertValueInt(PGresult * r, int row, int col);
static bool AssertValueBool(PGresult * r, int row, int col);
@@ -65,6 +66,9 @@ public:
Error CommitTrans();
Error EndTrans(Error err);
static void UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out = true);
protected:
// a helper method for escaping strings
@@ -77,10 +81,14 @@ protected:
DbConn * db_conn;
bool log_queries;
private:
DbTextStream bquery;
static int CharToInt(char c);
static bool IsCorrectOctalDigit(char c);
static int UnescapeBin(const char * str, size_t & i, size_t len);
DbTextStream bquery;
};

View File

@@ -14,6 +14,12 @@
DbItemQuery::DbItemQuery()
{
Clear();
}
void DbItemQuery::Clear()
{
sort_asc = true;
@@ -30,6 +36,7 @@ DbItemQuery::DbItemQuery()
limit = 0; // limit and offset not used by default
offset = 0;
}

View File

@@ -52,7 +52,8 @@ struct DbItemQuery
long offset;
DbItemQuery();
void Clear();
void SetAllSel(bool sel);
void SetAllWhere(bool where_);
void SetAll(bool sel, bool where_);

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -111,6 +111,17 @@ DbTextStream & DbTextStream::operator<<(RawText<std::wstring> raw)
}
DbTextStream & DbTextStream::operator<<(RawText<bool> raw)
{
if( raw.par )
PutText("true");
else
PutText("false");
return *this;
}
DbTextStream & DbTextStream::operator<<(RawText<char> raw)
{
TextStream<std::string>::operator<<(raw.par);
@@ -201,14 +212,13 @@ return *this;
*/
// !! sprawdzic jej dzialanie dla kolumn bytea (binarnych)
DbTextStream & DbTextStream::EBinPutChar(char c_)
{
char buf[10];
char buf[20];
int c = (unsigned char)c_;
if( (c>=0 && c<=31) || c>=127 || c==39 || c==92 )
if( (c>=0 && c<=31) || c>=127 || c=='\'' || c=='\\' )
{
sprintf(buf, "\\\\%03o", c);
buffer += buf;
@@ -391,6 +401,16 @@ DbTextStream & DbTextStream::operator<<(const std::wstring & str)
DbTextStream & DbTextStream::operator<<(bool v)
{
if( v )
EPutText("true");
else
EPutText("false");
return *this;
}
DbTextStream & DbTextStream::operator<<(char v)
{

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -104,6 +104,7 @@ public:
DbTextStream & operator<<(RawText<const std::wstring*> raw);
DbTextStream & operator<<(RawText<std::string> raw);
DbTextStream & operator<<(RawText<std::wstring> raw);
DbTextStream & operator<<(RawText<bool> raw);
DbTextStream & operator<<(RawText<char> raw);
DbTextStream & operator<<(RawText<wchar_t> raw);
DbTextStream & operator<<(RawText<int> raw);
@@ -140,6 +141,7 @@ public:
DbTextStream & operator<<(const wchar_t * str);
DbTextStream & operator<<(const std::wstring * str);
DbTextStream & operator<<(const std::wstring & str);
DbTextStream & operator<<(bool);
DbTextStream & operator<<(char);
DbTextStream & operator<<(wchar_t);
DbTextStream & operator<<(int);

View File

@@ -4,13 +4,10 @@ include Makefile.o.dep
all: $(o)
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o functionbase.o functionparser.o functions.o last.o ln.o login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o reload.o rm.o run.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o functionbase.o functionparser.o functions.o last.o ln.o login.o logout.o ls.o mkdir.o mv.o nicedit.o node.o priv.o privchanger.o reload.o rm.o run.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -35,7 +35,7 @@ bool AddUser::CheckAddUserVars(const std::wstring & login, const std::wstring &
return false;
}
if( pass.size() < config->password_min_size )
if( pass.size() < config->pass_min_size )
{
cur->request->status = WINIX_ERR_PASSWORD_TOO_SHORT;
return false;
@@ -61,7 +61,7 @@ User user;
const std::wstring & login = cur->request->PostVar(L"login");
const std::wstring & pass = cur->request->PostVar(L"password");
const std::wstring & conf_pass = cur->request->PostVar(L"confirmpassword");
const std::wstring & conf_pass = cur->request->PostVar(L"passwordconfirm");
if( !CheckAddUserVars(login, pass, conf_pass) )
return;
@@ -69,7 +69,10 @@ User user;
user.name = login;
user.email = cur->request->PostVar(L"email");
cur->request->status = db->AddUser(user, pass);
up.pass = pass;
system->crypt.PassHashCrypt(up);
cur->request->status = db->AddUser(user, up.pass, up.pass_encrypted, up.pass_type, up.pass_hash_salted);
if( cur->request->status == WINIX_ERR_OK )
{
@@ -91,6 +94,9 @@ User user;
}
void AddUser::MakeGet()
{
}
} // namespace

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -11,7 +11,7 @@
#define headerfile_winix_functions_adduser
#include "functionbase.h"
#include "core/user.h"
namespace Fun
@@ -24,11 +24,12 @@ public:
AddUser();
void MakePost();
void MakeGet();
private:
bool CheckAddUserVars(const std::wstring & login, const std::wstring & pass, const std::wstring & conf_pass);
UserPass up;
};

View File

@@ -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;
}

View File

@@ -178,11 +178,11 @@ void FunctionParser::Parse(Cur * pcur, Db * pdb, Functions * pfunctions, System
system = psystem;
functions = pfunctions;
cur->request->status = WINIX_ERR_OK;
get_index = 0;
get_tab_len = cur->request->get_tab.size();
cur->request->status = WINIX_ERR_OK;
get_index = 0;
get_tab_len = cur->request->get_tab.size();
cur->request->function = 0;
cur->request->is_item = false;
cur->request->is_item = false;
ParseDirectories();

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -122,10 +122,10 @@ Error Functions::CheckSpecialFile(const Item & item)
{
log << log3 << "Functions: reloading mount points" << logend;
Error status = system->mounts.ReadMounts(item.content);
system->mounts.ReadMounts(item.content);
templates->ReadNewIndexTemplates();
return status;
return WINIX_ERR_OK;
}
return WINIX_NOTHING_TO_DO;
@@ -187,6 +187,7 @@ void Functions::CreateFunctions()
Add(fun_ls);
Add(fun_mkdir);
Add(fun_mv);
Add(fun_nicedit);
Add(fun_node);
Add(fun_priv);
Add(fun_reload);
@@ -470,11 +471,12 @@ void Functions::ReadItemUrlSubject(Item & item, Item::Type item_type)
void Functions::ReadItemFilterHtml(Item & item)
{
html_filter.BreakLines(0);
html_filter.BreakWord(0);
html_filter.WrapLine(0);
html_filter.TrimWhite(false);
html_filter.InsertTabs(0);
html_filter.CheckOrphans(HTMLFilter::lang_none);
html_filter.SafeMode(true);
html_filter.ClearOrphans();
html_filter.Filter(cur->request->PostVar(L"itemcontent"), item.content);
}

View File

@@ -29,6 +29,7 @@
#include "ls.h"
#include "mkdir.h"
#include "mv.h"
#include "nicedit.h"
#include "node.h"
#include "priv.h"
#include "reload.h"
@@ -71,6 +72,7 @@ public:
Fun::Ls fun_ls;
Fun::Mkdir fun_mkdir;
Fun::Mv fun_mv;
Fun::Nicedit fun_nicedit;
Fun::Node fun_node;
Fun::Priv fun_priv;
Fun::Reload fun_reload;

View File

@@ -2,12 +2,14 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "login.h"
#include "utf8.h"
namespace Fun
@@ -19,6 +21,79 @@ Login::Login()
}
void Login::ClearTmpStruct()
{
system->crypt.ClearString(pass_decrypted);
system->crypt.ClearString(pass_hashed);
system->crypt.ClearString(up.pass);
system->crypt.ClearString(up.pass_encrypted);
system->crypt.ClearString(up2.pass);
system->crypt.ClearString(up2.pass_encrypted);
}
bool Login::CheckPasswords(const std::wstring & password)
{
if( !up.pass_encrypted.empty() )
{
if( system->crypt.RSA(false, config->pass_rsa_private_key, up.pass_encrypted, pass_decrypted) )
{
Ezc::UTF8ToWide(pass_decrypted, up.pass);
}
else
{
log << log1 << "Login: I cannot decrypt a stored password, login failure" << logend;
return false;
}
}
pass_hashed = password;
up2.pass_type = up.pass_type;
up2.pass = password;
if( up.pass_hash_salted )
salt = config->pass_hash_salt;
else
salt.clear();
if( !system->crypt.PassHash(salt, up2) )
{
log << log1 << "Login: I cannot hash a password, login failure" << logend;
return false;
}
return up.pass == up2.pass;
}
/*
this method is checking whether there is a person with that login and password
in the database
return true if it has found one and sets it user_id
*/
bool Login::CheckUserPass(const std::wstring & login, const std::wstring & password, long & user_id)
{
bool result;
if( db->GetUserPass(login, user_id, up) )
{
result = CheckPasswords(password);
}
else
{
log << log1 << "Login: there is no a user: " << login << " in the database (or an error)" << logend;
result = false;
}
ClearTmpStruct();
return result;
}
void Login::MakePost()
{
@@ -33,10 +108,14 @@ void Login::MakePost()
const std::wstring & remem = cur->request->PostVar(L"rememberme");
long user_id;
if( db->CheckUser(login, pass, user_id) )
if( CheckUserPass(login, pass, user_id) )
{
system->users.LoginUser(user_id, !remem.empty());
// !! moze zglosic komunikat o nie poprawnym logowaniu
}
else
{
// !! moze zglosic komunikat o nie poprawnym logowaniu
}
system->RedirectToLastItem();
}

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -11,6 +11,7 @@
#define headerfile_winix_functions_login
#include "functionbase.h"
#include "core/user.h"
@@ -24,10 +25,18 @@ public:
Login();
void MakePost();
bool CheckUserPass(const std::wstring & login, const std::wstring & password, long & user_id);
private:
void LoginUser(long user_id, bool remember_me);
void ClearTmpStruct();
bool CheckPasswords(const std::wstring & password);
UserPass up, up2;
std::string pass_decrypted;
std::wstring pass_hashed;
std::wstring salt;
};

38
functions/nicedit.cpp Executable file
View File

@@ -0,0 +1,38 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "nicedit.h"
#include "functions.h"
namespace Fun
{
Nicedit::Nicedit()
{
fun.url = L"nicedit";
}
bool Nicedit::HasAccess()
{
return functions->fun_emacs.HasAccess();
}
void Nicedit::MakePost()
{
functions->fun_emacs.MakePost();
}
} // namespace

34
functions/nicedit.h Executable file
View File

@@ -0,0 +1,34 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_nicedit
#define headerfile_winix_functions_nicedit
#include "functionbase.h"
namespace Fun
{
class Nicedit : public FunctionBase
{
public:
Nicedit();
bool HasAccess();
void MakePost();
};
} // namespace
#endif

View File

@@ -89,6 +89,40 @@ bool Upload::UploadSaveStaticFile(const Item & item, const std::wstring & tmp_fi
}
void Upload::CreateThumb(Item & item)
{
Mount & m = *system->mounts.pmount;
size_t cx = config->thumb_cx;
size_t cy = config->thumb_cy;
int mode = config->thumb_mode;
int index;
// reading width and height from then mount point (if exists)
index = system->mounts.MountParThumbSize();
if( m.param[index].defined && m.param[index].arg.size() == 2 )
{
cx = Tol(m.param[index].arg[0]);
cy = Tol(m.param[index].arg[1]);
}
if( cx > 2000 )
cx = 2000;
if( cy > 2000 )
cy = 2000;
// reading thumb mode from then mount point (if exists)
index = system->mounts.MountParThumbMode();
if( m.param[index].defined && m.param[index].arg.size() == 1 )
mode = Toi(m.param[index].arg[0]);
system->thumb.CreateThumb(item, cx, cy, mode);
}
void Upload::UploadFile(Item & item, const std::wstring & tmp_filename)
{
// we should add the file beforehand to get the proper item.id
@@ -103,7 +137,7 @@ void Upload::UploadFile(Item & item, const std::wstring & tmp_filename)
cur->request->status = db->EditFileById(item, item.id);
if( item.file_type == WINIX_ITEM_FILETYPE_IMAGE && config->create_thumb )
system->thumb.CreateThumb(item, config->thumb_cx, config->thumb_cy, config->thumb_mode);
CreateThumb(item);
}
else
{

View File

@@ -37,6 +37,7 @@ private:
bool FunUploadCheckAbuse();
void UploadMulti();
void UploadSingle();
void CreateThumb(Item & item);
};

View File

@@ -15,7 +15,7 @@
<input class="edit" type="password" name="password" value="">
<p class="withnext">{adduser_confirm_password}:</p>
<input class="edit" type="password" name="confirmpassword" value="">
<input class="edit" type="password" name="passwordconfirm" value="">
<p class="withnext">{adduser_email}:</p>
<input class="edit" type="text" name="email" value="[adduser_last_email]">

View File

@@ -34,6 +34,8 @@
<script type="text/javascript">CKEDITOR.replace('itemcontent', \{filebrowserUploadUrl: '[doc_base_url][dir]upload/noredirect/ckeditor_upload/', filebrowserBrowseUrl: '[doc_base_url][dir]ls/ckeditor_browse/fullscreen/', customConfig : '[doc_base_url_common]/ckeditor_full.js' \});</script>
[else]
<script type="text/javascript">CKEDITOR.replace('itemcontent', \{filebrowserUploadUrl: '[doc_base_url][dir]upload/noredirect/ckeditor_upload/', filebrowserBrowseUrl: '[doc_base_url][dir]ls/ckeditor_browse/fullscreen/', customConfig : '[doc_base_url_common]/ckeditor_winix.js' \});</script>
<!--<script type="text/javascript" src="[doc_base_url_common]/ckeditor/skins/office2003/skin.js"></script>-->
[end]
[if-no user_logged]

View File

@@ -55,7 +55,7 @@
[end]
<input size="30" class="edit" type="file" name="ticketparam[ticket_tab_param_id]">
<input class="filesubmit" type="submit" name="fileuploadsubmit" value="Add">
<input class="filesubmit" type="submit" name="fileuploadsubmit" value="{add}">
[end]
@@ -65,7 +65,7 @@
[end]
<input size="30" class="edit" type="file" name="ticketparam[ticket_tab_param_id]">
<input class="filesubmit" type="submit" name="fileuploadsubmit" value="Add">
<input class="filesubmit" type="submit" name="fileuploadsubmit" value="{add}">
[end]

77
html/fun_gallery.html Executable file
View File

@@ -0,0 +1,77 @@
[if mount_page_arg_is "subject"][if mount_page_arg_is "info"]<h1 class="withinfo">[else]<h1>[end][dir_last_subject]</h1>[end]
[if mount_page_arg_is "info"][include "dir_last_info.html"][end]
[if-one gallery_has_not_mount_type gallery_mount_type_arg_is "lightbox"]
[if gallery_tab]
<ul class="galleryimages">
[for gallery_tab]
<li><a rel="lightbox\[gallery\]" href="[gallery_tab_link]"><img src="[gallery_tab_link]/-/thumb" alt="[gallery_tab_subject]"></a></li>
[end]
</ul>
[end]
[end]
[if gallery_mount_type_arg_is "galleria"]
[if gallery_tab]
<ul class="galleryimages" style="width: [gallery_width]; height: [gallery_height];">
[for gallery_tab]
<li><a href="[gallery_tab_link]"><img src="[gallery_tab_link]/-/thumb" alt="[gallery_tab_subject]"></a></li>
[end]
</ul>
[if gallery_mount_theme_arg_is "white"]
<script type="text/javascript">Galleria.loadTheme('[doc_base_url_common]/aino-galleria/themes/white/galleria.white.js');</script>
[else]
<script type="text/javascript">Galleria.loadTheme('[doc_base_url_common]/aino-galleria/themes/classic/galleria.classic.js');</script>
[end]
[if-no winix_function_param_is "image"]
<script type="text/javascript">$('.galleryimages').galleria();</script>
[else]
<script type="text/javascript">$('.galleryimages').galleria(\{show: [winix_function_param_value "image"]\});</script>
[end]
[end]
[end]
[if gallery_mount_type_arg_is "galleriathumb"]
[if-no winix_function_param_is "image"]
[if gallery_tab]
<ul class="galleryimages">
[for gallery_tab]
<li><a href="[doc_base_url][dir]-/image:[gallery_tab_index]"><img src="[gallery_tab_link]/-/thumb" alt="[gallery_tab_subject]"></a></li>
[end]
</ul>
[end]
[else]
[if gallery_tab]
<ul class="galleryimages" style="width: [gallery_width]; height: [gallery_height];">
[for gallery_tab]
<li><a href="[gallery_tab_link]"><img src="[gallery_tab_link]/-/thumb" alt="[gallery_tab_subject]"></a></li>
[end]
</ul>
[if gallery_mount_theme_arg_is "white"]
<script type="text/javascript">Galleria.loadTheme('[doc_base_url_common]/aino-galleria/themes/white/galleria.white.js');</script>
[else]
<script type="text/javascript">Galleria.loadTheme('[doc_base_url_common]/aino-galleria/themes/classic/galleria.classic.js');</script>
[end]
<script type="text/javascript">$('.galleryimages').galleria(\{show_info:false, show: [winix_function_param_value "image"]\});</script>
[end]
[end]
[end]
[include "item_options.html"]

56
html/fun_nicedit.html Executable file
View File

@@ -0,0 +1,56 @@
[if item_is]<h1>{edit}</h1>[else]<h1>{add}</h1>[end]
[include "error.html"]
<form id="additem" method="post" action="[doc_base_url][dir][if item_is][item_url]/[end]nicedit">
<fieldset>
<legend>{form_emacs_legend}</legend>
[if mount_type_is "cms"]
<p class="withnext">{title}:</p>
<input class="edit" type="text" name="subject" value="[item_subject]">
<p class="withnext">{suggested_url}:</p>
<input class="edit" type="text" name="url" value="[item_url]">
[end]
[if-any mount_type_is "thread" mount_thread_arg_is "subject"]
<p class="withnext">{title}:</p>
<input class="edit" type="text" name="subject" value="[item_subject]">
<p class="withnext">{suggested_url}:</p>
<input class="edit" type="text" name="url" value="[item_url]">
[end]
[if mount_type_is "cms"]<p class="withnext">{form_emacs_content_cms}</p>[end]
[if mount_type_is "thread"]<p class="withnext">{form_emacs_content_thread}</p>[end]
[if mount_type_is "ticket"]<p class="withnext">{form_emacs_content_ticket}</p>[end]
<textarea class="multitext" rows="[if mount_type_is "cms"]30[else]10[end]" cols="60" name="itemcontent" id="nicarea">[item_content]</textarea>
<input type="hidden" name="contenttype" value="2">
<script type="text/javascript">
new nicEditor(\{fullPanel:true, iconsPath:'[doc_base_url_common]/nicedit/nicEditorIcons.gif', uploadURI:'[doc_base_url][dir]upload/' \}).panelInstance('nicarea');
</script>
[if winix_function_param_is "full"]
[else]
[end]
[if-no user_logged]
<p class="withnext">{nick}:</p>
<input class="edit" type="text" name="guestname" value="[item_guest_name]">
<p class="withnext">{rebus_how_is_it} [rebus_question]?</p>
<input class="edit" type="text" name="rebus">
[end]
<input class="submit" type="submit" value="[if item_is]{change}[else]{add}[end]">
</fieldset>
</form>

View File

@@ -8,7 +8,6 @@
</ul>
[end]
[if-no thread_mount_arg_is "sort_desc"]
<div class="threadbox">
[if item_can_write]<a class="threadedit" href="[item_link]/emacs" rel="nofollow">\[{edit}\]</a>[end]

View File

@@ -8,12 +8,12 @@
<table>
[for ticket_tab]
<tr>
<th>[ticket_tab_param_name]:</th>
<th>[filter fil_firstup][ticket_tab_param_name]:[end]</th>
<td>
[if ticket_tab_is_images]
[for ticket_tab_files_tab]
<img src="[doc_base_url][ticket_tab_value]/-/thumb" alt="[ticket_tab_value]" height="150">
<a href="[doc_base_url][ticket_tab_value]" rel="lightbox\[a\]" class="picture"><img src="[doc_base_url][ticket_tab_value]/-/thumb" alt="[ticket_tab_value]" height="150"></a>
[end]
[end]

View File

@@ -5,13 +5,19 @@
[end]
[# in the future tinymce will be placed in doc_base_url_common]
[if winix_function_is "tinymce"]
<script type="text/javascript" src="[doc_base_url_static]/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="[doc_base_url_static]/tinymce.js"></script>
<!--<script type="text/javascript">document.domain = "www.slimaczek.pl";</script>-->
<script type="text/javascript" src="[doc_base_url]/var/staticcommon/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="[doc_base_url]/var/staticcommon/tinymce.js"></script>
[end]
[if winix_function_is "nicedit"]
<script type="text/javascript" src="[doc_base_url_common]/nicedit/nicEdit.js"></script>
[end]
[if winix_function_is "vim"]
[# this editor doesn't work on different domains by default, solution: http://forum.wymeditor.org/forum/viewtopic.php?f=2&t=731&p=2507#p2504 ]
[# you should add one file to winix: wymiframe.html ]
@@ -20,7 +26,7 @@
<script type="text/javascript" src="[doc_base_url_common]/wymeditor/jquery.wymeditor.min.js"></script>
<script type="text/javascript" src="[doc_base_url_common]/wymeditor/lang/en.js"></script>
<script type="text/javascript" src="[doc_base_url_common]/wymeditor/skins/default/skin.js"></script>
<link rel="stylesheet" type="text/css" href="[doc_base_url_common]/wymeditor/skins/default/skin.css" />
<link rel="stylesheet" type="text/css" href="[doc_base_url_common]/wymeditor/skins/default/skin.css">
<script type="text/javascript">jQuery(function() \{ jQuery("textarea").wymeditor(\{ basePath: "[doc_base_url_common]/wymeditor/", iframeBasePath: "[doc_base_url]/var/", updateSelector : "form", updateEvent: 'submit' \}); \});</script>
[end]
@@ -31,3 +37,45 @@
[end]
[if winix_function_is "ticket"]
[# !! dodac lightboxa tylko jesli tickety zawieraja obrazki ]
<link rel="stylesheet" href="[doc_base_url_common]/lightbox/lightbox.css" type="text/css" media="screen">
<script src="[doc_base_url_common]/lightbox/js/prototype.js" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/lightbox.js" type="text/javascript"></script>
[end]
[if winix_function_is "gallery-old"]
[if-one gallery_has_not_mount_type gallery_mount_type_arg_is "lightbox"]
<link rel="stylesheet" href="[doc_base_url_common]/lightbox/lightbox.css" type="text/css" media="screen">
<script src="[doc_base_url_common]/lightbox/js/prototype.js" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/lightbox.js" type="text/javascript"></script>
[end]
[if-one gallery_mount_type_arg_is "galleria" gallery_mount_type_arg_is "galleriathumb"]
<script type="text/javascript" src="[doc_base_url_common]/jquery-1.4.2.min.js"></script>
<script src="[doc_base_url_common]/aino-galleria/src/galleria.js" type="text/javascript"></script>
[end]
[end]
[if winix_function_is "gallery"]
[if-one gallery_has_not_mount_type gallery_mount_type_arg_is "lightbox"]
<link rel="stylesheet" href="[doc_base_url_common]/lightbox/lightbox.css" type="text/css" media="screen">
<script src="[doc_base_url_common]/lightbox/js/prototype.js" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="[doc_base_url_common]/lightbox/js/lightbox.js" type="text/javascript"></script>
[end]
[if-one gallery_mount_type_arg_is "galleria" gallery_mount_type_arg_is "galleriathumb"]
<script type="text/javascript" src="[doc_base_url_common]/jquery-1.4.4.min.js"></script>
<script src="[doc_base_url_common]/aino-galleria/galleria-1.2.2.min.js" type="text/javascript"></script>
[end]
[end]

View File

@@ -5,18 +5,24 @@
[if-any dir_can_write]
<h2>{add_page}</h2>
<ul class="itemmenu">
[if-one dir_can_write]<li><a href="[doc_base_url][dir]emacs">{admin_emacs_add}</a></li>[end]
[if-any dir_can_write user_can_use_html]<li><a href="[doc_base_url][dir]ckeditor">{admin_ckeditor_add}</a></li>[end]
[if-any dir_can_write user_can_use_html]<li><a href="[doc_base_url][dir]tinymce">{admin_tinymce_add}</a></li>[end]
<li><a href="[doc_base_url][dir]emacs">{admin_emacs_add}</a></li>
[if user_can_use_html]
<li><a href="[doc_base_url][dir]ckeditor">{admin_ckeditor_add}</a></li>
<li><a href="[doc_base_url][dir]nicedit">{admin_nicedit_add}</a></li>
<li><a href="[doc_base_url][dir]tinymce">{admin_tinymce_add}</a></li>
[end]
</ul>
[end]
[if-any item_is item_can_write]
<h2>{edit_page}</h2>
<ul class="itemmenu">
[if-any item_is item_can_write]<li><a href="[doc_base_url][dir][item_url]/emacs">{admin_emacs_edit}</a></li>[end]
[if-any item_is item_can_write user_can_use_html]<li><a href="[doc_base_url][dir][item_url]/ckeditor">{admin_ckeditor_edit}</a></li>[end]
[if-any item_is item_can_write user_can_use_html]<li><a href="[doc_base_url][dir][item_url]/tinymce">{admin_tinymce_edit}</a></li>[end]
<li><a href="[doc_base_url][dir][item_url]/emacs">{admin_emacs_edit}</a></li>
[if user_can_use_html]
<li><a href="[doc_base_url][dir][item_url]/ckeditor">{admin_ckeditor_edit}</a></li>
<li><a href="[doc_base_url][dir][item_url]/nicedit">{admin_nicedit_edit}</a></li>
<li><a href="[doc_base_url][dir][item_url]/tinymce">{admin_tinymce_edit}</a></li>
[end]
</ul>
[end]

31
html/slog.html Executable file
View File

@@ -0,0 +1,31 @@
[if slog_tab]
<table>
[for slog_tab]
<tr>
<td>
[if slog_tab_is_info]
[end]
[if slog_tab_is_warning]
{slog_warning}:
[end]
[if slog_tab_is_error]
{slog_error}:
[end]
</td>
<td>
[slog_tab_print]
</td>
</tr>
[end]
</table>
[end]

View File

@@ -121,6 +121,9 @@ ls_header = Directory listing
mkdir_header = Make directory
mkdir_form_legend = Make directory form
html_lang_attr_value = "en"
language_orphans = ()
priv_header = Permissions
priv_form_legend = Permissions
priv_change_in_dir = Change permissions for all items in the following directory
@@ -195,6 +198,8 @@ admin_emacs_add = Add page (emacs)
admin_emacs_edit = Edit page (emacs)
admin_ckeditor_add = Add page (ckeditor)
admin_ckeditor_edit = Edit page (ckeditor)
admin_nicedit_add = Add page (nicedit)
admin_nicedit_edit = Edit page (nicedit)
admin_tinymce_add = Add page (tinymce)
admin_tinymce_edit = Edit page (tinymce)
admin_rm = Remove page (rm)
@@ -239,6 +244,17 @@ cp_preserve_attr = Preserve attributes: user, group, times
cp_follow_symlinks = Follow symlinks
slog_warning = Warning
slog_error = Error
unknown_filesystem = Unknown filesystem
no_such_dir = There is not such a directory
unknown_mount_type = There is not such a mount type
unknown_mount_param = Unknown mount point parameter
skipped = skipped
skipped_static_mount = Skipped static mount point
mount_exists = This mount point already exists
slog_turn_over = Session's log turned over due to size greater than
stat_header = Stat
stat_item_type = type
@@ -268,17 +284,20 @@ uname_header = Uname
# notifications
notify_new = News
notify_change = Changes
notify_from = winix notifications <dontreply@winix.org>
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.

View File

@@ -120,6 +120,21 @@ ls_header = Zawartość katalogu
mkdir_header = Stwórz katalog
mkdir_form_legend = Wypełnij wszystkie pozycje formularza
html_lang_attr_value = "pl"
# current limitation: winix is not allowed to convert polish capital letters to lower case
# so we need to give both versions (small and capital letters)
language_orphans = ( "(np.", "a", "ale", "bo", "by", "co", "czy", "do", "go", "i", "ich", "ja",
"je", "jej", "jest", "już", "juŻ", "ją", "jĄ", "ku", "li", "mi", "na", "nie",
"np.", "nr", "o", "od", "po", "s.", "są", "sĄ", "ta", "to", "tu", "tą", "tĄ"
"tę", "tĘ", "u", "w", "we", "wy", "z", "za", "ze", "że", "Że", "ów", "Ów" )
# orphans for SK i CZ (winix for those languages are not translated yet)
# ("a", "i", "k", "o", "s", "u", "v", "z")
priv_header = Zmień uprawnienia dostępu
priv_form_legend = Uprawnienia
priv_change_in_dir = Zmień hurtowo uprawnienia w katalogu
@@ -196,6 +211,8 @@ admin_emacs_add = Dodaj stronę (emacs)
admin_emacs_edit = Edytuj stronę (emacs)
admin_ckeditor_add = Dodaj stronę (ckeditor)
admin_ckeditor_edit = Edytuj stronę (ckeditor)
admin_nicedit_add = Dodaj stronę (nicedit)
admin_nicedit_edit = Edytuj stronę (nicedit)
admin_tinymce_add = Dodaj stronę (tinymce)
admin_tinymce_edit = Edytuj stronę (tinymce)
admin_rm = Usuń stronę (rm)
@@ -239,7 +256,16 @@ cp_remove_defaults = Usuń atrybut 'default' z kopiowanych katalogów
cp_preserve_attr = Zachowaj atrybuty: użytkownik, grupa, czas
cp_follow_symlinks = Podążaj za linkami symbolicznymi
slog_warning = Ostrzeżenie
slog_error = Błąd
unknown_filesystem = Nieznany system plików
no_such_dir = Nie ma takiego katalogu
unknown_mount_type = Nieprawidłowy rodzaj punktu montowania
unknown_mount_param = Nieprawidłowy parametr dla punktu montowania
skipped = pominięte
skipped_static_mount = Pominięto statyczny (static) punkt montowania
mount_exists = Ten punkt montowania jest już zdefiniowany
slog_turn_over = Log sesji wyczyszczony w związku z przekroczeniem wielkości
stat_header = Stat
stat_item_type = typ
@@ -269,19 +295,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 <dontreply@winix.org>
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 = ""

View File

@@ -4,13 +4,10 @@ include Makefile.o.dep
all: $(o)
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep

View File

@@ -1,27 +1,29 @@
# DO NOT DELETE
main.o: ../core/log.h ../core/textstream.h ../core/misc.h ../core/item.h
main.o: ../core/app.h ../core/config.h ../core/confparser.h
main.o: ../core/htmlfilter.h ../core/system.h ../core/dirs.h
main.o: ../core/dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
main.o: ../db/dbtextstream.h ../core/textstream.h ../core/error.h
main.o: ../core/log.h ../db/dbitemquery.h ../core/item.h
main.o: ../core/logmanipulators.h ../core/slog.h ../core/cur.h
main.o: ../core/request.h ../core/requesttypes.h ../core/error.h
main.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
main.o: ../templates/htmltextstream.h ../core/textstream.h ../core/session.h
main.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
main.o: ../templates/locale.h ../core/confparser.h ../core/slog.h
main.o: ../core/app.h ../core/system.h ../core/dirs.h ../core/dircontainer.h
main.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
main.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
main.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
main.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/request.h
main.o: ../core/requesttypes.h ../core/error.h ../templates/htmltextstream.h
main.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
main.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
main.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
main.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
main.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
main.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
main.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
main.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
main.o: ../core/user.h ../core/ugcontainer.h ../core/lastcontainer.h
main.o: ../core/cur.h ../core/session.h ../core/plugindata.h ../core/rebus.h
main.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
main.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
main.o: ../core/thumb.h ../core/basethread.h ../core/sessionmanager.h
main.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/log.h
main.o: ../notify/notify.h ../notify/notifypool.h ../templates/misc.h
main.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
main.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
main.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
main.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
main.o: ../templates/htmltextstream.h ../notify/notifythread.h
main.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
main.o: ../core/config.h ../core/users.h ../core/ugcontainer.h
main.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
main.o: ../core/mountparser.h ../core/crypt.h ../core/run.h ../core/users.h
main.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
main.o: ../core/basethread.h ../core/sessionmanager.h
main.o: ../core/sessioncontainer.h ../functions/functions.h
main.o: ../functions/functionbase.h ../core/request.h ../core/system.h
main.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
@@ -31,8 +33,8 @@ main.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
main.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
main.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
main.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
main.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
main.o: ../functions/rm.h ../functions/run.h ../functions/specialdefault.h
main.o: ../functions/nicedit.h ../functions/node.h ../functions/priv.h
main.o: ../functions/reload.h ../functions/rm.h ../functions/specialdefault.h
main.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
main.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
main.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -11,14 +11,17 @@
#include <ctime>
#include <iostream>
#include <sys/param.h>
#include <fcntl.h>
#include "core/log.h"
#include "core/slog.h"
#include "core/app.h"
#include "core/plugin.h"
Log log;
Log nlog; // notify log (used by a notification thread)
SLog slog; // session logger
Plugin plugin;
@@ -39,6 +42,37 @@ void print_syntax()
void CreateNewDescriptor(int des_dst, int flags)
{
int descriptor;
descriptor = open("/dev/null", flags | O_NOCTTY);
if( descriptor != -1 )
{
dup2(descriptor, des_dst);
if( descriptor != des_dst )
close(descriptor);
}
}
void CloseDescriptors()
{
close(0);
close(1);
close(2);
app.stdout_is_closed = true;
CreateNewDescriptor(0, O_RDONLY);
CreateNewDescriptor(1, O_WRONLY);
CreateNewDescriptor(2, O_WRONLY);
}
int main(int argv, char ** argc)
{
@@ -59,16 +93,8 @@ int main(int argv, char ** argc)
if( app.stdout_is_closed || app.config.demonize )
app.config.log_stdout = false;
// closing descriptors only at the beginning
// !! temporary we do not close standard output for errors
// client postgresql uses it for reporting warnings (I don't know why)
//close(2);
if( !app.config.log_stdout )
{
close(1);
app.stdout_is_closed = true;
}
CloseDescriptors();
log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
app.config.log_stdout, app.config.log_request);

View File

@@ -4,13 +4,10 @@ include Makefile.o.dep
all: $(o)
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep

View File

@@ -11,23 +11,24 @@ notify.o: ../core/user.h notifythread.h ../core/basethread.h
notify.o: ../core/synchro.h templatesnotify.h ../core/config.h
notify.o: ../core/confparser.h ../core/htmlfilter.h ../core/users.h
notify.o: ../core/user.h ../core/ugcontainer.h ../core/log.h
notify.o: ../core/textstream.h ../core/lastcontainer.h ../core/cur.h
notify.o: ../core/request.h ../core/requesttypes.h ../core/error.h
notify.o: ../core/config.h ../templates/htmltextstream.h ../core/session.h
notify.o: ../core/plugindata.h ../core/rebus.h ../db/db.h ../db/dbbase.h
notify.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
notify.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
notify.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
notify.o: ../core/textstream.h ../core/logmanipulators.h ../core/slog.h
notify.o: ../core/cur.h ../core/request.h ../core/requesttypes.h
notify.o: ../core/error.h ../core/config.h ../templates/htmltextstream.h
notify.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
notify.o: ../core/lastcontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
notify.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
notify.o: ../core/item.h ../db/dbitemcolumns.h ../core/group.h
notify.o: ../core/dircontainer.h ../core/ugcontainer.h
notify.o: ../templates/templates.h ../templates/patterncacher.h
notify.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
notify.o: ../core/log.h ../templates/indexpatterns.h ../core/cur.h
notify.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
notify.o: ../notify/notify.h ../core/mounts.h ../core/mount.h
notify.o: ../core/mountparser.h ../core/users.h ../core/groups.h
notify.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
notify.o: ../core/mountparser.h ../core/crypt.h ../core/run.h ../core/users.h
notify.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
notify.o: ../core/basethread.h ../core/sessionmanager.h
notify.o: ../core/sessioncontainer.h ../core/system.h ../core/request.h
notify.o: ../core/dirs.h ../core/synchro.h ../core/plugin.h
notify.o: ../core/sessioncontainer.h ../core/system.h ../core/htmlfilter.h
notify.o: ../core/request.h ../core/dirs.h ../core/synchro.h ../core/plugin.h
notify.o: ../core/pluginmsg.h ../core/sessionmanager.h
notify.o: ../functions/functions.h ../functions/functionbase.h
notify.o: ../functions/functionparser.h ../functions/adduser.h
@@ -36,13 +37,12 @@ notify.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
notify.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
notify.o: ../functions/last.h ../functions/login.h ../functions/logout.h
notify.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
notify.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
notify.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
notify.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
notify.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
notify.o: ../functions/specialdefault.h ../functions/stat.h
notify.o: ../functions/subject.h ../functions/template.h
notify.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
notify.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
notify.o: ../core/htmlfilter.h
notifypool.o: notifypool.h ../templates/locale.h ../core/confparser.h
notifythread.o: notifythread.h ../core/basethread.h ../core/synchro.h
notifythread.o: templatesnotify.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
@@ -56,14 +56,14 @@ notifythread.o: ../templates/locale.h ../templates/htmltextstream.h
notifythread.o: ../core/user.h ../core/config.h ../core/confparser.h
notifythread.o: ../core/htmlfilter.h ../core/users.h ../core/user.h
notifythread.o: ../core/ugcontainer.h ../core/log.h ../core/textstream.h
notifythread.o: ../core/lastcontainer.h ../core/cur.h ../core/request.h
notifythread.o: ../core/requesttypes.h ../core/error.h ../core/config.h
notifythread.o: ../templates/htmltextstream.h ../core/session.h
notifythread.o: ../core/plugindata.h ../core/rebus.h ../db/db.h
notifythread.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
notifythread.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
notifythread.o: ../db/dbitemcolumns.h ../core/group.h ../core/dircontainer.h
notifythread.o: ../core/ugcontainer.h
notifythread.o: ../core/logmanipulators.h ../core/slog.h ../core/cur.h
notifythread.o: ../core/request.h ../core/requesttypes.h ../core/error.h
notifythread.o: ../core/config.h ../templates/htmltextstream.h
notifythread.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
notifythread.o: ../core/lastcontainer.h ../db/db.h ../db/dbbase.h
notifythread.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
notifythread.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
notifythread.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
templatesnotify.o: templatesnotify.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
templatesnotify.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
templatesnotify.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h
@@ -71,43 +71,45 @@ templatesnotify.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h
templatesnotify.o: ../core/textstream.h ../core/misc.h notifypool.h
templatesnotify.o: ../templates/locale.h ../core/confparser.h
templatesnotify.o: ../core/plugin.h ../core/pluginmsg.h ../core/log.h
templatesnotify.o: ../core/textstream.h ../core/plugindata.h ../core/config.h
templatesnotify.o: ../core/request.h ../core/requesttypes.h ../core/error.h
templatesnotify.o: ../templates/htmltextstream.h ../core/system.h
templatesnotify.o: ../core/sessionmanager.h ../core/synchro.h
templatesnotify.o: ../functions/functions.h ../functions/functionbase.h
templatesnotify.o: ../core/item.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
templatesnotify.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
templatesnotify.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
templatesnotify.o: ../core/dircontainer.h ../core/ugcontainer.h
templatesnotify.o: ../core/request.h ../core/config.h ../core/confparser.h
templatesnotify.o: ../core/htmlfilter.h ../core/system.h ../core/dirs.h
templatesnotify.o: ../core/dircontainer.h ../notify/notify.h ../core/mounts.h
templatesnotify.o: ../core/mount.h ../core/mountparser.h ../core/users.h
templatesnotify.o: ../core/textstream.h ../core/logmanipulators.h
templatesnotify.o: ../core/slog.h ../core/cur.h ../core/request.h
templatesnotify.o: ../core/requesttypes.h ../core/error.h ../core/config.h
templatesnotify.o: ../templates/htmltextstream.h ../core/session.h
templatesnotify.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
templatesnotify.o: ../core/system.h ../core/sessionmanager.h
templatesnotify.o: ../core/synchro.h ../functions/functions.h
templatesnotify.o: ../functions/functionbase.h ../core/item.h ../db/db.h
templatesnotify.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
templatesnotify.o: ../core/error.h ../db/dbitemquery.h ../db/dbitemcolumns.h
templatesnotify.o: ../core/user.h ../core/group.h ../core/dircontainer.h
templatesnotify.o: ../core/ugcontainer.h ../core/request.h ../core/config.h
templatesnotify.o: ../core/confparser.h ../core/htmlfilter.h ../core/system.h
templatesnotify.o: ../core/dirs.h ../core/dircontainer.h ../notify/notify.h
templatesnotify.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
templatesnotify.o: ../core/crypt.h ../core/run.h ../core/users.h
templatesnotify.o: ../core/groups.h ../core/group.h ../core/ugcontainer.h
templatesnotify.o: ../core/rebus.h ../core/loadavg.h ../core/thumb.h
templatesnotify.o: ../core/basethread.h ../core/synchro.h
templatesnotify.o: ../functions/functionparser.h ../core/cur.h
templatesnotify.o: ../functions/adduser.h ../functions/cat.h
templatesnotify.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
templatesnotify.o: ../core/synchro.h ../functions/functionparser.h
templatesnotify.o: ../core/cur.h ../functions/adduser.h ../functions/cat.h
templatesnotify.o: ../functions/chmod.h ../functions/privchanger.h
templatesnotify.o: ../functions/chown.h ../functions/ckeditor.h
templatesnotify.o: ../functions/cp.h ../functions/default.h
templatesnotify.o: ../functions/download.h ../functions/emacs.h
templatesnotify.o: ../functions/last.h ../functions/login.h
templatesnotify.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
templatesnotify.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
templatesnotify.o: ../functions/mkdir.h ../functions/mv.h
templatesnotify.o: ../functions/nicedit.h ../functions/node.h
templatesnotify.o: ../functions/priv.h ../functions/reload.h
templatesnotify.o: ../functions/rm.h ../functions/run.h
templatesnotify.o: ../functions/specialdefault.h ../functions/stat.h
templatesnotify.o: ../functions/subject.h ../functions/template.h
templatesnotify.o: ../functions/tinymce.h ../functions/uname.h
templatesnotify.o: ../functions/upload.h ../functions/uptime.h
templatesnotify.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
templatesnotify.o: ../functions/rm.h ../functions/specialdefault.h
templatesnotify.o: ../functions/stat.h ../functions/subject.h
templatesnotify.o: ../functions/template.h ../functions/tinymce.h
templatesnotify.o: ../functions/uname.h ../functions/upload.h
templatesnotify.o: ../functions/uptime.h ../functions/who.h
templatesnotify.o: ../functions/vim.h ../core/htmlfilter.h
templatesnotify.o: ../templates/templates.h ../templates/patterncacher.h
templatesnotify.o: ../templates/ckeditorgetparser.h
templatesnotify.o: ../core/httpsimpleparser.h ../core/log.h
templatesnotify.o: ../templates/indexpatterns.h ../templates/localefilter.h
templatesnotify.o: ../templates/locale.h ../templates/htmltextstream.h
templatesnotify.o: ../core/sessionmanager.h ../core/sessioncontainer.h
templatesnotify.o: ../core/session.h ../core/user.h ../core/cur.h
templatesnotify.o: ../core/lastcontainer.h
templatesnotify.o: ../core/lastcontainer.h ../core/misc.h

View File

@@ -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);
}
@@ -80,7 +79,7 @@ void Notify::ReadTemplates()
return;
}
patterns.resize(static_cast<size_t>(Locale::lang_unknown));
patterns.resize(TemplatesFunctions::locale.Size());
for(size_t i=0 ; i<patterns.size() ; ++i)
{
@@ -93,7 +92,7 @@ void Notify::ReadTemplates()
patterns[i][a].Directory(config->txt_templates_dir, config->txt_templates_dir_default);
patterns[i][a].ParseFile(templates_names[a]);
TemplatesFunctions::locale_filter.Filter(patterns[i][a], TemplatesFunctions::locale, static_cast<Locale::Lang>(i));
TemplatesFunctions::locale_filter.Filter(patterns[i][a], TemplatesFunctions::locale, i);
}
}
@@ -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);
}

View File

@@ -61,7 +61,6 @@ private:
NotifyPool notify_pool;
size_t notify_template_cms;
size_t notify_template_thread;
// templates file names
std::vector<std::wstring> templates_names;

View File

@@ -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
@@ -67,7 +50,7 @@ struct NotifyUserMsg
{
std::wstring name;
std::wstring email;
Locale::Lang lang;
size_t lang;
};

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
@@ -100,10 +100,7 @@ bool res = false;
{
msg.name = i->name;
msg.email = i->email;
msg.lang = Locale::StrToLang(config->locale_str); // !! bedzie osobno dla kazdego uzytkownika
if( msg.lang == Locale::lang_unknown )
msg.lang = Locale::lang_en;
msg.lang = config->locale_default_index; // !! bedzie osobno dla kazdego uzytkownika
notify_user.insert(notify_user.end(), msg);
res = true;
@@ -163,7 +160,7 @@ void NotifyThread::SendMail()
{
notify_stream.Clear();
size_t lang_index = static_cast<size_t>(TemplatesNotifyFunctions::notify_user_msg.lang);
size_t lang_index = TemplatesNotifyFunctions::notify_user_msg.lang;
size_t template_index = TemplatesNotifyFunctions::notify_msg.template_index;
if( lang_index >= patterns.size() )

View File

@@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/

View File

@@ -9,6 +9,7 @@
#include "templatesnotify.h"
#include "core/plugin.h"
#include "core/misc.h"
@@ -22,68 +23,54 @@ Ezc::Functions<NotifyStream> ezc_functions;
NotifyUserMsg notify_user_msg;
NotifyMsg notify_msg;
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(Info & i)
void notify_to_email(Info & i)
{
i.out << notify_user_msg.email;
}
/*
void notify_doc_base_url(Info & i)
void notify_to_name(Info & i)
{
i.out << notify_user_msg.doc_base_url;
i.out << notify_user_msg.name;
}
*/
void notify_item_link(Info & i)
@@ -98,23 +85,23 @@ void notify_dir_link(Info & i)
}
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", notify_to);
//ezc_functions.Insert("notify_doc_base_url", notify_doc_base_url);
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);
}

27
plugins/gallery/Makefile Executable file
View File

@@ -0,0 +1,27 @@
include Makefile.o.dep
name = gallery.so
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name).so -o $(name) $(CXXFLAGS) *.o
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<
depend:
makedepend -Y. -I../.. -I../../../ezc/src -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
rm -f $(name)
include Makefile.dep

Some files were not shown because too many files have changed in this diff Show More