20 Commits
0.4.6 ... 0.4.7

Author SHA1 Message Date
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
139 changed files with 5649 additions and 1788 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

@@ -17,7 +17,7 @@ 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: crypt.h run.h 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
@@ -28,16 +28,16 @@ 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/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
app.o: ../core/htmlfilter.h ../templates/templates.h
app.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
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
app.o: ../functions/rm.h ../functions/specialdefault.h ../functions/stat.h
app.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
app.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
app.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
app.o: ../templates/templates.h ../templates/patterncacher.h
app.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
app.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
app.o: compress.h getparser.h httpsimpleparser.h postparser.h cookieparser.h
app.o: postmultiparser.h acceptencodingparser.h acceptbaseparser.h plugin.h
app.o: pluginmsg.h
basethread.o: basethread.h log.h textstream.h
bbcodeparser.o: bbcodeparser.h htmlfilter.h
compress.o: compress.h log.h textstream.h
@@ -57,8 +57,8 @@ 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: mount.h mountparser.h crypt.h run.h users.h groups.h group.h
config.o: loadavg.h thumb.h 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
@@ -68,7 +68,7 @@ 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: ../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,6 +78,8 @@ 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
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
dircontainer.o: dircontainer.h item.h log.h textstream.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
@@ -114,12 +116,12 @@ misc.o: ../templates/patterncacher.h ../core/item.h
misc.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
misc.o: ../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: ../templates/htmltextstream.h ../core/cur.h ../core/system.h
misc.o: ../core/sessionmanager.h ../core/htmlfilter.h ../db/db.h
misc.o: ../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
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
@@ -156,19 +158,19 @@ 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: ../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
mounts.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
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/specialdefault.h ../functions/stat.h
mounts.o: plugin.h pluginmsg.h system.h crypt.h run.h users.h groups.h
mounts.o: group.h loadavg.h thumb.h basethread.h sessionmanager.h
mounts.o: sessioncontainer.h ../functions/functions.h
mounts.o: ../functions/functionbase.h ../core/request.h ../core/system.h
mounts.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
mounts.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
mounts.o: ../functions/privchanger.h ../functions/chown.h
mounts.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
mounts.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
mounts.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
mounts.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
mounts.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
mounts.o: ../functions/rm.h ../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
mounts.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
@@ -192,8 +194,8 @@ 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: basethread.h sessionmanager.h sessioncontainer.h
plugin.o: mount.h mountparser.h crypt.h run.h users.h groups.h group.h
plugin.o: loadavg.h thumb.h 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
plugin.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
@@ -203,7 +205,7 @@ 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/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
@@ -229,8 +231,8 @@ 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: mounts.h mount.h mountparser.h crypt.h run.h users.h groups.h
plugindata.o: group.h 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
@@ -242,15 +244,15 @@ 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/stat.h ../functions/subject.h
plugindata.o: ../functions/template.h ../functions/tinymce.h
plugindata.o: ../functions/uname.h ../functions/upload.h
plugindata.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
plugindata.o: ../core/htmlfilter.h ../templates/templates.h
plugindata.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
plugindata.o: ../core/httpsimpleparser.h ../core/log.h
plugindata.o: ../templates/indexpatterns.h ../core/sessionmanager.h
plugindata.o: ../functions/specialdefault.h ../functions/stat.h
plugindata.o: ../functions/subject.h ../functions/template.h
plugindata.o: ../functions/tinymce.h ../functions/uname.h
plugindata.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
plugindata.o: ../functions/vim.h ../core/htmlfilter.h
plugindata.o: ../templates/templates.h ../templates/patterncacher.h
plugindata.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
plugindata.o: ../core/log.h ../templates/indexpatterns.h
plugindata.o: ../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
@@ -275,8 +277,8 @@ 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: mountparser.h crypt.h run.h users.h groups.h group.h loadavg.h
request.o: thumb.h 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
@@ -287,14 +289,15 @@ 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: ../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
run.o: run.h log.h textstream.h
session.o: session.h item.h error.h user.h plugindata.h rebus.h 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
@@ -321,10 +324,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
@@ -335,13 +339,12 @@ 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/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
@@ -367,13 +370,13 @@ 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: mounts.h mount.h mountparser.h crypt.h run.h users.h groups.h
system.o: group.h loadavg.h 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: ../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
@@ -391,6 +394,6 @@ 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: plugindata.h rebus.h mounts.h mount.h mountparser.h crypt.h run.h
thumb.o: 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 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.
*
*/
@@ -152,6 +152,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;
@@ -242,6 +247,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 +390,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();
@@ -458,7 +474,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 +481,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);
}
}
@@ -529,7 +540,7 @@ void App::PrepareSessionCookie()
void App::SendHeaders(bool compressing, Header header)
void App::SendHeaders(bool compressing, int compress_encoding, Header header)
{
PrepareSessionCookie();
@@ -579,8 +590,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 +604,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 +625,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 +734,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 +747,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,13 @@ 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;
void ProcessRequestThrow();
void ProcessRequest();
@@ -153,12 +151,12 @@ 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 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,7 +110,8 @@ 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);
@@ -153,25 +155,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 +182,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 +191,84 @@ 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;
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"
@@ -229,16 +242,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 +279,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 +315,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 +396,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

@@ -13,6 +13,7 @@
void Dirs::SetDb(Db * pdb)
{
db = pdb;

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.
*
*/
@@ -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)
{
@@ -269,6 +279,7 @@ 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.
*
*/
@@ -48,10 +48,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);
template<class StringType>
void LogString(const StringType & value, size_t max_size);
void SystemErr(int err);
void SaveLog();
void SaveLogAndClear();
@@ -100,6 +104,25 @@ 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;

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.
*
*/
@@ -426,5 +426,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

@@ -38,6 +38,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");

View File

@@ -63,6 +63,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; }
@@ -120,6 +122,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;

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

@@ -65,6 +65,7 @@ struct Session
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;
}

View File

@@ -73,6 +73,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

@@ -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 7
#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

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

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

View File

@@ -24,9 +24,9 @@ adduser.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
adduser.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
adduser.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
adduser.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
adduser.o: ../core/mount.h ../core/mountparser.h ../core/users.h
adduser.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
adduser.o: ../core/basethread.h ../core/synchro.h
adduser.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
adduser.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
adduser.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
cat.o: cat.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
cat.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
cat.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -50,8 +50,8 @@ cat.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
cat.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
cat.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
cat.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
cat.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
cat.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
cat.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
cat.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
cat.o: ../core/synchro.h
chmod.o: chmod.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
chmod.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -77,8 +77,9 @@ chmod.o: ../templates/htmltextstream.h ../notify/notifythread.h
chmod.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
chmod.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
chmod.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
chmod.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
chmod.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
chmod.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
chmod.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
chmod.o: ../core/synchro.h
chown.o: chown.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
chown.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
chown.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -103,8 +104,9 @@ chown.o: ../templates/htmltextstream.h ../notify/notifythread.h
chown.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
chown.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
chown.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
chown.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
chown.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
chown.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
chown.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
chown.o: ../core/synchro.h
ckeditor.o: ckeditor.h functionbase.h ../core/item.h ../db/db.h
ckeditor.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
ckeditor.o: ../core/textstream.h ../core/misc.h ../core/item.h
@@ -130,9 +132,10 @@ ckeditor.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
ckeditor.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
ckeditor.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
ckeditor.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
ckeditor.o: ../core/mount.h ../core/mountparser.h ../core/users.h
ckeditor.o: ../core/groups.h ../core/group.h ../core/loadavg.h
ckeditor.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
ckeditor.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
ckeditor.o: ../core/users.h ../core/groups.h ../core/group.h
ckeditor.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
ckeditor.o: ../core/synchro.h
cp.o: cp.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
cp.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
cp.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h
@@ -156,8 +159,8 @@ cp.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
cp.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
cp.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
cp.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
cp.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
cp.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
cp.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
cp.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
cp.o: ../core/synchro.h ../core/misc.h
default.o: default.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
default.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -183,9 +186,9 @@ default.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
default.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
default.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
default.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
default.o: ../core/mount.h ../core/mountparser.h ../core/users.h
default.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
default.o: ../core/basethread.h ../core/synchro.h
default.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
default.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
default.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
download.o: download.h functionbase.h ../core/item.h ../db/db.h
download.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
download.o: ../core/textstream.h ../core/misc.h ../core/item.h
@@ -211,9 +214,10 @@ download.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
download.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
download.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
download.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
download.o: ../core/mount.h ../core/mountparser.h ../core/users.h
download.o: ../core/groups.h ../core/group.h ../core/loadavg.h
download.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
download.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
download.o: ../core/users.h ../core/groups.h ../core/group.h
download.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
download.o: ../core/synchro.h
emacs.o: emacs.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
emacs.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
emacs.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -238,11 +242,12 @@ emacs.o: ../templates/htmltextstream.h ../notify/notifythread.h
emacs.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
emacs.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
emacs.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
emacs.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
emacs.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
emacs.o: ../templates/templates.h ../templates/patterncacher.h
emacs.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
emacs.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
emacs.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
emacs.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
emacs.o: ../core/synchro.h ../templates/templates.h
emacs.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
emacs.o: ../core/httpsimpleparser.h ../core/log.h
emacs.o: ../templates/indexpatterns.h ../core/sessionmanager.h
emacs.o: ../core/sessioncontainer.h ../core/system.h
functionbase.o: functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
functionbase.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -272,9 +277,9 @@ functionbase.o: ../core/basethread.h ../core/synchro.h
functionbase.o: ../notify/templatesnotify.h ../core/users.h
functionbase.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/cur.h
functionbase.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
functionbase.o: ../core/users.h ../core/groups.h ../core/group.h
functionbase.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
functionbase.o: ../core/synchro.h
functionbase.o: ../core/crypt.h ../core/users.h ../core/groups.h
functionbase.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
functionbase.o: ../core/basethread.h ../core/synchro.h
functionparser.o: functionparser.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
functionparser.o: ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
functionparser.o: ../core/item.h ../core/error.h ../core/log.h
@@ -304,9 +309,9 @@ functionparser.o: ../core/basethread.h ../core/synchro.h
functionparser.o: ../notify/templatesnotify.h ../core/users.h
functionparser.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/cur.h
functionparser.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
functionparser.o: ../core/users.h ../core/groups.h ../core/group.h
functionparser.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
functionparser.o: ../core/log.h
functionparser.o: ../core/crypt.h ../core/users.h ../core/groups.h
functionparser.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
functionparser.o: ../core/basethread.h ../core/log.h
functions.o: functions.h functionbase.h ../core/item.h ../db/db.h
functions.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
functions.o: ../core/textstream.h ../core/misc.h ../core/item.h
@@ -327,21 +332,22 @@ functions.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
functions.o: ../notify/templatesnotify.h ../core/users.h ../core/user.h
functions.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/cur.h
functions.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
functions.o: ../core/users.h ../core/groups.h ../core/group.h ../core/rebus.h
functions.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
functions.o: ../core/synchro.h functionparser.h ../core/cur.h
functions.o: ../core/session.h ../core/plugindata.h adduser.h cat.h chmod.h
functions.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h
functions.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h
functions.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h
functions.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
functions.o: ../core/htmlfilter.h ../core/log.h ../core/misc.h
functions.o: ../core/plugin.h ../core/pluginmsg.h ../core/system.h
functions.o: ../core/sessionmanager.h ../core/sessioncontainer.h
functions.o: ../functions/functions.h ../templates/templates.h
functions.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
functions.o: ../core/httpsimpleparser.h ../core/log.h
functions.o: ../templates/indexpatterns.h ../core/sessionmanager.h
functions.o: ../core/crypt.h run.h ../core/users.h ../core/groups.h
functions.o: ../core/group.h ../core/rebus.h ../core/loadavg.h
functions.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
functions.o: functionparser.h ../core/cur.h ../core/session.h
functions.o: ../core/plugindata.h adduser.h cat.h chmod.h privchanger.h
functions.o: chown.h ckeditor.h cp.h default.h download.h emacs.h last.h
functions.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
functions.o: rm.h specialdefault.h stat.h subject.h template.h tinymce.h
functions.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
functions.o: ../core/log.h ../core/misc.h ../core/plugin.h
functions.o: ../core/pluginmsg.h ../core/system.h ../core/sessionmanager.h
functions.o: ../core/sessioncontainer.h ../functions/functions.h
functions.o: ../templates/templates.h ../templates/patterncacher.h
functions.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
functions.o: ../core/log.h ../templates/indexpatterns.h
functions.o: ../core/sessionmanager.h
last.o: last.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
last.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
last.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -366,8 +372,9 @@ last.o: ../templates/htmltextstream.h ../notify/notifythread.h
last.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
last.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
last.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
last.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
last.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
last.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
last.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
last.o: ../core/synchro.h
ln.o: ln.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
ln.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
ln.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h
@@ -391,8 +398,8 @@ ln.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
ln.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
ln.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
ln.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
ln.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
ln.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
ln.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
ln.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
ln.o: ../core/synchro.h ../core/misc.h ../functions/functions.h
login.o: login.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
login.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -418,8 +425,9 @@ login.o: ../templates/htmltextstream.h ../notify/notifythread.h
login.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
login.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
login.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
login.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
login.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
login.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
login.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
login.o: ../core/synchro.h
logout.o: logout.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
logout.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
logout.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -444,9 +452,9 @@ logout.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
logout.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
logout.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
logout.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
logout.o: ../core/mount.h ../core/mountparser.h ../core/users.h
logout.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
logout.o: ../core/basethread.h ../core/synchro.h
logout.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
logout.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
logout.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
ls.o: ls.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
ls.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
ls.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h
@@ -470,8 +478,8 @@ ls.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
ls.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
ls.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
ls.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
ls.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
ls.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
ls.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
ls.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
ls.o: ../core/synchro.h
mkdir.o: mkdir.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
mkdir.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -497,8 +505,9 @@ mkdir.o: ../templates/htmltextstream.h ../notify/notifythread.h
mkdir.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
mkdir.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
mkdir.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
mkdir.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
mkdir.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
mkdir.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
mkdir.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
mkdir.o: ../core/synchro.h
mv.o: mv.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
mv.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
mv.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h
@@ -522,8 +531,8 @@ mv.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
mv.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
mv.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
mv.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
mv.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
mv.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
mv.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
mv.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
mv.o: ../core/synchro.h
node.o: node.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
node.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -549,8 +558,9 @@ node.o: ../templates/htmltextstream.h ../notify/notifythread.h
node.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
node.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
node.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
node.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
node.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
node.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
node.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
node.o: ../core/synchro.h
priv.o: priv.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
priv.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
priv.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -575,8 +585,9 @@ priv.o: ../templates/htmltextstream.h ../notify/notifythread.h
priv.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
priv.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
priv.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
priv.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
priv.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
priv.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
priv.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
priv.o: ../core/synchro.h
privchanger.o: privchanger.h ../core/request.h ../core/requesttypes.h
privchanger.o: ../core/item.h ../core/error.h ../core/config.h
privchanger.o: ../core/confparser.h ../core/htmlfilter.h ../core/textstream.h
@@ -605,8 +616,9 @@ privchanger.o: ../core/basethread.h ../core/synchro.h
privchanger.o: ../notify/templatesnotify.h ../core/users.h
privchanger.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/cur.h
privchanger.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
privchanger.o: ../core/users.h ../core/groups.h ../core/group.h
privchanger.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
privchanger.o: ../core/crypt.h ../core/users.h ../core/groups.h
privchanger.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
privchanger.o: ../core/basethread.h
reload.o: reload.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
reload.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
reload.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -631,12 +643,12 @@ reload.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
reload.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
reload.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
reload.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
reload.o: ../core/mount.h ../core/mountparser.h ../core/users.h
reload.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
reload.o: ../core/basethread.h ../core/synchro.h ../templates/templates.h
reload.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
reload.o: ../core/httpsimpleparser.h ../core/log.h
reload.o: ../templates/indexpatterns.h ../core/sessionmanager.h
reload.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
reload.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
reload.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
reload.o: ../templates/templates.h ../templates/patterncacher.h
reload.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
reload.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
reload.o: ../core/sessioncontainer.h ../core/system.h
rm.o: rm.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
rm.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h
@@ -661,8 +673,8 @@ rm.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
rm.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
rm.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
rm.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
rm.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
rm.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
rm.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
rm.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
rm.o: ../core/synchro.h ../core/plugin.h ../core/pluginmsg.h ../core/system.h
rm.o: ../core/sessionmanager.h ../core/sessioncontainer.h
rm.o: ../functions/functions.h ../templates/templates.h
@@ -692,8 +704,8 @@ run.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
run.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
run.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
run.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
run.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
run.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
run.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
run.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
run.o: ../core/synchro.h
specialdefault.o: specialdefault.h functionbase.h ../core/item.h ../db/db.h
specialdefault.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
@@ -724,9 +736,9 @@ specialdefault.o: ../core/basethread.h ../core/synchro.h
specialdefault.o: ../notify/templatesnotify.h ../core/users.h
specialdefault.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/cur.h
specialdefault.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h
specialdefault.o: ../core/users.h ../core/groups.h ../core/group.h
specialdefault.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
specialdefault.o: ../core/synchro.h
specialdefault.o: ../core/crypt.h ../core/users.h ../core/groups.h
specialdefault.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
specialdefault.o: ../core/basethread.h ../core/synchro.h
stat.o: stat.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
stat.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
stat.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -751,8 +763,9 @@ stat.o: ../templates/htmltextstream.h ../notify/notifythread.h
stat.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
stat.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
stat.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
stat.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
stat.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
stat.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
stat.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
stat.o: ../core/synchro.h
subject.o: subject.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
subject.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
subject.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -777,9 +790,9 @@ subject.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
subject.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
subject.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
subject.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
subject.o: ../core/mount.h ../core/mountparser.h ../core/users.h
subject.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
subject.o: ../core/basethread.h ../core/synchro.h
subject.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
subject.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
subject.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
template.o: template.h functionbase.h ../core/item.h ../db/db.h
template.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
template.o: ../core/textstream.h ../core/misc.h ../core/item.h
@@ -806,10 +819,10 @@ template.o: ../templates/htmltextstream.h ../notify/notifythread.h
template.o: ../core/basethread.h ../core/synchro.h
template.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
template.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
template.o: ../core/mount.h ../core/mountparser.h ../core/users.h
template.o: ../core/groups.h ../core/group.h ../core/loadavg.h
template.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
template.o: ../core/misc.h
template.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
template.o: ../core/users.h ../core/groups.h ../core/group.h
template.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
template.o: ../core/synchro.h ../core/misc.h
tinymce.o: tinymce.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
tinymce.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
tinymce.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -834,9 +847,9 @@ tinymce.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
tinymce.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
tinymce.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
tinymce.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
tinymce.o: ../core/mount.h ../core/mountparser.h ../core/users.h
tinymce.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
tinymce.o: ../core/basethread.h ../core/synchro.h
tinymce.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
tinymce.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
tinymce.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
uname.o: uname.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
uname.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
uname.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -861,8 +874,9 @@ uname.o: ../templates/htmltextstream.h ../notify/notifythread.h
uname.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
uname.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
uname.o: ../core/cur.h ../core/mounts.h ../core/mount.h ../core/mountparser.h
uname.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
uname.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
uname.o: ../core/crypt.h ../core/users.h ../core/groups.h ../core/group.h
uname.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
uname.o: ../core/synchro.h
upload.o: upload.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
upload.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
upload.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -887,10 +901,10 @@ upload.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
upload.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
upload.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
upload.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
upload.o: ../core/mount.h ../core/mountparser.h ../core/users.h
upload.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
upload.o: ../core/basethread.h ../core/synchro.h ../core/misc.h
upload.o: ../functions/functions.h
upload.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
upload.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
upload.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
upload.o: ../core/misc.h ../functions/functions.h
uptime.o: uptime.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
uptime.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
uptime.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -915,9 +929,9 @@ uptime.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
uptime.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
uptime.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
uptime.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h
uptime.o: ../core/mount.h ../core/mountparser.h ../core/users.h
uptime.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h
uptime.o: ../core/basethread.h ../core/synchro.h
uptime.o: ../core/mount.h ../core/mountparser.h ../core/crypt.h
uptime.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
uptime.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h
vim.o: vim.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
vim.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
vim.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
@@ -941,8 +955,8 @@ vim.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
vim.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
vim.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
vim.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
vim.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
vim.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
vim.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
vim.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
vim.o: ../core/synchro.h
who.o: who.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
who.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
@@ -967,6 +981,6 @@ who.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
who.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h
who.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h
who.o: ../core/lastcontainer.h ../core/cur.h ../core/mounts.h ../core/mount.h
who.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h
who.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h
who.o: ../core/mountparser.h ../core/crypt.h ../core/users.h ../core/groups.h
who.o: ../core/group.h ../core/loadavg.h ../core/thumb.h ../core/basethread.h
who.o: ../core/synchro.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.
*
*/
@@ -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,36 @@ User user;
}
void AddUser::MakeGet()
{
Run s;
std::string out;
/*
s.Env("PATH=/home/tomek/mybin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin");
s.Env("PWD=/home/tomek");
s.Env("SHELL=/bin/tcsh");
s.Env("USER=tomek");
s.Env("GROUP=wheel");
s.Env("HOME=/home/tomek");
*/
s.Par("dgst");
s.Par("-sha512");
s.Cmd("/usr/bin/openssl");
if( s.Go("swinka", out) == 0 )
log << log1 << "odpowiedz: " << out << logend;
if( s.Go("cosik", out) == 0 )
log << log1 << "odpowiedz: " << out << logend;
if( s.Go("ktosik", out) == 0 )
log << log1 << "odpowiedz: " << out << logend;
if( s.Go("", out) == 0 )
log << log1 << "odpowiedz: " << out << logend;
}
} // 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

@@ -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.
*
*/
@@ -470,11 +470,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

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

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

@@ -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"]

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

@@ -20,7 +20,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 +31,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

@@ -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
@@ -268,17 +271,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
@@ -269,19 +284,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

@@ -20,8 +20,9 @@ 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/crypt.h ../core/run.h ../core/users.h ../core/groups.h
main.o: ../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
@@ -32,15 +33,14 @@ 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/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
main.o: ../core/htmlfilter.h ../templates/templates.h
main.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
main.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
main.o: ../core/sessionmanager.h ../core/compress.h ../core/getparser.h
main.o: ../core/httpsimpleparser.h ../core/postparser.h
main.o: ../core/cookieparser.h ../core/postmultiparser.h
main.o: ../functions/rm.h ../functions/specialdefault.h ../functions/stat.h
main.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
main.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
main.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
main.o: ../templates/templates.h ../templates/patterncacher.h
main.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
main.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
main.o: ../core/compress.h ../core/getparser.h ../core/httpsimpleparser.h
main.o: ../core/postparser.h ../core/cookieparser.h ../core/postmultiparser.h
main.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
main.o: ../core/plugin.h ../core/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.
*
*/
@@ -11,6 +11,7 @@
#include <ctime>
#include <iostream>
#include <sys/param.h>
#include <fcntl.h>
#include "core/log.h"
#include "core/app.h"
@@ -39,6 +40,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 +91,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

@@ -23,11 +23,11 @@ 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
@@ -37,12 +37,11 @@ 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/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
@@ -83,7 +82,8 @@ 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/mount.h ../core/mountparser.h ../core/crypt.h
templatesnotify.o: ../core/run.h ../core/user.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
@@ -97,17 +97,17 @@ 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/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/session.h ../core/cur.h ../core/lastcontainer.h
templatesnotify.o: ../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

135
plugins/gallery/Makefile.dep Executable file
View File

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

1
plugins/gallery/Makefile.o.dep Executable file
View File

@@ -0,0 +1 @@
o = gallery.o galleryinfo.o init.o templates.o

90
plugins/gallery/gallery.cpp Executable file
View File

@@ -0,0 +1,90 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "gallery.h"
namespace Gallery
{
Gallery::Gallery()
{
fun.url = L"gallery";
}
void Gallery::SetGalleryInfo(GalleryInfo * pinfo)
{
gallery_info = pinfo;
}
bool Gallery::HasAccess()
{
return true;
}
void Gallery::CreatePointers()
{
gallery_info->item_sort_tab.resize(gallery_info->item_tab.size());
for(size_t i=0 ; i<gallery_info->item_tab.size() ; ++i)
gallery_info->item_sort_tab[i] = &gallery_info->item_tab[i];
}
void Gallery::SortPointers()
{
}
void Gallery::MakeGetDir()
{
iq.SetAll(false, false);
iq.sel_parent_id = true;
iq.sel_subject = true;
iq.sel_url = true;
iq.sel_type = true;
iq.sel_file = true;
iq.WhereParentId(cur->request->dir_tab.back()->id);
iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
db->GetItems(gallery_info->item_tab, iq);
CreatePointers();
}
void Gallery::MakeGetFile()
{
gallery_info->item_sort_tab.resize(1);
gallery_info->item_sort_tab[0] = &cur->request->item;
}
void Gallery::MakeGet()
{
if( cur->request->is_item )
MakeGetFile();
else
MakeGetDir();
SortPointers();
}
} // namespace

46
plugins/gallery/gallery.h Executable file
View File

@@ -0,0 +1,46 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_plugins_gallery_gallery
#define headerfile_winix_plugins_gallery_gallery
#include "functions/functionbase.h"
#include "galleryinfo.h"
namespace Gallery
{
class Gallery : public FunctionBase
{
public:
Gallery();
bool HasAccess();
void MakeGet();
void SetGalleryInfo(GalleryInfo * pinfo);
private:
GalleryInfo * gallery_info;
DbItemQuery iq;
void CreatePointers();
void SortPointers();
void MakeGetDir();
void MakeGetFile();
};
} // namespace
#endif

34
plugins/gallery/galleryinfo.cpp 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.
*
*/
#include "galleryinfo.h"
namespace Gallery
{
void GalleryInfo::Clear()
{
item_tab.clear();
item_sort_tab.clear();
}
} // namespace

60
plugins/gallery/galleryinfo.h Executable file
View File

@@ -0,0 +1,60 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_plugins_gallery_galleryinfo
#define headerfile_winix_plugins_gallery_galleryinfo
#include <vector>
#include "core/item.h"
namespace Gallery
{
class GalleryInfo
{
public:
// id of a mount type
int mount_type_gallery;
// enable a thread in a specific directory
// and set sort type (asc, desc)
int mount_par_gallery;
int mount_par_gallery_size;
int mount_par_gallery_theme;
// "lightbox" (default)
// "galleria" (http://galleria.aino.se/)
// "galleriathumb" (http://galleria.aino.se/)
int mount_par_gallery_type;
// id of the current plugin
int plugin_id;
void Clear();
std::vector<Item> item_tab;
std::vector<Item*> item_sort_tab;
private:
};
} // namespace
#endif

90
plugins/gallery/init.cpp Executable file
View File

@@ -0,0 +1,90 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "gallery.h"
#include "core/log.h"
#include "core/plugin.h"
extern "C" void Init(PluginInfo &);
namespace Gallery
{
Gallery fun_gallery;
GalleryInfo gallery_info;
const wchar_t plugin_name[] = L"gallery";
void AddFunctions(PluginInfo & info)
{
info.functions->Add(fun_gallery);
}
void SelectDefaultFunction(PluginInfo & info)
{
if( !info.cur->request->is_item && info.system->mounts.pmount->type == gallery_info.mount_type_gallery )
info.cur->request->function = &fun_gallery;
}
void AddMounts(PluginInfo & info)
{
Mounts & m = info.system->mounts;
gallery_info.mount_type_gallery = m.AddMountType(L"gallery");
gallery_info.mount_par_gallery = m.AddMountPar(L"gallery");
gallery_info.mount_par_gallery_size = m.AddMountPar(L"gallery_size");
gallery_info.mount_par_gallery_type = m.AddMountPar(L"gallery_type");
gallery_info.mount_par_gallery_theme = m.AddMountPar(L"gallery_theme");
}
void EndRequest(PluginInfo & info)
{
gallery_info.Clear();
}
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace Gallery;
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
gallery_info.plugin_id = info.plugin_id;
fun_gallery.SetGalleryInfo(&gallery_info);
info.p1 = (void*)(plugin_name);
}

167
plugins/gallery/templates.cpp Executable file
View File

@@ -0,0 +1,167 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "gallery.h"
#include "core/request.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "templates/templates.h"
#include "functions/functions.h"
namespace Gallery
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
extern GalleryInfo gallery_info;
extern Gallery fun_gallery;
static size_t gallery_index;
static std::wstring item_dir;
void gallery_tab(Info & i)
{
gallery_index = i.iter;
i.res = gallery_index < gallery_info.item_sort_tab.size();
}
void gallery_tab_index(Info & i)
{
i.out << gallery_index;
}
void gallery_tab_dir(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
system->dirs.MakePath(item.parent_id, item_dir);
i.out << item_dir;
}
}
void gallery_tab_url(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
i.out << item.url;
}
}
void gallery_tab_subject(Info & i)
{
if( gallery_index < gallery_info.item_sort_tab.size() )
{
Item & item = *gallery_info.item_sort_tab[gallery_index];
i.out << item.subject;
}
}
void gallery_tab_link(Info & i)
{
i.out << config->base_url;
gallery_tab_dir(i);
gallery_tab_url(i);
}
void gallery_width(Info & i)
{
if( !system->mounts.pmount )
return;
Mount & m = *system->mounts.pmount;
if( !m.param[gallery_info.mount_par_gallery_size].defined || m.param[gallery_info.mount_par_gallery_size].arg.size() != 2 )
{
i.out << "800px";
}
else
{
i.out << m.param[gallery_info.mount_par_gallery_size].arg[0];
}
}
void gallery_height(Info & i)
{
if( !system->mounts.pmount )
return;
Mount & m = *system->mounts.pmount;
if( !m.param[gallery_info.mount_par_gallery_size].defined || m.param[gallery_info.mount_par_gallery_size].arg.size() != 2 )
{
i.out << "500px";
}
else
{
i.out << m.param[gallery_info.mount_par_gallery_size].arg[1];
}
}
void gallery_has_not_mount_type(Info & i)
{
i.res = !system->mounts.pmount->IsPar(gallery_info.mount_par_gallery_type);
}
void gallery_mount_type_arg_is(Info & i)
{
i.res = system->mounts.pmount->IsArg(gallery_info.mount_par_gallery_type, i.par);
}
void gallery_mount_theme_arg_is(Info & i)
{
i.res = system->mounts.pmount->IsArg(gallery_info.mount_par_gallery_theme, i.par);
}
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
fun->Insert("gallery_tab", gallery_tab);
fun->Insert("gallery_tab_index", gallery_tab_index);
fun->Insert("gallery_tab_dir", gallery_tab_dir);
fun->Insert("gallery_tab_url", gallery_tab_url);
fun->Insert("gallery_tab_subject", gallery_tab_subject);
fun->Insert("gallery_tab_link", gallery_tab_link);
fun->Insert("gallery_width", gallery_width);
fun->Insert("gallery_height", gallery_height);
fun->Insert("gallery_has_not_mount_type", gallery_has_not_mount_type);
fun->Insert("gallery_mount_type_arg_is", gallery_mount_type_arg_is);
fun->Insert("gallery_mount_theme_arg_is", gallery_mount_theme_arg_is);
}
} // namespace

27
plugins/groupitem/Makefile Executable file
View File

@@ -0,0 +1,27 @@
include Makefile.o.dep
name = groupitem.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

105
plugins/groupitem/Makefile.dep Executable file
View File

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

View File

@@ -0,0 +1 @@
o = init.o templates.o

50
plugins/groupitem/init.cpp Executable file
View File

@@ -0,0 +1,50 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "core/log.h"
#include "core/plugin.h"
extern "C" void Init(PluginInfo &);
namespace Groupitem
{
const wchar_t plugin_name[] = L"groupitem";
void AddEzcFunctions(PluginInfo & info);
} // namespace
void Init(PluginInfo & info)
{
using namespace Groupitem;
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
info.p1 = (void*)(plugin_name);
}

37
plugins/groupitem/templates.cpp Executable file
View File

@@ -0,0 +1,37 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "templates/templates.h"
#include "core/plugin.h"
namespace Groupitem
{
using namespace TemplatesFunctions;
using TemplatesFunctions::system;
void AddEzcFunctions(PluginInfo & info)
{
using TemplatesFunctions::EzcFun;
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
// fun->Insert("gallery_tab", gallery_tab);
}
} // namespace

View File

@@ -3,14 +3,14 @@ include Makefile.o.dep
name = stats.so
all: $(o)
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name).so -o $(name) $(CXXFLAGS) *.o
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<

View File

@@ -25,13 +25,14 @@ init.o: ../../core/synchro.h ../../notify/templatesnotify.h
init.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h
init.o: ../../core/lastcontainer.h ../../core/cur.h ../../core/session.h
init.o: ../../core/rebus.h ../../core/mounts.h ../../core/mount.h
init.o: ../../core/mountparser.h ../../core/users.h ../../core/groups.h
init.o: ../../core/group.h ../../core/loadavg.h ../../core/thumb.h
init.o: ../../core/basethread.h ../../core/sessionmanager.h
init.o: ../../core/sessioncontainer.h ../../functions/functions.h
init.o: ../../functions/functionbase.h ../../core/system.h
init.o: ../../core/synchro.h ../../functions/functionparser.h
init.o: ../../core/cur.h ../../functions/adduser.h ../../functions/cat.h
init.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h
init.o: ../../core/users.h ../../core/groups.h ../../core/group.h
init.o: ../../core/loadavg.h ../../core/thumb.h ../../core/basethread.h
init.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
init.o: ../../functions/functions.h ../../functions/functionbase.h
init.o: ../../core/system.h ../../core/synchro.h
init.o: ../../functions/functionparser.h ../../core/cur.h
init.o: ../../functions/adduser.h ../../functions/cat.h
init.o: ../../functions/chmod.h ../../functions/privchanger.h
init.o: ../../functions/chown.h ../../functions/ckeditor.h
init.o: ../../functions/cp.h ../../functions/default.h
@@ -40,16 +41,15 @@ init.o: ../../functions/last.h ../../functions/login.h
init.o: ../../functions/logout.h ../../functions/ln.h ../../functions/ls.h
init.o: ../../functions/mkdir.h ../../functions/mv.h ../../functions/node.h
init.o: ../../functions/priv.h ../../functions/reload.h ../../functions/rm.h
init.o: ../../functions/run.h ../../functions/specialdefault.h
init.o: ../../functions/stat.h ../../functions/subject.h
init.o: ../../functions/template.h ../../functions/tinymce.h
init.o: ../../functions/uname.h ../../functions/upload.h
init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
init.o: ../../core/htmlfilter.h ../../templates/templates.h
init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h
init.o: ../../core/httpsimpleparser.h ../../core/log.h
init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
init.o: statssession.h ../../core/plugindata.h
init.o: ../../functions/specialdefault.h ../../functions/stat.h
init.o: ../../functions/subject.h ../../functions/template.h
init.o: ../../functions/tinymce.h ../../functions/uname.h
init.o: ../../functions/upload.h ../../functions/uptime.h
init.o: ../../functions/who.h ../../functions/vim.h ../../core/htmlfilter.h
init.o: ../../templates/templates.h ../../templates/patterncacher.h
init.o: ../../templates/ckeditorgetparser.h ../../core/httpsimpleparser.h
init.o: ../../core/log.h ../../templates/indexpatterns.h
init.o: ../../core/sessionmanager.h statssession.h ../../core/plugindata.h
stats.o: stats.h ../../core/config.h ../../core/log.h ../../core/textstream.h
stats.o: ../../core/misc.h ../../core/item.h ../../../ezc/src/utf8.h
templates.o: templates.h ../../core/plugin.h ../../core/pluginmsg.h
@@ -75,16 +75,17 @@ templates.o: ../../notify/templatesnotify.h ../../core/config.h
templates.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h
templates.o: ../../core/lastcontainer.h ../../core/cur.h ../../core/session.h
templates.o: ../../core/error.h ../../core/rebus.h ../../core/mounts.h
templates.o: ../../core/mount.h ../../core/mountparser.h ../../core/users.h
templates.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
templates.o: ../../core/thumb.h ../../core/basethread.h
templates.o: ../../core/textstream.h ../../core/misc.h
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
templates.o: ../../functions/functions.h ../../functions/functionbase.h
templates.o: ../../core/request.h ../../core/requesttypes.h
templates.o: ../../templates/htmltextstream.h ../../core/system.h
templates.o: ../../core/synchro.h ../../functions/functionparser.h
templates.o: ../../core/cur.h ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../core/mount.h ../../core/mountparser.h ../../core/crypt.h
templates.o: ../../core/run.h ../../core/users.h ../../core/groups.h
templates.o: ../../core/group.h ../../core/loadavg.h ../../core/thumb.h
templates.o: ../../core/basethread.h ../../core/textstream.h
templates.o: ../../core/misc.h ../../core/sessionmanager.h
templates.o: ../../core/sessioncontainer.h ../../functions/functions.h
templates.o: ../../functions/functionbase.h ../../core/request.h
templates.o: ../../core/requesttypes.h ../../templates/htmltextstream.h
templates.o: ../../core/system.h ../../core/synchro.h
templates.o: ../../functions/functionparser.h ../../core/cur.h
templates.o: ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../functions/chmod.h ../../functions/privchanger.h
templates.o: ../../functions/chown.h ../../functions/ckeditor.h
templates.o: ../../functions/cp.h ../../functions/default.h
@@ -94,14 +95,13 @@ templates.o: ../../functions/logout.h ../../functions/ln.h
templates.o: ../../functions/ls.h ../../functions/mkdir.h
templates.o: ../../functions/mv.h ../../functions/node.h
templates.o: ../../functions/priv.h ../../functions/reload.h
templates.o: ../../functions/rm.h ../../functions/run.h
templates.o: ../../functions/specialdefault.h ../../functions/stat.h
templates.o: ../../functions/subject.h ../../functions/template.h
templates.o: ../../functions/tinymce.h ../../functions/uname.h
templates.o: ../../functions/upload.h ../../functions/uptime.h
templates.o: ../../functions/who.h ../../functions/vim.h
templates.o: ../../core/htmlfilter.h ../../templates/templates.h
templates.o: ../../templates/patterncacher.h
templates.o: ../../functions/rm.h ../../functions/specialdefault.h
templates.o: ../../functions/stat.h ../../functions/subject.h
templates.o: ../../functions/template.h ../../functions/tinymce.h
templates.o: ../../functions/uname.h ../../functions/upload.h
templates.o: ../../functions/uptime.h ../../functions/who.h
templates.o: ../../functions/vim.h ../../core/htmlfilter.h
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
templates.o: ../../templates/ckeditorgetparser.h
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h

View File

@@ -3,14 +3,14 @@ include Makefile.o.dep
name = thread.so
all: $(o)
all: $(name)
$(name): $(o)
$(CXX) -shared -Wl,-soname,$(name).so -o $(name) $(CXXFLAGS) *.o
.SUFFIXES: .cpp .o
.cpp.o:
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $<

View File

@@ -28,11 +28,11 @@ createthread.o: ../../core/user.h ../../core/ugcontainer.h
createthread.o: ../../core/lastcontainer.h ../../core/cur.h
createthread.o: ../../core/session.h ../../core/plugindata.h
createthread.o: ../../core/rebus.h ../../core/mounts.h ../../core/mount.h
createthread.o: ../../core/mountparser.h ../../core/users.h
createthread.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
createthread.o: ../../core/thumb.h ../../core/basethread.h
createthread.o: ../../core/synchro.h tdb.h thread.h ../../db/dbbase.h
createthread.o: threadinfo.h ../../functions/functions.h
createthread.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h
createthread.o: ../../core/users.h ../../core/groups.h ../../core/group.h
createthread.o: ../../core/loadavg.h ../../core/thumb.h
createthread.o: ../../core/basethread.h ../../core/synchro.h tdb.h thread.h
createthread.o: ../../db/dbbase.h threadinfo.h ../../functions/functions.h
createthread.o: ../../functions/functionbase.h
createthread.o: ../../functions/functionparser.h ../../core/cur.h
createthread.o: ../../functions/adduser.h ../../functions/cat.h
@@ -45,13 +45,12 @@ createthread.o: ../../functions/logout.h ../../functions/ln.h
createthread.o: ../../functions/ls.h ../../functions/mkdir.h
createthread.o: ../../functions/mv.h ../../functions/node.h
createthread.o: ../../functions/priv.h ../../functions/reload.h
createthread.o: ../../functions/rm.h ../../functions/run.h
createthread.o: ../../functions/specialdefault.h ../../functions/stat.h
createthread.o: ../../functions/subject.h ../../functions/template.h
createthread.o: ../../functions/tinymce.h ../../functions/uname.h
createthread.o: ../../functions/upload.h ../../functions/uptime.h
createthread.o: ../../functions/who.h ../../functions/vim.h
createthread.o: ../../core/htmlfilter.h
createthread.o: ../../functions/rm.h ../../functions/specialdefault.h
createthread.o: ../../functions/stat.h ../../functions/subject.h
createthread.o: ../../functions/template.h ../../functions/tinymce.h
createthread.o: ../../functions/uname.h ../../functions/upload.h
createthread.o: ../../functions/uptime.h ../../functions/who.h
createthread.o: ../../functions/vim.h ../../core/htmlfilter.h
funthread.o: ../../core/misc.h ../../core/item.h funthread.h
funthread.o: ../../functions/functionbase.h ../../core/item.h ../../db/db.h
funthread.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
@@ -77,10 +76,11 @@ funthread.o: ../../notify/templatesnotify.h ../../core/users.h
funthread.o: ../../core/user.h ../../core/ugcontainer.h
funthread.o: ../../core/lastcontainer.h ../../core/cur.h ../../core/session.h
funthread.o: ../../core/plugindata.h ../../core/rebus.h ../../core/mounts.h
funthread.o: ../../core/mount.h ../../core/mountparser.h ../../core/users.h
funthread.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
funthread.o: ../../core/thumb.h ../../core/basethread.h ../../core/synchro.h
funthread.o: tdb.h thread.h ../../db/dbbase.h threadinfo.h
funthread.o: ../../core/mount.h ../../core/mountparser.h ../../core/crypt.h
funthread.o: ../../core/run.h ../../core/users.h ../../core/groups.h
funthread.o: ../../core/group.h ../../core/loadavg.h ../../core/thumb.h
funthread.o: ../../core/basethread.h ../../core/synchro.h tdb.h thread.h
funthread.o: ../../db/dbbase.h threadinfo.h
init.o: tdb.h thread.h ../../db/dbbase.h ../../core/error.h ../../core/log.h
init.o: ../../core/textstream.h reply.h ../../functions/functionbase.h
init.o: ../../core/item.h ../../db/db.h ../../db/dbbase.h ../../db/dbconn.h
@@ -105,14 +105,15 @@ init.o: ../../notify/templatesnotify.h ../../core/users.h ../../core/user.h
init.o: ../../core/ugcontainer.h ../../core/lastcontainer.h ../../core/cur.h
init.o: ../../core/session.h ../../core/plugindata.h ../../core/rebus.h
init.o: ../../core/mounts.h ../../core/mount.h ../../core/mountparser.h
init.o: ../../core/users.h ../../core/groups.h ../../core/group.h
init.o: ../../core/loadavg.h ../../core/thumb.h ../../core/basethread.h
init.o: ../../core/synchro.h threadinfo.h funthread.h createthread.h
init.o: showthreads.h ../../core/log.h ../../core/plugin.h pluginmsg.h
init.o: ../../core/system.h ../../core/sessionmanager.h
init.o: ../../core/sessioncontainer.h ../../functions/functions.h
init.o: ../../functions/functionbase.h ../../functions/functionparser.h
init.o: ../../core/cur.h ../../functions/adduser.h ../../functions/cat.h
init.o: ../../core/crypt.h ../../core/run.h ../../core/users.h
init.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
init.o: ../../core/thumb.h ../../core/basethread.h ../../core/synchro.h
init.o: threadinfo.h funthread.h createthread.h showthreads.h
init.o: ../../core/log.h ../../core/plugin.h pluginmsg.h ../../core/system.h
init.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
init.o: ../../functions/functions.h ../../functions/functionbase.h
init.o: ../../functions/functionparser.h ../../core/cur.h
init.o: ../../functions/adduser.h ../../functions/cat.h
init.o: ../../functions/chmod.h ../../functions/privchanger.h
init.o: ../../functions/chown.h ../../functions/ckeditor.h
init.o: ../../functions/cp.h ../../functions/default.h
@@ -121,16 +122,15 @@ init.o: ../../functions/last.h ../../functions/login.h
init.o: ../../functions/logout.h ../../functions/ln.h ../../functions/ls.h
init.o: ../../functions/mkdir.h ../../functions/mv.h ../../functions/node.h
init.o: ../../functions/priv.h ../../functions/reload.h ../../functions/rm.h
init.o: ../../functions/run.h ../../functions/specialdefault.h
init.o: ../../functions/stat.h ../../functions/subject.h
init.o: ../../functions/template.h ../../functions/tinymce.h
init.o: ../../functions/uname.h ../../functions/upload.h
init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
init.o: ../../core/htmlfilter.h ../../templates/templates.h
init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h
init.o: ../../core/httpsimpleparser.h ../../core/log.h
init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
init.o: templates.h
init.o: ../../functions/specialdefault.h ../../functions/stat.h
init.o: ../../functions/subject.h ../../functions/template.h
init.o: ../../functions/tinymce.h ../../functions/uname.h
init.o: ../../functions/upload.h ../../functions/uptime.h
init.o: ../../functions/who.h ../../functions/vim.h ../../core/htmlfilter.h
init.o: ../../templates/templates.h ../../templates/patterncacher.h
init.o: ../../templates/ckeditorgetparser.h ../../core/httpsimpleparser.h
init.o: ../../core/log.h ../../templates/indexpatterns.h
init.o: ../../core/sessionmanager.h templates.h
reply.o: reply.h ../../functions/functionbase.h ../../core/item.h
reply.o: ../../db/db.h ../../db/dbbase.h ../../db/dbconn.h
reply.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h
@@ -155,9 +155,10 @@ reply.o: ../../notify/templatesnotify.h ../../core/users.h ../../core/user.h
reply.o: ../../core/ugcontainer.h ../../core/lastcontainer.h ../../core/cur.h
reply.o: ../../core/session.h ../../core/plugindata.h ../../core/rebus.h
reply.o: ../../core/mounts.h ../../core/mount.h ../../core/mountparser.h
reply.o: ../../core/users.h ../../core/groups.h ../../core/group.h
reply.o: ../../core/loadavg.h ../../core/thumb.h ../../core/basethread.h
reply.o: ../../core/synchro.h tdb.h thread.h ../../db/dbbase.h threadinfo.h
reply.o: ../../core/crypt.h ../../core/run.h ../../core/users.h
reply.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
reply.o: ../../core/thumb.h ../../core/basethread.h ../../core/synchro.h
reply.o: tdb.h thread.h ../../db/dbbase.h threadinfo.h
reply.o: ../../functions/functions.h ../../functions/functionbase.h
reply.o: ../../functions/functionparser.h ../../core/cur.h
reply.o: ../../functions/adduser.h ../../functions/cat.h
@@ -169,13 +170,13 @@ reply.o: ../../functions/last.h ../../functions/login.h
reply.o: ../../functions/logout.h ../../functions/ln.h ../../functions/ls.h
reply.o: ../../functions/mkdir.h ../../functions/mv.h ../../functions/node.h
reply.o: ../../functions/priv.h ../../functions/reload.h ../../functions/rm.h
reply.o: ../../functions/run.h ../../functions/specialdefault.h
reply.o: ../../functions/stat.h ../../functions/subject.h
reply.o: ../../functions/template.h ../../functions/tinymce.h
reply.o: ../../functions/uname.h ../../functions/upload.h
reply.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
reply.o: ../../core/htmlfilter.h ../../core/misc.h ../../core/plugin.h
reply.o: pluginmsg.h ../../core/system.h ../../core/sessionmanager.h
reply.o: ../../functions/specialdefault.h ../../functions/stat.h
reply.o: ../../functions/subject.h ../../functions/template.h
reply.o: ../../functions/tinymce.h ../../functions/uname.h
reply.o: ../../functions/upload.h ../../functions/uptime.h
reply.o: ../../functions/who.h ../../functions/vim.h ../../core/htmlfilter.h
reply.o: ../../core/misc.h ../../core/plugin.h pluginmsg.h
reply.o: ../../core/system.h ../../core/sessionmanager.h
reply.o: ../../core/sessioncontainer.h ../../templates/templates.h
reply.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h
reply.o: ../../core/httpsimpleparser.h ../../core/log.h
@@ -207,11 +208,11 @@ showthreads.o: ../../core/user.h ../../core/ugcontainer.h
showthreads.o: ../../core/lastcontainer.h ../../core/cur.h
showthreads.o: ../../core/session.h ../../core/plugindata.h
showthreads.o: ../../core/rebus.h ../../core/mounts.h ../../core/mount.h
showthreads.o: ../../core/mountparser.h ../../core/users.h
showthreads.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
showthreads.o: ../../core/thumb.h ../../core/basethread.h
showthreads.o: ../../core/synchro.h tdb.h thread.h ../../db/dbbase.h
showthreads.o: threadinfo.h
showthreads.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h
showthreads.o: ../../core/users.h ../../core/groups.h ../../core/group.h
showthreads.o: ../../core/loadavg.h ../../core/thumb.h
showthreads.o: ../../core/basethread.h ../../core/synchro.h tdb.h thread.h
showthreads.o: ../../db/dbbase.h threadinfo.h
tdb.o: tdb.h thread.h ../../db/dbbase.h ../../core/error.h ../../core/log.h
tdb.o: ../../core/textstream.h ../../core/log.h
templates.o: threadinfo.h ../../core/item.h ../../core/system.h
@@ -238,17 +239,18 @@ templates.o: ../../core/cur.h ../../core/session.h ../../core/error.h
templates.o: ../../core/plugindata.h ../../core/rebus.h ../../core/mounts.h
templates.o: ../../core/mount.h ../../core/mountparser.h ../../core/config.h
templates.o: ../../core/confparser.h ../../core/htmlfilter.h
templates.o: ../../core/users.h ../../core/groups.h ../../core/group.h
templates.o: ../../core/loadavg.h ../../core/thumb.h ../../core/basethread.h
templates.o: thread.h tdb.h ../../db/dbbase.h reply.h
templates.o: ../../functions/functionbase.h ../../core/request.h
templates.o: ../../core/requesttypes.h ../../templates/htmltextstream.h
templates.o: ../../core/synchro.h funthread.h createthread.h showthreads.h
templates.o: ../../core/misc.h ../../core/plugin.h pluginmsg.h
templates.o: ../../core/system.h ../../core/sessionmanager.h
templates.o: ../../core/sessioncontainer.h ../../functions/functions.h
templates.o: ../../functions/functionbase.h ../../functions/functionparser.h
templates.o: ../../core/cur.h ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../core/crypt.h ../../core/run.h ../../core/users.h
templates.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
templates.o: ../../core/thumb.h ../../core/basethread.h thread.h tdb.h
templates.o: ../../db/dbbase.h reply.h ../../functions/functionbase.h
templates.o: ../../core/request.h ../../core/requesttypes.h
templates.o: ../../templates/htmltextstream.h ../../core/synchro.h
templates.o: funthread.h createthread.h showthreads.h ../../core/misc.h
templates.o: ../../core/plugin.h pluginmsg.h ../../core/system.h
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
templates.o: ../../functions/functions.h ../../functions/functionbase.h
templates.o: ../../functions/functionparser.h ../../core/cur.h
templates.o: ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../functions/chmod.h ../../functions/privchanger.h
templates.o: ../../functions/chown.h ../../functions/ckeditor.h
templates.o: ../../functions/cp.h ../../functions/default.h
@@ -258,14 +260,13 @@ templates.o: ../../functions/logout.h ../../functions/ln.h
templates.o: ../../functions/ls.h ../../functions/mkdir.h
templates.o: ../../functions/mv.h ../../functions/node.h
templates.o: ../../functions/priv.h ../../functions/reload.h
templates.o: ../../functions/rm.h ../../functions/run.h
templates.o: ../../functions/specialdefault.h ../../functions/stat.h
templates.o: ../../functions/subject.h ../../functions/template.h
templates.o: ../../functions/tinymce.h ../../functions/uname.h
templates.o: ../../functions/upload.h ../../functions/uptime.h
templates.o: ../../functions/who.h ../../functions/vim.h
templates.o: ../../core/htmlfilter.h ../../templates/templates.h
templates.o: ../../templates/patterncacher.h
templates.o: ../../functions/rm.h ../../functions/specialdefault.h
templates.o: ../../functions/stat.h ../../functions/subject.h
templates.o: ../../functions/template.h ../../functions/tinymce.h
templates.o: ../../functions/uname.h ../../functions/upload.h
templates.o: ../../functions/uptime.h ../../functions/who.h
templates.o: ../../functions/vim.h ../../core/htmlfilter.h
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
templates.o: ../../templates/ckeditorgetparser.h
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
@@ -293,6 +294,7 @@ threadinfo.o: ../../core/cur.h ../../core/session.h ../../core/error.h
threadinfo.o: ../../core/plugindata.h ../../core/rebus.h ../../core/mounts.h
threadinfo.o: ../../core/mount.h ../../core/mountparser.h ../../core/config.h
threadinfo.o: ../../core/confparser.h ../../core/htmlfilter.h
threadinfo.o: ../../core/users.h ../../core/groups.h ../../core/group.h
threadinfo.o: ../../core/loadavg.h ../../core/thumb.h ../../core/basethread.h
threadinfo.o: thread.h tdb.h ../../db/dbbase.h
threadinfo.o: ../../core/crypt.h ../../core/run.h ../../core/users.h
threadinfo.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
threadinfo.o: ../../core/thumb.h ../../core/basethread.h thread.h tdb.h
threadinfo.o: ../../db/dbbase.h

View File

@@ -50,6 +50,18 @@ return true;
}
void CreateThread::SendNotify(const Item & item)
{
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_ADD;
notify_msg.template_index = thread_info->template_index;
notify_msg.dir_link = config->base_url;
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
notify_msg.item_link = notify_msg.dir_link;
notify_msg.item_link += item.url;
system->notify.ItemChanged(notify_msg);
}
void CreateThread::MakePost()
@@ -77,6 +89,7 @@ void CreateThread::MakePost()
{
log << log2 << "CreateThread: added a new thread" << logend;
system->RedirectTo(cur->request->item);
SendNotify(cur->request->item);
}
else
{

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