Compare commits
304 Commits
0.4.7
...
337f563bd4
| Author | SHA1 | Date | |
|---|---|---|---|
| 337f563bd4 | |||
| c9fe09ebe3 | |||
| db1c63a350 | |||
| 7cc2dcd1fc | |||
| bcde392ce3 | |||
| 8d046f6280 | |||
| 9a6696699f | |||
| 56f2eec597 | |||
| d29b33532d | |||
| a16e82bf54 | |||
| 46c17cc441 | |||
| 2099092e16 | |||
| 88b7517337 | |||
| 619236329c | |||
| 76160a5ba6 | |||
| e95f32231a | |||
| be81307faa | |||
| 177e58da4e | |||
| 4c2efc08fd | |||
| ae03922491 | |||
| ab005118ba | |||
| eec8635af4 | |||
| 5060997d2a | |||
| 0ac5a21a14 | |||
| def0f8d144 | |||
| 8895f0dcac | |||
| 4f8db81c85 | |||
| aa388e248d | |||
| e5d7403c54 | |||
| 4f57d6134c | |||
| 03f6b54a5b | |||
| 63ef007ca1 | |||
| 603e0679e7 | |||
| b90445de4a | |||
| 491dd27ebf | |||
| 89d303f375 | |||
| a2ffc1e81c | |||
| a7c47140ae | |||
| ebd7f85fdb | |||
| 833c04776f | |||
| 919c2f62f5 | |||
| 8f6004d444 | |||
| 1b8f5dc673 | |||
| 027a8ec428 | |||
| d1e7765e98 | |||
| 2d1b2e6b6e | |||
| 350fc551e5 | |||
| 1c05c31721 | |||
| 08123fe6ac | |||
| 35b93b1655 | |||
| 436a198c36 | |||
| aa58faf145 | |||
| dcc6d35cba | |||
| 3f29cdc01e | |||
| ba7d55b7c1 | |||
| 6252a0e732 | |||
| ca14b1a427 | |||
| b01db89942 | |||
| fd421c54e3 | |||
| 55992b5066 | |||
| a5dfc9974f | |||
| 7b4a17c934 | |||
| c2a1097dd5 | |||
| ccf78dcb02 | |||
| 3eff400d88 | |||
| 5ab816b5be | |||
| e57840faed | |||
| 240bf4dc5d | |||
| abd1500f07 | |||
| 42144bb31c | |||
| 7ed41a03ae | |||
| 1286ceeddf | |||
| 145efe937c | |||
| ed5adb3f23 | |||
| 7d0508961e | |||
| e53e2e6af9 | |||
| 4fafd2a478 | |||
| f15da4d049 | |||
| 057607f9e5 | |||
| c433b3fd41 | |||
| 632b49ab90 | |||
| f54df8d600 | |||
| d8451ceaa0 | |||
| 62f178c2ee | |||
| eb4e7343e7 | |||
| 5274e8e8ff | |||
| ae2a885d6c | |||
| 901663b145 | |||
| dc301d4c50 | |||
| 34f0535a26 | |||
| af0e2a778d | |||
| 904f1e70f2 | |||
| ddf7ef30ad | |||
| 0a43870e76 | |||
| f875bd2944 | |||
| c9bf20201b | |||
| 76314aab10 | |||
| 3547d326b8 | |||
| 0ecb2ac70e | |||
| 8f8defe0de | |||
| db5572e864 | |||
| 1100cf75d7 | |||
| 4fda06b547 | |||
| fb18b2238e | |||
| 5266a7e4e5 | |||
| 8196fb77d1 | |||
| 4abf6642f7 | |||
| e3284dcfbc | |||
| f064ff6b3d | |||
| bfa5d8cc05 | |||
| 6614919c13 | |||
| 8379acdb7f | |||
| 160ddc258d | |||
| 01892d2766 | |||
| 222955a2e7 | |||
| 37b22c3559 | |||
| afbd522362 | |||
| a4bed3ab14 | |||
| 7468e7a36c | |||
| 145445c713 | |||
| 7fa9314c6b | |||
| 5d37b6c6ae | |||
| fe1f84e29d | |||
| 83e27a6653 | |||
| ee9c68b04e | |||
| c04874397b | |||
| 375604edd6 | |||
| 3e32f3784f | |||
| 5c4a54d998 | |||
| 3af3ac3f6f | |||
| d801f53154 | |||
| a6b06f82e9 | |||
| b7f3f84080 | |||
| 26715bdd4c | |||
| 083fa7857f | |||
| 9ffda3e070 | |||
| 81160dbbe9 | |||
| 7c266b85e2 | |||
| 48cdca7549 | |||
| 1c401eae3b | |||
| 0e9eb30b5d | |||
| c10c9393c0 | |||
| 8705b3437c | |||
| aed891764a | |||
| 495499d12f | |||
| 8d9a021eab | |||
| be6e09c5af | |||
| 293e426ed4 | |||
| 60f2337b73 | |||
| ce8152de2f | |||
| 496a1979d2 | |||
| fd698ca7b9 | |||
| b4b368d324 | |||
| 825694c880 | |||
| 32750a7d50 | |||
| 0045c6c72c | |||
| 4809016b78 | |||
| 6e2ba65524 | |||
| 8033ac66c4 | |||
| 9ef3736989 | |||
| 099dd55d0c | |||
| 53b4175d00 | |||
| 8aa6f08e08 | |||
| c5024598cb | |||
| dfcf6b29c0 | |||
| 7f48d1eb2e | |||
| eaa97995d2 | |||
| 14f997b844 | |||
| 26e87b20b1 | |||
| 5cdf6eff36 | |||
| 4ed535a3b7 | |||
| da15323c2f | |||
| bd1f717b4c | |||
| 72013046fc | |||
| 14ae19143f | |||
| d8260d8383 | |||
| 9174555ff8 | |||
| 0c6ddc2218 | |||
| 43b4075b16 | |||
| 8f8e44fee5 | |||
| 260c12894d | |||
| adf273479a | |||
| 54480da405 | |||
| 90261b2005 | |||
| cc71c225a3 | |||
| e739f30088 | |||
| 51d95b49a0 | |||
| b5c155b927 | |||
| 5a5fe1b0cc | |||
| 1c4e010fc1 | |||
| d8d523d983 | |||
| 1c2589a2f2 | |||
| 1ec61ffa11 | |||
| ca0a5c9cbe | |||
| 8dd31e737f | |||
| e98cca7fbc | |||
| 9830b0a50f | |||
| f76a0ca3e9 | |||
| 5a6d1991ac | |||
| 329e2d8001 | |||
| 403cca5aad | |||
| b8ff5d4cfc | |||
| 54e6c07efc | |||
| d11cda3577 | |||
| abafb80caf | |||
| e0dd85ca99 | |||
| 2c38fe180e | |||
| 0d0f12b394 | |||
| 86d6c96aeb | |||
| b605fb0a77 | |||
| ec773e5f29 | |||
| 9d5d088b4a | |||
| 1b858f5782 | |||
| 5b845f1d03 | |||
| db9d381a43 | |||
| 0df088e1e2 | |||
| 67099d5d06 | |||
| 07e8e0c63c | |||
| ecc89d8596 | |||
| c94b0311b6 | |||
| fc33b4f882 | |||
| 1da1eef768 | |||
| baf10a9ba9 | |||
| bcea4f9464 | |||
| 920290e9dc | |||
| 1d83cf42a1 | |||
| 09bfdf9e77 | |||
| e83fd91423 | |||
| 70421b7bd1 | |||
| 71ae70f670 | |||
| b1b3cea64e | |||
| 2712c57f15 | |||
| 0b528c7225 | |||
| b7007da5a9 | |||
| 489310ba1c | |||
| 6c2c12fe5e | |||
| e61f0db57e | |||
| 3e3546a2fd | |||
| d2fa3b7171 | |||
| 0e9f587591 | |||
| 9208b15167 | |||
| a45fb30e0a | |||
| 97c7edafd6 | |||
| 1a51b1adc7 | |||
| 9d2be5c50d | |||
| f381f24402 | |||
| f6db85fcdb | |||
| 9687d5cd66 | |||
| 6e2d00bc5b | |||
| 5aaab89cd8 | |||
| 7407d24586 | |||
| c9931da5ba | |||
| 4311f06ade | |||
| 8b64b5d372 | |||
| 631ca4f8a3 | |||
| 424618de38 | |||
| b2d3ca9543 | |||
| cb33f20a24 | |||
| 973d804db2 | |||
| 84eaa6b7b6 | |||
| f967a428ce | |||
| 543d464cbc | |||
| 43470b2a41 | |||
| fa05e25a9d | |||
| fe2f1605f1 | |||
| 48b5c167bf | |||
| 08a0a36dfd | |||
| d135c31ca0 | |||
| dce68221ad | |||
| 93273bd470 | |||
| 92f7c11999 | |||
| 024ce8e73c | |||
| 7902389ef1 | |||
| 1e9ab2f805 | |||
| 0550212b64 | |||
| c7b6ca67a2 | |||
| 9dae2de2fa | |||
| 968593106e | |||
| 302cb0130d | |||
| 89efaa790f | |||
| 60f0e62c23 | |||
| f113e2ef31 | |||
| 39923d6617 | |||
| 72be443414 | |||
| 392e8060ba | |||
| 8c01b0f6c0 | |||
| b984475e49 | |||
| 4f114ea33c | |||
| 5b8a9c0108 | |||
| ee6500ac65 | |||
| 3b2a1c3f25 | |||
| 4d87359aca | |||
| c37c1ff812 | |||
| 1812a2e9ad | |||
| ccc02f41bf | |||
| eaf10c70b7 | |||
| 06f42dd9cb | |||
| 1d6ff73aad | |||
| 700a6fe643 | |||
| 0a7432b059 | |||
| b369fda1d9 | |||
| c49c35cfbd | |||
| fb4742e165 | |||
| fce45b93a2 |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.cproject
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
winixd/winix
|
||||||
106
Makefile
106
Makefile
@@ -1,106 +0,0 @@
|
|||||||
# 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 -DEZC_HAS_SPECIAL_STREAM
|
|
||||||
endif
|
|
||||||
|
|
||||||
export CXX
|
|
||||||
export CXXFLAGS
|
|
||||||
|
|
||||||
|
|
||||||
all: winix.so plugins winix
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
winix.so: FORCE
|
|
||||||
@cd core ; $(MAKE) -e
|
|
||||||
@cd db ; $(MAKE) -e
|
|
||||||
@cd functions ; $(MAKE) -e
|
|
||||||
@cd notify ; $(MAKE) -e
|
|
||||||
@cd templates ; $(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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 plugins/gallery ; $(MAKE) -e depend
|
|
||||||
@cd plugins/groupitem ; $(MAKE) -e depend
|
|
||||||
@cd ../ezc/src ; $(MAKE) -e depend
|
|
||||||
@cd main ; $(MAKE) -e depend
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
install: all
|
|
||||||
# binaries
|
|
||||||
mkdir -p /usr/local/winix/bin
|
|
||||||
cp winix.so /usr/local/winix/bin
|
|
||||||
# use the full path with winix.so (we have to recompile winix with a new path to winix.so)
|
|
||||||
$(CXX) -o /usr/local/winix/bin/winix $(CXXFLAGS) main/*.o /usr/local/winix/bin/winix.so
|
|
||||||
# html templates
|
|
||||||
mkdir -p /usr/local/winix/html
|
|
||||||
cp -rf html/ /usr/local/winix/html/
|
|
||||||
find /usr/local/winix/html/ -type d -name ".svn" | xargs -I foo rm -fr foo
|
|
||||||
# txt templates
|
|
||||||
mkdir -p /usr/local/winix/txt
|
|
||||||
cp -rf txt/ /usr/local/winix/txt/
|
|
||||||
find /usr/local/winix/txt/ -type d -name ".svn" | xargs -I foo rm -fr foo
|
|
||||||
# locales
|
|
||||||
mkdir -p /usr/local/winix/locale
|
|
||||||
cp -rf locale/ /usr/local/winix/locale/
|
|
||||||
find /usr/local/winix/locale/ -type d -name ".svn" | xargs -I foo rm -fr foo
|
|
||||||
# plugins
|
|
||||||
mkdir -p /usr/local/winix/plugins
|
|
||||||
find plugins/ -name "*.so" | xargs -I foo cp foo /usr/local/winix/plugins/
|
|
||||||
# removed provileges for others
|
|
||||||
find /usr/local/winix -exec chmod o-r,o-x,o-w "{}" "+"
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
include Makefile.o.dep
|
|
||||||
|
|
||||||
|
|
||||||
all: $(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
|
|
||||||
|
|
||||||
include Makefile.dep
|
|
||||||
@@ -1,399 +0,0 @@
|
|||||||
# DO NOT DELETE
|
|
||||||
|
|
||||||
acceptbaseparser.o: acceptbaseparser.h
|
|
||||||
app.o: app.h config.h confparser.h htmlfilter.h system.h dirs.h item.h
|
|
||||||
app.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
|
||||||
app.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h log.h
|
|
||||||
app.o: textstream.h ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
app.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
app.o: ../core/ugcontainer.h request.h requesttypes.h error.h
|
|
||||||
app.o: ../templates/htmltextstream.h ../notify/notify.h
|
|
||||||
app.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
app.o: ../templates/misc.h ../templates/localefilter.h ../templates/locale.h
|
|
||||||
app.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
app.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
app.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
app.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
app.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
|
||||||
app.o: ../core/config.h ../core/users.h user.h ugcontainer.h lastcontainer.h
|
|
||||||
app.o: cur.h session.h plugindata.h rebus.h mounts.h mount.h mountparser.h
|
|
||||||
app.o: 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
|
|
||||||
app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
|
||||||
app.o: ../functions/privchanger.h ../functions/chown.h
|
|
||||||
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
|
||||||
app.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
|
||||||
app.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
|
||||||
app.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
|
||||||
app.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
|
|
||||||
app.o: ../functions/rm.h ../functions/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
|
|
||||||
config.o: config.h confparser.h htmlfilter.h log.h textstream.h plugin.h
|
|
||||||
config.o: pluginmsg.h plugindata.h request.h requesttypes.h item.h error.h
|
|
||||||
config.o: ../templates/htmltextstream.h ../core/textstream.h misc.h system.h
|
|
||||||
config.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
|
||||||
config.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
|
|
||||||
config.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
config.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
|
|
||||||
config.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
config.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
config.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
config.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
config.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
config.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
config.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
|
||||||
config.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
|
|
||||||
config.o: ugcontainer.h lastcontainer.h cur.h session.h rebus.h mounts.h
|
|
||||||
config.o: mount.h mountparser.h 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
|
|
||||||
config.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
|
||||||
config.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
|
||||||
config.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
|
||||||
config.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
|
||||||
config.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
|
|
||||||
config.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
|
|
||||||
config.o: ../functions/reload.h ../functions/rm.h
|
|
||||||
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
|
|
||||||
config.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
|
||||||
config.o: ../core/htmlfilter.h ../templates/templates.h
|
|
||||||
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
|
|
||||||
dirs.o: log.h textstream.h ../db/dbitemquery.h ../core/item.h
|
|
||||||
dirs.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
dirs.o: ../core/dircontainer.h ../core/ugcontainer.h request.h requesttypes.h
|
|
||||||
dirs.o: error.h config.h confparser.h htmlfilter.h
|
|
||||||
dirs.o: ../templates/htmltextstream.h ../notify/notify.h
|
|
||||||
dirs.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
dirs.o: ../templates/misc.h ../templates/localefilter.h ../templates/locale.h
|
|
||||||
dirs.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
dirs.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
dirs.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
dirs.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
dirs.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
|
||||||
dirs.o: ../core/config.h ../core/users.h user.h ugcontainer.h lastcontainer.h
|
|
||||||
dirs.o: cur.h session.h plugindata.h rebus.h
|
|
||||||
groups.o: groups.h group.h ugcontainer.h ../db/db.h ../db/dbbase.h
|
|
||||||
groups.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
|
|
||||||
groups.o: item.h ../core/error.h log.h textstream.h ../db/dbitemquery.h
|
|
||||||
groups.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
groups.o: ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
htmlfilter.o: htmlfilter.h
|
|
||||||
httpsimpleparser.o: httpsimpleparser.h
|
|
||||||
item.o: item.h misc.h
|
|
||||||
lastcontainer.o: lastcontainer.h log.h textstream.h misc.h item.h
|
|
||||||
loadavg.o: loadavg.h log.h textstream.h
|
|
||||||
log.o: log.h textstream.h ../../ezc/src/utf8.h
|
|
||||||
misc.o: misc.h item.h log.h textstream.h ../templates/templates.h
|
|
||||||
misc.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
misc.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
misc.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
misc.o: ../templates/patterncacher.h ../core/item.h
|
|
||||||
misc.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
|
||||||
misc.o: ../core/log.h ../templates/indexpatterns.h
|
|
||||||
misc.o: ../templates/localefilter.h ../templates/locale.h ../core/config.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
|
|
||||||
mount.o: mount.h misc.h item.h
|
|
||||||
mountparser.o: mountparser.h mount.h item.h error.h dirs.h dircontainer.h
|
|
||||||
mountparser.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
|
|
||||||
mountparser.o: ../core/textstream.h misc.h ../core/error.h log.h textstream.h
|
|
||||||
mountparser.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
mountparser.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
mountparser.o: ../core/ugcontainer.h request.h requesttypes.h config.h
|
|
||||||
mountparser.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
mountparser.o: ../notify/notify.h ../notify/notifypool.h
|
|
||||||
mountparser.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
mountparser.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
mountparser.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
mountparser.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
mountparser.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
mountparser.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
mountparser.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
|
||||||
mountparser.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
|
||||||
mountparser.o: user.h ugcontainer.h lastcontainer.h cur.h session.h
|
|
||||||
mountparser.o: plugindata.h rebus.h
|
|
||||||
mounts.o: mounts.h mount.h error.h dirs.h item.h dircontainer.h ../db/db.h
|
|
||||||
mounts.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
|
|
||||||
mounts.o: ../core/textstream.h misc.h ../core/error.h log.h textstream.h
|
|
||||||
mounts.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
mounts.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
mounts.o: ../core/ugcontainer.h request.h requesttypes.h config.h
|
|
||||||
mounts.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
mounts.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
mounts.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
mounts.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
mounts.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
mounts.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
mounts.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
mounts.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
mounts.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
|
||||||
mounts.o: ../core/config.h ../core/users.h user.h ugcontainer.h
|
|
||||||
mounts.o: lastcontainer.h cur.h session.h plugindata.h rebus.h mountparser.h
|
|
||||||
mounts.o: plugin.h pluginmsg.h system.h 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
|
|
||||||
mounts.o: ../core/htmlfilter.h ../templates/templates.h
|
|
||||||
mounts.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
|
||||||
mounts.o: ../core/httpsimpleparser.h ../core/log.h
|
|
||||||
mounts.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
|
||||||
plugin.o: plugin.h pluginmsg.h log.h textstream.h plugindata.h config.h
|
|
||||||
plugin.o: confparser.h htmlfilter.h request.h requesttypes.h item.h error.h
|
|
||||||
plugin.o: ../templates/htmltextstream.h ../core/textstream.h misc.h system.h
|
|
||||||
plugin.o: dirs.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
|
||||||
plugin.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
|
|
||||||
plugin.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
plugin.o: ../core/dircontainer.h ../core/ugcontainer.h ../notify/notify.h
|
|
||||||
plugin.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
plugin.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
plugin.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
plugin.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
plugin.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
plugin.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
plugin.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
|
||||||
plugin.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
|
|
||||||
plugin.o: ugcontainer.h lastcontainer.h cur.h session.h rebus.h mounts.h
|
|
||||||
plugin.o: mount.h mountparser.h 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
|
|
||||||
plugin.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
|
||||||
plugin.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
|
||||||
plugin.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
|
||||||
plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
|
||||||
plugin.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
|
|
||||||
plugin.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
|
|
||||||
plugin.o: ../functions/reload.h ../functions/rm.h
|
|
||||||
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
|
|
||||||
plugin.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
|
||||||
plugin.o: ../core/htmlfilter.h ../templates/templates.h
|
|
||||||
plugin.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
|
||||||
plugin.o: ../core/httpsimpleparser.h ../core/log.h
|
|
||||||
plugin.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
|
||||||
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h config.h
|
|
||||||
plugindata.o: confparser.h htmlfilter.h request.h requesttypes.h item.h
|
|
||||||
plugindata.o: error.h ../templates/htmltextstream.h ../core/textstream.h
|
|
||||||
plugindata.o: misc.h system.h dirs.h dircontainer.h ../db/db.h ../db/dbbase.h
|
|
||||||
plugindata.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
|
|
||||||
plugindata.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
plugindata.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
plugindata.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
plugindata.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
plugindata.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
plugindata.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
plugindata.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
plugindata.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
plugindata.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
plugindata.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
|
||||||
plugindata.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
|
||||||
plugindata.o: user.h ugcontainer.h lastcontainer.h cur.h session.h rebus.h
|
|
||||||
plugindata.o: mounts.h mount.h mountparser.h 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
|
|
||||||
plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
|
||||||
plugindata.o: ../functions/privchanger.h ../functions/chown.h
|
|
||||||
plugindata.o: ../functions/ckeditor.h ../functions/cp.h
|
|
||||||
plugindata.o: ../functions/default.h ../functions/download.h
|
|
||||||
plugindata.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
|
|
||||||
plugindata.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
|
||||||
plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
|
||||||
plugindata.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
|
||||||
plugindata.o: ../functions/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
|
|
||||||
rebus.o: log.h textstream.h rebus.h misc.h item.h cur.h request.h
|
|
||||||
rebus.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
|
|
||||||
rebus.o: ../templates/htmltextstream.h ../core/textstream.h session.h user.h
|
|
||||||
rebus.o: plugindata.h
|
|
||||||
request.o: request.h requesttypes.h item.h error.h config.h confparser.h
|
|
||||||
request.o: htmlfilter.h textstream.h ../templates/htmltextstream.h
|
|
||||||
request.o: ../core/textstream.h misc.h log.h plugin.h pluginmsg.h
|
|
||||||
request.o: plugindata.h system.h dirs.h dircontainer.h ../db/db.h
|
|
||||||
request.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
|
|
||||||
request.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
request.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
request.o: ../core/ugcontainer.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
request.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
request.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
request.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
request.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
request.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
request.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
request.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
|
||||||
request.o: ../core/config.h ../core/users.h user.h ugcontainer.h
|
|
||||||
request.o: lastcontainer.h cur.h session.h rebus.h mounts.h mount.h
|
|
||||||
request.o: mountparser.h 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
|
|
||||||
request.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
|
||||||
request.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
|
||||||
request.o: ../functions/default.h ../functions/download.h
|
|
||||||
request.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
|
|
||||||
request.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
|
||||||
request.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
|
||||||
request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
|
||||||
request.o: ../functions/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
|
|
||||||
sessioncontainer.o: config.h confparser.h htmlfilter.h textstream.h
|
|
||||||
sessioncontainer.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
|
|
||||||
sessioncontainer.o: log.h
|
|
||||||
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
|
|
||||||
sessionmanager.o: error.h user.h plugindata.h rebus.h cur.h request.h
|
|
||||||
sessionmanager.o: requesttypes.h config.h confparser.h htmlfilter.h
|
|
||||||
sessionmanager.o: textstream.h ../templates/htmltextstream.h
|
|
||||||
sessionmanager.o: ../core/textstream.h misc.h lastcontainer.h system.h dirs.h
|
|
||||||
sessionmanager.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
|
||||||
sessionmanager.o: ../db/dbtextstream.h ../core/error.h log.h
|
|
||||||
sessionmanager.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
|
|
||||||
sessionmanager.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
sessionmanager.o: ../core/ugcontainer.h ../notify/notify.h
|
|
||||||
sessionmanager.o: ../notify/notifypool.h ../templates/locale.h
|
|
||||||
sessionmanager.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
sessionmanager.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
sessionmanager.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
sessionmanager.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
sessionmanager.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
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 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
|
|
||||||
sessionmanager.o: ../functions/chown.h ../functions/ckeditor.h
|
|
||||||
sessionmanager.o: ../functions/cp.h ../functions/default.h
|
|
||||||
sessionmanager.o: ../functions/download.h ../functions/emacs.h
|
|
||||||
sessionmanager.o: ../functions/last.h ../functions/login.h
|
|
||||||
sessionmanager.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
|
||||||
sessionmanager.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
|
||||||
sessionmanager.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
|
||||||
sessionmanager.o: ../functions/specialdefault.h ../functions/stat.h
|
|
||||||
sessionmanager.o: ../functions/subject.h ../functions/template.h
|
|
||||||
sessionmanager.o: ../functions/tinymce.h ../functions/uname.h
|
|
||||||
sessionmanager.o: ../functions/upload.h ../functions/uptime.h
|
|
||||||
sessionmanager.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
|
|
||||||
sessionmanager.o: ../templates/templates.h ../templates/patterncacher.h
|
|
||||||
sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
|
||||||
sessionmanager.o: ../core/log.h ../templates/indexpatterns.h
|
|
||||||
sessionmanager.o: ../core/sessionmanager.h
|
|
||||||
sessionparser.o: sessionparser.h session.h item.h error.h user.h plugindata.h
|
|
||||||
sessionparser.o: rebus.h sessioncontainer.h cur.h request.h requesttypes.h
|
|
||||||
sessionparser.o: config.h confparser.h htmlfilter.h textstream.h
|
|
||||||
sessionparser.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
|
|
||||||
sessionparser.o: users.h log.h
|
|
||||||
synchro.o: synchro.h
|
|
||||||
system.o: system.h dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h
|
|
||||||
system.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
|
|
||||||
system.o: ../core/error.h log.h textstream.h ../db/dbitemquery.h
|
|
||||||
system.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
system.o: ../core/dircontainer.h ../core/ugcontainer.h request.h
|
|
||||||
system.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
|
|
||||||
system.o: ../templates/htmltextstream.h ../notify/notify.h
|
|
||||||
system.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
system.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
system.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
system.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
system.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h
|
|
||||||
system.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
system.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
|
||||||
system.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h user.h
|
|
||||||
system.o: ugcontainer.h lastcontainer.h cur.h session.h plugindata.h rebus.h
|
|
||||||
system.o: mounts.h mount.h mountparser.h 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 ../core/htmlfilter.h
|
|
||||||
system.o: ../functions/functionbase.h ../core/request.h ../core/synchro.h
|
|
||||||
textstream.o: textstream.h misc.h item.h
|
|
||||||
thumb.o: thumb.h basethread.h textstream.h ../db/db.h ../db/dbbase.h
|
|
||||||
thumb.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
|
|
||||||
thumb.o: item.h ../core/error.h log.h ../db/dbitemquery.h ../core/item.h
|
|
||||||
thumb.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
thumb.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/config.h
|
|
||||||
thumb.o: ../../ezc/src/utf8.h system.h dirs.h dircontainer.h request.h
|
|
||||||
thumb.o: requesttypes.h error.h config.h confparser.h htmlfilter.h
|
|
||||||
thumb.o: ../templates/htmltextstream.h ../notify/notify.h
|
|
||||||
thumb.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
thumb.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
thumb.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
|
||||||
thumb.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
|
||||||
thumb.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
|
||||||
thumb.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
thumb.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
|
||||||
thumb.o: ../core/users.h user.h ugcontainer.h lastcontainer.h cur.h session.h
|
|
||||||
thumb.o: plugindata.h rebus.h mounts.h mount.h mountparser.h crypt.h run.h
|
|
||||||
thumb.o: users.h groups.h group.h loadavg.h
|
|
||||||
users.o: users.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "acceptbaseparser.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool AcceptBaseParser::IsWhite(int c)
|
|
||||||
{
|
|
||||||
if( c==' ' || c=='\t' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::SkipWhite()
|
|
||||||
{
|
|
||||||
while( IsWhite(*text) )
|
|
||||||
++text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::RemoveWhiteFromEnd(std::string & str)
|
|
||||||
{
|
|
||||||
if( str.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
size_t i = str.size() - 1;
|
|
||||||
|
|
||||||
for( ; i!=0 && IsWhite(str[i]) ; --i);
|
|
||||||
|
|
||||||
if( !IsWhite(str[i]) )
|
|
||||||
++i;
|
|
||||||
|
|
||||||
if( i < str.size() )
|
|
||||||
str.erase(i); // erasing until the end of the string
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::ReadParameter()
|
|
||||||
{
|
|
||||||
param.clear();
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
while( *text!=0 && *text!=',' && *text!=';' )
|
|
||||||
{
|
|
||||||
param += *text;
|
|
||||||
++text;
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoveWhiteFromEnd(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::ReadQ()
|
|
||||||
{
|
|
||||||
q = 1.0;
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( *text != ';' )
|
|
||||||
return;
|
|
||||||
|
|
||||||
++text; // skipping a semicolon
|
|
||||||
|
|
||||||
while( *text!=0 && *text!=',' && *text!='=' )
|
|
||||||
// skipping until ',' or '='
|
|
||||||
++text;
|
|
||||||
|
|
||||||
if( *text==0 || *text==',' )
|
|
||||||
return;
|
|
||||||
|
|
||||||
++text; // skipping '='
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
q = strtod(text, (char**)&text);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::SkipParam()
|
|
||||||
{
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( *text == ',' )
|
|
||||||
++text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AcceptBaseParser::Parse(const char * str)
|
|
||||||
{
|
|
||||||
text = str;
|
|
||||||
Init();
|
|
||||||
|
|
||||||
while( *text != 0 )
|
|
||||||
{
|
|
||||||
ReadParameter();
|
|
||||||
ReadQ();
|
|
||||||
SkipParam();
|
|
||||||
Param(param, q);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_acceptbaseparser
|
|
||||||
#define headerfile_winix_core_acceptbaseparser
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// sample (you must create your own class derived from this one):
|
|
||||||
// object.Parse(" text/html ; , ; q = 45, application / xhtml+xml ; q = 0.4 , application/xml ; q = 0.9 , */* ; q = 0.8 ");
|
|
||||||
class AcceptBaseParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
void Parse(const char * str);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
virtual void Init() {} ;
|
|
||||||
virtual void Param(const std::string & param, double q) = 0;
|
|
||||||
|
|
||||||
bool IsWhite(int c);
|
|
||||||
void SkipWhite();
|
|
||||||
void RemoveWhiteFromEnd(std::string & str);
|
|
||||||
void ReadParameter();
|
|
||||||
void ReadQ();
|
|
||||||
void SkipParam();
|
|
||||||
|
|
||||||
|
|
||||||
const char * text;
|
|
||||||
std::string param;
|
|
||||||
double q;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_acceptencodingparser
|
|
||||||
#define headerfile_winix_core_acceptencodingparser
|
|
||||||
|
|
||||||
#include "acceptbaseparser.h"
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
|
|
||||||
class AcceptEncodingParser : public AcceptBaseParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
bool AcceptDeflate()
|
|
||||||
{
|
|
||||||
return accept_deflate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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.0 )
|
|
||||||
{
|
|
||||||
accept_deflate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( param=="gzip" && q!=0.0 )
|
|
||||||
{
|
|
||||||
accept_gzip = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool accept_deflate;
|
|
||||||
bool accept_gzip;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
1123
core/app.cpp
1123
core/app.cpp
File diff suppressed because it is too large
Load Diff
180
core/app.h
180
core/app.h
@@ -1,180 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_app
|
|
||||||
#define headerfile_winix_core_app
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <ctime>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <grp.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "system.h"
|
|
||||||
#include "mounts.h"
|
|
||||||
#include "request.h"
|
|
||||||
#include "synchro.h"
|
|
||||||
#include "sessionmanager.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
#include "functions/functions.h"
|
|
||||||
#include "templates/templates.h"
|
|
||||||
#include "compress.h"
|
|
||||||
#include "getparser.h"
|
|
||||||
#include "postparser.h"
|
|
||||||
#include "cookieparser.h"
|
|
||||||
#include "postmultiparser.h"
|
|
||||||
#include "acceptencodingparser.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class App
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
App();
|
|
||||||
|
|
||||||
bool InitFCGI();
|
|
||||||
bool DropPrivileges();
|
|
||||||
bool Init();
|
|
||||||
void Start();
|
|
||||||
void Close();
|
|
||||||
void LogUserGroups();
|
|
||||||
bool Demonize();
|
|
||||||
void SetStopSignal();
|
|
||||||
bool WasStopSignal();
|
|
||||||
bool Lock();
|
|
||||||
void Unlock();
|
|
||||||
void StartThreads();
|
|
||||||
void WaitForThreads();
|
|
||||||
|
|
||||||
// configuration read from a config file
|
|
||||||
Config config;
|
|
||||||
|
|
||||||
// pointers to the current request and a session
|
|
||||||
Cur cur;
|
|
||||||
|
|
||||||
// temporary one request object
|
|
||||||
// current request
|
|
||||||
Request req;
|
|
||||||
|
|
||||||
// users sessions
|
|
||||||
SessionManager session_manager;
|
|
||||||
|
|
||||||
// database
|
|
||||||
Db db;
|
|
||||||
DbConn db_conn;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
model
|
|
||||||
*/
|
|
||||||
|
|
||||||
// file system
|
|
||||||
System system;
|
|
||||||
|
|
||||||
// false at the beginning
|
|
||||||
// !! moze to do loggera dac?
|
|
||||||
bool stdout_is_closed;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
controllers
|
|
||||||
(note that the whole app object is actually a controller too)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// functions (ls, cat, emacs, ...)
|
|
||||||
Functions functions;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
view
|
|
||||||
*/
|
|
||||||
|
|
||||||
Templates templates;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
enum Header
|
|
||||||
{
|
|
||||||
h_200,
|
|
||||||
h_404,
|
|
||||||
h_403
|
|
||||||
};
|
|
||||||
|
|
||||||
GetParser get_parser;
|
|
||||||
PostParser post_parser;
|
|
||||||
PostMultiParser post_multi_parser;
|
|
||||||
CookieParser cookie_parser;
|
|
||||||
AcceptEncodingParser accept_encoding_parser;
|
|
||||||
Compress compress;
|
|
||||||
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();
|
|
||||||
bool BaseUrlRedirect();
|
|
||||||
void MakePage();
|
|
||||||
void Make();
|
|
||||||
void SaveSessionsIfNeeded(); // !! wywalic do menagera sesji??
|
|
||||||
void LogAccess();
|
|
||||||
|
|
||||||
void ReadRequest();
|
|
||||||
void SendAnswer();
|
|
||||||
|
|
||||||
void SetEnv(const char * & env, const char * name);
|
|
||||||
void ReadEnvVariables();
|
|
||||||
void ReadGetPostVars();
|
|
||||||
|
|
||||||
void CheckIE();
|
|
||||||
void CheckKonqueror();
|
|
||||||
void CheckRequestMethod();
|
|
||||||
void CheckFCGIRole();
|
|
||||||
|
|
||||||
void PrepareSessionCookie();
|
|
||||||
void AddDebugInfo(std::wstring & out);
|
|
||||||
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);
|
|
||||||
void LogGroup(const char * msg, gid_t id, bool put_logend = true);
|
|
||||||
void LogUsers();
|
|
||||||
void LogEffectiveGroups(std::vector<gid_t> & tab);
|
|
||||||
void LogGroups();
|
|
||||||
bool DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool additional_groups);
|
|
||||||
|
|
||||||
static void * SpecialThreadForSignals(void*);
|
|
||||||
void FetchPageOnExit();
|
|
||||||
|
|
||||||
void CreateStaticTree();
|
|
||||||
|
|
||||||
// !! dodac do session managera?
|
|
||||||
time_t last_sessions_save;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_compress
|
|
||||||
#define headerfile_winix_core_compress
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
class Compress
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Compress();
|
|
||||||
~Compress();
|
|
||||||
|
|
||||||
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();
|
|
||||||
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_raw_deflate, strm_deflate, strm_gzip;
|
|
||||||
bool raw_deflate_inited, deflate_inited, gzip_inited;
|
|
||||||
bool ready_for_compress;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
404
core/config.cpp
404
core/config.cpp
@@ -1,404 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "crypt.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Config::Config()
|
|
||||||
{
|
|
||||||
errors_to_stdout = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//!! czy tu w ogole mozemy uzywac log << ?
|
|
||||||
//!! przeciez jeszcze nie zostal przetworzony plik konfiguracyjny
|
|
||||||
|
|
||||||
|
|
||||||
void Config::ShowError()
|
|
||||||
{
|
|
||||||
|
|
||||||
switch( parser.status )
|
|
||||||
{
|
|
||||||
case ConfParser::ok:
|
|
||||||
log << log2 << "Config: syntax ok" << logend;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ConfParser::cant_open_file:
|
|
||||||
if( errors_to_stdout )
|
|
||||||
std::cout << "Config: cant open a config file: " << config_file << std::endl;
|
|
||||||
|
|
||||||
log << log1 << "Config: cant open a config file: " << config_file << logend;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ConfParser::syntax_error:
|
|
||||||
if( errors_to_stdout )
|
|
||||||
std::cout << "Config: syntax error, line: " << parser.line << std::endl;
|
|
||||||
|
|
||||||
log << log1 << "Config: syntax error, line: " << parser.line << logend;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
|
|
||||||
{
|
|
||||||
errors_to_stdout = errors_to_stdout_;
|
|
||||||
|
|
||||||
if( config_file.empty() )
|
|
||||||
{
|
|
||||||
log << log2 << "Config: name of the config file is empty" << logend;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
log << log2 << "Config: reading a config file" << logend;
|
|
||||||
|
|
||||||
parser.SplitSingle(true);
|
|
||||||
parser.UTF8(true); // config is always read in UTF-8
|
|
||||||
ConfParser::Status status = parser.Parse( config_file );
|
|
||||||
|
|
||||||
|
|
||||||
if( status == ConfParser::ok )
|
|
||||||
{
|
|
||||||
AssignValues(stdout_is_closed);
|
|
||||||
SetAdditionalVariables();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShowError();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Config::AssignValues(bool stdout_is_closed)
|
|
||||||
{
|
|
||||||
demonize = Bool(L"demonize", true);
|
|
||||||
|
|
||||||
user = AText(L"user");
|
|
||||||
group = AText(L"group");
|
|
||||||
additional_groups = Bool(L"additional_groups", true);
|
|
||||||
|
|
||||||
log_file = AText(L"log_file");
|
|
||||||
log_notify_file = AText(L"log_notify_file");
|
|
||||||
log_delimiter = Text(L"log_delimiter", L"---------------------------------------------------------------------------------");
|
|
||||||
fcgi_socket = AText(L"fcgi_socket");
|
|
||||||
fcgi_socket_chmod = Int(L"fcgi_socket_chmod", 0770);
|
|
||||||
fcgi_socket_user = AText(L"fcgi_socket_user");
|
|
||||||
fcgi_socket_group = AText(L"fcgi_socket_group");
|
|
||||||
log_level = Int(L"log_level", 1);
|
|
||||||
log_request = Int(L"log_request", 1);
|
|
||||||
log_save_each_line = Bool(L"log_save_each_line", false);
|
|
||||||
log_stdout = Bool(L"log_stdout", false);
|
|
||||||
log_db_query = Bool(L"log_db_query", false);
|
|
||||||
log_plugin_call = Bool(L"log_plugin_call", false);
|
|
||||||
log_post_value_size = Size(L"log_post_value_size", 80);
|
|
||||||
|
|
||||||
post_file_max = Size(L"post_file_max", 8388608); // 8 MB
|
|
||||||
upload_dir = Text(L"upload_dir");
|
|
||||||
upload_dirs_chmod = Int(L"upload_dirs_chmod", 0750);
|
|
||||||
upload_files_chmod = Int(L"upload_files_chmod", 0640);
|
|
||||||
create_thumb = Bool(L"create_thumb", true);
|
|
||||||
thumb_mode = Int(L"thumb_mode", 2);
|
|
||||||
thumb_cx = Size(L"thumb_cx", 150);
|
|
||||||
thumb_cy = Size(L"thumb_cy", 150);
|
|
||||||
convert_cmd = Text(L"convert_cmd", L"/usr/local/bin/convert");
|
|
||||||
|
|
||||||
templates_dir = Text(L"templates_dir");
|
|
||||||
templates_dir_default = Text(L"templates_dir_default");
|
|
||||||
txt_templates_dir = Text(L"txt_templates_dir");
|
|
||||||
txt_templates_dir_default = Text(L"txt_templates_dir_default");
|
|
||||||
templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_");
|
|
||||||
templates_fun_postfix = Text(L"templates_fun_postfix", L".html");
|
|
||||||
templates_index = Text(L"templates_index", L"index.html");
|
|
||||||
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
|
|
||||||
|
|
||||||
http_session_id_name = AText(L"http_session_id_name");
|
|
||||||
db_database = AText(L"db_database");
|
|
||||||
db_user = AText(L"db_user");
|
|
||||||
db_pass = AText(L"db_pass");
|
|
||||||
item_url_empty = Text(L"item_url_empty");
|
|
||||||
|
|
||||||
base_server = Text(L"base_server");
|
|
||||||
base_url = Text(L"base_url");
|
|
||||||
base_url_static = Text(L"base_url_static");
|
|
||||||
base_url_common = Text(L"base_url_common");
|
|
||||||
|
|
||||||
NoLastSlash(base_server);
|
|
||||||
NoLastSlash(base_url);
|
|
||||||
NoLastSlash(base_url_static);
|
|
||||||
NoLastSlash(base_url_common);
|
|
||||||
|
|
||||||
priv_no_user = Text(L"priv_no_user", L"-- no user --");
|
|
||||||
priv_no_group = Text(L"priv_no_group", L"-- no group --");
|
|
||||||
|
|
||||||
session_max_idle = Int(L"session_max_idle", 10800); // 3h
|
|
||||||
session_remember_max_idle = Int(L"session_remember_max_idle", 16070400); // 3 months
|
|
||||||
session_file = AText(L"session_file");
|
|
||||||
session_max = Size(L"session_max", 1000000);
|
|
||||||
|
|
||||||
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_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", true);
|
|
||||||
html_filter_orphans_mode_str = AText(L"html_filter_orphans_mode_str", L"nbsp");
|
|
||||||
|
|
||||||
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");
|
|
||||||
debug_info = Bool(L"debug_info", false);
|
|
||||||
|
|
||||||
editors_html_safe_mode = Bool(L"editors_html_safe_mode", true);
|
|
||||||
editors_html_safe_mode_skip_root = Bool(L"editors_html_safe_mode_skip_root", true);
|
|
||||||
|
|
||||||
plugins_dir = Text(L"plugins_dir", L"/usr/local/winix/plugins");
|
|
||||||
NoLastSlash(plugins_dir);
|
|
||||||
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);
|
|
||||||
|
|
||||||
utf8 = Bool(L"utf8", true);
|
|
||||||
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_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)
|
|
||||||
{
|
|
||||||
const char http[] = "http://";
|
|
||||||
const char https[] = "https://";
|
|
||||||
size_t http_len = sizeof(http) / sizeof(char) - 1;
|
|
||||||
size_t https_len = sizeof(https) / sizeof(char) - 1;
|
|
||||||
|
|
||||||
if( IsSubString(http, in.c_str()) )
|
|
||||||
out = in.substr(http_len);
|
|
||||||
else
|
|
||||||
if( IsSubString(https, in.c_str()) )
|
|
||||||
out = in.substr(https_len);
|
|
||||||
else
|
|
||||||
out.clear(); // if empty the RequestController::BaseUrlRedirect() returns false and no redirecting will be done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring Config::Text(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return parser.Text(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring Config::Text(const wchar_t * name, const wchar_t * def)
|
|
||||||
{
|
|
||||||
return parser.Text(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring Config::Text(const std::wstring & name, const std::wstring & def)
|
|
||||||
{
|
|
||||||
return parser.Text(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Config::AText(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return parser.AText(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Config::AText(const wchar_t * name, const wchar_t * def)
|
|
||||||
{
|
|
||||||
return parser.AText(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string Config::AText(const std::wstring & name, const std::wstring & def)
|
|
||||||
{
|
|
||||||
return parser.AText(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Config::Int(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return parser.Int(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Config::Int(const wchar_t * name, int def)
|
|
||||||
{
|
|
||||||
return parser.Int(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Config::Int(const std::wstring & name, int def)
|
|
||||||
{
|
|
||||||
return parser.Int(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Config::Size(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return parser.Size(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Config::Size(const wchar_t * name, size_t def)
|
|
||||||
{
|
|
||||||
return parser.Size(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Config::Size(const std::wstring & name, size_t def)
|
|
||||||
{
|
|
||||||
return parser.Size(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Config::Bool(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return parser.Bool(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Config::Bool(const wchar_t * name, bool def)
|
|
||||||
{
|
|
||||||
return parser.Bool(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Config::Bool(const std::wstring & name, bool def)
|
|
||||||
{
|
|
||||||
return parser.Bool(name, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
|
||||||
{
|
|
||||||
parser.ListText(name, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
|
|
||||||
{
|
|
||||||
parser.ListText(name, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Config::Print(std::ostream & out)
|
|
||||||
{
|
|
||||||
parser.Print(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
417
core/config.h
417
core/config.h
@@ -1,417 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_config
|
|
||||||
#define headerfile_winix_core_config
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "confparser.h"
|
|
||||||
#include "htmlfilter.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Config
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// name of the config file
|
|
||||||
// this is the parameter passed to winix programm
|
|
||||||
std::string config_file;
|
|
||||||
|
|
||||||
// start as a demon (in the background)
|
|
||||||
// default: true
|
|
||||||
bool demonize;
|
|
||||||
|
|
||||||
// system user name (to which drop privileges)
|
|
||||||
// used only if winix is started as the root
|
|
||||||
std::string user;
|
|
||||||
|
|
||||||
// system group name (to which drop privileges)
|
|
||||||
// used only if winix is started as the root
|
|
||||||
std::string group;
|
|
||||||
|
|
||||||
// setting additional effective groups from /etc/group
|
|
||||||
// by using initgroups()
|
|
||||||
// used only if winix is started as the root
|
|
||||||
// default: true
|
|
||||||
bool additional_groups;
|
|
||||||
|
|
||||||
// log file name, log file name for notifications (sending emails, etc)
|
|
||||||
std::string log_file, log_notify_file;
|
|
||||||
|
|
||||||
// 1 - minimum
|
|
||||||
// 2 - (default)
|
|
||||||
// 3 - maximum - all logs
|
|
||||||
int log_level;
|
|
||||||
|
|
||||||
// logging to stdout too
|
|
||||||
// only if demonize is 'false'
|
|
||||||
// default: false
|
|
||||||
bool log_stdout;
|
|
||||||
|
|
||||||
// how many requests should be saved in the same time
|
|
||||||
// default: 1
|
|
||||||
int log_request;
|
|
||||||
|
|
||||||
// whether to save each line of the config (use it for debug purposes)
|
|
||||||
// default: false
|
|
||||||
bool log_save_each_line;
|
|
||||||
|
|
||||||
// logging db queries
|
|
||||||
// default: false
|
|
||||||
bool log_db_query;
|
|
||||||
|
|
||||||
// logging when a plugin function is called
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
// fast cgi: socket (unix domain)
|
|
||||||
std::string fcgi_socket;
|
|
||||||
|
|
||||||
// fast cgi: socket permissions
|
|
||||||
int fcgi_socket_chmod;
|
|
||||||
|
|
||||||
// fast cgi: owner of the socket
|
|
||||||
std::string fcgi_socket_user;
|
|
||||||
|
|
||||||
// fast cgi: group of the socket
|
|
||||||
std::string fcgi_socket_group;
|
|
||||||
|
|
||||||
std::wstring templates_dir;
|
|
||||||
std::wstring templates_dir_default; // html templates from winix
|
|
||||||
|
|
||||||
std::wstring txt_templates_dir;
|
|
||||||
std::wstring txt_templates_dir_default; // txt (notifications) templates from winix
|
|
||||||
|
|
||||||
// prefix and postfix for functions templates
|
|
||||||
// default:
|
|
||||||
// prefix: "fun_"
|
|
||||||
// postfix: ".html"
|
|
||||||
std::wstring templates_fun_prefix;
|
|
||||||
std::wstring templates_fun_postfix;
|
|
||||||
|
|
||||||
// main html template
|
|
||||||
// default: index.html
|
|
||||||
std::wstring templates_index;
|
|
||||||
|
|
||||||
// if true then only root can use 'template' function
|
|
||||||
// default: false
|
|
||||||
bool template_only_root_use_template_fun;
|
|
||||||
|
|
||||||
std::string db_database;
|
|
||||||
std::string db_user;
|
|
||||||
std::string db_pass;
|
|
||||||
|
|
||||||
std::string http_session_id_name;
|
|
||||||
|
|
||||||
// when the HOST_HTTP environment variable doesn't point into 'base_url' (the part 'http://' and the last slash is removed)
|
|
||||||
// the server will redirect into 'base_url' + 'REQUEST_URI'
|
|
||||||
// it's useful when you want to redirect from 'mydomain.tld' into 'www.mydomain.tld' etc.
|
|
||||||
bool base_url_redirect;
|
|
||||||
|
|
||||||
// string used in a place where is a user (or group) selected
|
|
||||||
std::wstring priv_no_user;
|
|
||||||
std::wstring priv_no_group;
|
|
||||||
|
|
||||||
// time in seconds when the user will be automatically logged out (iddle time)
|
|
||||||
int session_max_idle;
|
|
||||||
|
|
||||||
// time in seconds when the user will be automatically logged out (when he selected 'remember me' option)
|
|
||||||
// this time is usually greater than session_max_idle
|
|
||||||
int session_remember_max_idle;
|
|
||||||
|
|
||||||
// this file is used when the program is starting and ending
|
|
||||||
std::string session_file;
|
|
||||||
|
|
||||||
// how many sessions can be (zero turn off this checking)
|
|
||||||
// default: 1000000 (one milion)
|
|
||||||
size_t session_max;
|
|
||||||
|
|
||||||
// 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
|
|
||||||
// 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
|
|
||||||
std::wstring plugins_dir;
|
|
||||||
|
|
||||||
// plugins
|
|
||||||
// you can provide either a relative path (plugins_dir will be used)
|
|
||||||
// or a full path to a plugin
|
|
||||||
std::vector<std::wstring> plugin_file;
|
|
||||||
|
|
||||||
// should the html code be cleaned by the html filter
|
|
||||||
bool html_filter;
|
|
||||||
|
|
||||||
// should white characters be trimmed
|
|
||||||
bool html_filter_trim_white;
|
|
||||||
|
|
||||||
// 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
|
|
||||||
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: true
|
|
||||||
bool html_filter_orphans;
|
|
||||||
|
|
||||||
// orphans mode
|
|
||||||
// either: "nbsp" or "160"
|
|
||||||
// default: "nbsp"
|
|
||||||
std::string html_filter_orphans_mode_str;
|
|
||||||
HTMLFilter::OrphanMode html_filter_orphans_mode;
|
|
||||||
|
|
||||||
// the url of a new empty item (if there is not the subject too)
|
|
||||||
std::wstring item_url_empty;
|
|
||||||
|
|
||||||
// maximum length of a file send by post multipart form
|
|
||||||
// 0 - not used
|
|
||||||
size_t post_file_max;
|
|
||||||
|
|
||||||
// directory for static files
|
|
||||||
std::wstring upload_dir;
|
|
||||||
|
|
||||||
// chmod of newly created directories (under upload_dir)
|
|
||||||
// default: 0750
|
|
||||||
int upload_dirs_chmod;
|
|
||||||
|
|
||||||
// chmod of newly created files (under upload_dir)
|
|
||||||
// default: 0640
|
|
||||||
int upload_files_chmod;
|
|
||||||
|
|
||||||
// create a thumbnail from an image
|
|
||||||
// default: true
|
|
||||||
bool create_thumb;
|
|
||||||
|
|
||||||
// the mode of creating a thumbnail
|
|
||||||
// width means thumb_cx, height means thumb_cy
|
|
||||||
// 1: Width given, height automagically selected to preserve aspect ratio.
|
|
||||||
// 2: Height given, width automagically selected to preserve aspect ratio.
|
|
||||||
// 3: Maximum values of height and width given, aspect ratio preserved.
|
|
||||||
// 4: Minimum values of width and height given, aspect ratio preserved.
|
|
||||||
// 5: Width and height emphatically given, original aspect ratio ignored.
|
|
||||||
// 6: Change as per widthxheight (3) but only if an image dimension exceeds a specified dimension.
|
|
||||||
// 7: Change dimensions only if both image dimensions are less than specified dimensions.
|
|
||||||
// default: 2
|
|
||||||
int thumb_mode;
|
|
||||||
|
|
||||||
// width of thumbnails
|
|
||||||
// default: 150
|
|
||||||
size_t thumb_cx;
|
|
||||||
|
|
||||||
// height of thumbnails
|
|
||||||
// default: 150
|
|
||||||
size_t thumb_cy;
|
|
||||||
|
|
||||||
// the convert program
|
|
||||||
// default: /usr/local/bin/convert
|
|
||||||
std::wstring convert_cmd;
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
// the main address of the site (e.g. http://www.someserver.com)
|
|
||||||
std::wstring base_url;
|
|
||||||
|
|
||||||
// static content not authorized by winix
|
|
||||||
std::wstring base_url_static;
|
|
||||||
|
|
||||||
// additional static server for common content (not authorized)
|
|
||||||
std::wstring base_url_common;
|
|
||||||
|
|
||||||
// separator used in <title> html tag
|
|
||||||
std::wstring title_separator;
|
|
||||||
|
|
||||||
// http header recognized by www server as a file to send back
|
|
||||||
// default: X-LIGHTTPD-send-file
|
|
||||||
std::wstring http_header_send_file;
|
|
||||||
|
|
||||||
// prints additional information (in the end of the html page as a commentary)
|
|
||||||
bool debug_info;
|
|
||||||
|
|
||||||
// in editors (emacs, ckeditor,...) the html will be filtered and unsafe tags
|
|
||||||
// will be dropped (script, frame, etc.)
|
|
||||||
// default: true;
|
|
||||||
bool editors_html_safe_mode;
|
|
||||||
|
|
||||||
// don't filter the html code for root
|
|
||||||
// default: true
|
|
||||||
// (if true the html code for root is not filtered)
|
|
||||||
bool editors_html_safe_mode_skip_root;
|
|
||||||
|
|
||||||
// temporarily we do not support time zones per user
|
|
||||||
// there is one offset for all users
|
|
||||||
// default: 0
|
|
||||||
int time_zone_offset;
|
|
||||||
|
|
||||||
// time zone offset for guests (not logged users)
|
|
||||||
// default: 0
|
|
||||||
int time_zone_offset_guest;
|
|
||||||
|
|
||||||
// charset used in templates, locales, logs etc.
|
|
||||||
// default: true (UTF-8)
|
|
||||||
// if false it means 8-bit ASCII
|
|
||||||
bool utf8;
|
|
||||||
|
|
||||||
// how many maximum symlinks can be followed
|
|
||||||
// (symlinks on directories as well)
|
|
||||||
// default: 20
|
|
||||||
size_t symlinks_follow_max;
|
|
||||||
|
|
||||||
// the prefix of a name of html form controls used in the ticket plugin
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// based on base_url
|
|
||||||
// set by SetAdditionalVariables()
|
|
||||||
// without the first part http:// (or https://) or the whole string is empty
|
|
||||||
std::wstring base_url_http_host;
|
|
||||||
|
|
||||||
|
|
||||||
Config();
|
|
||||||
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
|
||||||
|
|
||||||
std::wstring Text(const wchar_t * name);
|
|
||||||
std::wstring Text(const wchar_t * name, const wchar_t * def);
|
|
||||||
std::wstring Text(const std::wstring & name, const std::wstring & def);
|
|
||||||
std::string AText(const wchar_t * name);
|
|
||||||
std::string AText(const wchar_t * name, const wchar_t * def);
|
|
||||||
std::string AText(const std::wstring & name, const std::wstring & def);
|
|
||||||
|
|
||||||
int Int(const wchar_t *);
|
|
||||||
int Int(const wchar_t * name, int def);
|
|
||||||
int Int(const std::wstring & name, int def);
|
|
||||||
size_t Size(const wchar_t *);
|
|
||||||
size_t Size(const wchar_t * name, size_t def);
|
|
||||||
size_t Size(const std::wstring & name, size_t def);
|
|
||||||
bool Bool(const wchar_t *);
|
|
||||||
bool Bool(const wchar_t * name, bool def);
|
|
||||||
bool Bool(const std::wstring & name, bool def);
|
|
||||||
void ListText(const wchar_t * name, std::vector<std::wstring> & list);
|
|
||||||
void ListText(const std::wstring & name, std::vector<std::wstring> & list);
|
|
||||||
|
|
||||||
// for debug
|
|
||||||
void Print(std::ostream & out);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ShowError();
|
|
||||||
void AssignValues(bool stdout_is_closed);
|
|
||||||
void SetHttpHost(const std::wstring & in, std::wstring & out);
|
|
||||||
void SetAdditionalVariables();
|
|
||||||
void CheckLocale();
|
|
||||||
void CheckPasswd();
|
|
||||||
|
|
||||||
ConfParser parser;
|
|
||||||
|
|
||||||
std::string default_str;
|
|
||||||
int default_int;
|
|
||||||
bool default_bool;
|
|
||||||
|
|
||||||
bool errors_to_stdout;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,729 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include "confparser.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "utf8.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::ConfParser()
|
|
||||||
{
|
|
||||||
// you can change this separators to what you want
|
|
||||||
// you shoud not use only white characters here (as expected by IsWhite() method)
|
|
||||||
// and new line characters ('\n')
|
|
||||||
separator = '=';
|
|
||||||
commentary = '#';
|
|
||||||
list_start = '(';
|
|
||||||
list_end = ')';
|
|
||||||
list_delimiter = ',';
|
|
||||||
split_single = false;
|
|
||||||
skip_empty = false;
|
|
||||||
use_escape_char = true;
|
|
||||||
input_as_utf8 = false;
|
|
||||||
|
|
||||||
default_str = L"";
|
|
||||||
default_int = 0;
|
|
||||||
default_size = 0;
|
|
||||||
default_bool = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SplitSingle(bool split)
|
|
||||||
{
|
|
||||||
split_single = split;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SkipEmpty(bool skip)
|
|
||||||
{
|
|
||||||
skip_empty = skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::UseEscapeChar(bool escape)
|
|
||||||
{
|
|
||||||
use_escape_char = escape;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::Status ConfParser::Parse(const char * file_name)
|
|
||||||
{
|
|
||||||
line = 1;
|
|
||||||
table.clear();
|
|
||||||
table_single.clear();
|
|
||||||
|
|
||||||
file.clear();
|
|
||||||
file.open( file_name );
|
|
||||||
|
|
||||||
if( file )
|
|
||||||
{
|
|
||||||
status = ParseFile();
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status = cant_open_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::Status ConfParser::Parse(const std::string & file_name)
|
|
||||||
{
|
|
||||||
return Parse(file_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::Status ConfParser::Parse(const wchar_t * file_name)
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(file_name, afile_name);
|
|
||||||
return Parse(afile_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::Status ConfParser::Parse(const std::wstring & file_name)
|
|
||||||
{
|
|
||||||
return Parse(file_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfParser::Status ConfParser::ParseFile()
|
|
||||||
{
|
|
||||||
ReadChar();
|
|
||||||
SkipWhiteLines();
|
|
||||||
|
|
||||||
while( lastc != -1 )
|
|
||||||
{
|
|
||||||
if( !ReadVariable() )
|
|
||||||
return syntax_error;
|
|
||||||
|
|
||||||
if( lastc != separator )
|
|
||||||
return syntax_error;
|
|
||||||
|
|
||||||
if( !ReadValue() )
|
|
||||||
return syntax_error;
|
|
||||||
|
|
||||||
AddOption();
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( lastc != -1 && lastc != '\n' )
|
|
||||||
return syntax_error; // some characters have left at the end of an option
|
|
||||||
|
|
||||||
SkipWhiteLines();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::IsVariableChar(int c)
|
|
||||||
{
|
|
||||||
if( (c>='a' && c<='z') ||
|
|
||||||
(c>='A' && c<='Z') ||
|
|
||||||
(c>='0' && c<='9') ||
|
|
||||||
c=='.' || c==',' || c=='_' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::AddOption()
|
|
||||||
{
|
|
||||||
if( value.empty() && skip_empty )
|
|
||||||
{
|
|
||||||
DeleteFromTable(variable);
|
|
||||||
DeleteFromTableSingle(variable);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( split_single && value.size() == 1 )
|
|
||||||
{
|
|
||||||
table_single[variable] = value[0];
|
|
||||||
DeleteFromTable(variable);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
table[variable] = value;
|
|
||||||
DeleteFromTableSingle(variable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::DeleteFromTable(const std::wstring & var)
|
|
||||||
{
|
|
||||||
Table::iterator i = table.find(var);
|
|
||||||
|
|
||||||
if( i != table.end() )
|
|
||||||
table.erase(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::DeleteFromTableSingle(const std::wstring & var)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i = table_single.find(var);
|
|
||||||
|
|
||||||
if( i != table_single.end() )
|
|
||||||
table_single.erase(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadVariable()
|
|
||||||
{
|
|
||||||
variable.clear();
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
while( IsVariableChar(lastc) )
|
|
||||||
{
|
|
||||||
variable += lastc;
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
return !variable.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadValue()
|
|
||||||
{
|
|
||||||
value.clear();
|
|
||||||
ReadChar(); // skipping separator '='
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( lastc == list_start )
|
|
||||||
return ReadValueList();
|
|
||||||
else
|
|
||||||
return ReadValueNoList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadValueList()
|
|
||||||
{
|
|
||||||
ReadChar(); // skipping first list character '('
|
|
||||||
SkipWhiteLines(); // lists can be split into several lines
|
|
||||||
|
|
||||||
while( lastc != -1 && lastc != list_end )
|
|
||||||
{
|
|
||||||
if( !ReadValueNoList(true) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( lastc == list_delimiter )
|
|
||||||
ReadChar();
|
|
||||||
|
|
||||||
SkipWhiteLines();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( lastc != list_end )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ReadChar(); // skipping last list character ')'
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadValueNoList(bool use_list_delimiter)
|
|
||||||
{
|
|
||||||
bool res;
|
|
||||||
|
|
||||||
value_item.clear();
|
|
||||||
|
|
||||||
if( lastc == '"' )
|
|
||||||
{
|
|
||||||
res = ReadValueQuoted(); // quoted value
|
|
||||||
|
|
||||||
if( res )
|
|
||||||
value.push_back(value_item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res = ReadValueSimple(use_list_delimiter);
|
|
||||||
|
|
||||||
if( res && !value_item.empty() )
|
|
||||||
value.push_back(value_item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadValueQuoted()
|
|
||||||
{
|
|
||||||
ReadChar(); // skipping the first quote
|
|
||||||
|
|
||||||
while( lastc != '"' && lastc != -1 )
|
|
||||||
{
|
|
||||||
if( use_escape_char && lastc == '\\' )
|
|
||||||
ReadChar();
|
|
||||||
|
|
||||||
value_item += lastc;
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( lastc != '"' )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ReadChar(); // skipping the last quote
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ReadValueSimple(bool use_list_delimiter)
|
|
||||||
{
|
|
||||||
int list_delimiter1 = -1;
|
|
||||||
int list_delimiter2 = -1;
|
|
||||||
|
|
||||||
if( use_list_delimiter )
|
|
||||||
{
|
|
||||||
list_delimiter1 = list_delimiter;
|
|
||||||
list_delimiter2 = list_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
while( lastc!=-1 && lastc!='\n' && lastc!=commentary &&
|
|
||||||
lastc!=list_delimiter1 && lastc!=list_delimiter2 )
|
|
||||||
{
|
|
||||||
value_item += lastc;
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
Trim(value_item);
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::ReadUTF8Char()
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
bool correct;
|
|
||||||
|
|
||||||
lastc = -1;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Ezc::UTF8ToInt(file, c, correct);
|
|
||||||
|
|
||||||
if( !file )
|
|
||||||
return lastc;
|
|
||||||
}
|
|
||||||
while( !correct );
|
|
||||||
|
|
||||||
lastc = c;
|
|
||||||
|
|
||||||
if( lastc == '\n' )
|
|
||||||
++line;
|
|
||||||
|
|
||||||
return lastc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::ReadASCIIChar()
|
|
||||||
{
|
|
||||||
lastc = file.get();
|
|
||||||
|
|
||||||
if( lastc == '\n' )
|
|
||||||
++line;
|
|
||||||
|
|
||||||
return lastc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::ReadChar()
|
|
||||||
{
|
|
||||||
if( input_as_utf8 )
|
|
||||||
return ReadUTF8Char();
|
|
||||||
|
|
||||||
return ReadASCIIChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::IsWhite(int c)
|
|
||||||
{
|
|
||||||
// dont use '\n' here
|
|
||||||
// 13 (\r) is at the end of a line in a dos file \r\n
|
|
||||||
// 160 is an unbreakable space
|
|
||||||
if( c==' ' || c=='\t' || c==13 || c==160 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SkipWhite()
|
|
||||||
{
|
|
||||||
while( IsWhite(lastc) || lastc == commentary )
|
|
||||||
{
|
|
||||||
if( lastc == commentary )
|
|
||||||
SkipLine();
|
|
||||||
else
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SkipWhiteLines()
|
|
||||||
{
|
|
||||||
while( IsWhite(lastc) || lastc == commentary || lastc=='\n' )
|
|
||||||
{
|
|
||||||
if( lastc == commentary )
|
|
||||||
SkipLine();
|
|
||||||
else
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SkipLine()
|
|
||||||
{
|
|
||||||
while( lastc != -1 && lastc != '\n' )
|
|
||||||
ReadChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::Trim(std::wstring & s)
|
|
||||||
{
|
|
||||||
std::wstring::size_type i;
|
|
||||||
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// looking for white characters at the end
|
|
||||||
for(i=s.size()-1 ; i>0 && IsWhite(s[i]) ; --i);
|
|
||||||
|
|
||||||
if( i==0 && IsWhite(s[i]) )
|
|
||||||
{
|
|
||||||
// the whole string has white characters
|
|
||||||
s.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// deleting white characters at the end
|
|
||||||
if( i != s.size() - 1 )
|
|
||||||
s.erase(i+1, std::wstring::npos);
|
|
||||||
|
|
||||||
// looking for white characters at the beginning
|
|
||||||
for(i=0 ; i<s.size() && IsWhite(s[i]) ; ++i);
|
|
||||||
|
|
||||||
// deleting white characters at the beginning
|
|
||||||
if( i != 0 )
|
|
||||||
s.erase(0, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring ConfParser::Text(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return Text(std::wstring(name), default_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring ConfParser::Text(const wchar_t * name, const wchar_t * def)
|
|
||||||
{
|
|
||||||
return Text(std::wstring(name), std::wstring(def));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring ConfParser::Text(const std::wstring & name, const std::wstring & def)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i = table_single.find(name);
|
|
||||||
|
|
||||||
if( i == table_single.end() )
|
|
||||||
{
|
|
||||||
Table::iterator t = table.find(name);
|
|
||||||
|
|
||||||
if( t == table.end() || t->second.empty() )
|
|
||||||
return def;
|
|
||||||
|
|
||||||
return t->second[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string ConfParser::AText(const wchar_t * name)
|
|
||||||
{
|
|
||||||
std::wstring res = Text(name);
|
|
||||||
std::string ares;
|
|
||||||
|
|
||||||
Ezc::WideToUTF8(res, ares);
|
|
||||||
|
|
||||||
return ares;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string ConfParser::AText(const wchar_t * name, const wchar_t * def)
|
|
||||||
{
|
|
||||||
std::wstring res = Text(name, def);
|
|
||||||
std::string ares;
|
|
||||||
|
|
||||||
Ezc::WideToUTF8(res, ares);
|
|
||||||
|
|
||||||
return ares;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string ConfParser::AText(const std::wstring & name, const std::wstring & def)
|
|
||||||
{
|
|
||||||
std::wstring res = Text(name, def);
|
|
||||||
std::string ares;
|
|
||||||
|
|
||||||
Ezc::WideToUTF8(res, ares);
|
|
||||||
|
|
||||||
return ares;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::Int(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return Int(std::wstring(name), default_int);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::Int(const wchar_t * name, int def)
|
|
||||||
{
|
|
||||||
return Int(std::wstring(name), def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::ToInt(const std::wstring & value)
|
|
||||||
{
|
|
||||||
long res = (value[0] == '0')? wcstol(value.c_str() + 1, 0, 8) : wcstol(value.c_str(), 0, 10);
|
|
||||||
|
|
||||||
return static_cast<int>(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ConfParser::Int(const std::wstring & name, int def)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i = table_single.find(name);
|
|
||||||
|
|
||||||
if( i == table_single.end() )
|
|
||||||
{
|
|
||||||
Table::iterator t = table.find(name);
|
|
||||||
|
|
||||||
if( t == table.end() || t->second.empty() )
|
|
||||||
return def;
|
|
||||||
|
|
||||||
return ToInt(t->second[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ToInt(i->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t ConfParser::Size(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return Size(std::wstring(name), default_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t ConfParser::Size(const wchar_t * name, size_t def)
|
|
||||||
{
|
|
||||||
return Size(std::wstring(name), def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t ConfParser::ToSize(const std::wstring & value)
|
|
||||||
{
|
|
||||||
unsigned long res = (value[0] == '0')? wcstoul(value.c_str() + 1, 0, 8) : wcstoul(value.c_str(), 0, 10);
|
|
||||||
|
|
||||||
return static_cast<size_t>(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t ConfParser::Size(const std::wstring & name, size_t def)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i = table_single.find(name);
|
|
||||||
|
|
||||||
if( i == table_single.end() )
|
|
||||||
{
|
|
||||||
Table::iterator t = table.find(name);
|
|
||||||
|
|
||||||
if( t == table.end() || t->second.empty() )
|
|
||||||
return def;
|
|
||||||
|
|
||||||
return ToSize(t->second[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ToSize(i->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::Bool(const wchar_t * name)
|
|
||||||
{
|
|
||||||
return Bool(std::wstring(name), default_bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::Bool(const wchar_t * name, bool def)
|
|
||||||
{
|
|
||||||
return Bool(std::wstring(name), def);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::ToBool(const std::wstring & value)
|
|
||||||
{
|
|
||||||
return ( EqualNoCase(value.c_str(), L"true") ||
|
|
||||||
EqualNoCase(value.c_str(), L"yes") ||
|
|
||||||
EqualNoCase(value.c_str(), L"1")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ConfParser::Bool(const std::wstring & name, bool def)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i = table_single.find(name);
|
|
||||||
|
|
||||||
if( i == table_single.end() )
|
|
||||||
{
|
|
||||||
Table::iterator t = table.find(name);
|
|
||||||
|
|
||||||
if( t == table.end() || t->second.empty() )
|
|
||||||
return def;
|
|
||||||
|
|
||||||
return ToBool(t->second[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ToBool(i->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::SetDefaultText(const std::wstring & def)
|
|
||||||
{
|
|
||||||
default_str = def;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfParser::SetDefaultInt(int def)
|
|
||||||
{
|
|
||||||
default_int = def;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfParser::SetDefaultSize(size_t def)
|
|
||||||
{
|
|
||||||
default_size = def;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfParser::SetDefaultBool(bool def)
|
|
||||||
{
|
|
||||||
default_bool = def;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// in lists we don't use default values
|
|
||||||
void ConfParser::ListText(const wchar_t * name, std::vector<std::wstring> & list)
|
|
||||||
{
|
|
||||||
ListText(std::wstring(name), list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::ListText(const std::wstring & name, std::vector<std::wstring> & list)
|
|
||||||
{
|
|
||||||
list.clear();
|
|
||||||
|
|
||||||
ConfParser::TableSingle::iterator i = table_single.find(name);
|
|
||||||
|
|
||||||
if( i != table_single.end() )
|
|
||||||
{
|
|
||||||
list.push_back(i->second);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfParser::Table::iterator z = table.find(name);
|
|
||||||
|
|
||||||
if( z != table.end() )
|
|
||||||
{
|
|
||||||
list = z->second;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::UTF8(bool utf)
|
|
||||||
{
|
|
||||||
input_as_utf8 = utf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfParser::Print(std::ostream & out)
|
|
||||||
{
|
|
||||||
TableSingle::iterator i1;
|
|
||||||
|
|
||||||
for(i1 = table_single.begin() ; i1 != table_single.end() ; ++i1)
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(i1->first, out);
|
|
||||||
out << '=';
|
|
||||||
Ezc::WideToUTF8(i1->second, out);
|
|
||||||
out << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Table::iterator i2;
|
|
||||||
Value::iterator i3;
|
|
||||||
|
|
||||||
for(i2 = table.begin() ; i2 != table.end() ; ++i2)
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(i2->first, out);
|
|
||||||
out << '=';
|
|
||||||
|
|
||||||
for(i3 = i2->second.begin() ; i3 != i2->second.end() ; ++i3)
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(*i3, out);
|
|
||||||
out << ',';
|
|
||||||
}
|
|
||||||
|
|
||||||
out << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfileconfparser
|
|
||||||
#define headerfileconfparser
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
A parser for parsing config files.
|
|
||||||
|
|
||||||
A config file can look like this:
|
|
||||||
variable1 = value 1
|
|
||||||
variable2 = " value 2 "
|
|
||||||
variable3 = (value 1, value 2)
|
|
||||||
variable4 = (" value 1 " , "value2", value 3)
|
|
||||||
|
|
||||||
sample of use:
|
|
||||||
ConfParser parser;
|
|
||||||
parser.Parse("/path/to/config");
|
|
||||||
|
|
||||||
if( parser.status == ConfParser::ok )
|
|
||||||
{
|
|
||||||
// the whole config we have in parser.table (parser.table_single)
|
|
||||||
}
|
|
||||||
|
|
||||||
config syntax:
|
|
||||||
option = list
|
|
||||||
|
|
||||||
list can consists of any number of items, if you're using more than one item you should
|
|
||||||
use brackets ()
|
|
||||||
|
|
||||||
for one item the brackets can be ommited:
|
|
||||||
option = value
|
|
||||||
white characters at the beginning of the value (and at the end) will be trimmed,
|
|
||||||
or you can use quotes:
|
|
||||||
option = "value"
|
|
||||||
option2 = "value with spaces at the end "
|
|
||||||
|
|
||||||
the form without quotes:
|
|
||||||
option = value
|
|
||||||
should be written in one line, so this is not allowed:
|
|
||||||
option =
|
|
||||||
value
|
|
||||||
you can use a new line characters only between brackets and quotes:
|
|
||||||
option = "this is
|
|
||||||
a multiline string"
|
|
||||||
option = ( value1,
|
|
||||||
value2 )
|
|
||||||
|
|
||||||
but there is one requirement: the first character " or ( should be in the same line,
|
|
||||||
so this is not allowed
|
|
||||||
option =
|
|
||||||
"this is wrong"
|
|
||||||
but this is ok:
|
|
||||||
option = "
|
|
||||||
that is ok"
|
|
||||||
|
|
||||||
empty lists:
|
|
||||||
option = ()
|
|
||||||
this creates an empty list: parser.table['option'].empty() == true
|
|
||||||
|
|
||||||
option =
|
|
||||||
this creates an empty list too (the same as previously)
|
|
||||||
|
|
||||||
option = ""
|
|
||||||
but this doesn't create an empty list, it creates a list with one (empty) item
|
|
||||||
|
|
||||||
commentaries:
|
|
||||||
# this is a commentary (until the end of the line)
|
|
||||||
option = value # this is a commentary too
|
|
||||||
|
|
||||||
commentaries are treated as white characters, other example:
|
|
||||||
option = ( # this is my list
|
|
||||||
"value 1" # this is a value one
|
|
||||||
value 2 # and this is a value two
|
|
||||||
) # end of my list
|
|
||||||
|
|
||||||
overwriting:
|
|
||||||
option1 = some value
|
|
||||||
option1 = other value
|
|
||||||
# always the last option is used so option1 is "other value"
|
|
||||||
|
|
||||||
list delimiter:
|
|
||||||
option1 = (value1, value2, value3)
|
|
||||||
option2 = ("value1", "value2", "value3")
|
|
||||||
above we're using a comma ',' as a list delimiter but when using quotes (second line)
|
|
||||||
the commas can be omitted:
|
|
||||||
option2 = ("value1" "value2" "value3")
|
|
||||||
|
|
||||||
white characters:
|
|
||||||
the name of an option cannot consist of white characters
|
|
||||||
some option = value # this is wrong
|
|
||||||
some_option = value # this is ok
|
|
||||||
|
|
||||||
which characters are allowed in an option name is defined by IsVariableChar() method
|
|
||||||
|
|
||||||
you can use white characters in values
|
|
||||||
option = value with spaces or tabs
|
|
||||||
white characters at the beginning and at the end will be trimmed,
|
|
||||||
so if you want them use quotes:
|
|
||||||
option = " other value with spaces "
|
|
||||||
|
|
||||||
special characters in quoted strings:
|
|
||||||
option = "this is a string with \" a quote inside"
|
|
||||||
the option will be: this is a string with " a quote inside
|
|
||||||
\\ - means one \
|
|
||||||
basically: \char produces char
|
|
||||||
so:
|
|
||||||
"\a" gives "a"
|
|
||||||
"\\" gives "\"
|
|
||||||
"\Z" gives "Z" and so on
|
|
||||||
you can call UseEscapeChar(false) to turn this off
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
class ConfParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
ConfParser();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
status of parsing
|
|
||||||
*/
|
|
||||||
enum Status { ok, cant_open_file, syntax_error };
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
the last status of parsing, set by Parse() methods
|
|
||||||
*/
|
|
||||||
Status status;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
the main methods used to parse
|
|
||||||
file_name is the path to a file
|
|
||||||
*/
|
|
||||||
Status Parse(const char * file_name);
|
|
||||||
Status Parse(const std::string & file_name);
|
|
||||||
Status Parse(const wchar_t * file_name);
|
|
||||||
Status Parse(const std::wstring & file_name);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
a number of a line in which there is a syntax_error
|
|
||||||
*/
|
|
||||||
int line;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
this is the table which represents your config file
|
|
||||||
in the Table map: the first (key) is your 'option' and the second is 'list'
|
|
||||||
*/
|
|
||||||
typedef std::vector<std::wstring> Value;
|
|
||||||
typedef std::map<std::wstring, Value> Table;
|
|
||||||
Table table;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if your config file consists mainly of single forms such as:
|
|
||||||
option = value
|
|
||||||
option2 = value2
|
|
||||||
then you can call SplitSingle(true) for not inserting single values to
|
|
||||||
previous 'table' but instead to 'table_single'
|
|
||||||
table_single as the second parameter takes only std::wstring (instead of the whole std::vector)
|
|
||||||
so you can save a little memory from not using std::vector
|
|
||||||
*/
|
|
||||||
typedef std::map<std::wstring, std::wstring> TableSingle;
|
|
||||||
TableSingle table_single;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if your list consists of only one item, e.g:
|
|
||||||
option1 = value 1
|
|
||||||
option2 = "value 2"
|
|
||||||
option3 = ( "value 3" )
|
|
||||||
then if you call SplitSingle(true) then such values will be stored in
|
|
||||||
'table_single' instead of 'table' map
|
|
||||||
default: false
|
|
||||||
*/
|
|
||||||
void SplitSingle(bool split);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if true then empty lists, e.g:
|
|
||||||
option =
|
|
||||||
option2 = ()
|
|
||||||
will be omitted (not inserted to 'table' or 'table_single')
|
|
||||||
default: false
|
|
||||||
*/
|
|
||||||
void SkipEmpty(bool skip);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
'\' character is used to escape other characters in a quoted string
|
|
||||||
so "some \t t\"ext" will produce "some t t"ext"
|
|
||||||
(this is only use in quoted string)
|
|
||||||
default: true
|
|
||||||
*/
|
|
||||||
void UseEscapeChar(bool escape);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
those methods are used to extract information from table or table_single
|
|
||||||
as a parameter they take the name of an option
|
|
||||||
and a default value (if there is no such a parameter),
|
|
||||||
they return appropriate value (either text, int or boolean)
|
|
||||||
(in lists they return the first item if exists)
|
|
||||||
*/
|
|
||||||
std::wstring Text(const wchar_t * name);
|
|
||||||
std::wstring Text(const wchar_t * name, const wchar_t * def);
|
|
||||||
std::wstring Text(const std::wstring & name, const std::wstring & def);
|
|
||||||
std::string AText(const wchar_t * name);
|
|
||||||
std::string AText(const wchar_t * name, const wchar_t * def);
|
|
||||||
std::string AText(const std::wstring & name, const std::wstring & def);
|
|
||||||
int Int(const wchar_t *);
|
|
||||||
int Int(const wchar_t * name, int def);
|
|
||||||
int Int(const std::wstring & name, int def);
|
|
||||||
size_t Size(const wchar_t *);
|
|
||||||
size_t Size(const wchar_t * name, size_t def);
|
|
||||||
size_t Size(const std::wstring & name, size_t def);
|
|
||||||
bool Bool(const wchar_t *);
|
|
||||||
bool Bool(const wchar_t * name, bool def);
|
|
||||||
bool Bool(const std::wstring & name, bool def);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
some default values
|
|
||||||
used in Text() Int() or Bool() when you don't explicitly set the default value
|
|
||||||
|
|
||||||
if you don't set it directly then:
|
|
||||||
default text is: "" (empty)
|
|
||||||
default int or size is: 0
|
|
||||||
default bool is: false
|
|
||||||
*/
|
|
||||||
void SetDefaultText(const std::wstring & def);
|
|
||||||
void SetDefaultInt(int def);
|
|
||||||
void SetDefaultSize(size_t def);
|
|
||||||
void SetDefaultBool(bool def);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
those methods are used to extract lists
|
|
||||||
note: if there is one option in table_single they will return it
|
|
||||||
*/
|
|
||||||
void ListText(const wchar_t * name, std::vector<std::wstring> & list);
|
|
||||||
void ListText(const std::wstring & name, std::vector<std::wstring> & list);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if true then the input file is treated as UTF-8
|
|
||||||
*/
|
|
||||||
void UTF8(bool utf);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
printing the content
|
|
||||||
(for debug purposes)
|
|
||||||
*/
|
|
||||||
void Print(std::ostream & out);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/*
|
|
||||||
last read variable (option)
|
|
||||||
*/
|
|
||||||
std::wstring variable;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
last read list item
|
|
||||||
*/
|
|
||||||
std::wstring value_item;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
last read list
|
|
||||||
*/
|
|
||||||
Value value;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
separator between a variable and a value, default: '='
|
|
||||||
*/
|
|
||||||
int separator;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
commentary char, default: '#'
|
|
||||||
*/
|
|
||||||
int commentary;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
list starting character, default: '('
|
|
||||||
*/
|
|
||||||
int list_start;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
list ending character, default: ')'
|
|
||||||
*/
|
|
||||||
int list_end;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
list delimiter, default: ','
|
|
||||||
*/
|
|
||||||
int list_delimiter;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
last read char
|
|
||||||
or -1 if the end
|
|
||||||
*/
|
|
||||||
int lastc;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
current file
|
|
||||||
*/
|
|
||||||
std::ifstream file;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if true then lists with one item will be put into 'table_single' table
|
|
||||||
default: false
|
|
||||||
*/
|
|
||||||
bool split_single;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if true then empty lists, e.g:
|
|
||||||
option =
|
|
||||||
option2 = ()
|
|
||||||
will be omitted (not inserted to 'table' or 'table_single')
|
|
||||||
default: false
|
|
||||||
*/
|
|
||||||
bool skip_empty;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
input file is in UTF-8
|
|
||||||
default: false
|
|
||||||
*/
|
|
||||||
bool input_as_utf8;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if true you can use an escape character '\' in quoted values
|
|
||||||
*/
|
|
||||||
bool use_escape_char;
|
|
||||||
|
|
||||||
std::string afile_name;
|
|
||||||
|
|
||||||
std::wstring default_str;
|
|
||||||
int default_int;
|
|
||||||
size_t default_size;
|
|
||||||
bool default_bool;
|
|
||||||
|
|
||||||
int ToInt(const std::wstring & value);
|
|
||||||
size_t ToSize(const std::wstring & value);
|
|
||||||
bool ToBool(const std::wstring & value);
|
|
||||||
|
|
||||||
Status ParseFile();
|
|
||||||
void AddOption();
|
|
||||||
|
|
||||||
void DeleteFromTable(const std::wstring & var);
|
|
||||||
void DeleteFromTableSingle(const std::wstring & var);
|
|
||||||
|
|
||||||
bool ReadVariable();
|
|
||||||
bool ReadValue();
|
|
||||||
bool ReadValueList();
|
|
||||||
bool ReadValueNoList(bool use_list_delimiter = false);
|
|
||||||
bool ReadValueQuoted();
|
|
||||||
bool ReadValueSimple(bool use_list_delimiter = false);
|
|
||||||
|
|
||||||
int ReadUTF8Char();
|
|
||||||
int ReadASCIIChar();
|
|
||||||
int ReadChar();
|
|
||||||
bool IsWhite(int c);
|
|
||||||
bool IsVariableChar(int c);
|
|
||||||
void SkipWhite();
|
|
||||||
void SkipWhiteLines();
|
|
||||||
void SkipLine();
|
|
||||||
void Trim(std::wstring & s);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_cookieparser
|
|
||||||
#define headerfile_winix_core_cookieparser
|
|
||||||
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
#include "httpsimpleparser.h"
|
|
||||||
#include "requesttypes.h"
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CookieParser : public HttpSimpleParser
|
|
||||||
{
|
|
||||||
|
|
||||||
const char * cookie_string;
|
|
||||||
CookieTab * cookie_tab;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
virtual int GetChar()
|
|
||||||
{
|
|
||||||
if( !cookie_string || *cookie_string == 0 )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return (int)(unsigned char)*(cookie_string++);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual void Parameter(std::string & name, std::string & value)
|
|
||||||
{
|
|
||||||
// Cookie names are case insensitive according to section 3.1 of RFC 2965
|
|
||||||
ToLower(name);
|
|
||||||
|
|
||||||
std::pair<CookieTab::iterator, bool> res = cookie_tab->insert( std::make_pair(name, value) );
|
|
||||||
|
|
||||||
log << log2 << "Cookie, name: \"" << name << "\", value: \"" << value << "\"";
|
|
||||||
|
|
||||||
if( res.second == false )
|
|
||||||
{
|
|
||||||
res.first->second = value;
|
|
||||||
log << " (overwritten)";
|
|
||||||
}
|
|
||||||
|
|
||||||
log << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
CookieParser()
|
|
||||||
{
|
|
||||||
HttpSimpleParser::separator = ';';
|
|
||||||
HttpSimpleParser::value_can_be_quoted = true;
|
|
||||||
HttpSimpleParser::skip_white_chars = true;
|
|
||||||
HttpSimpleParser::recognize_special_chars = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// cookie_string can be null
|
|
||||||
void Parse(const char * cookie_string_, CookieTab & cookie_tab_)
|
|
||||||
{
|
|
||||||
cookie_string = cookie_string_;
|
|
||||||
cookie_tab = &cookie_tab_;
|
|
||||||
|
|
||||||
HttpSimpleParser::Parse();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
273
core/crypt.cpp
273
core/crypt.cpp
@@ -1,273 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
34
core/cur.h
34
core/cur.h
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_cur
|
|
||||||
#define headerfile_winix_core_cur
|
|
||||||
|
|
||||||
#include "request.h"
|
|
||||||
#include "session.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
current request and session
|
|
||||||
*/
|
|
||||||
struct Cur
|
|
||||||
{
|
|
||||||
Request * request;
|
|
||||||
Session * session;
|
|
||||||
|
|
||||||
// those pointers are never null, if there is no a session for the user
|
|
||||||
// the 'session' pointer pointers at a special temporary session
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_dircontainer
|
|
||||||
#define headerfile_winix_core_dircontainer
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include "item.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DirContainer
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef std::list<Item> Table;
|
|
||||||
typedef Table::iterator Iterator;
|
|
||||||
typedef Table::size_type SizeType;
|
|
||||||
|
|
||||||
typedef std::map<long, Iterator> TableId;
|
|
||||||
typedef std::multimap<long, Iterator> TableParent;
|
|
||||||
typedef TableParent::iterator ParentIterator;
|
|
||||||
typedef TableParent::size_type ParentSizeType;
|
|
||||||
|
|
||||||
|
|
||||||
DirContainer();
|
|
||||||
|
|
||||||
Iterator GetRoot();
|
|
||||||
Iterator GetEtc();
|
|
||||||
Iterator GetVar();
|
|
||||||
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
SizeType Size();
|
|
||||||
bool Empty();
|
|
||||||
Iterator PushBack(const Item & item);
|
|
||||||
bool ChangeParent(long dir_id, long new_parent_id);
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
Iterator FindId(long id);
|
|
||||||
|
|
||||||
bool DelById(long id);
|
|
||||||
|
|
||||||
ParentIterator ParentBegin();
|
|
||||||
ParentIterator ParentEnd();
|
|
||||||
ParentSizeType ParentSize();
|
|
||||||
bool ParentEmpty();
|
|
||||||
ParentIterator FindFirstChild(long parent);
|
|
||||||
ParentIterator NextChild(ParentIterator pi);
|
|
||||||
|
|
||||||
bool IsNameOfSpecialFolder(const std::wstring & name);
|
|
||||||
void FindSpecialFolders();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void CheckSpecialFolder(const Item & item, Iterator iter);
|
|
||||||
|
|
||||||
// main table with dirs
|
|
||||||
Table table;
|
|
||||||
|
|
||||||
// true if there is a root dir in the table
|
|
||||||
bool is_root;
|
|
||||||
|
|
||||||
// root
|
|
||||||
Iterator root_iter;
|
|
||||||
|
|
||||||
// true if there is a etc dir in the table
|
|
||||||
bool is_etc;
|
|
||||||
|
|
||||||
// etc
|
|
||||||
Iterator etc_iter;
|
|
||||||
|
|
||||||
// true if there is a var dir in the table
|
|
||||||
bool is_var;
|
|
||||||
|
|
||||||
// var
|
|
||||||
Iterator var_iter;
|
|
||||||
|
|
||||||
// indexes
|
|
||||||
TableId table_id;
|
|
||||||
TableParent table_parent;
|
|
||||||
|
|
||||||
// names of folders
|
|
||||||
static std::wstring dir_etc, dir_var;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
78
core/error.h
78
core/error.h
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_error
|
|
||||||
#define headerfile_winix_core_error
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
#define WINIX_ERR_OK 0
|
|
||||||
//#define WINIX_ERR_INCORRECT_PATH 1
|
|
||||||
|
|
||||||
//#define WINIX_ERR_NO_POSTVAR 2
|
|
||||||
#define WINIX_ERR_INCORRECT_DIR 3
|
|
||||||
#define WINIX_ERR_CANT_CHANGE_USER 4
|
|
||||||
#define WINIX_ERR_CANT_CHANGE_GROUP 5
|
|
||||||
#define WINIX_ERR_CANT_CHANGE_PRIVILEGES 6
|
|
||||||
#define WINIX_ERR_PERMISSION_DENIED 7
|
|
||||||
#define WINIX_ERR_NO_ROOT_DIR 8
|
|
||||||
#define WINIX_ERR_NO_FUNCTION 9
|
|
||||||
|
|
||||||
|
|
||||||
#define WINIX_ERR_NO_ITEM 10
|
|
||||||
#define WINIX_ERR_UNKNOWN_PARAM 11
|
|
||||||
|
|
||||||
#define WINIX_ERR_MOUNT_UNKNOWN 12
|
|
||||||
#define WINIX_ERR_UNKNOWN_FILESYSTEM 13
|
|
||||||
#define WINIX_ERR_NO_MOUNTPOINT 14
|
|
||||||
//#define WINIX_ERR_MOUNT_NO_PARAM 15
|
|
||||||
|
|
||||||
#define WINIX_ERR_NO_THREAD 16
|
|
||||||
#define WINIX_ERR_EMPTY 17
|
|
||||||
#define WINIX_ERR_SPAM 18
|
|
||||||
#define WINIX_ERR_INCORRECT_REBUS 19
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define WINIX_ERR_NO_BOUNDARY 20
|
|
||||||
#define WINIX_ERR_BROKEN_INPUT 21
|
|
||||||
#define WINIX_ERR_INPUT_TOO_LARGE 22
|
|
||||||
#define WINIX_ERR_CANT_CREATE_FILE 23
|
|
||||||
|
|
||||||
#define WINIX_ERR_NO_TICKET 24
|
|
||||||
|
|
||||||
#define WINIX_ERR_PASSWORDS_DIFFERENT 25
|
|
||||||
#define WINIX_ERR_PASSWORD_TOO_SHORT 26
|
|
||||||
#define WINIX_ERR_USER_EXISTS 27
|
|
||||||
#define WINIX_ERR_LOGIN_EMPTY 28
|
|
||||||
#define WINIX_DIFFERENT_MOUNT_POINTS 29
|
|
||||||
|
|
||||||
|
|
||||||
#define WINIX_ERR_DB_FATAL_ERROR_DURING_CONNECTING 100
|
|
||||||
#define WINIX_ERR_DB_INCORRECT_QUERY 101
|
|
||||||
#define WINIX_ERR_DB_INCORRENT_RESULT_STATUS 102
|
|
||||||
#define WINIX_ERR_DB_NO_COLUMN 103
|
|
||||||
#define WINIX_ERR_DB_INCORRECT_LOGIN 104
|
|
||||||
#define WINIX_ERR_DB_MORE_THAN_ONE_LOGIN 105
|
|
||||||
#define WINIX_ERR_DB_ERR_CURRVAL 106
|
|
||||||
|
|
||||||
#define WINIX_ERR_FILE_EXPECTED 107
|
|
||||||
#define WINIX_ERR_DIR_EXPECTED 108
|
|
||||||
|
|
||||||
//#define WINIX_ERR_UNKNOWN 1000
|
|
||||||
#define WINIX_NOTHING_TO_DO 109
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef int Error;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_getparser
|
|
||||||
#define headerfile_winix_core_getparser
|
|
||||||
|
|
||||||
#include "httpsimpleparser.h"
|
|
||||||
#include "requesttypes.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "utf8.h"
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
|
|
||||||
class GetParser : public HttpSimpleParser
|
|
||||||
{
|
|
||||||
|
|
||||||
const char * get_string;
|
|
||||||
GetTab * get_tab;
|
|
||||||
std::wstring temp;
|
|
||||||
bool input_as_utf8;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual int GetChar()
|
|
||||||
{
|
|
||||||
if( !get_string || *get_string == 0 )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return (int)(unsigned char)*(get_string++);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual void Parameter(std::string &, std::string & value)
|
|
||||||
{
|
|
||||||
if( input_as_utf8 )
|
|
||||||
Ezc::UTF8ToWide(value, temp);
|
|
||||||
else
|
|
||||||
AssignString(value, temp);
|
|
||||||
|
|
||||||
get_tab->push_back(temp);
|
|
||||||
log << log2 << "Get, value: \"" << temp << "\"" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
GetParser()
|
|
||||||
{
|
|
||||||
HttpSimpleParser::separator = '/';
|
|
||||||
HttpSimpleParser::read_name = false;
|
|
||||||
input_as_utf8 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UTF8(bool utf)
|
|
||||||
{
|
|
||||||
input_as_utf8 = utf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get_string_ can be null
|
|
||||||
void Parse(const char * get_string_, GetTab & get_tab_)
|
|
||||||
{
|
|
||||||
get_string = get_string_;
|
|
||||||
get_tab = &get_tab_;
|
|
||||||
|
|
||||||
if( get_string && *get_string == separator )
|
|
||||||
{
|
|
||||||
// skipping one '/' at the beginning
|
|
||||||
++get_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpSimpleParser::Parse();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
43
core/group.h
43
core/group.h
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_group
|
|
||||||
#define headerfile_winix_core_group
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Group
|
|
||||||
{
|
|
||||||
long id;
|
|
||||||
std::wstring name; // group name
|
|
||||||
std::vector<long> members; // users id
|
|
||||||
|
|
||||||
Group()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
id = -1;
|
|
||||||
name.clear();
|
|
||||||
members.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
116
core/groups.cpp
116
core/groups.cpp
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "groups.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Groups::Groups()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Groups::Clear()
|
|
||||||
{
|
|
||||||
table.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Groups::ReadGroups(Db * db)
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
db->GetGroups(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Group * Groups::GetGroup(long group_id)
|
|
||||||
{
|
|
||||||
Table::Iterator i = table.FindId(group_id);
|
|
||||||
|
|
||||||
if( i == table.End() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &(*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Group * Groups::GetGroup(const std::wstring & name)
|
|
||||||
{
|
|
||||||
Table::Iterator i = table.FindName(name);
|
|
||||||
|
|
||||||
if( i == table.End() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &(*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
long Groups::GetGroupId(const std::wstring & name)
|
|
||||||
{
|
|
||||||
Group * pgroup = GetGroup(name);
|
|
||||||
|
|
||||||
if( !pgroup )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return pgroup->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Groups::Iterator Groups::Begin()
|
|
||||||
{
|
|
||||||
return table.Begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Groups::Iterator Groups::End()
|
|
||||||
{
|
|
||||||
return table.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Groups::SizeType Groups::Size()
|
|
||||||
{
|
|
||||||
return table.Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Group & Groups::operator[](Groups::SizeType pos)
|
|
||||||
{
|
|
||||||
return table[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_groups
|
|
||||||
#define headerfile_winix_core_groups
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include "group.h"
|
|
||||||
#include "ugcontainer.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Groups
|
|
||||||
{
|
|
||||||
typedef UGContainer<Group> Table;
|
|
||||||
|
|
||||||
Table table;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef Table::Iterator Iterator;
|
|
||||||
typedef Table::SizeType SizeType;
|
|
||||||
|
|
||||||
Groups();
|
|
||||||
void Clear();
|
|
||||||
void ReadGroups(Db * db);
|
|
||||||
Group * GetGroup(long group_id);
|
|
||||||
Group * GetGroup(const std::wstring & name);
|
|
||||||
long GetGroupId(const std::wstring & name);
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
SizeType Size();
|
|
||||||
Group & operator[](SizeType pos);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,235 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "httpsimpleparser.h"
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::ToLower(std::string & s)
|
|
||||||
{
|
|
||||||
std::string::iterator i;
|
|
||||||
|
|
||||||
for(i=s.begin() ; i!= s.end() ; ++i)
|
|
||||||
{
|
|
||||||
if( *i>='A' && *i<='Z' )
|
|
||||||
*i = *i - 'A' + 'a';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool HttpSimpleParser::IsWhite(int c)
|
|
||||||
{
|
|
||||||
if( c==' ' || c=='\t' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::SkipWhiteChars()
|
|
||||||
{
|
|
||||||
while( IsWhite(last_c) )
|
|
||||||
last_c = GetChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::TrimWhiteChars(std::string & s)
|
|
||||||
{
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string::size_type i;
|
|
||||||
|
|
||||||
for(i = 0 ; i<s.size() && IsWhite(s[i]) ; ++i);
|
|
||||||
|
|
||||||
if( i == s.size() )
|
|
||||||
{
|
|
||||||
// all characters are white
|
|
||||||
s.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( i > 0 )
|
|
||||||
// there are some white characters at the beginning
|
|
||||||
s.erase(0, i);
|
|
||||||
|
|
||||||
|
|
||||||
// s is not empty now (i was not equal s.size())
|
|
||||||
// and we have some non white characters
|
|
||||||
// we stops at the last non white character
|
|
||||||
for(i = s.size()-1 ; i>0 && IsWhite(s[i]) ; --i);
|
|
||||||
|
|
||||||
if( i != s.size()-1 )
|
|
||||||
// there are some white characters at the end
|
|
||||||
// we're starting from i+1 even when i==0 (there are some non white characters)
|
|
||||||
s.erase(i+1, s.size() - i - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int HttpSimpleParser::ParseHalfHex(int c)
|
|
||||||
{
|
|
||||||
if( c>='a' && c<='z' )
|
|
||||||
c += 'A' - 'a'; // to upper case
|
|
||||||
|
|
||||||
|
|
||||||
if( c >= 'A' )
|
|
||||||
c = c - 'A' + 10;
|
|
||||||
else
|
|
||||||
c = c - '0';
|
|
||||||
|
|
||||||
c &= 0xf;
|
|
||||||
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::CheckSpecialChar()
|
|
||||||
{
|
|
||||||
if( last_c == '%' )
|
|
||||||
{
|
|
||||||
int c1 = GetChar();
|
|
||||||
int c2 = GetChar();
|
|
||||||
|
|
||||||
if( c1==-1 || c2==-1 )
|
|
||||||
{
|
|
||||||
last_c = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c1 = ParseHalfHex(c1);
|
|
||||||
c2 = ParseHalfHex(c2);
|
|
||||||
|
|
||||||
last_c = (c1 << 4) + c2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( last_c == '+' )
|
|
||||||
{
|
|
||||||
last_c = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::ReadName()
|
|
||||||
{
|
|
||||||
// we're checking 'separator' and '=' because the string is allowed not having '=' (the value is optional)
|
|
||||||
|
|
||||||
for( ; last_c!=-1 && last_c!=separator && last_c!='=' ; last_c = GetChar() )
|
|
||||||
{
|
|
||||||
if( recognize_special_chars )
|
|
||||||
CheckSpecialChar();
|
|
||||||
|
|
||||||
if( last_c != -1 )
|
|
||||||
last_name += last_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( last_c == '=' )
|
|
||||||
last_c = GetChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::ReadQuotedValue()
|
|
||||||
{
|
|
||||||
// skipping '"'
|
|
||||||
last_c = GetChar();
|
|
||||||
|
|
||||||
|
|
||||||
for( ; last_c!=-1 && last_c!='"' ; last_c = GetChar() )
|
|
||||||
{
|
|
||||||
if( recognize_special_chars )
|
|
||||||
CheckSpecialChar();
|
|
||||||
|
|
||||||
if( last_c != -1 )
|
|
||||||
last_value += last_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( last_c == '"' )
|
|
||||||
last_c = GetChar();
|
|
||||||
|
|
||||||
// looking for a separator (skipping)
|
|
||||||
for( ; last_c!=-1 && last_c!=separator ; last_c = GetChar() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::ReadValue()
|
|
||||||
{
|
|
||||||
if( skip_white_chars )
|
|
||||||
SkipWhiteChars();
|
|
||||||
|
|
||||||
if( value_can_be_quoted && last_c == '"' )
|
|
||||||
{
|
|
||||||
ReadQuotedValue();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( ; last_c!=-1 && last_c!=separator ; last_c = GetChar() )
|
|
||||||
{
|
|
||||||
if( recognize_special_chars )
|
|
||||||
CheckSpecialChar();
|
|
||||||
|
|
||||||
if( last_c != -1 )
|
|
||||||
last_value += last_c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( last_c == separator )
|
|
||||||
last_c = GetChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HttpSimpleParser::Parse()
|
|
||||||
{
|
|
||||||
for( last_c = GetChar() ; last_c != -1 ; )
|
|
||||||
{
|
|
||||||
last_name.clear();
|
|
||||||
last_value.clear();
|
|
||||||
|
|
||||||
if( read_name )
|
|
||||||
ReadName();
|
|
||||||
|
|
||||||
ReadValue();
|
|
||||||
|
|
||||||
if( skip_white_chars )
|
|
||||||
{
|
|
||||||
TrimWhiteChars(last_name);
|
|
||||||
TrimWhiteChars(last_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Parameter(last_name, last_value); // user definied function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_httpsimpleparser
|
|
||||||
#define headerfile_winix_core_httpsimpleparser
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HttpSimpleParser
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
|
|
||||||
bool read_name;
|
|
||||||
bool value_can_be_quoted;
|
|
||||||
bool skip_white_chars;
|
|
||||||
bool recognize_special_chars;
|
|
||||||
|
|
||||||
int ParseHalfHex(int c);
|
|
||||||
void ReadName();
|
|
||||||
void ReadQuotedValue();
|
|
||||||
void ReadValue();
|
|
||||||
|
|
||||||
std::string last_name;
|
|
||||||
std::string last_value;
|
|
||||||
|
|
||||||
int last_c;
|
|
||||||
int separator;
|
|
||||||
|
|
||||||
// '-1' means end (eof)
|
|
||||||
virtual int GetChar() = 0;
|
|
||||||
virtual void Parameter(std::string & last_name, std::string & last_value) = 0;
|
|
||||||
|
|
||||||
void ToLower(std::string & s);
|
|
||||||
bool IsWhite(int c);
|
|
||||||
|
|
||||||
void SkipWhiteChars();
|
|
||||||
void TrimWhiteChars(std::string & s);
|
|
||||||
void CheckSpecialChar();
|
|
||||||
|
|
||||||
void Parse();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
HttpSimpleParser()
|
|
||||||
{
|
|
||||||
separator = '&';
|
|
||||||
read_name = true;
|
|
||||||
value_can_be_quoted = false;
|
|
||||||
skip_white_chars = false;
|
|
||||||
recognize_special_chars = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "item.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Item::Item()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Item::SetDateToNow()
|
|
||||||
{
|
|
||||||
date_creation = Time(std::time(0));
|
|
||||||
date_modification = date_creation;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Item::SetDateModifyToNow()
|
|
||||||
{
|
|
||||||
date_modification = Time(std::time(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Item::Clear()
|
|
||||||
{
|
|
||||||
id = -1;
|
|
||||||
|
|
||||||
user_id = -1;
|
|
||||||
group_id = -1;
|
|
||||||
privileges = 0;
|
|
||||||
modification_user_id = -1;
|
|
||||||
|
|
||||||
guest_name.clear();
|
|
||||||
|
|
||||||
subject.clear();
|
|
||||||
content.clear();
|
|
||||||
modify_index = 0;
|
|
||||||
url.clear();
|
|
||||||
|
|
||||||
content_type = ct_formatted_text;
|
|
||||||
|
|
||||||
type = none;
|
|
||||||
parent_id = -1;
|
|
||||||
|
|
||||||
link_to.clear();
|
|
||||||
link_redirect = false;
|
|
||||||
|
|
||||||
content_id = -1;
|
|
||||||
ref = 1;
|
|
||||||
|
|
||||||
file_path.clear();
|
|
||||||
file_fs = -1;
|
|
||||||
file_type = WINIX_ITEM_FILETYPE_NONE;
|
|
||||||
|
|
||||||
has_thumb = false;
|
|
||||||
|
|
||||||
html_template.clear();
|
|
||||||
|
|
||||||
SetDateToNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
106
core/item.h
106
core/item.h
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_item
|
|
||||||
#define headerfile_winix_core_item
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
#define WINIX_ITEM_FILETYPE_NONE 0
|
|
||||||
#define WINIX_ITEM_FILETYPE_IMAGE 1
|
|
||||||
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
|
|
||||||
#define WINIX_ITEM_FILETYPE_UNKNOWN 3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Item
|
|
||||||
{
|
|
||||||
long id;
|
|
||||||
long parent_id;
|
|
||||||
|
|
||||||
|
|
||||||
long user_id;
|
|
||||||
long group_id;
|
|
||||||
std::wstring guest_name; // used as a user name when user_id is equal -1
|
|
||||||
|
|
||||||
long modification_user_id; // who has modified the item last (not taken into account when checking permissions)
|
|
||||||
|
|
||||||
int privileges;
|
|
||||||
|
|
||||||
tm date_creation;
|
|
||||||
tm date_modification;
|
|
||||||
|
|
||||||
std::wstring subject;
|
|
||||||
std::wstring content;
|
|
||||||
|
|
||||||
std::wstring url;
|
|
||||||
int modify_index;
|
|
||||||
|
|
||||||
enum ContentType
|
|
||||||
{
|
|
||||||
ct_text = 0,
|
|
||||||
ct_formatted_text,
|
|
||||||
ct_html,
|
|
||||||
ct_bbcode,
|
|
||||||
ct_raw
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentType content_type;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum Type
|
|
||||||
{
|
|
||||||
dir = 0,
|
|
||||||
file = 1,
|
|
||||||
symlink = 2,
|
|
||||||
|
|
||||||
none = 1000
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Type type;
|
|
||||||
|
|
||||||
|
|
||||||
// used when type is symlink or to a directory too (function 'default')
|
|
||||||
std::wstring link_to;
|
|
||||||
int link_redirect;
|
|
||||||
|
|
||||||
|
|
||||||
// static file (if exists)
|
|
||||||
std::wstring file_path; // relative file path
|
|
||||||
int file_fs; // file system type where the file was saved
|
|
||||||
int file_type; // file type (none, image, doc, etc)
|
|
||||||
bool has_thumb;
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring html_template;
|
|
||||||
|
|
||||||
|
|
||||||
// methods
|
|
||||||
Item();
|
|
||||||
void SetDateToNow();
|
|
||||||
void SetDateModifyToNow();
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
// used by the database
|
|
||||||
long content_id; // content id in 'content' table
|
|
||||||
int ref; // content references
|
|
||||||
|
|
||||||
friend class Db;
|
|
||||||
friend class DbItemColumns;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "lastcontainer.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
LastItem::LastItem()
|
|
||||||
{
|
|
||||||
user_id = 0;
|
|
||||||
ip = 0;
|
|
||||||
session_id = 0;
|
|
||||||
memset((char*)&start, 0, sizeof(start));
|
|
||||||
memset((char*)&end, 0, sizeof(end));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool LastItem::IsLoggedOut()
|
|
||||||
{
|
|
||||||
if( end.tm_sec == 0 &&
|
|
||||||
end.tm_min == 0 &&
|
|
||||||
end.tm_hour == 0 &&
|
|
||||||
end.tm_mday == 0 &&
|
|
||||||
end.tm_mon == 0 &&
|
|
||||||
end.tm_year == 0 )
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LastContainer::Iterator LastContainer::Begin()
|
|
||||||
{
|
|
||||||
return last_tab.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LastContainer::Iterator LastContainer::End()
|
|
||||||
{
|
|
||||||
return last_tab.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LastContainer::Iterator LastContainer::FindNotLoggedOut(long user_id, long session_id)
|
|
||||||
{
|
|
||||||
LastTab::iterator i;
|
|
||||||
|
|
||||||
for(i=last_tab.begin() ; i!=last_tab.end() ; ++i)
|
|
||||||
{
|
|
||||||
if( i->user_id == user_id && i->session_id == session_id && !i->IsLoggedOut() )
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return last_tab.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LastContainer::UserLogin(long user_id, const std::wstring & name, unsigned int ip, long session_id)
|
|
||||||
{
|
|
||||||
LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
|
|
||||||
|
|
||||||
if( i != last_tab.end() )
|
|
||||||
{
|
|
||||||
log << log1 << "LC: such a user and session_id exist, not added as a new one" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( last_tab.size() >= WINIX_LASTCONTAINER_TABLE_SIZE ) // last_tab has O(n) complexity
|
|
||||||
last_tab.erase(last_tab.begin());
|
|
||||||
|
|
||||||
LastItem li;
|
|
||||||
|
|
||||||
li.user_id = user_id;
|
|
||||||
li.name = name;
|
|
||||||
li.ip = ip;
|
|
||||||
li.session_id = session_id;
|
|
||||||
li.start = Time(std::time(0));
|
|
||||||
|
|
||||||
last_tab.insert(last_tab.end(), li);
|
|
||||||
|
|
||||||
log << log2 << "LC: added user: " << name << " into the last table" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LastContainer::UserLogout(long user_id, long session_id)
|
|
||||||
{
|
|
||||||
LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
|
|
||||||
|
|
||||||
if( i != last_tab.end() )
|
|
||||||
{
|
|
||||||
i->end = Time(std::time(0));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log4 << "LC: there is no such a user to log out" << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_lastcontainer
|
|
||||||
#define headerfile_winix_core_lastcontainer
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#include <cstring>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// how many items we store in the 'last' function
|
|
||||||
#define WINIX_LASTCONTAINER_TABLE_SIZE 100
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct LastItem
|
|
||||||
{
|
|
||||||
long user_id;
|
|
||||||
|
|
||||||
// additional we store the whole string-name
|
|
||||||
// (you can delete a user from the database but we can still print the name)
|
|
||||||
std::wstring name;
|
|
||||||
|
|
||||||
// ip address
|
|
||||||
unsigned int ip;
|
|
||||||
|
|
||||||
// session id (used when logging out)
|
|
||||||
long session_id;
|
|
||||||
|
|
||||||
// start logging and end logging
|
|
||||||
tm start;
|
|
||||||
tm end;
|
|
||||||
|
|
||||||
|
|
||||||
LastItem();
|
|
||||||
bool IsLoggedOut();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LastContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef std::list<LastItem> LastTab;
|
|
||||||
typedef LastTab::iterator Iterator;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
void UserLogin(long user_id, const std::wstring & name, unsigned int ip, long session_id);
|
|
||||||
void UserLogout(long user_id, long session_id);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
LastTab last_tab;
|
|
||||||
Iterator FindNotLoggedOut(long user_id, long session_id);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
358
core/log.cpp
358
core/log.cpp
@@ -1,358 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
#include <ctime>
|
|
||||||
#include <string.h>
|
|
||||||
#include "utf8.h"
|
|
||||||
|
|
||||||
|
|
||||||
Log::Log()
|
|
||||||
{
|
|
||||||
log_level = 1;
|
|
||||||
current_level = 100; // nothing to log (call Init() first)
|
|
||||||
request = 0;
|
|
||||||
max_requests = 1;
|
|
||||||
lines = 0;
|
|
||||||
max_lines = 5000;
|
|
||||||
log_file_open = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Log::~Log()
|
|
||||||
{
|
|
||||||
SaveLogAndClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Log::Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests)
|
|
||||||
{
|
|
||||||
log_level = log_level_;
|
|
||||||
log_file = log_file_;
|
|
||||||
log_stdout = log_std;
|
|
||||||
max_requests = log_max_requests;
|
|
||||||
save_each_line = save_each_line_;
|
|
||||||
|
|
||||||
// don't open the file here
|
|
||||||
// because it would be created with the root as an owner
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Log::OpenFile()
|
|
||||||
{
|
|
||||||
if( !log_file.empty() )
|
|
||||||
{
|
|
||||||
file.open( log_file.c_str(), std::ios_base::out | std::ios_base::app );
|
|
||||||
log_file_open = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Log::PutDate(Manipulators m)
|
|
||||||
{
|
|
||||||
// logs are related to localtime
|
|
||||||
|
|
||||||
time_t t = std::time(0);
|
|
||||||
std::tm * loct = std::localtime(&t);
|
|
||||||
|
|
||||||
char buffer[70];
|
|
||||||
sprintf(buffer, "%d.%02d.%02d %02d:%02d:%02d ", int(loct->tm_year + 1900),
|
|
||||||
int(loct->tm_mon + 1),
|
|
||||||
int(loct->tm_mday),
|
|
||||||
int(loct->tm_hour),
|
|
||||||
int(loct->tm_min),
|
|
||||||
int(loct->tm_sec));
|
|
||||||
|
|
||||||
(*this) << m << buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const void * s)
|
|
||||||
{
|
|
||||||
if( current_level > log_level )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
buffer << s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const char * s)
|
|
||||||
{
|
|
||||||
if( current_level > log_level )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
if( !s )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
buffer << s;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const std::string & s)
|
|
||||||
{
|
|
||||||
if( current_level > log_level )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
buffer << s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const std::string * s)
|
|
||||||
{
|
|
||||||
if( current_level > log_level )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
buffer << *s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const wchar_t * s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
if( s )
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const std::wstring & s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(const std::wstring * s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << *s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(int s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(long s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(char s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(wchar_t s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(size_t s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(double s)
|
|
||||||
{
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log & Log::operator<<(Manipulators m)
|
|
||||||
{
|
|
||||||
switch(m)
|
|
||||||
{
|
|
||||||
case logend:
|
|
||||||
if( current_level <= log_level )
|
|
||||||
{
|
|
||||||
buffer << '\n';
|
|
||||||
lines += 1;
|
|
||||||
|
|
||||||
if( save_each_line )
|
|
||||||
SaveLogAndClear();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case logsave:
|
|
||||||
SaveLogAndClear();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case logendrequest:
|
|
||||||
if( ++request >= max_requests || lines > max_lines )
|
|
||||||
SaveLogAndClear();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case log1:
|
|
||||||
current_level = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case log2:
|
|
||||||
current_level = 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case log3:
|
|
||||||
current_level = 3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case log4:
|
|
||||||
current_level = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Log::SystemErr(int err)
|
|
||||||
{
|
|
||||||
(*this) << "errno: " << err;
|
|
||||||
|
|
||||||
const char * err_msg = strerror(err);
|
|
||||||
|
|
||||||
if( err_msg )
|
|
||||||
(*this) << " (" << err_msg << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Log::SaveLogAndClear()
|
|
||||||
{
|
|
||||||
SaveLog();
|
|
||||||
|
|
||||||
buffer.Clear();
|
|
||||||
request = 0;
|
|
||||||
lines = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Log::SaveLog()
|
|
||||||
{
|
|
||||||
if( buffer.Str().empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( log_stdout )
|
|
||||||
Ezc::WideToUTF8(buffer.Str(), std::cout);
|
|
||||||
|
|
||||||
if( log_file.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( !log_file_open || !file )
|
|
||||||
{
|
|
||||||
file.close();
|
|
||||||
file.clear();
|
|
||||||
|
|
||||||
OpenFile();
|
|
||||||
|
|
||||||
if( !file )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ezc::WideToUTF8(buffer.Str(), file);
|
|
||||||
file.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
132
core/log.h
132
core/log.h
@@ -1,132 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_log
|
|
||||||
#define headerfile_winix_core_log
|
|
||||||
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include "textstream.h"
|
|
||||||
|
|
||||||
|
|
||||||
// log1 - the first level
|
|
||||||
// log2
|
|
||||||
// log3
|
|
||||||
// log4 - the last level (debug level)
|
|
||||||
// logend - the end of a line
|
|
||||||
// logendrequest - end of a current request
|
|
||||||
// logsave - current log buffer is saved and cleared
|
|
||||||
enum Manipulators { log1, log2, log3, log4, logend, logendrequest, logsave };
|
|
||||||
|
|
||||||
|
|
||||||
class Log
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Log();
|
|
||||||
~Log();
|
|
||||||
|
|
||||||
void Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests);
|
|
||||||
|
|
||||||
void PutDate(Manipulators m);
|
|
||||||
Log & operator<<(const void * s);
|
|
||||||
Log & operator<<(const char * s);
|
|
||||||
Log & operator<<(const std::string * s);
|
|
||||||
Log & operator<<(const std::string & s);
|
|
||||||
Log & operator<<(const wchar_t * s);
|
|
||||||
Log & operator<<(const std::wstring * s);
|
|
||||||
Log & operator<<(const std::wstring & s);
|
|
||||||
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();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// buffer for the log
|
|
||||||
TextStream<std::wstring> buffer;
|
|
||||||
|
|
||||||
// log lovel from the config file
|
|
||||||
int log_level;
|
|
||||||
|
|
||||||
// current level set by a modifier (e.g. log << log3)
|
|
||||||
int current_level;
|
|
||||||
|
|
||||||
// current request for logging
|
|
||||||
// starts from zero and incremented after logendrequest modifier
|
|
||||||
int request;
|
|
||||||
|
|
||||||
// how many request to save at once
|
|
||||||
int max_requests;
|
|
||||||
|
|
||||||
// file log
|
|
||||||
std::string log_file;
|
|
||||||
std::ofstream file;
|
|
||||||
|
|
||||||
// logging to stdout
|
|
||||||
bool log_stdout;
|
|
||||||
|
|
||||||
// how many lines there are in the buffer
|
|
||||||
int lines;
|
|
||||||
|
|
||||||
// is the config file already open
|
|
||||||
bool log_file_open;
|
|
||||||
|
|
||||||
// how many lines can be in the config buffer
|
|
||||||
// default: 5000
|
|
||||||
int max_lines;
|
|
||||||
|
|
||||||
// whether to save each line (for debug)
|
|
||||||
bool save_each_line;
|
|
||||||
|
|
||||||
void OpenFile();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
1018
core/misc.cpp
1018
core/misc.cpp
File diff suppressed because it is too large
Load Diff
433
core/misc.h
433
core/misc.h
@@ -1,433 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_misc
|
|
||||||
#define headerfile_winix_core_misc
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
#include <ctime>
|
|
||||||
#include <cstdio>
|
|
||||||
#include "item.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
conversions between text and numbers
|
|
||||||
*/
|
|
||||||
|
|
||||||
int Toi(const std::string & str, int base = 10);
|
|
||||||
int Toi(const std::wstring & str, int base = 10);
|
|
||||||
int Toi(const char * str, int base = 10);
|
|
||||||
int Toi(const wchar_t * str, int base = 10);
|
|
||||||
|
|
||||||
long Tol(const std::string & str, int base = 10);
|
|
||||||
long Tol(const std::wstring & str, int base = 10);
|
|
||||||
long Tol(const char * str, int base = 10);
|
|
||||||
long Tol(const wchar_t * str, int base = 10);
|
|
||||||
|
|
||||||
|
|
||||||
// if the buffer is too small it will be terminated at the beginning (empty string)
|
|
||||||
// and the function returns false
|
|
||||||
template<class CharType>
|
|
||||||
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10)
|
|
||||||
{
|
|
||||||
size_t i1, i2;
|
|
||||||
long rest;
|
|
||||||
|
|
||||||
if( buf_len == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
i1 = i2 = 0;
|
|
||||||
|
|
||||||
if( base < 2 ) base = 2;
|
|
||||||
if( base > 16 ) base = 16;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rest = value % base;
|
|
||||||
value = value / base;
|
|
||||||
buffer[i2++] = (rest < 10) ? char(rest) + '0' : char(rest) - 10 + 'A';
|
|
||||||
}
|
|
||||||
while(value != 0 && i2 < buf_len);
|
|
||||||
|
|
||||||
if( i2 >= buf_len )
|
|
||||||
{
|
|
||||||
buffer[0] = 0; // ops, the buffer was too small
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[i2--] = 0;
|
|
||||||
|
|
||||||
for( ; i1 < i2 ; ++i1, --i2)
|
|
||||||
{
|
|
||||||
CharType temp = buffer[i1];
|
|
||||||
buffer[i1] = buffer[i2];
|
|
||||||
buffer[i2] = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if the buffer is too small it will be terminated at the beginning (empty string)
|
|
||||||
// and the function returns false
|
|
||||||
template<class CharType>
|
|
||||||
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10)
|
|
||||||
{
|
|
||||||
if( buf_len == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CharType * buf = buffer;
|
|
||||||
|
|
||||||
if( value < 0 )
|
|
||||||
{
|
|
||||||
buffer[0] = '-';
|
|
||||||
buf += 1;
|
|
||||||
buf_len -= 1;
|
|
||||||
value = -value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool res = Toa(static_cast<unsigned long>(value), buf, buf_len, base);
|
|
||||||
|
|
||||||
if( !res )
|
|
||||||
buffer[0] = 0;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CharType>
|
|
||||||
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10)
|
|
||||||
{
|
|
||||||
return Toa(static_cast<unsigned long>(value), buffer, buf_len, base);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CharType>
|
|
||||||
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10)
|
|
||||||
{
|
|
||||||
return Toa(static_cast<long>(value), buffer, buf_len, base);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// warning: it uses its own static buffer
|
|
||||||
// one buffer for both these functions
|
|
||||||
const wchar_t * Toa(unsigned int value, int base = 10);
|
|
||||||
const wchar_t * Toa(unsigned long value, int base = 10);
|
|
||||||
const wchar_t * Toa(int value, int base = 10);
|
|
||||||
const wchar_t * Toa(long value, int base = 10);
|
|
||||||
|
|
||||||
|
|
||||||
void Toa(int value, std::string & res, int base = 10, bool clear = true);
|
|
||||||
void Toa(long value, std::string & res, int base = 10, bool clear = true);
|
|
||||||
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
|
|
||||||
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
conversions between ascii text and wide characters
|
|
||||||
(destination is always std::string or std::wstring)
|
|
||||||
|
|
||||||
characters are copied as they are without any locales checking
|
|
||||||
*/
|
|
||||||
|
|
||||||
void AssignString(const char * src, size_t len, std::wstring & dst, bool clear = true);
|
|
||||||
void AssignString(const char * src, std::wstring & dst, bool clear = true);
|
|
||||||
void AssignString(const std::string & src, std::wstring & dst, bool clear = true);
|
|
||||||
|
|
||||||
void AssignString(const wchar_t * src, size_t len, std::string & dst, bool clear = true);
|
|
||||||
void AssignString(const wchar_t * src, std::string & dst, bool clear = true);
|
|
||||||
void AssignString(const std::wstring & src, std::string & dst, bool clear = true);
|
|
||||||
|
|
||||||
void AssignString(const char * src, size_t len, std::string & dst, bool clear = true);
|
|
||||||
void AssignString(const char * src, std::string & dst, bool clear = true);
|
|
||||||
void AssignString(const std::string & src, std::string & dst, bool clear = true);
|
|
||||||
|
|
||||||
void AssignString(const wchar_t * src, size_t len, std::wstring & dst, bool clear = true);
|
|
||||||
void AssignString(const wchar_t * src, std::wstring & dst, bool clear = true);
|
|
||||||
void AssignString(const std::wstring & src, std::wstring & dst, bool clear = true);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CorrectUrlChar(wchar_t c);
|
|
||||||
void CorrectUrlDots(std::wstring & url);
|
|
||||||
void CorrectUrlChars(std::wstring & url);
|
|
||||||
void CorrectUrlOnlyAllowedChar(std::wstring & url);
|
|
||||||
|
|
||||||
|
|
||||||
const wchar_t * DateToStr(int year, int month, int day);
|
|
||||||
const wchar_t * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
|
||||||
const wchar_t * DateToStr(const tm * ptm);
|
|
||||||
const wchar_t * DateToStr(const tm & rtm);
|
|
||||||
const wchar_t * DateToStr(time_t t);
|
|
||||||
const wchar_t * DateToStrWithoutHours(const tm * ptm);
|
|
||||||
const wchar_t * DateToStrWithoutHours(const tm & rtm);
|
|
||||||
const wchar_t * DateToStrWithoutHours(time_t t);
|
|
||||||
|
|
||||||
const char * DateToStrCookie(int year, int month, int day, int hour, int min, int sec);
|
|
||||||
const char * DateToStrCookie(const tm * ptm);
|
|
||||||
const char * DateToStrCookie(const tm & rtm);
|
|
||||||
const char * DateToStrCookie(time_t t);
|
|
||||||
|
|
||||||
const wchar_t * IpToStr(unsigned int ip_);
|
|
||||||
|
|
||||||
bool IsWhite(wchar_t s);
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void TrimWhite(StringType & s)
|
|
||||||
{
|
|
||||||
typename StringType::size_type i;
|
|
||||||
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// looking for white characters at the end
|
|
||||||
for(i=s.size()-1 ; i>0 && IsWhite(s[i]) ; --i);
|
|
||||||
|
|
||||||
if( i==0 && IsWhite(s[i]) )
|
|
||||||
{
|
|
||||||
// the whole string has white characters
|
|
||||||
s.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// deleting white characters at the end
|
|
||||||
if( i != s.size() - 1 )
|
|
||||||
s.erase(i+1, StringType::npos);
|
|
||||||
|
|
||||||
// looking for white characters at the beginning
|
|
||||||
for(i=0 ; i<s.size() && IsWhite(s[i]) ; ++i);
|
|
||||||
|
|
||||||
// deleting white characters at the beginning
|
|
||||||
if( i != 0 )
|
|
||||||
s.erase(0, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void Trim(StringType & s, wchar_t c)
|
|
||||||
{
|
|
||||||
typename StringType::size_type i;
|
|
||||||
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// looking for the 'c' characters at the end
|
|
||||||
for(i=s.size()-1 ; i>0 && s[i]==c ; --i);
|
|
||||||
|
|
||||||
if( i==0 && s[i]==c )
|
|
||||||
{
|
|
||||||
// the whole string has the 'c' characters
|
|
||||||
s.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// deleting 'c' characters at the end
|
|
||||||
if( i != s.size() - 1 )
|
|
||||||
s.erase(i+1, StringType::npos);
|
|
||||||
|
|
||||||
// looking for the 'c' characters at the beginning
|
|
||||||
for(i=0 ; i<s.size() && s[i]==c ; ++i);
|
|
||||||
|
|
||||||
// deleting the 'c' characters at the beginning
|
|
||||||
if( i != 0 )
|
|
||||||
s.erase(0, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wchar_t ToSmall(wchar_t c);
|
|
||||||
void ToSmall(std::wstring & s);
|
|
||||||
|
|
||||||
const char * SkipWhite(const char * s);
|
|
||||||
const wchar_t * SkipWhite(const wchar_t * s);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool IsSubString(const StringType1 * short_str, const StringType2 * long_str)
|
|
||||||
{
|
|
||||||
while( *short_str && *long_str && wchar_t(*short_str) == wchar_t(*long_str) )
|
|
||||||
{
|
|
||||||
++short_str;
|
|
||||||
++long_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( *short_str == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool IsSubString(const StringType1 & short_str, const StringType2 & long_str)
|
|
||||||
{
|
|
||||||
return IsSubString(short_str.c_str(), long_str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool IsSubStringNoCase(const StringType1 * short_str, const StringType2 * long_str)
|
|
||||||
{
|
|
||||||
while( *short_str && *long_str && ToSmall(*short_str) == ToSmall(*long_str) )
|
|
||||||
{
|
|
||||||
++short_str;
|
|
||||||
++long_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( *short_str == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool IsSubStringNoCase(const StringType1 & short_str, const StringType2 & long_str)
|
|
||||||
{
|
|
||||||
return IsSubStringNoCase(short_str.c_str(), long_str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool Equal(const StringType1 * str1, const StringType2 * str2)
|
|
||||||
{
|
|
||||||
while( *str1 && *str2 && wchar_t(*str1) == wchar_t(*str2) )
|
|
||||||
{
|
|
||||||
++str1;
|
|
||||||
++str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( *str1 == 0 && *str2 == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool Equal(const StringType1 & str1, const StringType2 & str2)
|
|
||||||
{
|
|
||||||
return Equal(str1.c_str(), str2.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool EqualNoCase(const StringType1 * str1, const StringType2 * str2)
|
|
||||||
{
|
|
||||||
while( *str1 && *str2 && ToSmall(*str1) == ToSmall(*str2) )
|
|
||||||
{
|
|
||||||
++str1;
|
|
||||||
++str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( *str1 == 0 && *str2 == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType1, class StringType2>
|
|
||||||
bool EqualNoCase(const StringType1 & str1, const StringType2 & str2)
|
|
||||||
{
|
|
||||||
return EqualNoCase(str1.c_str(), str2.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void NoLastSlash(StringType & s)
|
|
||||||
{
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
size_t i = s.size();
|
|
||||||
|
|
||||||
for( ; i>0 && s[i-1]=='/' ; --i);
|
|
||||||
|
|
||||||
if( i < s.size() )
|
|
||||||
s.erase(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void NoFirstHttp(StringType & s)
|
|
||||||
{
|
|
||||||
if( s.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
const char http[] = "http://";
|
|
||||||
const char https[] = "https://";
|
|
||||||
|
|
||||||
if( IsSubStringNoCase(http, s.c_str()) )
|
|
||||||
{
|
|
||||||
s.erase(0, sizeof(http)/sizeof(char));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( IsSubStringNoCase(https, s.c_str()) )
|
|
||||||
{
|
|
||||||
s.erase(0, sizeof(https)/sizeof(char));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ValidateEmail(const std::wstring & email);
|
|
||||||
|
|
||||||
bool IsFile(const wchar_t * file);
|
|
||||||
bool IsFile(const std::wstring & file);
|
|
||||||
bool CreateDir(const wchar_t * dir, int priv);
|
|
||||||
bool CreateDir(const std::wstring & dir, int priv);
|
|
||||||
|
|
||||||
// creating directories (dirs) under base_dir (base_dir must exist)
|
|
||||||
// if skip_last == true then last part from dir is treated as a file (the last directory is not created)
|
|
||||||
bool CreateDirs(const wchar_t * base_dir, const wchar_t * dirs, int priv = 0755, bool skip_last = false);
|
|
||||||
bool CreateDirs(const std::wstring & base_dir, const std::wstring & dirs, int priv = 0755, bool skip_last = false);
|
|
||||||
|
|
||||||
bool CopyFile(FILE * in, FILE * out);
|
|
||||||
bool CopyFile(const wchar_t * src, const wchar_t * dst);
|
|
||||||
bool CopyFile(const std::wstring & src, const std::wstring & dst);
|
|
||||||
|
|
||||||
bool RemoveFile(const wchar_t * file);
|
|
||||||
bool RemoveFile(const std::wstring & file);
|
|
||||||
|
|
||||||
bool RenameFile(const wchar_t * from, const wchar_t * to);
|
|
||||||
bool RenameFile(const std::wstring & from, const std::wstring & to);
|
|
||||||
|
|
||||||
const wchar_t * GetFileExt(const wchar_t * name);
|
|
||||||
int SelectFileType(const wchar_t * file_name);
|
|
||||||
int SelectFileType(const std::wstring & file_name);
|
|
||||||
|
|
||||||
|
|
||||||
time_t Time(const tm & par);
|
|
||||||
time_t Time(const tm * par);
|
|
||||||
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
|
|
||||||
71
core/mount.h
71
core/mount.h
@@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_mount
|
|
||||||
#define headerfile_winix_core_mount
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Mount
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
struct ParamRow
|
|
||||||
{
|
|
||||||
typedef std::vector<std::wstring> ParamArg;
|
|
||||||
|
|
||||||
bool defined;
|
|
||||||
ParamArg arg;
|
|
||||||
|
|
||||||
ParamRow() { defined = false; }
|
|
||||||
void Clear() { defined = false; arg.clear(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<ParamRow> Param;
|
|
||||||
|
|
||||||
|
|
||||||
long dir_id;
|
|
||||||
int type;
|
|
||||||
int fs;
|
|
||||||
Param param;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mount();
|
|
||||||
void ClearParams();
|
|
||||||
|
|
||||||
bool IsPar(int code);
|
|
||||||
|
|
||||||
bool IsArg(int code, const wchar_t * arg);
|
|
||||||
bool IsArg(int code, const std::wstring & arg);
|
|
||||||
bool IsArg(int code, int arg);
|
|
||||||
|
|
||||||
// returning the arg argument if defined (or an empty string)
|
|
||||||
const std::wstring & Arg(int code, int arg) const;
|
|
||||||
|
|
||||||
// returning the first argument (arg=0) if defined (or an empty string)
|
|
||||||
const std::wstring & FirstArg(int code) const;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// for Arg() methods when the argument is not defined
|
|
||||||
const std::wstring empty_str;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,412 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mountparser.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
MountParser::MountParser()
|
|
||||||
{
|
|
||||||
dirs = 0;
|
|
||||||
mount_type_tab = 0;
|
|
||||||
mount_fs_tab = 0;
|
|
||||||
mount_par_tab = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SetDirs(Dirs * pdirs)
|
|
||||||
{
|
|
||||||
dirs = pdirs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SetMountTypeTab(const std::vector<std::wstring> & tab)
|
|
||||||
{
|
|
||||||
mount_type_tab = &tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SetMountFsTab(const std::vector<std::wstring> & tab)
|
|
||||||
{
|
|
||||||
mount_fs_tab = &tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SetMountParTab(const std::vector<std::wstring> & tab)
|
|
||||||
{
|
|
||||||
mount_par_tab = &tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MountParser::IsWhite(int c)
|
|
||||||
{
|
|
||||||
if( c==' ' || c=='\t' || c==13 || c==160 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SkipWhite()
|
|
||||||
{
|
|
||||||
while( IsWhite(*pinput) )
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::SkipLine()
|
|
||||||
{
|
|
||||||
while( *pinput && *pinput != 10 )
|
|
||||||
++pinput;
|
|
||||||
|
|
||||||
if( *pinput == 10 )
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadWordQuote(std::wstring & res)
|
|
||||||
{
|
|
||||||
++pinput;
|
|
||||||
|
|
||||||
while( *pinput && *pinput!=10 && *pinput!='\"' )
|
|
||||||
{
|
|
||||||
if( pinput[0]=='\\' && pinput[1]=='\"' )
|
|
||||||
{
|
|
||||||
res += '\"';
|
|
||||||
pinput += 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( pinput[0]=='\\' && pinput[1]=='\\' )
|
|
||||||
{
|
|
||||||
res += '\\';
|
|
||||||
pinput += 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
res += *pinput;
|
|
||||||
pinput += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( *pinput == '"' )
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// a white character is the separator
|
|
||||||
void MountParser::ReadWordWhite(std::wstring & res)
|
|
||||||
{
|
|
||||||
while( *pinput && *pinput!=10 && !IsWhite(*pinput) )
|
|
||||||
{
|
|
||||||
res += *pinput;
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// the comma or the second bracket ')' are the separators
|
|
||||||
void MountParser::ReadWordComma(std::wstring & res)
|
|
||||||
{
|
|
||||||
while( *pinput && *pinput!=10 && *pinput!=',' && *pinput!=')' )
|
|
||||||
{
|
|
||||||
res += *pinput;
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
|
|
||||||
// trimming last white characters
|
|
||||||
// (white characters can be in the middle of the string)
|
|
||||||
TrimWhite(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadWord(std::wstring & res, bool comma_bracket_separator)
|
|
||||||
{
|
|
||||||
res.clear();
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( *pinput == '"' )
|
|
||||||
{
|
|
||||||
ReadWordQuote(res);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( comma_bracket_separator )
|
|
||||||
{
|
|
||||||
ReadWordComma(res);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ReadWordWhite(res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadParamArgsLoop(Mount::ParamRow::ParamArg & args)
|
|
||||||
{
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
while( *pinput && *pinput!=10 && *pinput!=')' )
|
|
||||||
{
|
|
||||||
ReadWord(temp_arg, true);
|
|
||||||
|
|
||||||
if( !temp_arg.empty() )
|
|
||||||
args.push_back(temp_arg);
|
|
||||||
|
|
||||||
if( *pinput == ',' )
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadParamArgs(Mount::ParamRow::ParamArg & args)
|
|
||||||
{
|
|
||||||
SkipWhite();
|
|
||||||
args.clear();
|
|
||||||
|
|
||||||
|
|
||||||
if( *pinput == '(' )
|
|
||||||
{
|
|
||||||
++pinput;
|
|
||||||
ReadParamArgsLoop(args);
|
|
||||||
|
|
||||||
if( *pinput != ')' )
|
|
||||||
{
|
|
||||||
// there should be ')' at the end
|
|
||||||
// temporarily we do nothing
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadParamName(std::wstring & res)
|
|
||||||
{
|
|
||||||
SkipWhite();
|
|
||||||
res.clear();
|
|
||||||
|
|
||||||
while( *pinput && *pinput!=10 && *pinput!=',' && *pinput!='(' && !IsWhite(*pinput) )
|
|
||||||
{
|
|
||||||
res += *pinput;
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadParam(std::wstring & res, Mount::ParamRow::ParamArg & args)
|
|
||||||
{
|
|
||||||
ReadParamName(res);
|
|
||||||
|
|
||||||
if( res.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ReadParamArgs(args);
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( *pinput == ',' )
|
|
||||||
++pinput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MountParser::FindIndex(const std::vector<std::wstring> * tab, const std::wstring & value)
|
|
||||||
{
|
|
||||||
for(size_t i=0 ; i < tab->size() ; ++i)
|
|
||||||
{
|
|
||||||
if( (*tab)[i] == value )
|
|
||||||
return static_cast<int>(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadMountType()
|
|
||||||
{
|
|
||||||
ReadWord(temp);
|
|
||||||
|
|
||||||
if( temp.empty() )
|
|
||||||
{
|
|
||||||
// an empty line (some white characters only)
|
|
||||||
err = WINIX_ERR_EMPTY;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mount.type = FindIndex(mount_type_tab, temp);
|
|
||||||
|
|
||||||
if( mount.type != -1 )
|
|
||||||
{
|
|
||||||
log << log3 << "MP: mount type: " << (*mount_type_tab)[mount.type] << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
err = WINIX_ERR_MOUNT_UNKNOWN;
|
|
||||||
log << log1 << "MP: unknown mount type: " << temp << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadMountPoint()
|
|
||||||
{
|
|
||||||
ReadWord(temp);
|
|
||||||
|
|
||||||
pdir = dirs->GetDir(temp);
|
|
||||||
|
|
||||||
if( pdir )
|
|
||||||
{
|
|
||||||
mount.dir_id = pdir->id;
|
|
||||||
log << log3 << "MP: mount point (directory): " << temp << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
err = WINIX_ERR_NO_MOUNTPOINT;
|
|
||||||
log << log1 << "MP: there is no such a mount point (directory): " << temp << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadFs()
|
|
||||||
{
|
|
||||||
ReadWord(temp);
|
|
||||||
mount.fs = FindIndex(mount_fs_tab, temp);
|
|
||||||
|
|
||||||
if( mount.fs != -1 )
|
|
||||||
{
|
|
||||||
log << log2 << "MP: file system: " << (*mount_fs_tab)[mount.fs] << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
err = WINIX_ERR_UNKNOWN_FILESYSTEM;
|
|
||||||
log << log1 << "MP: unknown filesystem: " << temp << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::LogMountParams()
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
log << log3 << "MP: mount param: " << temp << "(";
|
|
||||||
|
|
||||||
for(i=0 ; i<param_args.size() ; ++i)
|
|
||||||
{
|
|
||||||
log << param_args[i];
|
|
||||||
|
|
||||||
if( i != param_args.size()-1 )
|
|
||||||
log << ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
log << ")" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadMountParams()
|
|
||||||
{
|
|
||||||
mount.ClearParams();
|
|
||||||
|
|
||||||
for( ReadParam(temp, param_args) ; !temp.empty() ; ReadParam(temp, param_args) )
|
|
||||||
{
|
|
||||||
int code = FindIndex(mount_par_tab, temp);
|
|
||||||
|
|
||||||
if( code != -1 )
|
|
||||||
{
|
|
||||||
mount.param[code].defined = true;
|
|
||||||
mount.param[code].arg = param_args;
|
|
||||||
LogMountParams();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "MP: unknown mount param: " << temp << " (skipped)" << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MountParser::ReadRow(std::map<long, Mount> & output)
|
|
||||||
{
|
|
||||||
ReadMountType();
|
|
||||||
|
|
||||||
if( err == WINIX_ERR_EMPTY )
|
|
||||||
{
|
|
||||||
err = WINIX_ERR_OK;
|
|
||||||
SkipLine();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( err == WINIX_ERR_OK )
|
|
||||||
ReadMountPoint();
|
|
||||||
|
|
||||||
if( err == WINIX_ERR_OK )
|
|
||||||
ReadFs();
|
|
||||||
|
|
||||||
if( err == WINIX_ERR_OK )
|
|
||||||
ReadMountParams();
|
|
||||||
|
|
||||||
if( err == WINIX_ERR_OK )
|
|
||||||
{
|
|
||||||
std::pair<std::map<long, Mount>::iterator, bool> res = output.insert( std::make_pair(mount.dir_id, mount) );
|
|
||||||
|
|
||||||
if( !res.second )
|
|
||||||
log << log1 << "MP: this mount point exists (skipped)" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkipLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Error MountParser::Parse(const std::wstring & input, std::map<long, Mount> & output)
|
|
||||||
{
|
|
||||||
if( !dirs || !mount_type_tab || !mount_fs_tab || !mount_par_tab )
|
|
||||||
{
|
|
||||||
log << log1 << "pdir: " << pdir << logend;
|
|
||||||
log << log1 << "type: " << mount_type_tab << logend;
|
|
||||||
log << log1 << "fs: " << mount_fs_tab << logend;
|
|
||||||
log << log1 << "par: " << mount_par_tab << logend;
|
|
||||||
|
|
||||||
log << log1 << "MP: input tables not set" << logend;
|
|
||||||
return WINIX_NOTHING_TO_DO; // !! may a better code?
|
|
||||||
}
|
|
||||||
|
|
||||||
pinput = input.c_str();
|
|
||||||
err = WINIX_ERR_OK;
|
|
||||||
|
|
||||||
mount.param.resize(mount_par_tab->size());
|
|
||||||
mount.ClearParams();
|
|
||||||
|
|
||||||
output.clear();
|
|
||||||
|
|
||||||
while( *pinput && err == WINIX_ERR_OK )
|
|
||||||
ReadRow(output);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_mountparser
|
|
||||||
#define headerfile_winix_core_mountparser
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include "mount.h"
|
|
||||||
#include "item.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "dirs.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MountParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
MountParser();
|
|
||||||
Error Parse(const std::wstring & input, std::map<long, Mount> & output);
|
|
||||||
void SetDirs(Dirs * pdirs);
|
|
||||||
void SetMountTypeTab(const std::vector<std::wstring> & tab);
|
|
||||||
void SetMountFsTab(const std::vector<std::wstring> & tab);
|
|
||||||
void SetMountParTab(const std::vector<std::wstring> & tab);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Dirs * dirs;
|
|
||||||
|
|
||||||
const std::vector<std::wstring> * mount_type_tab;
|
|
||||||
const std::vector<std::wstring> * mount_fs_tab;
|
|
||||||
const std::vector<std::wstring> * mount_par_tab;
|
|
||||||
|
|
||||||
bool IsWhite(int c);
|
|
||||||
void SkipWhite();
|
|
||||||
void SkipLine();
|
|
||||||
void ReadWordQuote(std::wstring & res);
|
|
||||||
void ReadWordWhite(std::wstring & res);
|
|
||||||
void ReadWordComma(std::wstring & res);
|
|
||||||
void ReadWord(std::wstring & res, bool comma_bracket_separator = false);
|
|
||||||
void ReadParamArgsLoop(Mount::ParamRow::ParamArg & args);
|
|
||||||
void ReadParamArgs(Mount::ParamRow::ParamArg & args);
|
|
||||||
void ReadParamName(std::wstring & res);
|
|
||||||
void ReadParam(std::wstring & res, Mount::ParamRow::ParamArg & args);
|
|
||||||
int FindIndex(const std::vector<std::wstring> * tab, const std::wstring & value);
|
|
||||||
void ReadMountType();
|
|
||||||
void ReadMountPoint();
|
|
||||||
void ReadFs();
|
|
||||||
void LogMountParams();
|
|
||||||
void ReadMountParams();
|
|
||||||
void ReadRow(std::map<long, Mount> & output);
|
|
||||||
|
|
||||||
const wchar_t * pinput;
|
|
||||||
std::wstring temp;
|
|
||||||
std::wstring temp_arg;
|
|
||||||
Mount::ParamRow::ParamArg param_args;
|
|
||||||
|
|
||||||
|
|
||||||
Mount mount;
|
|
||||||
|
|
||||||
Item * pdir;
|
|
||||||
Error err;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
422
core/plugin.cpp
422
core/plugin.cpp
@@ -1,422 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "pluginmsg.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::UnloadPlugins()
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
slots.clear();
|
|
||||||
|
|
||||||
for(i=0 ; i<plugins.size() ; ++i)
|
|
||||||
dlclose(plugins[i].handle);
|
|
||||||
|
|
||||||
plugins.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Plugin::Plugin()
|
|
||||||
{
|
|
||||||
current_plugin = -1;
|
|
||||||
|
|
||||||
db = 0;
|
|
||||||
config = 0;
|
|
||||||
cur = 0;
|
|
||||||
system = 0;
|
|
||||||
functions = 0;
|
|
||||||
templates = 0;
|
|
||||||
synchro = 0;
|
|
||||||
session_manager = 0;
|
|
||||||
|
|
||||||
ret_false = 0;
|
|
||||||
ret_true = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Plugin::~Plugin()
|
|
||||||
{
|
|
||||||
UnloadPlugins();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetDb(Db * pdb)
|
|
||||||
{
|
|
||||||
db = pdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Plugin::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetCur(Cur * pcur)
|
|
||||||
{
|
|
||||||
cur = pcur;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetSystem(System * psystem)
|
|
||||||
{
|
|
||||||
system = psystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetFunctions(Functions * pfunctions)
|
|
||||||
{
|
|
||||||
functions = pfunctions;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetTemplates(Templates * ptemplates)
|
|
||||||
{
|
|
||||||
templates = ptemplates;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetSynchro(Synchro * psynchro)
|
|
||||||
{
|
|
||||||
synchro = psynchro;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::SetSessionManager(SessionManager * psession_manager)
|
|
||||||
{
|
|
||||||
session_manager = psession_manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::SetPointers(PluginInfo & info)
|
|
||||||
{
|
|
||||||
// for safety we call a plugin function only when all our pointers are not null
|
|
||||||
bool res = (db && config && cur && system && functions && templates && synchro && session_manager);
|
|
||||||
|
|
||||||
if( !res )
|
|
||||||
log << log1 << "Plugin: cannot call a function - some of the winix pointers are null" << logend;
|
|
||||||
|
|
||||||
info.db = db;
|
|
||||||
info.config = config;
|
|
||||||
info.cur = cur;
|
|
||||||
info.system = system;
|
|
||||||
info.functions = functions;
|
|
||||||
info.templates = templates;
|
|
||||||
info.synchro = synchro;
|
|
||||||
info.session_manager = session_manager;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::LoadPlugins(const std::wstring & plugins_dir, const std::vector<std::wstring> & plugins)
|
|
||||||
{
|
|
||||||
for(size_t i=0 ; i<plugins.size() ; ++i)
|
|
||||||
{
|
|
||||||
if( !plugins[i].empty() && plugins[i][0] == '/' )
|
|
||||||
{
|
|
||||||
LoadPlugin(plugins[i]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
temp_path = plugins_dir;
|
|
||||||
temp_path += '/';
|
|
||||||
temp_path += plugins[i];
|
|
||||||
LoadPlugin(temp_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::LoadPlugin(const std::string & filename)
|
|
||||||
{
|
|
||||||
LoadPlugin(filename.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void * Plugin::LoadInitFun(const char * filename, Fun1 & fun_init)
|
|
||||||
{
|
|
||||||
void * p = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
|
||||||
|
|
||||||
if( !p )
|
|
||||||
{
|
|
||||||
log << log1 << "Plugin: cannot load a plugin: \"" << filename << "\"" << logend;
|
|
||||||
log << log1 << "Plugin: dlerror: " << dlerror() << logend;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fun_init = (Fun1)dlfunc(p, "Init");
|
|
||||||
|
|
||||||
if( !fun_init )
|
|
||||||
{
|
|
||||||
log << log1 << "Plugin: cannot load a plugin: " << filename
|
|
||||||
<< " (there is no Init() function)" << logend;
|
|
||||||
|
|
||||||
dlclose(p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
log << log2 << "Plugin: plugin loaded"
|
|
||||||
<< ", file: " << filename
|
|
||||||
<< ", index: " << plugins.size() << logend;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::LoadPlugin(const char * filename)
|
|
||||||
{
|
|
||||||
Fun1 fun_init;
|
|
||||||
void * plugin_handle;
|
|
||||||
int old_current_plugin;
|
|
||||||
PluginInfo info;
|
|
||||||
|
|
||||||
if( !SetPointers(info) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( !(plugin_handle = LoadInitFun(filename, fun_init)) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
info.Clear();
|
|
||||||
old_current_plugin = current_plugin;
|
|
||||||
current_plugin = (int)plugins.size();
|
|
||||||
info.plugin_id = current_plugin;
|
|
||||||
|
|
||||||
fun_init(info);
|
|
||||||
|
|
||||||
PluginsItem item;
|
|
||||||
item.handle = plugin_handle;
|
|
||||||
item.plugin_name = reinterpret_cast<const wchar_t *>(info.p1);
|
|
||||||
|
|
||||||
plugins.push_back(item);
|
|
||||||
|
|
||||||
current_plugin = old_current_plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::LoadPlugin(const wchar_t * filename)
|
|
||||||
{
|
|
||||||
AssignString(filename, afilename);
|
|
||||||
LoadPlugin(afilename.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::LoadPlugin(const std::wstring & filename)
|
|
||||||
{
|
|
||||||
LoadPlugin(filename.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::HasPlugin(const wchar_t * name)
|
|
||||||
{
|
|
||||||
if( *name == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for(size_t i=0 ; i<plugins.size() ; ++i)
|
|
||||||
{
|
|
||||||
if( plugins[i].plugin_name && Equal(plugins[i].plugin_name, name) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::HasPlugin(const std::wstring & name)
|
|
||||||
{
|
|
||||||
return HasPlugin(name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, Slots::iterator & slot, PluginInfo & info)
|
|
||||||
{
|
|
||||||
if( !SetPointers(info) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
current_plugin = slot->second.index;
|
|
||||||
info.plugin_id = current_plugin;
|
|
||||||
|
|
||||||
if( current_plugin != -1 )
|
|
||||||
info.plugin_data_base = cur->session->plugin_data.Get(current_plugin);
|
|
||||||
else
|
|
||||||
info.plugin_data_base = 0;
|
|
||||||
|
|
||||||
if( !slot->second.is_running )
|
|
||||||
{
|
|
||||||
if( config->log_plugin_call )
|
|
||||||
log << log1 << "Plugin: calling plugin id: " << slot->second.index << ", message: " << message << logend;
|
|
||||||
|
|
||||||
slot->second.is_running = true;
|
|
||||||
|
|
||||||
if( slot->second.fun1 )
|
|
||||||
slot->second.fun1(info);
|
|
||||||
|
|
||||||
if( slot->second.fun2 )
|
|
||||||
slot->second.fun2();
|
|
||||||
|
|
||||||
slot->second.is_running = false;
|
|
||||||
|
|
||||||
if( config->log_plugin_call )
|
|
||||||
log << log1 << "Plugin: returning from plugin id: " << slot->second.index << ", message: " << message << logend;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "Plugin: id: " << slot->second.index
|
|
||||||
<< ", message: " << message
|
|
||||||
<< ", recurrences are not allowed" << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_, void * p2_, long l1_, long l2_)
|
|
||||||
{
|
|
||||||
// how many plugins return 'false' and 'true'
|
|
||||||
// we are using local variables because Call() method can be called
|
|
||||||
// from a plugin too (one Call() can execute another Call())
|
|
||||||
int ret_false_loc = 0;
|
|
||||||
int ret_true_loc = 0;
|
|
||||||
int old_current_plugin = current_plugin;
|
|
||||||
PluginInfo info;
|
|
||||||
|
|
||||||
Slots::iterator i = slots.lower_bound(message);
|
|
||||||
|
|
||||||
for( ; i!=slots.end() && i->first==message ; ++i )
|
|
||||||
{
|
|
||||||
info.Clear();
|
|
||||||
info.p1 = p1_;
|
|
||||||
info.p2 = p2_;
|
|
||||||
info.l1 = l1_;
|
|
||||||
info.l2 = l2_;
|
|
||||||
|
|
||||||
Call(message, i, info);
|
|
||||||
|
|
||||||
if( info.res )
|
|
||||||
++ret_true_loc;
|
|
||||||
else
|
|
||||||
++ret_false_loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
current_plugin = old_current_plugin;
|
|
||||||
ret_false = ret_false_loc;
|
|
||||||
ret_true = ret_true_loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message)
|
|
||||||
{
|
|
||||||
Call(message, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_)
|
|
||||||
{
|
|
||||||
Call(message, p1_, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_, void * p2_)
|
|
||||||
{
|
|
||||||
Call(message, p1_, p2_, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, long l1_)
|
|
||||||
{
|
|
||||||
Call(message, 0, 0, l1_, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, long l1_, long l2_)
|
|
||||||
{
|
|
||||||
Call(message, 0, 0, l1_, l2_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_, long l1_)
|
|
||||||
{
|
|
||||||
Call(message, p1_, 0, l1_, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_, long l1_, long l2_)
|
|
||||||
{
|
|
||||||
Call(message, p1_, 0, l1_, l2_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Call(int message, void * p1_, void * p2_, long l1_)
|
|
||||||
{
|
|
||||||
Call(message, p1_, p2_, l1_, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t Plugin::Size()
|
|
||||||
{
|
|
||||||
return plugins.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Plugin::True()
|
|
||||||
{
|
|
||||||
return ret_true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Plugin::False()
|
|
||||||
{
|
|
||||||
return ret_false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Assign(int message, Fun1 fun1)
|
|
||||||
{
|
|
||||||
Slot s;
|
|
||||||
|
|
||||||
if( current_plugin == -1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
s.fun1 = fun1;
|
|
||||||
s.index = current_plugin;
|
|
||||||
|
|
||||||
slots.insert( std::make_pair(message, s) );
|
|
||||||
log << log3 << "Plugin: added function for message: " << message << ", plugin index: " << s.index << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Plugin::Assign(int message, Fun2 fun2)
|
|
||||||
{
|
|
||||||
Slot s;
|
|
||||||
|
|
||||||
if( current_plugin == -1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
s.fun2 = fun2;
|
|
||||||
s.index = current_plugin;
|
|
||||||
|
|
||||||
slots.insert( std::make_pair(message, s) );
|
|
||||||
log << log3 << "Plugin: added function for message: " << message << ", plugin index: " << s.index << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
219
core/plugin.h
219
core/plugin.h
@@ -1,219 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_plugin
|
|
||||||
#define headerfile_winix_core_plugin
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
#include "pluginmsg.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "plugindata.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "request.h"
|
|
||||||
#include "system.h"
|
|
||||||
#include "sessionmanager.h"
|
|
||||||
#include "synchro.h"
|
|
||||||
#include "functions/functions.h"
|
|
||||||
#include "templates/templates.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
all your plugin functions can have signature either:
|
|
||||||
void my_function(PluginInfo & info); or
|
|
||||||
void my_function();
|
|
||||||
|
|
||||||
only the main Init should have:
|
|
||||||
extern "C" void Init(PluginFunction & info);
|
|
||||||
|
|
||||||
in the Init you can add your own functions by using plugin.Assign() method
|
|
||||||
and you can set the name of the plugin by setting info.p1 pointer
|
|
||||||
to a string buffer (const char *)
|
|
||||||
(this buffer will not be copied so it should not be destroyed after Init finishes)
|
|
||||||
also in Init you can only use logger (log) info.config and info.db objects
|
|
||||||
(the rest winix objects are not initialized yet)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct PluginInfo
|
|
||||||
{
|
|
||||||
// these variables are used for some purposes
|
|
||||||
// depending on a hook in which they are used
|
|
||||||
void * p1;
|
|
||||||
void * p2;
|
|
||||||
long l1;
|
|
||||||
long l2;
|
|
||||||
|
|
||||||
// unique plugin identifier
|
|
||||||
int plugin_id;
|
|
||||||
|
|
||||||
// objects from winix which are accessible from a plugin
|
|
||||||
Db * db;
|
|
||||||
Config * config;
|
|
||||||
Cur * cur;
|
|
||||||
System * system;
|
|
||||||
Functions * functions;
|
|
||||||
Templates * templates;
|
|
||||||
Synchro * synchro;
|
|
||||||
SessionManager * session_manager;
|
|
||||||
|
|
||||||
// pointer to the plugin session (can be null if not set by the plugin)
|
|
||||||
// you should use WINIX_SESSION_CREATED and WINIX_SESSION_REMOVE
|
|
||||||
// to create your plugin's session data
|
|
||||||
PluginDataBase * plugin_data_base; // !! zmienic nazwe na plugin_session_base ? a moze session_base; a moze plugin_session?
|
|
||||||
|
|
||||||
// function return status
|
|
||||||
// default: false (if not set by the plugin)
|
|
||||||
bool res;
|
|
||||||
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
// pointers to winix objects are not cleared here
|
|
||||||
|
|
||||||
p1 = 0;
|
|
||||||
p2 = 0;
|
|
||||||
l1 = 0;
|
|
||||||
l2 = 0;
|
|
||||||
|
|
||||||
plugin_id = -1;
|
|
||||||
plugin_data_base = 0;
|
|
||||||
|
|
||||||
res = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// index of a plugin which is called by Call() method
|
|
||||||
// normally: -1
|
|
||||||
int current_plugin;
|
|
||||||
|
|
||||||
// Fun is a type of a function you should provide in your plugin
|
|
||||||
typedef void (*Fun1)(PluginInfo &);
|
|
||||||
typedef void (*Fun2)(void);
|
|
||||||
|
|
||||||
|
|
||||||
struct Slot
|
|
||||||
{
|
|
||||||
Fun1 fun1;
|
|
||||||
Fun2 fun2;
|
|
||||||
int index; // plugin index (which plugin has inserted the slot)
|
|
||||||
bool is_running;
|
|
||||||
|
|
||||||
Slot()
|
|
||||||
{
|
|
||||||
fun1 = 0;
|
|
||||||
fun2 = 0;
|
|
||||||
index = -1;
|
|
||||||
is_running = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Plugin();
|
|
||||||
~Plugin();
|
|
||||||
|
|
||||||
void SetDb(Db * pdb);
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void SetSystem(System * psystem);
|
|
||||||
void SetFunctions(Functions * pfunctions);
|
|
||||||
void SetTemplates(Templates * ptemplates);
|
|
||||||
void SetSynchro(Synchro * psynchro);
|
|
||||||
void SetSessionManager(SessionManager * psession_manager);
|
|
||||||
|
|
||||||
void LoadPlugin(const char * filename);
|
|
||||||
void LoadPlugin(const std::string & filename);
|
|
||||||
void LoadPlugin(const wchar_t * filename);
|
|
||||||
void LoadPlugin(const std::wstring & filename);
|
|
||||||
|
|
||||||
void LoadPlugins(const std::wstring & plugins_dir, const std::vector<std::wstring> & plugins);
|
|
||||||
void UnloadPlugins();
|
|
||||||
|
|
||||||
bool HasPlugin(const wchar_t * name);
|
|
||||||
bool HasPlugin(const std::wstring & name);
|
|
||||||
|
|
||||||
void Call(int message);
|
|
||||||
void Call(int message, void * p1_);
|
|
||||||
void Call(int message, void * p1_, void * p2_);
|
|
||||||
void Call(int message, long l1_);
|
|
||||||
void Call(int message, long l1_, long l2_);
|
|
||||||
void Call(int message, void * p1_, long l1_);
|
|
||||||
void Call(int message, void * p1_, long l1_, long l2_);
|
|
||||||
void Call(int message, void * p1_, void * p2_, long l1_);
|
|
||||||
void Call(int message, void * p1_, void * p2_, long l1_, long l2_);
|
|
||||||
|
|
||||||
// how many plugins there are
|
|
||||||
size_t Size();
|
|
||||||
|
|
||||||
// how many plugins returned 'true'
|
|
||||||
// from last Call()
|
|
||||||
int True();
|
|
||||||
|
|
||||||
// how many plugins returned 'false'
|
|
||||||
// from last Call()
|
|
||||||
int False();
|
|
||||||
|
|
||||||
// assign a function to a message
|
|
||||||
// you can assign more than one function to a specific message
|
|
||||||
void Assign(int message, Fun1);
|
|
||||||
void Assign(int message, Fun2);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Db * db;
|
|
||||||
Config * config;
|
|
||||||
Cur * cur;
|
|
||||||
System * system;
|
|
||||||
Functions * functions;
|
|
||||||
Templates * templates;
|
|
||||||
Synchro * synchro;
|
|
||||||
SessionManager * session_manager;
|
|
||||||
|
|
||||||
int ret_false;
|
|
||||||
int ret_true;
|
|
||||||
|
|
||||||
std::wstring temp_path;
|
|
||||||
|
|
||||||
struct PluginsItem
|
|
||||||
{
|
|
||||||
void * handle;
|
|
||||||
const wchar_t * plugin_name; // plugin name (can be null if was not set by the plugin)
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<PluginsItem> Plugins;
|
|
||||||
Plugins plugins;
|
|
||||||
|
|
||||||
typedef std::multimap<int, Slot> Slots;
|
|
||||||
Slots slots;
|
|
||||||
|
|
||||||
std::string afilename;
|
|
||||||
|
|
||||||
void * LoadInitFun(const char * filename, Fun1 & fun_init);
|
|
||||||
void Call(int message, Slots::iterator & slot, PluginInfo & info);
|
|
||||||
|
|
||||||
bool SetPointers(PluginInfo & info);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern Plugin plugin;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "plugindata.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PluginData::Assign(size_t index, PluginDataBase * data)
|
|
||||||
{
|
|
||||||
if( index >= table.size() )
|
|
||||||
Resize(index+1);
|
|
||||||
|
|
||||||
table[index] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PluginData::Assign(PluginDataBase * data)
|
|
||||||
{
|
|
||||||
if( plugin.current_plugin == -1 )
|
|
||||||
{
|
|
||||||
log << log1 << "PD: Assign(PluginDataBase*) should be called only from plugins" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Assign(plugin.current_plugin, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginDataBase * PluginData::Get(size_t index)
|
|
||||||
{
|
|
||||||
if( index >= table.size() )
|
|
||||||
Resize(index+1);
|
|
||||||
|
|
||||||
return table[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PluginDataBase * PluginData::Get()
|
|
||||||
{
|
|
||||||
if( plugin.current_plugin == -1 )
|
|
||||||
{
|
|
||||||
log << log1 << "PD: Get() should be called only from plugins" << logend;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Get(plugin.current_plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PluginData::DeleteAll()
|
|
||||||
{
|
|
||||||
if( table.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
plugin.Call(WINIX_SESSION_REMOVE);
|
|
||||||
|
|
||||||
for(size_t i=0 ; i<table.size() ; ++i)
|
|
||||||
table[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginData::PluginData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginData::PluginData(const PluginData & p)
|
|
||||||
{
|
|
||||||
operator=(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginData & PluginData::operator=(const PluginData & p)
|
|
||||||
{
|
|
||||||
// we don't copy all pointers - only resize the table
|
|
||||||
// pointers will be set to zero
|
|
||||||
Resize(p.Size());
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PluginData::~PluginData()
|
|
||||||
{
|
|
||||||
DeleteAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t PluginData::Size() const
|
|
||||||
{
|
|
||||||
return table.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PluginData::Resize(size_t new_size)
|
|
||||||
{
|
|
||||||
size_t old_size = table.size();
|
|
||||||
|
|
||||||
if( old_size == new_size )
|
|
||||||
return;
|
|
||||||
|
|
||||||
table.resize(new_size);
|
|
||||||
|
|
||||||
for(size_t i = old_size ; i<new_size ; ++i)
|
|
||||||
table[i] = 0;
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_plugindata
|
|
||||||
#define headerfile_winix_core_plugindata
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct PluginDataBase
|
|
||||||
{
|
|
||||||
virtual ~PluginDataBase() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PluginData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
void Assign(size_t index, PluginDataBase * data);
|
|
||||||
void Assign(PluginDataBase * data);
|
|
||||||
|
|
||||||
PluginDataBase * Get(size_t index);
|
|
||||||
PluginDataBase * Get();
|
|
||||||
|
|
||||||
void DeleteAll();
|
|
||||||
|
|
||||||
PluginData();
|
|
||||||
PluginData(const PluginData & p);
|
|
||||||
PluginData & operator=(const PluginData & p);
|
|
||||||
~PluginData();
|
|
||||||
|
|
||||||
size_t Size() const;
|
|
||||||
void Resize(size_t new_size);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::vector<PluginDataBase*> table;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
109
core/pluginmsg.h
109
core/pluginmsg.h
@@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#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
|
|
||||||
#define WINIX_TEMPLATES_CREATEFUNCTIONS 999
|
|
||||||
|
|
||||||
// here you can add your own EZC functions to notify system
|
|
||||||
// warning: this functions will be called from an other thread
|
|
||||||
// so you should use synchro->Lock() and synchro->Unlock()
|
|
||||||
// when attempting to winix objects
|
|
||||||
// PluginInfo.p1 is a pointer to Ezc::Functions object
|
|
||||||
// which is defined as:
|
|
||||||
// Ezc::Functions<NotifyStream> ezc_functions;
|
|
||||||
// and Notify Stream is:
|
|
||||||
// typedef TextStream<std::wstring> NotifyStream;
|
|
||||||
#define WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS 998
|
|
||||||
|
|
||||||
// winix function and parameters have been parsed
|
|
||||||
// the request.status is OK
|
|
||||||
// (the winix function was not called yet)
|
|
||||||
#define WINIX_PREPARE_REQUEST 2000
|
|
||||||
|
|
||||||
// post and get functions have done their jobs
|
|
||||||
// now you can act
|
|
||||||
// this is called only if the request.status is OK
|
|
||||||
#define WINIX_PROCESS_REQUEST 2001
|
|
||||||
|
|
||||||
// prepere your content for displaying
|
|
||||||
// this is called after WINIX_PROCESS_REQUEST
|
|
||||||
// and when there is not a redirect
|
|
||||||
// request.status is not checked here
|
|
||||||
#define WINIX_CONTENT_MAKE 2002
|
|
||||||
|
|
||||||
// here you can attach your own session data (based on PluginDataBase class)
|
|
||||||
// call request.session->plugin_data.Assign(pointer)
|
|
||||||
#define WINIX_SESSION_CREATED 3000
|
|
||||||
|
|
||||||
// here you should remove your session data
|
|
||||||
#define WINIX_SESSION_REMOVE 3001
|
|
||||||
|
|
||||||
// when a session is changed (you can save a pointer to your data here)
|
|
||||||
#define WINIX_SESSION_CHANGED 3002
|
|
||||||
|
|
||||||
// the winix is closing
|
|
||||||
// the is not any session available (cur->session is null)
|
|
||||||
#define WINIX_CLOSE 3004
|
|
||||||
|
|
||||||
// a file or symlink was removed (rm function)
|
|
||||||
// PluginInfo::l1 is the file (item) id
|
|
||||||
// !! moze zmienic nazwe i dodac symlink w nazwie?
|
|
||||||
#define WINIX_FILE_REMOVED 3005
|
|
||||||
|
|
||||||
// directory was removed (rm function)
|
|
||||||
// PluginInfo::l1 is the dir id
|
|
||||||
#define WINIX_DIR_REMOVED 3006
|
|
||||||
|
|
||||||
// preparing to remove a directory (rm function)
|
|
||||||
// PluginInfo::l1 is the dir id
|
|
||||||
#define WINIX_DIR_PREPARE_TO_REMOVE 3007
|
|
||||||
|
|
||||||
// winix is initialized,
|
|
||||||
// now you can initialize your plugin
|
|
||||||
#define WINIX_PLUGIN_INIT 3008
|
|
||||||
|
|
||||||
// here you can add your own mount point, file systems, mount parameters
|
|
||||||
// for adding a new mount type call: system->mounts.AddMountType("new_mount_name")
|
|
||||||
#define WINIX_ADD_MOUNTS 3009
|
|
||||||
|
|
||||||
// add plugin functions here
|
|
||||||
#define WINIX_CREATE_FUNCTIONS 3010
|
|
||||||
|
|
||||||
// choose a default function
|
|
||||||
// if you do not select it then it will be choosen by winix
|
|
||||||
#define WINIX_SELECT_DEFAULT_FUNCTION 3011
|
|
||||||
|
|
||||||
// /etc/fstab has been changed
|
|
||||||
// now we have new mount points
|
|
||||||
#define WINIX_FSTAB_CHANGED 3012
|
|
||||||
|
|
||||||
// here you add your own template to notification system
|
|
||||||
// call system->notify.AddTemplate() method
|
|
||||||
// with a template file name
|
|
||||||
#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
|
|
||||||
|
|
||||||
// values from 4100 - 4199 reserved for 'ticket' plugin
|
|
||||||
// see plugins/ticket/pluginmsg.h
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_postmultiparser
|
|
||||||
#define headerfile_winix_core_postmultiparser
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
#include <fstream>
|
|
||||||
#include "error.h"
|
|
||||||
#include "requesttypes.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
// 2 MB
|
|
||||||
#define WINIX_POSTMULTI_INPUT_BUFFER 2097152
|
|
||||||
#define WINIX_POSTMULTI_OUTPUT_BUFFER 2097152
|
|
||||||
|
|
||||||
|
|
||||||
class PostMultiParser
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
PostMultiParser();
|
|
||||||
PostMultiParser(const PostMultiParser &);
|
|
||||||
PostMultiParser & operator=(const PostMultiParser &);
|
|
||||||
~PostMultiParser();
|
|
||||||
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
Error Parse(FCGX_Stream * in_, PostTab & post_tab_, PostFileTab & post_file_tab_);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Config * config;
|
|
||||||
|
|
||||||
FCGX_Stream * in;
|
|
||||||
unsigned char * in_buffer;
|
|
||||||
std::ofstream tmp_file;
|
|
||||||
std::wstring tmp_filename;
|
|
||||||
std::string atmp_filename;
|
|
||||||
int tmp_filename_postfix;
|
|
||||||
size_t in_buffer_ind;
|
|
||||||
size_t in_buffer_len;
|
|
||||||
|
|
||||||
PostTab * post_tab;
|
|
||||||
PostFileTab * post_file_tab;
|
|
||||||
|
|
||||||
int last; // last read character
|
|
||||||
|
|
||||||
bool line_end_dos;
|
|
||||||
std::string boundary;
|
|
||||||
std::string content;
|
|
||||||
size_t content_len;
|
|
||||||
|
|
||||||
std::string header_name, header_value;
|
|
||||||
Error err;
|
|
||||||
|
|
||||||
std::string name, filename;
|
|
||||||
std::wstring namew, contentw;
|
|
||||||
PostFile post_file_temp;
|
|
||||||
|
|
||||||
void LogFirst(const std::string & to_log, size_t len);
|
|
||||||
|
|
||||||
bool IsWhite(int c);
|
|
||||||
void SkipWhite();
|
|
||||||
|
|
||||||
void AddNormalPostVar();
|
|
||||||
void AddFilePostVar();
|
|
||||||
void AddPostVar();
|
|
||||||
|
|
||||||
void ReadBoundary();
|
|
||||||
|
|
||||||
bool IsHeader();
|
|
||||||
void ReadHeaderName();
|
|
||||||
void ReadHeaderValue();
|
|
||||||
void ReadPartHeader();
|
|
||||||
|
|
||||||
void CreateTmpFile();
|
|
||||||
bool HasBoundary();
|
|
||||||
void ReadContentSkipBoundary(bool has_boundary);
|
|
||||||
void ReadContentToFileLoop();
|
|
||||||
void ReadContentToFile();
|
|
||||||
void ReadContentLoop();
|
|
||||||
void ReadContent();
|
|
||||||
void CheckBoundaryEnd();
|
|
||||||
void ReadPart();
|
|
||||||
|
|
||||||
void ReadChar();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_postparser
|
|
||||||
#define headerfile_winix_core_postparser
|
|
||||||
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
#include <string>
|
|
||||||
#include "httpsimpleparser.h"
|
|
||||||
#include "requesttypes.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "utf8.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PostParser : public HttpSimpleParser
|
|
||||||
{
|
|
||||||
|
|
||||||
FCGX_Stream * in;
|
|
||||||
PostTab * post_tab;
|
|
||||||
std::wstring temp_name, temp_value;
|
|
||||||
bool input_as_utf8;
|
|
||||||
size_t log_value_size;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
virtual int GetChar()
|
|
||||||
{
|
|
||||||
return FCGX_GetChar(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
Ezc::UTF8ToWide(name, temp_name);
|
|
||||||
Ezc::UTF8ToWide(value, temp_value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AssignString(name, temp_name);
|
|
||||||
AssignString(value, temp_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<PostTab::iterator, bool> res = post_tab->insert( std::make_pair(temp_name, temp_value) );
|
|
||||||
CreateLog(res.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
PostParser()
|
|
||||||
{
|
|
||||||
input_as_utf8 = false;
|
|
||||||
log_value_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UTF8(bool utf)
|
|
||||||
{
|
|
||||||
input_as_utf8 = utf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogValueSize(size_t s)
|
|
||||||
{
|
|
||||||
log_value_size = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parse(FCGX_Stream * in_, PostTab & post_tab_)
|
|
||||||
{
|
|
||||||
in = in_;
|
|
||||||
post_tab = &post_tab_;
|
|
||||||
|
|
||||||
HttpSimpleParser::Parse();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
51
core/rebus.h
51
core/rebus.h
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_rebus
|
|
||||||
#define headerfile_winix_core_rebus
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
struct Cur;
|
|
||||||
|
|
||||||
|
|
||||||
class Rebus
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
struct Item
|
|
||||||
{
|
|
||||||
int key;
|
|
||||||
std::wstring question;
|
|
||||||
int answer;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void Init();
|
|
||||||
Item * Rand();
|
|
||||||
bool IsAnswerOk(Item * item, const std::wstring & answer);
|
|
||||||
bool CheckRebus();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Cur * cur;
|
|
||||||
|
|
||||||
bool InitPair(int a, int b, Item & item);
|
|
||||||
|
|
||||||
std::vector<Item> table;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
272
core/request.cpp
272
core/request.cpp
@@ -1,272 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "request.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Request::Request() : char_empty(0)
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Request::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Request::ClearPostFileTmp()
|
|
||||||
{
|
|
||||||
// deleting temporary files (if exists)
|
|
||||||
|
|
||||||
while( !post_file_tab.empty() )
|
|
||||||
{
|
|
||||||
const std::wstring & tmp_filename = post_file_tab.begin()->second.tmp_filename;
|
|
||||||
|
|
||||||
if( RemoveFile(tmp_filename) )
|
|
||||||
log << log3 << "Request: deleted tmp file: " << tmp_filename << logend;
|
|
||||||
|
|
||||||
post_file_tab.erase(post_file_tab.begin());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Request::Clear()
|
|
||||||
{
|
|
||||||
// id is never 0
|
|
||||||
if( ++id == 0 )
|
|
||||||
++id;
|
|
||||||
|
|
||||||
ClearPostFileTmp();
|
|
||||||
|
|
||||||
get_tab.clear();
|
|
||||||
post_tab.clear();
|
|
||||||
post_file_tab.clear();
|
|
||||||
cookie_tab.clear();
|
|
||||||
|
|
||||||
method = none;
|
|
||||||
role = responder;
|
|
||||||
|
|
||||||
headers.Clear();
|
|
||||||
page.Clear();
|
|
||||||
debug.Clear();
|
|
||||||
|
|
||||||
env_request_method = &char_empty;
|
|
||||||
env_request_uri = &char_empty;
|
|
||||||
env_http_cookie = &char_empty;
|
|
||||||
env_remote_addr = &char_empty;
|
|
||||||
env_http_host = &char_empty;
|
|
||||||
env_http_user_agent = &char_empty;
|
|
||||||
env_fcgi_role = &char_empty;
|
|
||||||
env_content_type = &char_empty;
|
|
||||||
env_http_accept_encoding = &char_empty;
|
|
||||||
|
|
||||||
item_tab.clear();
|
|
||||||
item.Clear();
|
|
||||||
dir_tab.clear();
|
|
||||||
last_item = &item;
|
|
||||||
is_item = false;
|
|
||||||
function = 0; // !! dodac jakas empty funkcje
|
|
||||||
param_tab.clear();
|
|
||||||
|
|
||||||
status = WINIX_ERR_OK;
|
|
||||||
|
|
||||||
browser_msie = false;
|
|
||||||
redirect_to.clear();
|
|
||||||
x_sendfile.clear();
|
|
||||||
send_as_attachment = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// value can be null
|
|
||||||
void Request::SetCookie(const char * name, const char * value, tm * expires)
|
|
||||||
{
|
|
||||||
headers << "Set-Cookie: " << name << "=";
|
|
||||||
|
|
||||||
if( value && value[0]!=0 )
|
|
||||||
headers << value;
|
|
||||||
else
|
|
||||||
headers << "\"\"";
|
|
||||||
|
|
||||||
if( expires )
|
|
||||||
headers << "; expires=" << DateToStrCookie(expires) << " GMT";
|
|
||||||
|
|
||||||
headers << "; path=/; domain=." << config->base_server << "\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Request::SetCookie(const char * name, long value, tm * expires)
|
|
||||||
{
|
|
||||||
headers << "Set-Cookie: " << name << "=" << value;
|
|
||||||
|
|
||||||
if( expires )
|
|
||||||
headers << "; expires=" << DateToStrCookie(expires) << " GMT";
|
|
||||||
|
|
||||||
headers << "; path=/; domain=." << config->base_server << "\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Request::IsPostVar(const wchar_t * var)
|
|
||||||
{
|
|
||||||
PostTab::iterator p;
|
|
||||||
|
|
||||||
p = post_tab.find(var);
|
|
||||||
|
|
||||||
if( p == post_tab.end() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const std::wstring & Request::PostVar(const wchar_t * var)
|
|
||||||
{
|
|
||||||
PostTab::iterator p = post_tab.find(var);
|
|
||||||
|
|
||||||
if( p == post_tab.end() )
|
|
||||||
return str_empty;
|
|
||||||
|
|
||||||
return p->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Request::PostVar(const wchar_t * var, std::wstring & result)
|
|
||||||
{
|
|
||||||
PostTab::iterator p = post_tab.find(var);
|
|
||||||
|
|
||||||
if( p == post_tab.end() )
|
|
||||||
{
|
|
||||||
result.clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = p->second;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring * Request::PostVarp(const wchar_t * var)
|
|
||||||
{
|
|
||||||
PostTab::iterator p = post_tab.find(var);
|
|
||||||
|
|
||||||
if( p == post_tab.end() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &p->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Request::PrintGetTab()
|
|
||||||
{
|
|
||||||
debug << "get_tab: " << get_tab.size() << "\n";
|
|
||||||
|
|
||||||
for(GetTab::iterator i = get_tab.begin() ; i != get_tab.end() ; ++i)
|
|
||||||
debug << " \"" << *i << "\"\n";
|
|
||||||
|
|
||||||
debug << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void Request::PrintEnv()
|
|
||||||
{
|
|
||||||
char ** e;
|
|
||||||
|
|
||||||
debug << "environment variables:\n";
|
|
||||||
|
|
||||||
for( e = env ; *e ; ++e )
|
|
||||||
debug << ' ' << *e << "\n";
|
|
||||||
|
|
||||||
debug << '\n';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
bool Request::AllPostVarEmpty()
|
|
||||||
{
|
|
||||||
PostTab::iterator i;
|
|
||||||
|
|
||||||
for(i=post_tab.begin() ; i!=post_tab.end() ; ++i)
|
|
||||||
if( !i->second.empty() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Request::IsParam(const wchar_t * param_name)
|
|
||||||
{
|
|
||||||
ParamTab::iterator i;
|
|
||||||
|
|
||||||
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
|
|
||||||
{
|
|
||||||
if( i->name == param_name )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Request::IsParam(const std::wstring & param_name)
|
|
||||||
{
|
|
||||||
ParamTab::iterator i;
|
|
||||||
|
|
||||||
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
|
|
||||||
{
|
|
||||||
if( i->name == param_name )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const std::wstring & Request::ParamValue(const wchar_t * param_name)
|
|
||||||
{
|
|
||||||
ParamTab::iterator i;
|
|
||||||
|
|
||||||
for(i=param_tab.begin() ; i!=param_tab.end() ; ++i)
|
|
||||||
{
|
|
||||||
if( i->name == param_name )
|
|
||||||
return i->value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return str_empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const std::wstring & Request::ParamValue(const std::wstring & param_name)
|
|
||||||
{
|
|
||||||
return ParamValue(param_name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
154
core/request.h
154
core/request.h
@@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_request
|
|
||||||
#define headerfile_winix_core_request
|
|
||||||
|
|
||||||
#include <fcgiapp.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
#include "requesttypes.h"
|
|
||||||
#include "item.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "textstream.h"
|
|
||||||
#include "templates/htmltextstream.h"
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionBase;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Request
|
|
||||||
{
|
|
||||||
// request id
|
|
||||||
// is incremented for each request and is never 0
|
|
||||||
// (from -1 will be incremented twice)
|
|
||||||
// it's used for some optimalizations e.g. in templates
|
|
||||||
size_t id;
|
|
||||||
|
|
||||||
// !! moze pozbyc sie tego none?
|
|
||||||
enum Method { get, post, head, none } method;
|
|
||||||
enum Role { responder, authorizer } role;
|
|
||||||
|
|
||||||
// headers, page and debug
|
|
||||||
//std::ostringstream headers, page, debug;
|
|
||||||
TextStream<std::string> headers;
|
|
||||||
HtmlTextStream page, debug;
|
|
||||||
|
|
||||||
// raw parameters
|
|
||||||
GetTab get_tab;
|
|
||||||
PostTab post_tab;
|
|
||||||
PostFileTab post_file_tab;
|
|
||||||
CookieTab cookie_tab;
|
|
||||||
|
|
||||||
// environment variables
|
|
||||||
// they are not null -- when the server doesn't have such a variable
|
|
||||||
// it will be pointing into 'char_empty' which is default '\0'
|
|
||||||
const char * env_request_method;
|
|
||||||
const char * env_request_uri;
|
|
||||||
const char * env_http_cookie;
|
|
||||||
const char * env_remote_addr;
|
|
||||||
const char * env_http_host;
|
|
||||||
const char * env_http_user_agent;
|
|
||||||
const char * env_http_accept_encoding;
|
|
||||||
const char * env_fcgi_role;
|
|
||||||
const char * env_content_type;
|
|
||||||
|
|
||||||
// true if the browser is Microsoft Internet Explorer
|
|
||||||
bool browser_msie;
|
|
||||||
|
|
||||||
// true if the browser is Konqueror
|
|
||||||
bool browser_konqueror;
|
|
||||||
|
|
||||||
// current directory
|
|
||||||
std::vector<Item*> dir_tab;
|
|
||||||
|
|
||||||
// true if a file exists
|
|
||||||
bool is_item;
|
|
||||||
|
|
||||||
// current file (if exists)
|
|
||||||
Item item;
|
|
||||||
|
|
||||||
// current winix function
|
|
||||||
// null if there is no a function
|
|
||||||
FunctionBase * function;
|
|
||||||
|
|
||||||
// parameters (name:value)
|
|
||||||
ParamTab param_tab;
|
|
||||||
|
|
||||||
// request status
|
|
||||||
Error status;
|
|
||||||
|
|
||||||
// usually items in the current directory (depends on the function)
|
|
||||||
std::vector<Item> item_tab;
|
|
||||||
|
|
||||||
// if not empty means an address for redirecting to
|
|
||||||
std::wstring redirect_to;
|
|
||||||
std::string aredirect_to;
|
|
||||||
|
|
||||||
// send header X-LIGHTTPD-send-file with path to a file
|
|
||||||
std::wstring x_sendfile;
|
|
||||||
|
|
||||||
// send as attachment (causing header: content-disposition: attachment)
|
|
||||||
bool send_as_attachment;
|
|
||||||
|
|
||||||
// this is a pointer either to the item (if exists) or to the last directory
|
|
||||||
Item * last_item;
|
|
||||||
|
|
||||||
|
|
||||||
Request();
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
// for debugging
|
|
||||||
void PrintGetTab();
|
|
||||||
//void PrintEnv();
|
|
||||||
|
|
||||||
|
|
||||||
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 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);
|
|
||||||
|
|
||||||
bool IsPostVar(const wchar_t * var);
|
|
||||||
const std::wstring & PostVar(const wchar_t * var); // !! zamienic na referencje nie do sta³ej (bez const)
|
|
||||||
bool PostVar(const wchar_t * var, std::wstring & result);
|
|
||||||
std::wstring * PostVarp(const wchar_t * var);
|
|
||||||
|
|
||||||
bool AllPostVarEmpty(); // returning true if all post vars are empty
|
|
||||||
|
|
||||||
void SendAll();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Config * config;
|
|
||||||
|
|
||||||
void ClearPostFileTmp();
|
|
||||||
|
|
||||||
// contains '\0'
|
|
||||||
// used to set env_* pointers to the empty value
|
|
||||||
const char char_empty;
|
|
||||||
|
|
||||||
// used in ParamValue() and PostVar() when there is no such a param
|
|
||||||
const std::wstring str_empty;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_requesttypes
|
|
||||||
#define headerfile_winix_core_requesttypes
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
// !! narazie uzywane tylko w post multi parserze
|
|
||||||
// dodac do zwyklego parsera post
|
|
||||||
#define WINIX_POSTTABLE_MAXSIZE 50
|
|
||||||
|
|
||||||
|
|
||||||
struct PostFile
|
|
||||||
{
|
|
||||||
std::wstring filename; // original file name
|
|
||||||
std::wstring tmp_filename; // file with content (in /tmp)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// parameters from get name:value
|
|
||||||
struct Param
|
|
||||||
{
|
|
||||||
std::wstring name;
|
|
||||||
std::wstring value;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// some global types used by Request class
|
|
||||||
typedef std::vector<std::wstring> GetTab;
|
|
||||||
typedef std::map<std::wstring, std::wstring> PostTab;
|
|
||||||
typedef std::map<std::wstring, PostFile> PostFileTab;
|
|
||||||
typedef std::vector<Param> ParamTab;
|
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> CookieTab;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "session.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Session::Session()
|
|
||||||
{
|
|
||||||
SetTimeToNow();
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Session::SetTimeToNow()
|
|
||||||
{
|
|
||||||
time = std::time(0);
|
|
||||||
tm_time = Time(time);
|
|
||||||
|
|
||||||
last_time = time;
|
|
||||||
tm_last_time = tm_time;
|
|
||||||
|
|
||||||
// the first request can be a POST (it doesn't matter)
|
|
||||||
last_time_get = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this doesn't clear times
|
|
||||||
void Session::Clear()
|
|
||||||
{
|
|
||||||
id = 0;
|
|
||||||
time = 0;
|
|
||||||
puser = 0;
|
|
||||||
rebus_item = 0;
|
|
||||||
rebus_checked = false;
|
|
||||||
remember_me = false;
|
|
||||||
new_session = true;
|
|
||||||
spam_score = 0;
|
|
||||||
plugin_data.Resize(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_session
|
|
||||||
#define headerfile_winix_core_session
|
|
||||||
|
|
||||||
#include <ctime>
|
|
||||||
#include "item.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "user.h"
|
|
||||||
#include "plugindata.h"
|
|
||||||
#include "rebus.h"
|
|
||||||
|
|
||||||
|
|
||||||
// when deleting Sessions you should set request.session into the session object as well
|
|
||||||
// this allows to delete plugins session data
|
|
||||||
// because a session object has plugin_data object
|
|
||||||
// and in its destructor the plugin.Call(WINIX_SESSION_REMOVE) is called
|
|
||||||
struct Session
|
|
||||||
{
|
|
||||||
// 0 - means that there is a temporary session
|
|
||||||
long id;
|
|
||||||
|
|
||||||
// true if the session was created now
|
|
||||||
bool new_session;
|
|
||||||
|
|
||||||
// when this session was created
|
|
||||||
// (the same values)
|
|
||||||
time_t time;
|
|
||||||
tm tm_time;
|
|
||||||
|
|
||||||
// when this session was last used
|
|
||||||
// (the same values)
|
|
||||||
time_t last_time;
|
|
||||||
tm tm_last_time;
|
|
||||||
|
|
||||||
// when there was a last get request
|
|
||||||
// (used to calculate spam)
|
|
||||||
time_t last_time_get;
|
|
||||||
|
|
||||||
// 0 - means that nobody is logged
|
|
||||||
User * puser;
|
|
||||||
|
|
||||||
// if false the session will end when the user browser is shutdown
|
|
||||||
bool remember_me;
|
|
||||||
|
|
||||||
|
|
||||||
// rebus - set by rebus_question(Info & i) from templates
|
|
||||||
Rebus::Item * rebus_item;
|
|
||||||
bool rebus_checked;
|
|
||||||
|
|
||||||
|
|
||||||
int spam_score;
|
|
||||||
|
|
||||||
|
|
||||||
PluginData plugin_data;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Session();
|
|
||||||
void SetTimeToNow();
|
|
||||||
void Clear();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sessioncontainer.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::SessionContainer()
|
|
||||||
{
|
|
||||||
table_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionContainer::SetCur(Cur * pcur)
|
|
||||||
{
|
|
||||||
cur = pcur;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionContainer::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionContainer::SetTmpSession(Session * psession)
|
|
||||||
{
|
|
||||||
tmp_session = psession;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionContainer::Clear()
|
|
||||||
{
|
|
||||||
Table::iterator i = table.begin();
|
|
||||||
|
|
||||||
log << log3 << "SC: deleting all sessions" << logend;
|
|
||||||
|
|
||||||
// don't use table.clear();
|
|
||||||
// because plugins session data would not be erased
|
|
||||||
// we must set cur->session for each session and then delete it
|
|
||||||
while( i != table.end() )
|
|
||||||
{
|
|
||||||
cur->session = &(*i);
|
|
||||||
table.erase(i++);
|
|
||||||
}
|
|
||||||
|
|
||||||
// erasing indexes
|
|
||||||
index_id.clear();
|
|
||||||
table_size = 0;
|
|
||||||
cur->session = tmp_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionContainer::EraseById(IdIterator i)
|
|
||||||
{
|
|
||||||
Session * old_session = tmp_session;
|
|
||||||
|
|
||||||
if( cur->session != &(*i->second) )
|
|
||||||
old_session = cur->session;
|
|
||||||
|
|
||||||
cur->session = &(*i->second);
|
|
||||||
|
|
||||||
log << log4 << "SC: deleting session, id: " << i->second->id << logend;
|
|
||||||
table.erase(i->second);
|
|
||||||
index_id.erase(i);
|
|
||||||
table_size -= 1;
|
|
||||||
|
|
||||||
cur->session = old_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t SessionContainer::Size()
|
|
||||||
{
|
|
||||||
// don't use table.size() as it has O(n) complexity on FreeBSD
|
|
||||||
return table_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionContainer::Begin()
|
|
||||||
{
|
|
||||||
return table.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionContainer::End()
|
|
||||||
{
|
|
||||||
return table.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Session & SessionContainer::Back()
|
|
||||||
{
|
|
||||||
return table.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::IdIterator SessionContainer::IdBegin()
|
|
||||||
{
|
|
||||||
return index_id.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::IdIterator SessionContainer::IdEnd()
|
|
||||||
{
|
|
||||||
return index_id.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionContainer::PushBack(const Session & session)
|
|
||||||
{
|
|
||||||
std::pair<IndexId::iterator, bool> index_id_res = index_id.insert( std::make_pair(session.id, table.end()) );
|
|
||||||
|
|
||||||
if( !index_id_res.second )
|
|
||||||
{
|
|
||||||
// that element already exists (was not inserted now)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator last = table.insert(table.end(), session);
|
|
||||||
index_id_res.first->second = last;
|
|
||||||
table_size += 1;
|
|
||||||
|
|
||||||
log << log3 << "SC: added session, id: " << session.id << logend;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionContainer::FindById(long id)
|
|
||||||
{
|
|
||||||
IndexId::iterator i;
|
|
||||||
|
|
||||||
i = index_id.find(id);
|
|
||||||
|
|
||||||
if( i == index_id.end() )
|
|
||||||
return table.end();
|
|
||||||
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_sessioncontainer
|
|
||||||
#define headerfile_winix_core_sessioncontainer
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
#include "session.h"
|
|
||||||
#include "cur.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SessionContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// when deleting Sessions you should set request.session into the session object
|
|
||||||
// this allows to delete plugins session data
|
|
||||||
// because a session object has plugin_data object
|
|
||||||
// and in its destructor the plugin.Call(WINIX_SESSION_REMOVE) is called
|
|
||||||
typedef std::list<Session> Table;
|
|
||||||
typedef Table::iterator Iterator;
|
|
||||||
typedef std::map<long, Iterator> IndexId;
|
|
||||||
typedef IndexId::iterator IdIterator;
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer();
|
|
||||||
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetTmpSession(Session * psession);
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
size_t Size();
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
Session & Back();
|
|
||||||
bool PushBack(const Session & session);
|
|
||||||
Iterator FindById(long);
|
|
||||||
|
|
||||||
IdIterator IdBegin();
|
|
||||||
IdIterator IdEnd();
|
|
||||||
|
|
||||||
void EraseById(IdIterator i);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Table table;
|
|
||||||
IndexId index_id;
|
|
||||||
|
|
||||||
Cur * cur;
|
|
||||||
Config * config;
|
|
||||||
Session * tmp_session;
|
|
||||||
|
|
||||||
// in FreeBSD implementation (GCC) list::size() has linear complexity
|
|
||||||
// so we use our own table_size with O(1)
|
|
||||||
size_t table_size;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,438 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include "sessionmanager.h"
|
|
||||||
#include "request.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "session.h"
|
|
||||||
#include "sessionparser.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SessionManager::SessionManager()
|
|
||||||
{
|
|
||||||
temporary_session.id = 0;
|
|
||||||
session = &temporary_session;
|
|
||||||
session_tab.SetTmpSession(&temporary_session);
|
|
||||||
|
|
||||||
// thread work mode
|
|
||||||
work_mode = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SetCur(Cur * pcur)
|
|
||||||
{
|
|
||||||
cur = pcur;
|
|
||||||
session_tab.SetCur(pcur);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
session_tab.SetConfig(pconfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SetSystem(System * psystem)
|
|
||||||
{
|
|
||||||
system = psystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SetLastContainer(LastContainer * plast_container)
|
|
||||||
{
|
|
||||||
last_container = plast_container;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size_t SessionManager::Size()
|
|
||||||
{
|
|
||||||
return session_tab.Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionManager::IsSession(long id)
|
|
||||||
{
|
|
||||||
if( session_tab.FindById(id) == session_tab.End() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long SessionManager::CreateSessionId()
|
|
||||||
{
|
|
||||||
long id;
|
|
||||||
|
|
||||||
// make sure to call std::srand() somewhere at the beginning
|
|
||||||
// id must be != 0 (0 is reserved)
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if( sizeof(long) == 8 )
|
|
||||||
{
|
|
||||||
id = ((unsigned long)std::rand()) << 32 + std::rand();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
id = std::rand();
|
|
||||||
}
|
|
||||||
|
|
||||||
id += std::time(0);
|
|
||||||
|
|
||||||
if( id < 0 )
|
|
||||||
id = -id;
|
|
||||||
|
|
||||||
}
|
|
||||||
while( id == 0 ); // 0 reserved for a temporary session
|
|
||||||
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
for( ; !added && attempts > 0 ; --attempts )
|
|
||||||
{
|
|
||||||
new_session.id = CreateSessionId();
|
|
||||||
added = session_tab.PushBack(new_session);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log2 << "SM: sessions limit exceeded (" << config->session_max << ")" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( added )
|
|
||||||
{
|
|
||||||
session = &session_tab.Back();
|
|
||||||
session->new_session = true;
|
|
||||||
log << log2 << "SM: created a new session: " << session->id << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// there is a problem with generating a new session id
|
|
||||||
// we do not set a session cookie
|
|
||||||
session = &temporary_session;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionManager::SetSessionFromCookie(const std::string & cookie)
|
|
||||||
{
|
|
||||||
long id = Tol(cookie.c_str());
|
|
||||||
SessionContainer::Iterator s = session_tab.FindById(id);
|
|
||||||
|
|
||||||
if( s == session_tab.End() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// that session is in the table
|
|
||||||
session = &(*s);
|
|
||||||
session->new_session = false;
|
|
||||||
session->last_time = std::time(0);
|
|
||||||
session->tm_last_time = Time(session->last_time);
|
|
||||||
|
|
||||||
if( cur->request->method == Request::get )
|
|
||||||
session->last_time_get = session->last_time;
|
|
||||||
|
|
||||||
log << log2 << "SM: session: " << session->id;
|
|
||||||
|
|
||||||
if( session->puser )
|
|
||||||
log << log2 << ", user: " << session->puser->name << ", id: " << session->puser->id;
|
|
||||||
|
|
||||||
log << log2 << logend;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SetSession()
|
|
||||||
{
|
|
||||||
CookieTab::iterator i = cur->request->cookie_tab.find(config->http_session_id_name);
|
|
||||||
|
|
||||||
if( i == cur->request->cookie_tab.end() )
|
|
||||||
{
|
|
||||||
CreateSession();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( !SetSessionFromCookie(i->second) )
|
|
||||||
{
|
|
||||||
// there is no such a session
|
|
||||||
// deleting the old cookie
|
|
||||||
cur->request->cookie_tab.erase(i);
|
|
||||||
|
|
||||||
// and creating a new one
|
|
||||||
CreateSession();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionManager::SessionBegin()
|
|
||||||
{
|
|
||||||
return session_tab.Begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionManager::SessionEnd()
|
|
||||||
{
|
|
||||||
return session_tab.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::DeleteSessions()
|
|
||||||
{
|
|
||||||
session_tab.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::InitTmpSession()
|
|
||||||
{
|
|
||||||
Session * old_session = cur->session;
|
|
||||||
|
|
||||||
log << log4 << "SM: initializing temporary session" << logend;
|
|
||||||
cur->session = &temporary_session;
|
|
||||||
plugin.Call(WINIX_SESSION_CREATED);
|
|
||||||
|
|
||||||
cur->session = old_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::UninitTmpSession()
|
|
||||||
{
|
|
||||||
Session * old_session = cur->session;
|
|
||||||
|
|
||||||
log << log4 << "SM: uninitializing temporary session" << logend;
|
|
||||||
cur->session = &temporary_session;
|
|
||||||
cur->session->plugin_data.DeleteAll(); // this will call plugin.Call(WINIX_SESSION_REMOVE);
|
|
||||||
cur->session->plugin_data.Resize(0);
|
|
||||||
|
|
||||||
cur->session = old_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::LoadSessions()
|
|
||||||
{
|
|
||||||
SessionParser sp;
|
|
||||||
SessionContainer::Iterator i;
|
|
||||||
|
|
||||||
// sessions will be overwritten (pointers are invalidated)
|
|
||||||
cur->session = &temporary_session;
|
|
||||||
|
|
||||||
sp.SetUsers(&system->users);
|
|
||||||
sp.Parse(config->session_file, session_tab);
|
|
||||||
|
|
||||||
for(i=session_tab.Begin() ; i != session_tab.End() ; ++i)
|
|
||||||
{
|
|
||||||
i->plugin_data.Resize(plugin.Size());
|
|
||||||
cur->session = &(*i);
|
|
||||||
plugin.Call(WINIX_SESSION_CREATED);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->session = &temporary_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SessionManager::SaveSessions()
|
|
||||||
{
|
|
||||||
if( config->session_file.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::ofstream file(config->session_file.c_str());
|
|
||||||
|
|
||||||
if( !file )
|
|
||||||
{
|
|
||||||
log << log1 << "SM: cannot open the session file for writing - sessions lost" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
log << log2 << "SM: saving sessions" << logend;
|
|
||||||
long len = 0;
|
|
||||||
|
|
||||||
SessionContainer::Iterator i = session_tab.Begin();
|
|
||||||
|
|
||||||
for( ; i!=session_tab.End() ; ++i )
|
|
||||||
{
|
|
||||||
if( i->id != 0 && i->puser )
|
|
||||||
{
|
|
||||||
file << i->id << ' ' << i->puser->id << ' ' << i->remember_me << ' ';
|
|
||||||
file << (long)i->time << ' ' << (long)i->last_time << std::endl;
|
|
||||||
|
|
||||||
++len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
chmod(config->session_file.c_str(), 0600);
|
|
||||||
|
|
||||||
log << log2 << "SM: saved " << len << " session(s)" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Session * SessionManager::GetTmpSession()
|
|
||||||
{
|
|
||||||
return &temporary_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Session * SessionManager::GetCurSession()
|
|
||||||
{
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* sessions gc (second thread)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void SessionManager::Work()
|
|
||||||
{
|
|
||||||
bool exit = false;
|
|
||||||
SessionContainer::IndexId::iterator i;
|
|
||||||
|
|
||||||
deleted = 0;
|
|
||||||
|
|
||||||
Lock();
|
|
||||||
i = session_tab.IdBegin();
|
|
||||||
Unlock();
|
|
||||||
|
|
||||||
while( !exit )
|
|
||||||
{
|
|
||||||
Lock();
|
|
||||||
|
|
||||||
CheckSession(i);
|
|
||||||
exit = synchro->was_stop_signal;
|
|
||||||
|
|
||||||
Unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// it's called from the other thread (with Lock and Unlock)
|
|
||||||
void SessionManager::CheckSession(SessionContainer::IndexId::iterator & i)
|
|
||||||
{
|
|
||||||
const int deleted_max_at_once = 10;
|
|
||||||
|
|
||||||
if( i == session_tab.IdEnd() )
|
|
||||||
{
|
|
||||||
if( deleted > 0 )
|
|
||||||
{
|
|
||||||
deleted = 0;
|
|
||||||
log << logsave;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = session_tab.IdBegin();
|
|
||||||
WaitForSignalSleep(10);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( IsSessionOutdated(*i->second) )
|
|
||||||
{
|
|
||||||
DeleteSession(i++);
|
|
||||||
++deleted;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( deleted >= deleted_max_at_once )
|
|
||||||
{
|
|
||||||
log << logsave;
|
|
||||||
WaitForSignalSleep(1);
|
|
||||||
deleted = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// it's called from the other thread (with Lock and Unlock)
|
|
||||||
bool SessionManager::IsSessionOutdated(const Session & s) const
|
|
||||||
{
|
|
||||||
bool outdated;
|
|
||||||
|
|
||||||
if( s.remember_me )
|
|
||||||
outdated = s.last_time < std::time(0) - config->session_remember_max_idle;
|
|
||||||
else
|
|
||||||
outdated = s.last_time < std::time(0) - config->session_max_idle;
|
|
||||||
|
|
||||||
return outdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// it's called from the other thread (with Lock and Unlock)
|
|
||||||
void SessionManager::DeleteSession(SessionContainer::IdIterator i)
|
|
||||||
{
|
|
||||||
Session * del_session = &(*i->second);
|
|
||||||
|
|
||||||
if( del_session->puser )
|
|
||||||
last_container->UserLogout(del_session->puser->id, del_session->id);
|
|
||||||
|
|
||||||
session_tab.EraseById(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* end of sessions gc
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_sessionmanager
|
|
||||||
#define headerfile_winix_core_sessionmanager
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
#include "sessioncontainer.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "request.h"
|
|
||||||
#include "lastcontainer.h"
|
|
||||||
#include "system.h"
|
|
||||||
#include "synchro.h"
|
|
||||||
#include "basethread.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SessionManager : public BaseThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
SessionManager();
|
|
||||||
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetSystem(System * psystem);
|
|
||||||
void SetLastContainer(LastContainer * plast_container);
|
|
||||||
|
|
||||||
void SetSession();
|
|
||||||
void DeleteSessions(); // deleting all sessions
|
|
||||||
|
|
||||||
void InitTmpSession();
|
|
||||||
void UninitTmpSession();
|
|
||||||
|
|
||||||
Session * GetTmpSession();
|
|
||||||
Session * GetCurSession();
|
|
||||||
|
|
||||||
void LoadSessions();
|
|
||||||
void SaveSessions();
|
|
||||||
|
|
||||||
SessionContainer::Iterator SessionBegin();
|
|
||||||
SessionContainer::Iterator SessionEnd();
|
|
||||||
|
|
||||||
size_t Size();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Config * config;
|
|
||||||
Cur * cur;
|
|
||||||
System * system;
|
|
||||||
|
|
||||||
LastContainer * last_container;
|
|
||||||
|
|
||||||
// current session - set by SetSession()
|
|
||||||
Session * session;
|
|
||||||
|
|
||||||
SessionContainer session_tab;
|
|
||||||
|
|
||||||
// session with id 0
|
|
||||||
Session temporary_session;
|
|
||||||
|
|
||||||
// for adding a new session to the container
|
|
||||||
Session new_session;
|
|
||||||
|
|
||||||
bool IsSession(long s);
|
|
||||||
|
|
||||||
long CreateSessionId();
|
|
||||||
void CreateSession();
|
|
||||||
bool SetSessionFromCookie(const std::string & cookie);
|
|
||||||
|
|
||||||
|
|
||||||
// second thread
|
|
||||||
int deleted;
|
|
||||||
virtual void Work();
|
|
||||||
void CheckSession(SessionContainer::IndexId::iterator & i);
|
|
||||||
bool IsSessionOutdated(const Session & s) const;
|
|
||||||
void DeleteSession(SessionContainer::IdIterator i);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sessionparser.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionParser::Parse(const std::string & path, SessionContainer & container)
|
|
||||||
{
|
|
||||||
return Parse(path.c_str(), container);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionParser::SetUsers(Users * pusers)
|
|
||||||
{
|
|
||||||
users = pusers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionParser::Parse(const char * path, SessionContainer & container)
|
|
||||||
{
|
|
||||||
container.Clear();
|
|
||||||
file.open(path, std::ios_base::in | std::ios_base::binary);
|
|
||||||
|
|
||||||
if( !file )
|
|
||||||
{
|
|
||||||
log << log1 << "SP: cannot open the session file for reading (file: '" << path << "')" << logend;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool res = Parse(container);
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionParser::Parse(SessionContainer & container)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
file format, each rows:
|
|
||||||
session_id(long) user_id(long) remember_me(0|1) time(long) last_time(long)
|
|
||||||
*/
|
|
||||||
|
|
||||||
long user_id;
|
|
||||||
|
|
||||||
session.Clear();
|
|
||||||
last = file.get();
|
|
||||||
|
|
||||||
log << log2 << "SP: reading sessions from the session file" << logend;
|
|
||||||
|
|
||||||
while( true )
|
|
||||||
{
|
|
||||||
session.id = ReadLong();
|
|
||||||
|
|
||||||
if( file.eof() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
user_id = ReadLong();
|
|
||||||
session.remember_me = ReadLong();
|
|
||||||
session.time = ReadLong();
|
|
||||||
session.last_time = ReadLong();
|
|
||||||
|
|
||||||
if( MakeSession(user_id) )
|
|
||||||
{
|
|
||||||
users->IncrementLoggedUsers();
|
|
||||||
container.PushBack(session);
|
|
||||||
log << log2 << "SP: read session id: " << session.id << " for user: " << session.puser->name << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkipLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
log << log2 << "SP: read " << container.Size() << " session(s)" << logend;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionParser::MakeSession(long user_id)
|
|
||||||
{
|
|
||||||
User * puser = users->GetUser(user_id);
|
|
||||||
|
|
||||||
if( !puser )
|
|
||||||
{
|
|
||||||
log << log1 << "SP: there is no a user with id: " << user_id << " (skipped)" << logend;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
session.puser = puser;
|
|
||||||
session.new_session = true;
|
|
||||||
session.tm_time = Time(session.time);
|
|
||||||
session.tm_last_time = Time(session.last_time);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SessionParser::IsWhite(int c)
|
|
||||||
{
|
|
||||||
if( c==' ' || c=='\t' || c==13 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SessionParser::IsDigit(int c)
|
|
||||||
{
|
|
||||||
if( c>='0' && c<='9' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionParser::SkipWhite()
|
|
||||||
{
|
|
||||||
while( IsWhite(last) )
|
|
||||||
last = file.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SessionParser::SkipLine()
|
|
||||||
{
|
|
||||||
while( last != 10 )
|
|
||||||
last = file.get();
|
|
||||||
|
|
||||||
last = file.get(); // first character from the new line
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long SessionParser::ReadLong()
|
|
||||||
{
|
|
||||||
long res = 0;
|
|
||||||
bool is_sign = false;
|
|
||||||
|
|
||||||
SkipWhite();
|
|
||||||
|
|
||||||
if( last == '-' )
|
|
||||||
{
|
|
||||||
is_sign = true;
|
|
||||||
last = file.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
while( IsDigit(last) )
|
|
||||||
{
|
|
||||||
res = res*10 + (last-'0');
|
|
||||||
last = file.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( is_sign )
|
|
||||||
res = -res;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_sessionparser
|
|
||||||
#define headerfile_winix_core_sessionparser
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
|
||||||
#include "session.h"
|
|
||||||
#include "sessioncontainer.h"
|
|
||||||
#include "users.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SessionParser
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
bool Parse(const char * path, SessionContainer & container);
|
|
||||||
bool Parse(const std::string & path, SessionContainer & container);
|
|
||||||
void SetUsers(Users * pusers);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Users * users;
|
|
||||||
|
|
||||||
bool Parse(SessionContainer & container);
|
|
||||||
bool MakeSession(long user_id);
|
|
||||||
|
|
||||||
bool IsWhite(int c);
|
|
||||||
bool IsDigit(int c);
|
|
||||||
void SkipWhite();
|
|
||||||
void SkipLine();
|
|
||||||
|
|
||||||
long ReadLong();
|
|
||||||
|
|
||||||
std::ifstream file;
|
|
||||||
int last; // last character
|
|
||||||
Session session;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "synchro.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Synchro::Synchro() : mutex(PTHREAD_MUTEX_INITIALIZER)
|
|
||||||
{
|
|
||||||
was_stop_signal = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Synchro::Lock()
|
|
||||||
{
|
|
||||||
return pthread_mutex_lock(&mutex) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Synchro::Unlock()
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_synchro
|
|
||||||
#define headerfile_winix_core_synchro
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Synchro
|
|
||||||
{
|
|
||||||
// one global mutex
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
|
|
||||||
|
|
||||||
// true when winix is closing
|
|
||||||
volatile bool was_stop_signal;
|
|
||||||
|
|
||||||
|
|
||||||
Synchro();
|
|
||||||
|
|
||||||
bool Lock();
|
|
||||||
void Unlock();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
157
core/system.h
157
core/system.h
@@ -1,157 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_system
|
|
||||||
#define headerfile_winix_core_system
|
|
||||||
|
|
||||||
#include <ctime>
|
|
||||||
#include "dirs.h"
|
|
||||||
#include "mounts.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
#include "request.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "crypt.h"
|
|
||||||
#include "users.h"
|
|
||||||
#include "groups.h"
|
|
||||||
#include "rebus.h"
|
|
||||||
#include "loadavg.h"
|
|
||||||
#include "synchro.h"
|
|
||||||
#include "thumb.h"
|
|
||||||
#include "notify/notify.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// file system
|
|
||||||
class System
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// contains current directories tree
|
|
||||||
Dirs dirs;
|
|
||||||
|
|
||||||
// mount points
|
|
||||||
Mounts mounts;
|
|
||||||
|
|
||||||
// users
|
|
||||||
Users users;
|
|
||||||
|
|
||||||
// groups
|
|
||||||
Groups groups;
|
|
||||||
|
|
||||||
// rebus (captcha)
|
|
||||||
Rebus rebus;
|
|
||||||
|
|
||||||
// load averages
|
|
||||||
LoadAvg load_avg;
|
|
||||||
|
|
||||||
// notifications (by emails)
|
|
||||||
Notify notify;
|
|
||||||
|
|
||||||
// thumbnails (special thread)
|
|
||||||
Thumb thumb;
|
|
||||||
|
|
||||||
// the time when the winix starts
|
|
||||||
time_t system_start;
|
|
||||||
|
|
||||||
// cryptography and hashes
|
|
||||||
Crypt crypt;
|
|
||||||
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetDb(Db * pdb);
|
|
||||||
void SetSynchro(Synchro * psynchro);
|
|
||||||
void Init();
|
|
||||||
|
|
||||||
void AddParams(const ParamTab & param_tab, std::wstring & str, bool clear_str = true);
|
|
||||||
|
|
||||||
void RedirectTo(const Item & item, const wchar_t * postfix = 0);
|
|
||||||
void RedirectTo(long item_id, const wchar_t * postfix = 0);
|
|
||||||
void RedirectTo(const std::wstring & url);
|
|
||||||
void RedirectWithFunctionAndParamsTo(const std::wstring & url);
|
|
||||||
void RedirectToLastDir();
|
|
||||||
void RedirectToLastItem(); // redirect to an item if exists or to the last directory
|
|
||||||
|
|
||||||
bool CanChangeUser(const Item & item, long new_user_id);
|
|
||||||
bool CanChangeGroup(const Item & item, long new_group_id);
|
|
||||||
bool CanChangePrivileges(const Item & item, int new_priv);
|
|
||||||
bool HasAccess(const Item & item, int mask);
|
|
||||||
bool HasReadAccess(const Item & item);
|
|
||||||
bool HasWriteAccess(const Item & item);
|
|
||||||
bool HasReadWriteAccess(const Item & item);
|
|
||||||
bool HasReadExecAccess(const Item & item);
|
|
||||||
bool HasReadExecAccessToPath(long dir_id);
|
|
||||||
bool HasReadExecAccessToPath(const std::vector<Item*> & dir_tab);
|
|
||||||
bool DirsHaveReadExecPerm();
|
|
||||||
void CheckAccessToItems(std::vector<Item> & item_tab);
|
|
||||||
|
|
||||||
bool CanUseHtml(long user_id);
|
|
||||||
bool CanUseBBCode(long user_id);
|
|
||||||
bool CanUseRaw(long user_id);
|
|
||||||
|
|
||||||
bool IsMemberOfGroup(long user_id, const wchar_t * group_name);
|
|
||||||
|
|
||||||
// creating item.file_path and item.file_fs (the mountpoint where the item is located)
|
|
||||||
bool CreateNewFile(Item & item);
|
|
||||||
bool MakeFilePath(const Item & item, std::wstring & path, bool thumb = false, bool create_dir = false, int chmod = 0755);
|
|
||||||
|
|
||||||
bool MakePath(const Item & item, std::wstring & path, bool clear_path = true);
|
|
||||||
|
|
||||||
Error AddFile(Item & item, int notify_code = 0);
|
|
||||||
Error EditFile(Item & item, bool with_url = true, int notify_code = 0);
|
|
||||||
|
|
||||||
// converting GMT time to local time (different for each user)
|
|
||||||
time_t LocalTime(time_t gmt_time);
|
|
||||||
tm LocalTime(const tm * ptm);
|
|
||||||
tm LocalTime(const tm & ptm);
|
|
||||||
|
|
||||||
int FollowLink(const std::vector<Item*> & current_dir_tab, const std::wstring & link_to,
|
|
||||||
std::vector<Item*> & out_dir_tab, Item & out_item);
|
|
||||||
|
|
||||||
int FollowAllLinks(const std::vector<Item*> & current_dir_tab, const std::wstring & link_to,
|
|
||||||
std::vector<Item*> & out_dir_tab, Item & out_item,
|
|
||||||
bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true);
|
|
||||||
|
|
||||||
// starting from root dir
|
|
||||||
int FollowAllLinks(const std::wstring & link_to,
|
|
||||||
std::vector<Item*> & out_dir_tab, Item & out_item,
|
|
||||||
bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true);
|
|
||||||
|
|
||||||
// using cur->request->dir_tab and cur->request->item
|
|
||||||
bool FollowAllLinks(const std::wstring & link_to,
|
|
||||||
bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Cur * cur;
|
|
||||||
Db * db;
|
|
||||||
Config * config;
|
|
||||||
Synchro * synchro;
|
|
||||||
|
|
||||||
Item item_temp;
|
|
||||||
std::wstring link_to_temp, name_temp;
|
|
||||||
|
|
||||||
// for FollowAllLinks
|
|
||||||
std::vector<Item*> temp_follow_dir_tab;
|
|
||||||
std::vector<Item*> root_follow_dir_tab;
|
|
||||||
Item temp_follow_item;
|
|
||||||
|
|
||||||
bool CreateNewFileSimpleFs(Item & item);
|
|
||||||
bool CreateNewFileHashFs(Item & item);
|
|
||||||
|
|
||||||
bool FollowAllLinksDirFound(std::vector<Item*> & out_dir_tab,
|
|
||||||
bool follow_dir_default, bool stop_on_link_redirect, bool check_access);
|
|
||||||
|
|
||||||
bool FollowAllLinksFileOrSymlinkFound(std::vector<Item*> & out_dir_tab, Item & out_item,
|
|
||||||
bool stop_on_link_redirect, bool check_access);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "textstream.h"
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,296 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_textstream
|
|
||||||
#define headerfile_winix_core_textstream
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
a special class representing a stream buffer
|
|
||||||
similar to std::ostringstream
|
|
||||||
|
|
||||||
StringType can be either std::string or std::wstring
|
|
||||||
this class doesn't use UTF-8 in any kind
|
|
||||||
*/
|
|
||||||
template<class StringType>
|
|
||||||
class TextStream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef typename StringType::value_type CharType;
|
|
||||||
typedef typename StringType::value_type char_type;
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
bool Empty() const;
|
|
||||||
size_t Size() const;
|
|
||||||
void Reserve(size_t len);
|
|
||||||
|
|
||||||
const StringType & Str() const;
|
|
||||||
const CharType * CStr() const;
|
|
||||||
|
|
||||||
TextStream & operator<<(const char * str);
|
|
||||||
TextStream & operator<<(const std::string * str);
|
|
||||||
TextStream & operator<<(const std::string & str);
|
|
||||||
|
|
||||||
TextStream & operator<<(const wchar_t * str);
|
|
||||||
TextStream & operator<<(const std::wstring * str);
|
|
||||||
TextStream & operator<<(const std::wstring & str);
|
|
||||||
|
|
||||||
TextStream & operator<<(char);
|
|
||||||
TextStream & operator<<(wchar_t);
|
|
||||||
TextStream & operator<<(int);
|
|
||||||
TextStream & operator<<(long);
|
|
||||||
TextStream & operator<<(unsigned int);
|
|
||||||
TextStream & operator<<(unsigned long);
|
|
||||||
TextStream & operator<<(double);
|
|
||||||
TextStream & operator<<(const void *);// printing a pointer
|
|
||||||
|
|
||||||
TextStream & Write(const char * buf, size_t len);
|
|
||||||
TextStream & Write(const wchar_t * buf, size_t len);
|
|
||||||
TextStream & write(const char * buf, size_t len); // for compatibility with standard library (Ezc uses it)
|
|
||||||
TextStream & write(const wchar_t * buf, size_t len);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
StringType buffer;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void TextStream<StringType>::Clear()
|
|
||||||
{
|
|
||||||
buffer.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
bool TextStream<StringType>::Empty() const
|
|
||||||
{
|
|
||||||
return buffer.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
size_t TextStream<StringType>::Size() const
|
|
||||||
{
|
|
||||||
return buffer.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
void TextStream<StringType>::Reserve(size_t len)
|
|
||||||
{
|
|
||||||
buffer.reserve(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
const StringType & TextStream<StringType>::Str() const
|
|
||||||
{
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
const typename TextStream<StringType>::CharType * TextStream<StringType>::CStr() const
|
|
||||||
{
|
|
||||||
return buffer.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const char * str)
|
|
||||||
{
|
|
||||||
AssignString(str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const std::string * str)
|
|
||||||
{
|
|
||||||
AssignString(*str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const std::string & str)
|
|
||||||
{
|
|
||||||
AssignString(str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const wchar_t * str)
|
|
||||||
{
|
|
||||||
AssignString(str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const std::wstring * str)
|
|
||||||
{
|
|
||||||
AssignString(*str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const std::wstring & str)
|
|
||||||
{
|
|
||||||
AssignString(str, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(char v)
|
|
||||||
{
|
|
||||||
buffer += v;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(wchar_t v)
|
|
||||||
{
|
|
||||||
buffer += static_cast<CharType>(v);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(int v)
|
|
||||||
{
|
|
||||||
wchar_t buf[50];
|
|
||||||
size_t len = sizeof(buf) / sizeof(wchar_t);
|
|
||||||
|
|
||||||
Toa(v, buf, len);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(long v)
|
|
||||||
{
|
|
||||||
wchar_t buf[50];
|
|
||||||
size_t len = sizeof(buf) / sizeof(wchar_t);
|
|
||||||
|
|
||||||
Toa(v, buf, len);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned int v)
|
|
||||||
{
|
|
||||||
wchar_t buf[50];
|
|
||||||
size_t len = sizeof(buf) / sizeof(wchar_t);
|
|
||||||
|
|
||||||
Toa(v, buf, len);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned long v)
|
|
||||||
{
|
|
||||||
wchar_t buf[50];
|
|
||||||
size_t len = sizeof(buf) / sizeof(wchar_t);
|
|
||||||
|
|
||||||
Toa(v, buf, len);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(double v)
|
|
||||||
{
|
|
||||||
char buf[50];
|
|
||||||
|
|
||||||
sprintf(buf, "%f", v);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::operator<<(const void * v)
|
|
||||||
{
|
|
||||||
wchar_t buf[50];
|
|
||||||
size_t len = sizeof(buf) / sizeof(wchar_t);
|
|
||||||
|
|
||||||
buf[0] = '0';
|
|
||||||
buf[1] = 'x';
|
|
||||||
|
|
||||||
Toa(reinterpret_cast<unsigned long>(v), buf+2, len-2, 16);
|
|
||||||
AssignString(buf, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::Write(const char * buf, size_t len)
|
|
||||||
{
|
|
||||||
AssignString(buf, len, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::write(const char * buf, size_t len)
|
|
||||||
{
|
|
||||||
return Write(buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::Write(const wchar_t * buf, size_t len)
|
|
||||||
{
|
|
||||||
AssignString(buf, len, buffer, false);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class StringType>
|
|
||||||
TextStream<StringType> & TextStream<StringType>::write(const wchar_t * buf, size_t len)
|
|
||||||
{
|
|
||||||
return Write(buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
309
core/thumb.cpp
309
core/thumb.cpp
@@ -1,309 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ctime>
|
|
||||||
#include "thumb.h"
|
|
||||||
#include "utf8.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "system.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Thumb::SetDb(Db * pdb)
|
|
||||||
{
|
|
||||||
db = pdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Thumb::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Thumb::SetSystem(System * psystem)
|
|
||||||
{
|
|
||||||
system = psystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// first thread (objects locked)
|
|
||||||
void Thumb::CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode)
|
|
||||||
{
|
|
||||||
item_temp.file = item;
|
|
||||||
item_temp.cx = cx;
|
|
||||||
item_temp.cy = cy;
|
|
||||||
item_temp.aspect_mode = aspect_mode;
|
|
||||||
|
|
||||||
thumb_tab.insert(thumb_tab.end(), item_temp);
|
|
||||||
WakeUpThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects locked)
|
|
||||||
bool Thumb::SignalReceived()
|
|
||||||
{
|
|
||||||
return !thumb_tab.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects not locked)
|
|
||||||
void Thumb::Do()
|
|
||||||
{
|
|
||||||
ThumbTab::iterator i;
|
|
||||||
bool end;
|
|
||||||
|
|
||||||
Lock();
|
|
||||||
i = thumb_tab.begin();
|
|
||||||
Unlock();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Lock();
|
|
||||||
|
|
||||||
if( i != thumb_tab.end() )
|
|
||||||
{
|
|
||||||
item_work = *i;
|
|
||||||
thumb_tab.erase(i++);
|
|
||||||
end = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
end = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unlock();
|
|
||||||
|
|
||||||
if( !end )
|
|
||||||
CreateThumbnail();
|
|
||||||
|
|
||||||
}
|
|
||||||
while( !end && !IsExitSignal() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Thumb::EscapePath(const std::string & path)
|
|
||||||
{
|
|
||||||
command << '"';
|
|
||||||
|
|
||||||
for(size_t i=0 ; i<path.size() ; ++i)
|
|
||||||
{
|
|
||||||
if( path[i] == '"' )
|
|
||||||
command << '\\';
|
|
||||||
|
|
||||||
command << path[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
command << "\" ";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
from: http://www.imagemagick.org/script/command-line-processing.php#geometry
|
|
||||||
|
|
||||||
scale% Height and width both scaled by specified percentage.
|
|
||||||
scale-x%xscale-y% Height and width individually scaled by specified percentages. (Only one % symbol needed.)
|
|
||||||
width Width given, height automagically selected to preserve aspect ratio.
|
|
||||||
xheight Height given, width automagically selected to preserve aspect ratio.
|
|
||||||
widthxheight Maximum values of height and width given, aspect ratio preserved.
|
|
||||||
widthxheight^ Minimum values of width and height given, aspect ratio preserved.
|
|
||||||
widthxheight! Width and height emphatically given, original aspect ratio ignored.
|
|
||||||
widthxheight> Change as per widthxheight but only if an image dimension exceeds a specified dimension.
|
|
||||||
widthxheight< Change dimensions only if both image dimensions exceed specified dimensions.
|
|
||||||
*/
|
|
||||||
void Thumb::SelectAspect()
|
|
||||||
{
|
|
||||||
switch( item_work.aspect_mode )
|
|
||||||
{
|
|
||||||
case WINIX_THUMB_MODE_1:
|
|
||||||
command << item_work.cx;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_3:
|
|
||||||
command << item_work.cx << "x" << item_work.cy;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_4:
|
|
||||||
command << '"' << item_work.cx << "x" << item_work.cy << "^\"";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_5:
|
|
||||||
command << '"' << item_work.cx << "x" << item_work.cy << "!\"";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_6:
|
|
||||||
command << '"' << item_work.cx << "x" << item_work.cy << ">\"";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_7:
|
|
||||||
command << '"' << item_work.cx << "x" << item_work.cy << "<\"";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WINIX_THUMB_MODE_2:
|
|
||||||
default:
|
|
||||||
command << "x" << item_work.cy;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects are not locked)
|
|
||||||
bool Thumb::CreateCommand()
|
|
||||||
{
|
|
||||||
bool res;
|
|
||||||
|
|
||||||
command.Clear();
|
|
||||||
stream_tmp_path.Clear();
|
|
||||||
|
|
||||||
Lock();
|
|
||||||
|
|
||||||
Ezc::WideToUTF8(config->convert_cmd, tempa);
|
|
||||||
command << tempa << " -quiet -strip -thumbnail ";
|
|
||||||
SelectAspect();
|
|
||||||
command << " ";
|
|
||||||
|
|
||||||
if( system->MakeFilePath(item_work.file, src_path) )
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(src_path, tempa);
|
|
||||||
EscapePath(tempa);
|
|
||||||
|
|
||||||
stream_tmp_path << config->upload_dir << L"/tmp/thumb_" << std::time(0);
|
|
||||||
Ezc::WideToUTF8(stream_tmp_path.Str(), string_tmp_patha);
|
|
||||||
EscapePath(string_tmp_patha);
|
|
||||||
|
|
||||||
res = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "Thumb: cannot create a source path" << logend;
|
|
||||||
res = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unlock();
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects are not locked)
|
|
||||||
void Thumb::SaveTmpThumbnail()
|
|
||||||
{
|
|
||||||
bool moved = false;
|
|
||||||
|
|
||||||
Lock();
|
|
||||||
|
|
||||||
// the file could have been changed especially when creating thumbnail lasted too long
|
|
||||||
iq.SetAll(false, false);
|
|
||||||
iq.sel_parent_id = true;
|
|
||||||
iq.sel_file = true;
|
|
||||||
iq.sel_url = true;
|
|
||||||
iq.sel_type = true;
|
|
||||||
iq.WhereId(item_work.file.id);
|
|
||||||
|
|
||||||
if( db->GetItem(item_work.file, iq) == WINIX_ERR_OK )
|
|
||||||
{
|
|
||||||
if( system->MakeFilePath(item_work.file, dst_path, true, true, config->upload_dirs_chmod) )
|
|
||||||
{
|
|
||||||
if( RenameFile(stream_tmp_path.Str(), dst_path) )
|
|
||||||
{
|
|
||||||
log << log3 << "Thumb: created a thumbnail: " << dst_path << logend;
|
|
||||||
db->EditHasThumbById(true, item_work.file.id);
|
|
||||||
moved = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "Thumb: cannot move a temporary file: " << stream_tmp_path.Str() << ", to: " << dst_path << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "Thumb: cannot create a destination path" << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !moved )
|
|
||||||
::RemoveFile(stream_tmp_path.Str());
|
|
||||||
|
|
||||||
Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects are not locked)
|
|
||||||
void Thumb::CreateThumbnail()
|
|
||||||
{
|
|
||||||
if( !CreateCommand() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
int res = std::system(command.CStr());
|
|
||||||
|
|
||||||
if( res == 0 )
|
|
||||||
{
|
|
||||||
SaveTmpThumbnail();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Lock();
|
|
||||||
log << log3 << "Thumb: some problems with creating a thumbnail " << tempa
|
|
||||||
<< ", 'convert' process returned: " << res << logend;
|
|
||||||
Unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// second thread (objects are not locked)
|
|
||||||
// !! there is a problem with GIF files
|
|
||||||
// Bus error (core dumped)
|
|
||||||
/*
|
|
||||||
#include "wand/MagickWand.h"
|
|
||||||
|
|
||||||
// compiler options:
|
|
||||||
// include: -I/usr/local/include/ImageMagick
|
|
||||||
// link with: `MagickWand-config --ldflags --libs`
|
|
||||||
|
|
||||||
void Thumb::CreateThumbnail()
|
|
||||||
{
|
|
||||||
Ezc::WideToUTF8(item_work.source, sourcea);
|
|
||||||
Ezc::WideToUTF8(item_work.dst, dsta);
|
|
||||||
|
|
||||||
MagickWandGenesis();
|
|
||||||
|
|
||||||
MagickWand * wand = NewMagickWand();
|
|
||||||
|
|
||||||
if( MagickReadImage(wand, sourcea.c_str()) )
|
|
||||||
{
|
|
||||||
MagickThumbnailImage(wand, item_work.cx, item_work.cy);
|
|
||||||
|
|
||||||
if( MagickWriteImage(wand, dsta.c_str()) )
|
|
||||||
{
|
|
||||||
Lock();
|
|
||||||
log << log3 << "Thumb: created a thumbnail: " << dsta << logend;
|
|
||||||
Unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DestroyMagickWand(wand);
|
|
||||||
|
|
||||||
MagickWandTerminus();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
97
core/thumb.h
97
core/thumb.h
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_thumb
|
|
||||||
#define headerfile_winix_core_thumb
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#include "basethread.h"
|
|
||||||
#include "textstream.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
#include "core/item.h"
|
|
||||||
#include "core/config.h"
|
|
||||||
|
|
||||||
|
|
||||||
class System;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Width given, height automagically selected to preserve aspect ratio.
|
|
||||||
#define WINIX_THUMB_MODE_1 1
|
|
||||||
|
|
||||||
// Height given, width automagically selected to preserve aspect ratio.
|
|
||||||
#define WINIX_THUMB_MODE_2 2
|
|
||||||
|
|
||||||
// Maximum values of height and width given, aspect ratio preserved.
|
|
||||||
#define WINIX_THUMB_MODE_3 3
|
|
||||||
|
|
||||||
// Minimum values of width and height given, aspect ratio preserved.
|
|
||||||
#define WINIX_THUMB_MODE_4 4
|
|
||||||
|
|
||||||
// Width and height emphatically given, original aspect ratio ignored.
|
|
||||||
#define WINIX_THUMB_MODE_5 5
|
|
||||||
|
|
||||||
// Change as per widthxheight but only if an image dimension exceeds a specified dimension.
|
|
||||||
#define WINIX_THUMB_MODE_6 6
|
|
||||||
|
|
||||||
// Change dimensions only if both image dimensions are less than specified dimensions.
|
|
||||||
#define WINIX_THUMB_MODE_7 7
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Thumb : public BaseThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
void CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode);
|
|
||||||
|
|
||||||
void SetDb(Db * pdb);
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetSystem(System * psystem);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Db * db;
|
|
||||||
Config * config;
|
|
||||||
System * system;
|
|
||||||
|
|
||||||
struct ThumbItem
|
|
||||||
{
|
|
||||||
Item file;
|
|
||||||
size_t cx;
|
|
||||||
size_t cy;
|
|
||||||
int aspect_mode;
|
|
||||||
};
|
|
||||||
|
|
||||||
// queue of thumbnails to create
|
|
||||||
typedef std::list<ThumbItem> ThumbTab;
|
|
||||||
ThumbTab thumb_tab;
|
|
||||||
ThumbItem item_temp;
|
|
||||||
|
|
||||||
// only for second thread
|
|
||||||
ThumbItem item_work;
|
|
||||||
std::wstring src_path, dst_path;
|
|
||||||
std::string tempa, string_tmp_patha;
|
|
||||||
TextStream<std::string> command;
|
|
||||||
TextStream<std::wstring> stream_tmp_path;
|
|
||||||
DbItemQuery iq;
|
|
||||||
|
|
||||||
virtual bool SignalReceived();
|
|
||||||
virtual void Do();
|
|
||||||
bool CreateCommand();
|
|
||||||
void SaveTmpThumbnail();
|
|
||||||
void CreateThumbnail();
|
|
||||||
void SelectAspect();
|
|
||||||
void EscapePath(const std::string & path);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_ugcontainer
|
|
||||||
#define headerfile_winix_core_ugcontainer
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class UGContainer
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef typename std::vector<Type> Table;
|
|
||||||
typedef typename Table::iterator Iterator;
|
|
||||||
typedef typename Table::size_type SizeType;
|
|
||||||
|
|
||||||
typedef typename std::map<long, SizeType> TableId;
|
|
||||||
typedef typename std::map<std::wstring, SizeType> TableName;
|
|
||||||
|
|
||||||
|
|
||||||
UGContainer();
|
|
||||||
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
SizeType Size();
|
|
||||||
bool Empty();
|
|
||||||
Iterator PushBack(const Type & type); // can return End() if the user already exists
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
bool Is(long id);
|
|
||||||
bool Is(const std::wstring & name);
|
|
||||||
|
|
||||||
Iterator FindId(long id);
|
|
||||||
Iterator FindName(const std::wstring & name);
|
|
||||||
|
|
||||||
Type & operator[](SizeType pos);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void AddIndexes(SizeType pos);
|
|
||||||
void RebuildIndexes();
|
|
||||||
|
|
||||||
// main table
|
|
||||||
Table table;
|
|
||||||
|
|
||||||
// indexes
|
|
||||||
TableId table_id;
|
|
||||||
TableName table_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
UGContainer<Type>::UGContainer() // : table(100)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::Iterator UGContainer<Type>::Begin()
|
|
||||||
{
|
|
||||||
return table.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::Iterator UGContainer<Type>::End()
|
|
||||||
{
|
|
||||||
return table.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::SizeType UGContainer<Type>::Size()
|
|
||||||
{
|
|
||||||
return table.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool UGContainer<Type>::Empty()
|
|
||||||
{
|
|
||||||
return table.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::Iterator UGContainer<Type>::PushBack(const Type & type)
|
|
||||||
{
|
|
||||||
if( Is(type.id) || Is(type.name) )
|
|
||||||
return End();
|
|
||||||
|
|
||||||
table.push_back(type);
|
|
||||||
log << log2 << "UGCont: added, id: " << type.id << ", name: " << type.name << logend;
|
|
||||||
|
|
||||||
AddIndexes( table.size() - 1 );
|
|
||||||
|
|
||||||
return --table.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void UGContainer<Type>::Clear()
|
|
||||||
{
|
|
||||||
table.clear();
|
|
||||||
table_id.clear();
|
|
||||||
table_name.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool UGContainer<Type>::Is(long id)
|
|
||||||
{
|
|
||||||
typename TableId::iterator i = table_id.find(id);
|
|
||||||
|
|
||||||
if( i == table_id.end() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool UGContainer<Type>::Is(const std::wstring & name)
|
|
||||||
{
|
|
||||||
typename TableName::iterator i = table_name.find(name);
|
|
||||||
|
|
||||||
if( i == table_name.end() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::Iterator UGContainer<Type>::FindId(long id)
|
|
||||||
{
|
|
||||||
typename TableId::iterator i = table_id.find(id);
|
|
||||||
|
|
||||||
if( i == table_id.end() )
|
|
||||||
return table.end();
|
|
||||||
|
|
||||||
return table.begin() + i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename UGContainer<Type>::Iterator UGContainer<Type>::FindName(const std::wstring & name)
|
|
||||||
{
|
|
||||||
typename TableName::iterator i = table_name.find(name);
|
|
||||||
|
|
||||||
if( i == table_name.end() )
|
|
||||||
return table.end();
|
|
||||||
|
|
||||||
return table.begin() + i->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void UGContainer<Type>::AddIndexes(UGContainer<Type>::SizeType pos)
|
|
||||||
{
|
|
||||||
table_id.insert( std::make_pair(table[pos].id, pos) );
|
|
||||||
table_name.insert( std::make_pair(table[pos].name, pos) );
|
|
||||||
|
|
||||||
log << log4 << "UGCont: added indexes to: id: " << table[pos].id << ", name: " << table[pos].name << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void UGContainer<Type>::RebuildIndexes()
|
|
||||||
{
|
|
||||||
log << log4 << "UGCont: rebuilding indexes" << logend;
|
|
||||||
|
|
||||||
table_id.clear();
|
|
||||||
table_name.clear();
|
|
||||||
|
|
||||||
SizeType i, len = table.size();
|
|
||||||
|
|
||||||
|
|
||||||
for(i=0 ; i!=len ; ++i)
|
|
||||||
AddIndexes( i );
|
|
||||||
|
|
||||||
log << log4 << "UGCont: indexes rebuilt, table.size: " << table.size() << ", table_id.size: "
|
|
||||||
<< table_id.size() << ", table_name.size: " << table_name.size() << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Type & UGContainer<Type>::operator[](UGContainer<Type>::SizeType pos)
|
|
||||||
{
|
|
||||||
if( pos >= table.size() )
|
|
||||||
throw std::out_of_range("UGContainer: operator[]: index is out of range");
|
|
||||||
|
|
||||||
return table[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
79
core/user.h
79
core/user.h
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_user
|
|
||||||
#define headerfile_winix_core_user
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#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;
|
|
||||||
std::wstring name;
|
|
||||||
bool super_user;
|
|
||||||
std::vector<long> groups;
|
|
||||||
std::wstring email;
|
|
||||||
int notify;
|
|
||||||
|
|
||||||
|
|
||||||
// !! currently all users have the same offset
|
|
||||||
// option in config: time_zone_offset
|
|
||||||
int time_zone_offset;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
User()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
id = -1;
|
|
||||||
name.clear();
|
|
||||||
super_user = false;
|
|
||||||
groups.clear();
|
|
||||||
email.clear();
|
|
||||||
notify = 0;
|
|
||||||
time_zone_offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool IsMemberOf(long group)
|
|
||||||
{
|
|
||||||
std::vector<long>::iterator i;
|
|
||||||
|
|
||||||
for(i=groups.begin() ; i!=groups.end() ; ++i)
|
|
||||||
if( *i == group )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
191
core/users.cpp
191
core/users.cpp
@@ -1,191 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include "users.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Users::Users()
|
|
||||||
{
|
|
||||||
how_many_logged = 0;
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Users::SetCur(Cur * pcur)
|
|
||||||
{
|
|
||||||
cur = pcur;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Users::Clear()
|
|
||||||
{
|
|
||||||
table.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Users::ReadUsers(Db * db)
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
db->GetUsers(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Users::SetTimeZoneOffset(int offset)
|
|
||||||
{
|
|
||||||
Table::Iterator i;
|
|
||||||
|
|
||||||
for(i=table.Begin() ; i!=table.End() ; ++i)
|
|
||||||
{
|
|
||||||
i->time_zone_offset = offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Users::AddUser(const User & user)
|
|
||||||
{
|
|
||||||
Table::Iterator i = table.PushBack(user);
|
|
||||||
|
|
||||||
return (i != table.End());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Users::IsUser(const std::wstring & name)
|
|
||||||
{
|
|
||||||
return table.Is(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
User * Users::GetUser(long user_id)
|
|
||||||
{
|
|
||||||
Table::Iterator i = table.FindId(user_id);
|
|
||||||
|
|
||||||
if( i == table.End() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &(*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
User * Users::GetUser(const std::wstring & name)
|
|
||||||
{
|
|
||||||
Table::Iterator i = table.FindName(name);
|
|
||||||
|
|
||||||
if( i == table.End() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &(*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long Users::GetUserId(const std::wstring & name)
|
|
||||||
{
|
|
||||||
User * puser = GetUser(name);
|
|
||||||
|
|
||||||
if( !puser )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return puser->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Users::Iterator Users::Begin()
|
|
||||||
{
|
|
||||||
return table.Begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Users::Iterator Users::End()
|
|
||||||
{
|
|
||||||
return table.End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Users::SizeType Users::Size()
|
|
||||||
{
|
|
||||||
return table.Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
User & Users::operator[](Users::SizeType pos)
|
|
||||||
{
|
|
||||||
return table[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Users::LoginUser(long user_id, bool remember_me)
|
|
||||||
{
|
|
||||||
if( !cur->session )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( cur->session->id == 0 )
|
|
||||||
{
|
|
||||||
log << log1 << "Users: cannot login a user on a temporary session" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->session->puser = GetUser(user_id);
|
|
||||||
cur->session->spam_score = 0;
|
|
||||||
|
|
||||||
if( !cur->session->puser )
|
|
||||||
{
|
|
||||||
log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->session->remember_me = remember_me;
|
|
||||||
|
|
||||||
last.UserLogin(user_id, cur->session->puser->name, inet_addr(cur->request->env_remote_addr), cur->session->id);
|
|
||||||
how_many_logged += 1;
|
|
||||||
|
|
||||||
log << log2 << "User " << cur->session->puser->name << " (id: " << user_id << ") logged" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Users::LogoutCurrentUser()
|
|
||||||
{
|
|
||||||
if( !cur->session || !cur->session->puser )
|
|
||||||
return;
|
|
||||||
|
|
||||||
log << log2 << "Users: user " << cur->session->puser->name << ", id: "
|
|
||||||
<< cur->session->puser->id << " logged out" << logend;
|
|
||||||
|
|
||||||
last.UserLogout(cur->session->puser->id, cur->session->id);
|
|
||||||
|
|
||||||
if( how_many_logged > 0 ) // for safety
|
|
||||||
how_many_logged -= 1;
|
|
||||||
|
|
||||||
cur->session->puser = 0;
|
|
||||||
cur->session->remember_me = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Users::IncrementLoggedUsers()
|
|
||||||
{
|
|
||||||
how_many_logged += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
long Users::HowManyLogged()
|
|
||||||
{
|
|
||||||
return how_many_logged;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
67
core/users.h
67
core/users.h
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_users
|
|
||||||
#define headerfile_winix_core_users
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include "user.h"
|
|
||||||
#include "ugcontainer.h"
|
|
||||||
#include "lastcontainer.h"
|
|
||||||
#include "cur.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
|
|
||||||
|
|
||||||
class Users
|
|
||||||
{
|
|
||||||
typedef UGContainer<User> Table;
|
|
||||||
Table table;
|
|
||||||
|
|
||||||
Cur * cur;
|
|
||||||
long how_many_logged;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef Table::Iterator Iterator;
|
|
||||||
typedef Table::SizeType SizeType;
|
|
||||||
|
|
||||||
LastContainer last;
|
|
||||||
|
|
||||||
Users();
|
|
||||||
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void ReadUsers(Db * db);
|
|
||||||
void SetTimeZoneOffset(int offset); // !! temporarily one time_zone for all users
|
|
||||||
bool AddUser(const User & user);
|
|
||||||
bool IsUser(const std::wstring & name);
|
|
||||||
User * GetUser(long user_id);
|
|
||||||
User * GetUser(const std::wstring & name);
|
|
||||||
long GetUserId(const std::wstring & name);
|
|
||||||
Iterator Begin();
|
|
||||||
Iterator End();
|
|
||||||
SizeType Size();
|
|
||||||
User & operator[](SizeType pos);
|
|
||||||
|
|
||||||
void LoginUser(long user_id, bool remember_me);
|
|
||||||
void LogoutCurrentUser();
|
|
||||||
|
|
||||||
void IncrementLoggedUsers();
|
|
||||||
long HowManyLogged();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_core_version
|
|
||||||
#define headerfile_winix_core_version
|
|
||||||
|
|
||||||
|
|
||||||
#define WINIX_VER_MAJOR 0
|
|
||||||
#define WINIX_VER_MINOR 4
|
|
||||||
#define WINIX_VER_REVISION 7
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
19
db/Makefile
19
db/Makefile
@@ -1,19 +0,0 @@
|
|||||||
include Makefile.o.dep
|
|
||||||
|
|
||||||
|
|
||||||
all: $(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
|
|
||||||
|
|
||||||
include Makefile.dep
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# DO NOT DELETE
|
|
||||||
|
|
||||||
db.o: db.h dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
|
|
||||||
db.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
db.o: ../core/textstream.h dbitemquery.h ../core/item.h dbitemcolumns.h
|
|
||||||
db.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
db.o: ../core/ugcontainer.h ../core/log.h ../core/misc.h
|
|
||||||
dbbase.o: dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
|
|
||||||
dbbase.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
dbbase.o: ../core/textstream.h ../core/log.h ../core/misc.h
|
|
||||||
dbbase.o: ../../ezc/src/utf8.h
|
|
||||||
dbconn.o: dbconn.h dbtextstream.h ../core/textstream.h ../core/misc.h
|
|
||||||
dbconn.o: ../core/item.h ../core/log.h ../core/error.h ../core/log.h
|
|
||||||
dbconn.o: ../core/textstream.h
|
|
||||||
dbitemcolumns.o: dbitemcolumns.h ../core/item.h dbbase.h dbconn.h
|
|
||||||
dbitemcolumns.o: dbtextstream.h ../core/textstream.h ../core/misc.h
|
|
||||||
dbitemcolumns.o: ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
dbitemcolumns.o: ../core/textstream.h
|
|
||||||
dbitemquery.o: dbitemquery.h ../core/item.h
|
|
||||||
dbtextstream.o: dbtextstream.h ../core/textstream.h ../core/misc.h
|
|
||||||
dbtextstream.o: ../core/item.h ../../ezc/src/utf8.h
|
|
||||||
121
db/db.h
121
db/db.h
@@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_db_db
|
|
||||||
#define headerfile_winix_db_db
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <ctime>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "dbbase.h"
|
|
||||||
#include "dbitemquery.h"
|
|
||||||
#include "dbitemcolumns.h"
|
|
||||||
|
|
||||||
#include "core/item.h"
|
|
||||||
#include "core/user.h"
|
|
||||||
#include "core/group.h"
|
|
||||||
#include "core/dircontainer.h"
|
|
||||||
#include "core/ugcontainer.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Db : public DbBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// !! przerobic tak aby GetItem zwracalo wszystkie pozycja
|
|
||||||
// !! GetFile tylko dla plikow
|
|
||||||
// !! GetDir tylko dla katalogow
|
|
||||||
// !! GetFile i GetDir beda uzywac GetItem
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
Error EditItemByUrl(Item & item, bool with_url = true);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// !! nie zwracac zadnych kodow bledow?
|
|
||||||
void GetItems(std::vector<Item> & item_tab, const DbItemQuery & item_query);
|
|
||||||
void GetItems(std::vector<long> & item_tab, const DbItemQuery & item_query);
|
|
||||||
Error GetItem(Item & item, const DbItemQuery & item_query);
|
|
||||||
|
|
||||||
bool GetPriv(Item & item, long id);
|
|
||||||
Error EditPrivById(Item & item, long id);
|
|
||||||
Error EditParentUrlById(Item & item, long id);
|
|
||||||
Error EditFileById(const Item & item, long id); // file_path, file_fs, file_type
|
|
||||||
Error EditHasThumbById(bool has_thumb, long id);
|
|
||||||
|
|
||||||
Error DelDirById(long id);
|
|
||||||
Error DelFileById(long file_id);
|
|
||||||
Error DelSymlinkById(long symlink_id);
|
|
||||||
|
|
||||||
Error EditSubjectById(Item & item, long id);
|
|
||||||
|
|
||||||
|
|
||||||
Error DelItem(const Item & item);
|
|
||||||
void GetDirs(DirContainer & dir_tab);
|
|
||||||
void GetUsers(UGContainer<User> & user_tab);
|
|
||||||
void GetGroups(UGContainer<Group> & group_tab);
|
|
||||||
|
|
||||||
// !! nowy interfejs
|
|
||||||
long Size(long parent_id, Item::Type type = Item::none);
|
|
||||||
|
|
||||||
Error GetItemById(long item_id, Item & item);
|
|
||||||
Error GetItem(long parent_id, const std::wstring & url, Item & item);
|
|
||||||
Error EditLinkItem(long id, const std::wstring & link_to, int link_redirect);
|
|
||||||
Error EditTemplateItemById(long id, const std::wstring & new_html_template);
|
|
||||||
|
|
||||||
long GetItemId(long parent_id, const std::wstring & url, Item::Type type);
|
|
||||||
long GetFileId(long parent_id, const std::wstring & url);
|
|
||||||
long GetDirId(long parent_id, const std::wstring & url);
|
|
||||||
|
|
||||||
Error AddHardLink(Item & item);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
DbTextStream query, query_create_url;
|
|
||||||
std::wstring temp_url;
|
|
||||||
Item dir_temp;
|
|
||||||
std::wstring iq_id_list;
|
|
||||||
|
|
||||||
bool AddItemCreateUrlSubject(Item & item);
|
|
||||||
|
|
||||||
Error AddItemIntoContent(Item & item);
|
|
||||||
Error AddItemIntoItem(Item & item);
|
|
||||||
|
|
||||||
Error EditItemInItem(Item & item, bool with_url);
|
|
||||||
Error EditItemInContent(Item & item);
|
|
||||||
Error EditItemGetIdsByUrl(Item & item);
|
|
||||||
long GetContentId(long item_id);
|
|
||||||
|
|
||||||
PGresult * GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel = false);
|
|
||||||
|
|
||||||
Error DelItemDelItem(long item_id, int type);
|
|
||||||
Error DelItemDelContent(long content_id);
|
|
||||||
|
|
||||||
Error IncrementContentRef(long content_id);
|
|
||||||
Error DecrementContentRef(long content_id);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
99
db/dbbase.h
99
db/dbbase.h
@@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_db_dbbase
|
|
||||||
#define headerfile_winix_db_dbbase
|
|
||||||
|
|
||||||
|
|
||||||
#include "dbconn.h"
|
|
||||||
#include "dbtextstream.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include "core/error.h"
|
|
||||||
|
|
||||||
|
|
||||||
class DbBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DbBase();
|
|
||||||
|
|
||||||
void SetConn(DbConn * conn);
|
|
||||||
void SetConn(DbConn & conn);
|
|
||||||
DbConn * GetConn();
|
|
||||||
|
|
||||||
void LogQueries(bool log_q);
|
|
||||||
|
|
||||||
PGresult * AssertQuery(const char * query);
|
|
||||||
PGresult * AssertQuery(const std::wstring & query);
|
|
||||||
PGresult * AssertQuery(const DbTextStream & query);
|
|
||||||
void AssertResult(PGresult * r, ExecStatusType t);
|
|
||||||
static int AssertColumn(PGresult * r, const char * column_name);
|
|
||||||
|
|
||||||
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);
|
|
||||||
static unsigned long AssertValueULong(PGresult * r, int row, int col);
|
|
||||||
static unsigned int AssertValueUInt(PGresult * r, int row, int col);
|
|
||||||
static tm AssertValueTm(PGresult * r, int row, int col);
|
|
||||||
|
|
||||||
void ClearResult(PGresult * r);
|
|
||||||
long AssertCurrval(const char * table);
|
|
||||||
|
|
||||||
bool IsNull(PGresult * r, int row, int col);
|
|
||||||
int Rows(PGresult * r);
|
|
||||||
int Cols(PGresult * r);
|
|
||||||
long AffectedRows(PGresult * r);
|
|
||||||
|
|
||||||
static tm ConvertTime(const char * str);
|
|
||||||
static const char * ConvertTime(const tm & t); // warning: it uses its own static buffer
|
|
||||||
void CreateIdList(const std::vector<long> & id_tab, std::wstring & list, bool add_parentheses = true);
|
|
||||||
|
|
||||||
Error DoCommand(const DbTextStream & command);
|
|
||||||
Error DoCommand(const char * command);
|
|
||||||
Error BeginTrans();
|
|
||||||
Error RollbackTrans();
|
|
||||||
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
|
|
||||||
template<class RawType>
|
|
||||||
DbTextStream::RawText<RawType> R(const RawType & par)
|
|
||||||
{
|
|
||||||
return DbTextStream::RawText<RawType>(par);
|
|
||||||
}
|
|
||||||
|
|
||||||
DbConn * db_conn;
|
|
||||||
bool log_queries;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
static int CharToInt(char c);
|
|
||||||
static bool IsCorrectOctalDigit(char c);
|
|
||||||
static int UnescapeBin(const char * str, size_t & i, size_t len);
|
|
||||||
|
|
||||||
DbTextStream bquery;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
55
db/dbconn.h
55
db/dbconn.h
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_db_dbconn
|
|
||||||
#define headerfile_winix_db_dbconn
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <libpq-fe.h>
|
|
||||||
#include "dbtextstream.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DbConn
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
DbConn();
|
|
||||||
~DbConn();
|
|
||||||
|
|
||||||
void SetConnParam(const std::string & database, const std::string & user, const std::string & pass);
|
|
||||||
void Connect();
|
|
||||||
void WaitForConnection();
|
|
||||||
void Close();
|
|
||||||
bool AssertConnection(bool put_log = true, bool throw_if_no_connection = true);
|
|
||||||
void SetDbParameters();
|
|
||||||
PGconn * GetPgConn();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void LogConnectionSocket();
|
|
||||||
|
|
||||||
PGconn * pg_conn;
|
|
||||||
std::string db_database, db_user, db_pass;
|
|
||||||
DbTextStream conn_info;
|
|
||||||
|
|
||||||
// a helper method for escaping strings
|
|
||||||
template<class RawType>
|
|
||||||
DbTextStream::RawText<RawType> R(const RawType & par)
|
|
||||||
{
|
|
||||||
return DbTextStream::RawText<RawType>(par);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dbitemcolumns.h"
|
|
||||||
#include "dbbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DbItemColumns::SetColumns(PGresult * r)
|
|
||||||
{
|
|
||||||
// PQfnumber returns -1 if there is no such a column
|
|
||||||
id = PQfnumber(r, "id");
|
|
||||||
user_id = PQfnumber(r, "user_id");
|
|
||||||
group_id = PQfnumber(r, "group_id");
|
|
||||||
privileges = PQfnumber(r, "privileges");
|
|
||||||
date_creation = PQfnumber(r, "date_creation");
|
|
||||||
date_modification = PQfnumber(r, "date_modification");
|
|
||||||
url = PQfnumber(r, "url");
|
|
||||||
type = PQfnumber(r, "type");
|
|
||||||
parent_id = PQfnumber(r, "parent_id");
|
|
||||||
content_id = PQfnumber(r, "content_id");
|
|
||||||
link_to = PQfnumber(r, "link_to");
|
|
||||||
link_redirect = PQfnumber(r, "link_redirect");
|
|
||||||
subject = PQfnumber(r, "subject");
|
|
||||||
content = PQfnumber(r, "content");
|
|
||||||
content_type = PQfnumber(r, "content_type");
|
|
||||||
guest_name = PQfnumber(r, "guest_name");
|
|
||||||
html_template = PQfnumber(r, "template");
|
|
||||||
modification_user_id = PQfnumber(r, "modification_user_id");
|
|
||||||
file_path = PQfnumber(r, "file_path");
|
|
||||||
file_fs = PQfnumber(r, "file_fs");
|
|
||||||
file_type = PQfnumber(r, "file_type");
|
|
||||||
has_thumb = PQfnumber(r, "has_thumb");
|
|
||||||
ref = PQfnumber(r, "ref");
|
|
||||||
modify_index = PQfnumber(r, "modify_index");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DbItemColumns::SetItem(PGresult * r, long row, Item & item)
|
|
||||||
{
|
|
||||||
if( id != -1 ) item.id = DbBase::AssertValueLong(r, row, id);
|
|
||||||
if( user_id != -1 ) item.user_id = DbBase::AssertValueLong(r, row, user_id);
|
|
||||||
if( group_id != -1 ) item.group_id = DbBase::AssertValueLong(r, row, group_id);
|
|
||||||
if( privileges != -1 ) item.privileges = DbBase::AssertValueInt(r, row, privileges);
|
|
||||||
if( date_creation != -1 ) item.date_creation = DbBase::AssertValueTm(r, row, date_creation);
|
|
||||||
if( date_modification != -1 ) item.date_modification = DbBase::AssertValueTm(r, row, date_modification);
|
|
||||||
if( type != -1 ) item.type = static_cast<Item::Type>( DbBase::AssertValueInt(r, row, type) );
|
|
||||||
if( parent_id != -1 ) item.parent_id = DbBase::AssertValueLong(r, row, parent_id);
|
|
||||||
if( content_id != -1 ) item.content_id = DbBase::AssertValueLong(r, row, content_id);
|
|
||||||
if( link_redirect != -1 ) item.link_redirect = DbBase::AssertValueInt(r, row, link_redirect);
|
|
||||||
if( content_type != -1 ) item.content_type = static_cast<Item::ContentType>( DbBase::AssertValueInt(r, row, content_type) );
|
|
||||||
if( modification_user_id != -1 ) item.modification_user_id = DbBase::AssertValueLong(r, row, modification_user_id);
|
|
||||||
if( file_fs != -1 ) item.file_fs = DbBase::AssertValueInt(r, row, file_fs);
|
|
||||||
if( file_type != -1 ) item.file_type = DbBase::AssertValueInt(r, row, file_type);
|
|
||||||
if( has_thumb != -1 ) item.has_thumb = DbBase::AssertValueBool(r, row, has_thumb);
|
|
||||||
if( ref != -1 ) item.ref = DbBase::AssertValueInt(r, row, ref);
|
|
||||||
if( modify_index != -1 ) item.modify_index = DbBase::AssertValueInt(r, row, modify_index);
|
|
||||||
|
|
||||||
if( url != -1 ) DbBase::AssertValueWide(r, row, url, item.url);
|
|
||||||
if( content != -1 ) DbBase::AssertValueWide(r, row, content, item.content);
|
|
||||||
if( subject != -1 ) DbBase::AssertValueWide(r, row, subject, item.subject);
|
|
||||||
if( file_path != -1 ) DbBase::AssertValueWide(r, row, file_path, item.file_path);
|
|
||||||
if( link_to != -1 ) DbBase::AssertValueWide(r, row, link_to, item.link_to);
|
|
||||||
if( guest_name != -1 ) DbBase::AssertValueWide(r, row, guest_name, item.guest_name);
|
|
||||||
if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_db_dbitemcolumns
|
|
||||||
#define headerfile_winix_db_dbitemcolumns
|
|
||||||
|
|
||||||
|
|
||||||
#include <libpq-fe.h>
|
|
||||||
#include "core/item.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DbItemColumns
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
int user_id;
|
|
||||||
int group_id;
|
|
||||||
int privileges;
|
|
||||||
int date_creation;
|
|
||||||
int date_modification;
|
|
||||||
int url;
|
|
||||||
int type;
|
|
||||||
int parent_id;
|
|
||||||
int content_id;
|
|
||||||
int link_to;
|
|
||||||
int link_redirect;
|
|
||||||
int subject;
|
|
||||||
int content;
|
|
||||||
int content_type;
|
|
||||||
int guest_name;
|
|
||||||
int modification_user_id;
|
|
||||||
int html_template;
|
|
||||||
int file_path;
|
|
||||||
int file_fs;
|
|
||||||
int file_type;
|
|
||||||
int has_thumb;
|
|
||||||
int ref;
|
|
||||||
int modify_index;
|
|
||||||
|
|
||||||
void SetColumns(PGresult * r);
|
|
||||||
void SetItem(PGresult * r, long row, Item & item);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_db_dbitemquery
|
|
||||||
#define headerfile_winix_db_dbitemquery
|
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "core/item.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DbItemQuery
|
|
||||||
{
|
|
||||||
// id and content_id is selected always
|
|
||||||
bool sel_parent_id; // parent_id
|
|
||||||
bool sel_user_id; // user_id, modification_user_id
|
|
||||||
bool sel_group_id; // group_id
|
|
||||||
bool sel_guest_name; // guest_name
|
|
||||||
bool sel_privileges; // privileges
|
|
||||||
bool sel_date; // date_creation, date_modification
|
|
||||||
bool sel_subject; // subject
|
|
||||||
bool sel_content; // content, content_type, ref, modify_index
|
|
||||||
bool sel_url; // url
|
|
||||||
bool sel_type; // type (dir, file, none)
|
|
||||||
bool sel_link; // link_to, link_redirect
|
|
||||||
bool sel_file; // file_path, file_fs, file_type, has_thumb
|
|
||||||
bool sel_html_template; // template
|
|
||||||
|
|
||||||
bool where_id; //
|
|
||||||
bool where_parent_id; //
|
|
||||||
bool where_type;
|
|
||||||
bool where_file_type;
|
|
||||||
|
|
||||||
long id; // if where_id is true
|
|
||||||
long parent_id; // if where_parent_id is true
|
|
||||||
Item::Type type;
|
|
||||||
bool type_equal;
|
|
||||||
int file_type;
|
|
||||||
bool file_type_equal; // if true means file_type should be equal
|
|
||||||
bool sort_asc;
|
|
||||||
|
|
||||||
const std::vector<long> * id_tab; // != 0 if WhereIdIn was used
|
|
||||||
|
|
||||||
long limit;
|
|
||||||
long offset;
|
|
||||||
|
|
||||||
DbItemQuery();
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
void SetAllSel(bool sel);
|
|
||||||
void SetAllWhere(bool where_);
|
|
||||||
void SetAll(bool sel, bool where_);
|
|
||||||
|
|
||||||
void WhereId(long id_);
|
|
||||||
void WhereIdIn(const std::vector<long> & id_tab_list);
|
|
||||||
void WhereParentId(long parent_id_);
|
|
||||||
void WhereType(Item::Type type_, bool equal = true);
|
|
||||||
void WhereFileType(int file_t, bool equal = true);
|
|
||||||
|
|
||||||
void Limit(long l); // setting 0 turns off
|
|
||||||
void Offset(long o); // setting 0 turns off
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
include Makefile.o.dep
|
|
||||||
|
|
||||||
|
|
||||||
all: $(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
|
|
||||||
|
|
||||||
include Makefile.dep
|
|
||||||
@@ -1,986 +0,0 @@
|
|||||||
# DO NOT DELETE
|
|
||||||
|
|
||||||
adduser.o: adduser.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
|
|
||||||
adduser.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
|
|
||||||
adduser.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
adduser.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
adduser.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
adduser.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
adduser.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
adduser.o: ../core/htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
adduser.o: ../core/config.h ../core/system.h ../core/dirs.h
|
|
||||||
adduser.o: ../core/dircontainer.h ../core/request.h ../notify/notify.h
|
|
||||||
adduser.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
adduser.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
adduser.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
adduser.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
adduser.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
adduser.o: ../core/plugindata.h ../core/rebus.h cat.h chmod.h privchanger.h
|
|
||||||
adduser.o: chown.h ckeditor.h cp.h default.h download.h emacs.h last.h
|
|
||||||
adduser.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
adduser.o: rm.h run.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
adduser.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
cat.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
cat.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
cat.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
cat.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
cat.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
cat.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
cat.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
cat.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
cat.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
cat.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
cat.o: functions.h functionparser.h ../core/cur.h ../core/session.h
|
|
||||||
cat.o: ../core/user.h ../core/plugindata.h ../core/rebus.h adduser.h chmod.h
|
|
||||||
cat.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
cat.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
cat.o: rm.h run.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
cat.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
chmod.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
chmod.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
chmod.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
chmod.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
chmod.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
chmod.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
chmod.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
chmod.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
chmod.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
chmod.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
chmod.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
chmod.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
chmod.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
chmod.o: ../core/rebus.h adduser.h cat.h chown.h privchanger.h ckeditor.h
|
|
||||||
chmod.o: cp.h default.h download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
chmod.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
chmod.o: stat.h subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
chmod.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
chown.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
chown.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
chown.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
chown.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
chown.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
chown.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
chown.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
chown.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
chown.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
chown.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
chown.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
chown.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
chown.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h ckeditor.h
|
|
||||||
chown.o: cp.h default.h download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
chown.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
chown.o: stat.h subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
chown.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
ckeditor.o: ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
ckeditor.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
ckeditor.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
ckeditor.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
ckeditor.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
ckeditor.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
ckeditor.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
ckeditor.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
ckeditor.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
ckeditor.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
ckeditor.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
ckeditor.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
ckeditor.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
ckeditor.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
ckeditor.o: privchanger.h chown.h cp.h default.h download.h emacs.h last.h
|
|
||||||
ckeditor.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
ckeditor.o: rm.h run.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
ckeditor.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
cp.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
cp.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
cp.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
cp.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
cp.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
cp.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
cp.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
cp.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
|
|
||||||
cp.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
cp.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
cp.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
cp.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
cp.o: privchanger.h chown.h ckeditor.h default.h download.h emacs.h last.h
|
|
||||||
cp.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h
|
|
||||||
cp.o: run.h specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
cp.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
default.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
default.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
default.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
default.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
default.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
default.o: ../core/htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
default.o: ../core/config.h ../core/system.h ../core/dirs.h
|
|
||||||
default.o: ../core/dircontainer.h ../core/request.h ../notify/notify.h
|
|
||||||
default.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
default.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
default.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
default.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
default.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
default.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
default.o: privchanger.h chown.h ckeditor.h cp.h download.h emacs.h last.h
|
|
||||||
default.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
default.o: rm.h run.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
default.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
download.o: ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
download.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
download.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
download.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
download.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
download.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
download.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
download.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
download.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
download.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
download.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
download.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
download.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
download.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
download.o: privchanger.h chown.h ckeditor.h cp.h default.h emacs.h last.h
|
|
||||||
download.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
download.o: rm.h run.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
download.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
emacs.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
emacs.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
emacs.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
emacs.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
emacs.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
emacs.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
emacs.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
emacs.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
emacs.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
emacs.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
emacs.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
emacs.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
emacs.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
emacs.o: ckeditor.h cp.h default.h download.h last.h login.h logout.h ln.h
|
|
||||||
emacs.o: ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
emacs.o: stat.h subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
emacs.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
functionbase.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
functionbase.o: ../core/textstream.h ../db/dbitemquery.h
|
|
||||||
functionbase.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
functionbase.o: ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
functionbase.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
functionbase.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
functionbase.o: ../templates/htmltextstream.h ../core/config.h
|
|
||||||
functionbase.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
functionbase.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
functionbase.o: ../templates/locale.h ../core/confparser.h
|
|
||||||
functionbase.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
functionbase.o: ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
functionbase.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
functionbase.o: ../../ezc/src/pattern.h functions.h functionparser.h
|
|
||||||
functionbase.o: ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
functionbase.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
functionbase.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
functionbase.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h
|
|
||||||
functionbase.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h
|
|
||||||
functionbase.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
functionbase.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
functionbase.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
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/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
|
|
||||||
functionparser.o: ../core/textstream.h ../db/dbitemquery.h ../core/item.h
|
|
||||||
functionparser.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
functionparser.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/cur.h
|
|
||||||
functionparser.o: ../core/request.h ../core/session.h ../core/error.h
|
|
||||||
functionparser.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
|
||||||
functionparser.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
functionparser.o: ../notify/notify.h ../notify/notifypool.h
|
|
||||||
functionparser.o: ../templates/locale.h ../core/confparser.h
|
|
||||||
functionparser.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
functionparser.o: ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
functionparser.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
functionparser.o: ../../ezc/src/pattern.h functions.h functionbase.h
|
|
||||||
functionparser.o: ../core/request.h ../core/requesttypes.h ../core/config.h
|
|
||||||
functionparser.o: ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
functionparser.o: ../templates/htmltextstream.h ../core/config.h
|
|
||||||
functionparser.o: ../core/synchro.h adduser.h cat.h chmod.h privchanger.h
|
|
||||||
functionparser.o: chown.h ckeditor.h cp.h default.h download.h emacs.h last.h
|
|
||||||
functionparser.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
functionparser.o: reload.h rm.h run.h specialdefault.h stat.h subject.h
|
|
||||||
functionparser.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
functionparser.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
functionparser.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
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/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
|
|
||||||
functions.o: ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
functions.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
functions.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
functions.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
functions.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
functions.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
functions.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
functions.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
functions.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
functions.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
functions.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
functions.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
functions.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h
|
|
||||||
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/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
|
|
||||||
last.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
last.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
last.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
last.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
last.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
last.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
last.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
last.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
last.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
last.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
last.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
last.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
|
||||||
last.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h
|
|
||||||
last.o: default.h download.h emacs.h login.h logout.h ln.h ls.h mkdir.h mv.h
|
|
||||||
last.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h
|
|
||||||
last.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
last.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
ln.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
ln.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
ln.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
ln.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
ln.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
ln.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
ln.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
ln.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
|
|
||||||
ln.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
ln.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
ln.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
ln.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
ln.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
ln.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h
|
|
||||||
ln.o: run.h specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
ln.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
login.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
login.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
login.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
login.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
login.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
login.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
login.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
login.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
login.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
login.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
login.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
login.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
login.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
login.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
login.o: ckeditor.h cp.h default.h download.h emacs.h last.h logout.h ln.h
|
|
||||||
login.o: ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
login.o: stat.h subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
login.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
logout.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
logout.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
logout.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
logout.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
logout.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
logout.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
logout.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
logout.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
logout.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
logout.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
logout.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
logout.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
logout.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
logout.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h ln.h
|
|
||||||
logout.o: ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
|
||||||
logout.o: specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
logout.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
ls.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
ls.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
ls.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
ls.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
ls.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
ls.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
ls.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
ls.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
|
|
||||||
ls.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
ls.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
ls.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
ls.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
ls.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
ls.o: last.h login.h logout.h ln.h mkdir.h mv.h node.h priv.h reload.h rm.h
|
|
||||||
ls.o: run.h specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
ls.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
mkdir.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
mkdir.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
mkdir.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
mkdir.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
mkdir.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
mkdir.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
mkdir.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
mkdir.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
mkdir.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
mkdir.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
mkdir.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
mkdir.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
mkdir.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
mkdir.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
mkdir.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h logout.h
|
|
||||||
mkdir.o: ln.h ls.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
mkdir.o: stat.h subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
mkdir.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
mv.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
mv.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
mv.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
mv.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
mv.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
mv.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
mv.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
mv.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
|
|
||||||
mv.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
mv.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
mv.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
mv.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
mv.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
mv.o: last.h login.h logout.h ln.h ls.h mkdir.h node.h priv.h reload.h rm.h
|
|
||||||
mv.o: run.h specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
mv.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
node.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
node.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
node.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
node.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
node.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
node.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
node.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
node.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
node.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
node.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
node.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
node.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
node.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
|
||||||
node.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h
|
|
||||||
node.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
node.o: mkdir.h mv.h priv.h reload.h rm.h run.h specialdefault.h stat.h
|
|
||||||
node.o: subject.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
node.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
priv.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
priv.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
priv.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
priv.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
priv.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
priv.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
priv.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
priv.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
priv.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
priv.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
priv.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
priv.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
|
||||||
priv.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h
|
|
||||||
priv.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
priv.o: mkdir.h mv.h node.h reload.h rm.h run.h specialdefault.h stat.h
|
|
||||||
priv.o: subject.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
priv.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
privchanger.o: ../templates/htmltextstream.h ../core/textstream.h
|
|
||||||
privchanger.o: ../core/misc.h ../core/system.h ../core/dirs.h
|
|
||||||
privchanger.o: ../core/dircontainer.h ../db/db.h ../db/dbbase.h
|
|
||||||
privchanger.o: ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
|
|
||||||
privchanger.o: ../core/log.h ../db/dbitemquery.h ../core/item.h
|
|
||||||
privchanger.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
|
||||||
privchanger.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/request.h
|
|
||||||
privchanger.o: ../notify/notify.h ../notify/notifypool.h
|
|
||||||
privchanger.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
privchanger.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
privchanger.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
privchanger.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
privchanger.o: functionbase.h ../core/config.h ../core/synchro.h
|
|
||||||
privchanger.o: functionparser.h ../core/cur.h ../core/session.h
|
|
||||||
privchanger.o: ../core/user.h ../core/plugindata.h ../core/rebus.h adduser.h
|
|
||||||
privchanger.o: cat.h chmod.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
privchanger.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h
|
|
||||||
privchanger.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h
|
|
||||||
privchanger.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
privchanger.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
privchanger.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
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/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
|
|
||||||
reload.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
reload.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
reload.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
reload.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
reload.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
reload.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
reload.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
reload.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
reload.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
reload.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
reload.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
reload.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
reload.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
reload.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h
|
|
||||||
reload.o: logout.h ln.h ls.h mkdir.h mv.h node.h priv.h rm.h run.h
|
|
||||||
reload.o: specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
reload.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
rm.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
rm.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
rm.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
rm.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
rm.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
rm.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
rm.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
rm.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
rm.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h
|
|
||||||
rm.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
rm.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
rm.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
rm.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
rm.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
rm.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h
|
|
||||||
rm.o: run.h specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
rm.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
rm.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
|
||||||
rm.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
|
||||||
rm.o: ../core/sessionmanager.h ../core/misc.h
|
|
||||||
run.o: run.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h
|
|
||||||
run.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
|
|
||||||
run.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
run.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
run.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
run.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
run.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
run.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
run.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
run.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
run.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
run.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
run.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
run.o: functions.h functionparser.h ../core/cur.h ../core/session.h
|
|
||||||
run.o: ../core/user.h ../core/plugindata.h ../core/rebus.h adduser.h cat.h
|
|
||||||
run.o: chmod.h privchanger.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
run.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
run.o: reload.h rm.h specialdefault.h stat.h subject.h template.h tinymce.h
|
|
||||||
run.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
specialdefault.o: ../core/textstream.h ../core/misc.h ../core/item.h
|
|
||||||
specialdefault.o: ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
specialdefault.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
specialdefault.o: ../core/group.h ../core/dircontainer.h
|
|
||||||
specialdefault.o: ../core/ugcontainer.h ../core/request.h
|
|
||||||
specialdefault.o: ../core/requesttypes.h ../core/error.h ../core/config.h
|
|
||||||
specialdefault.o: ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
specialdefault.o: ../templates/htmltextstream.h ../core/config.h
|
|
||||||
specialdefault.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
specialdefault.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
specialdefault.o: ../templates/locale.h ../core/confparser.h
|
|
||||||
specialdefault.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
specialdefault.o: ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
specialdefault.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
specialdefault.o: ../../ezc/src/pattern.h functions.h functionparser.h
|
|
||||||
specialdefault.o: ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
specialdefault.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h
|
|
||||||
specialdefault.o: chmod.h privchanger.h chown.h ckeditor.h cp.h default.h
|
|
||||||
specialdefault.o: download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
specialdefault.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h stat.h
|
|
||||||
specialdefault.o: subject.h template.h tinymce.h uname.h upload.h uptime.h
|
|
||||||
specialdefault.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
specialdefault.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
|
||||||
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/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
|
|
||||||
stat.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
stat.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
stat.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
stat.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
stat.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
stat.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
stat.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
stat.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
stat.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
stat.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
stat.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
stat.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
|
||||||
stat.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h
|
|
||||||
stat.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h
|
|
||||||
stat.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h
|
|
||||||
stat.o: subject.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
stat.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
subject.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
subject.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
subject.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
subject.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
subject.o: ../core/htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
subject.o: ../core/config.h ../core/system.h ../core/dirs.h
|
|
||||||
subject.o: ../core/dircontainer.h ../core/request.h ../notify/notify.h
|
|
||||||
subject.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
subject.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
subject.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
subject.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
subject.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
subject.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
subject.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
subject.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
subject.o: reload.h rm.h run.h specialdefault.h stat.h template.h tinymce.h
|
|
||||||
subject.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
template.o: ../core/error.h ../core/log.h ../core/textstream.h
|
|
||||||
template.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
|
||||||
template.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
|
||||||
template.o: ../core/request.h ../core/requesttypes.h ../core/error.h
|
|
||||||
template.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h
|
|
||||||
template.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h
|
|
||||||
template.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h
|
|
||||||
template.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h
|
|
||||||
template.o: ../core/confparser.h ../templates/misc.h
|
|
||||||
template.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
template.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
template.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
template.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
template.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
template.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
template.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h
|
|
||||||
template.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h
|
|
||||||
template.o: tinymce.h uname.h upload.h uptime.h who.h vim.h
|
|
||||||
template.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
tinymce.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
tinymce.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
tinymce.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
tinymce.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
tinymce.o: ../core/htmlfilter.h ../templates/htmltextstream.h
|
|
||||||
tinymce.o: ../core/config.h ../core/system.h ../core/dirs.h
|
|
||||||
tinymce.o: ../core/dircontainer.h ../core/request.h ../notify/notify.h
|
|
||||||
tinymce.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h
|
|
||||||
tinymce.o: ../templates/misc.h ../templates/localefilter.h
|
|
||||||
tinymce.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
|
|
||||||
tinymce.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h
|
|
||||||
tinymce.o: functionparser.h ../core/cur.h ../core/session.h ../core/user.h
|
|
||||||
tinymce.o: ../core/plugindata.h ../core/rebus.h adduser.h cat.h chmod.h
|
|
||||||
tinymce.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h emacs.h
|
|
||||||
tinymce.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
tinymce.o: reload.h rm.h run.h specialdefault.h stat.h subject.h template.h
|
|
||||||
tinymce.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
uname.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
uname.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
uname.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
uname.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
uname.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
uname.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
uname.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
uname.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
uname.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
uname.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
uname.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
uname.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
uname.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
uname.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h logout.h
|
|
||||||
uname.o: ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
|
||||||
uname.o: specialdefault.h stat.h subject.h template.h tinymce.h upload.h
|
|
||||||
uname.o: uptime.h who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h
|
|
||||||
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/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
|
|
||||||
upload.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
upload.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
upload.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
upload.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
upload.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
upload.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
upload.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
upload.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
upload.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
upload.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
upload.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
upload.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
upload.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
upload.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h
|
|
||||||
upload.o: logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
|
||||||
upload.o: specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
upload.o: uptime.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
uptime.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
uptime.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
uptime.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
uptime.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
uptime.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
uptime.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
uptime.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
uptime.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
uptime.o: ../templates/localefilter.h ../templates/locale.h
|
|
||||||
uptime.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
|
||||||
uptime.o: ../../ezc/src/pattern.h functions.h functionparser.h ../core/cur.h
|
|
||||||
uptime.o: ../core/session.h ../core/user.h ../core/plugindata.h
|
|
||||||
uptime.o: ../core/rebus.h adduser.h cat.h chmod.h privchanger.h chown.h
|
|
||||||
uptime.o: ckeditor.h cp.h default.h download.h emacs.h last.h login.h
|
|
||||||
uptime.o: logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
|
||||||
uptime.o: specialdefault.h stat.h subject.h template.h tinymce.h uname.h
|
|
||||||
uptime.o: upload.h who.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
vim.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
vim.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
vim.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
vim.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
vim.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
vim.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
vim.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
vim.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
vim.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
vim.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
vim.o: functions.h functionparser.h ../core/cur.h ../core/session.h
|
|
||||||
vim.o: ../core/user.h ../core/plugindata.h ../core/rebus.h adduser.h cat.h
|
|
||||||
vim.o: chmod.h privchanger.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
vim.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
vim.o: reload.h rm.h run.h specialdefault.h stat.h subject.h template.h
|
|
||||||
vim.o: tinymce.h uname.h upload.h uptime.h who.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
who.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
|
||||||
who.o: ../core/textstream.h ../db/dbitemquery.h ../db/dbitemcolumns.h
|
|
||||||
who.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
|
||||||
who.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h
|
|
||||||
who.o: ../core/error.h ../core/config.h ../core/confparser.h
|
|
||||||
who.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h
|
|
||||||
who.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
|
||||||
who.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h
|
|
||||||
who.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h
|
|
||||||
who.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h
|
|
||||||
who.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h
|
|
||||||
who.o: functions.h functionparser.h ../core/cur.h ../core/session.h
|
|
||||||
who.o: ../core/user.h ../core/plugindata.h ../core/rebus.h adduser.h cat.h
|
|
||||||
who.o: chmod.h privchanger.h chown.h ckeditor.h cp.h default.h download.h
|
|
||||||
who.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h
|
|
||||||
who.o: reload.h rm.h run.h specialdefault.h stat.h subject.h template.h
|
|
||||||
who.o: tinymce.h uname.h upload.h uptime.h vim.h ../core/htmlfilter.h
|
|
||||||
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/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
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o default.o download.o emacs.o functionbase.o functionparser.o functions.o last.o ln.o login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o reload.o rm.o run.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "adduser.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
AddUser::AddUser()
|
|
||||||
{
|
|
||||||
fun.url = L"adduser";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool AddUser::CheckAddUserVars(const std::wstring & login, const std::wstring & pass, const std::wstring & conf_pass)
|
|
||||||
{
|
|
||||||
if( login.empty() )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_LOGIN_EMPTY;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pass != conf_pass )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_PASSWORDS_DIFFERENT;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pass.size() < config->pass_min_size )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_PASSWORD_TOO_SHORT;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( system->users.IsUser(login) )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_USER_EXISTS;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AddUser::MakePost()
|
|
||||||
{
|
|
||||||
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"passwordconfirm");
|
|
||||||
|
|
||||||
if( !CheckAddUserVars(login, pass, conf_pass) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
user.name = login;
|
|
||||||
user.email = cur->request->PostVar(L"email");
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
if( system->users.AddUser(user) )
|
|
||||||
{
|
|
||||||
if( !cur->session->puser )
|
|
||||||
system->users.LoginUser(user.id, false);
|
|
||||||
|
|
||||||
log << log2 << "Adduser: added a new user: " << user.name << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log1 << "Adduser: I can't add to system->users: " << user.name
|
|
||||||
<< " but the user was added to the db correctly" << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
system->RedirectToLastItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_adduser
|
|
||||||
#define headerfile_winix_functions_adduser
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
#include "core/user.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class AddUser : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
AddUser();
|
|
||||||
void MakePost();
|
|
||||||
void MakeGet();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
bool CheckAddUserVars(const std::wstring & login, const std::wstring & pass, const std::wstring & conf_pass);
|
|
||||||
UserPass up;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "cat.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
Cat::Cat()
|
|
||||||
{
|
|
||||||
fun.url = L"cat";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Cat::MakeGet()
|
|
||||||
{
|
|
||||||
if( !cur->request->is_item )
|
|
||||||
{
|
|
||||||
log << log1 << "Content: cat function requires an item" << logend;
|
|
||||||
cur->request->status = WINIX_ERR_NO_ITEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( !system->HasReadAccess(cur->request->item) )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_cat
|
|
||||||
#define headerfile_winix_functions_cat
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Cat : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Cat();
|
|
||||||
void MakeGet();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Fun
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "chmod.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Chmod::Chmod()
|
|
||||||
{
|
|
||||||
fun.url = L"chmod";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Chmod::MakePost()
|
|
||||||
{
|
|
||||||
priv_changer.SetCur(cur);
|
|
||||||
priv_changer.SetSystem(system);
|
|
||||||
priv_changer.SetDb(db);
|
|
||||||
|
|
||||||
priv_changer.Change(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Chmod::MakeGet()
|
|
||||||
{
|
|
||||||
priv_changer.SetCur(cur);
|
|
||||||
priv_changer.SetSystem(system);
|
|
||||||
priv_changer.SetDb(db);
|
|
||||||
|
|
||||||
priv_changer.CheckAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_chmod
|
|
||||||
#define headerfile_winix_functions_chmod
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
#include "privchanger.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Chmod : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Chmod();
|
|
||||||
void MakePost();
|
|
||||||
void MakeGet();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
PrivChanger priv_changer;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "chown.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Chown::Chown()
|
|
||||||
{
|
|
||||||
fun.url = L"chown";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Chown::MakePost()
|
|
||||||
{
|
|
||||||
priv_changer.SetCur(cur);
|
|
||||||
priv_changer.SetSystem(system);
|
|
||||||
priv_changer.SetDb(db);
|
|
||||||
|
|
||||||
priv_changer.Change(true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Chown::MakeGet()
|
|
||||||
{
|
|
||||||
priv_changer.SetCur(cur);
|
|
||||||
priv_changer.SetSystem(system);
|
|
||||||
priv_changer.SetDb(db);
|
|
||||||
|
|
||||||
priv_changer.CheckAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_chown
|
|
||||||
#define headerfile_winix_functions_chown
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
#include "privchanger.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Chown : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Chown();
|
|
||||||
void MakePost();
|
|
||||||
void MakeGet();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
PrivChanger priv_changer;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ckeditor.h"
|
|
||||||
#include "functions.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
Ckeditor::Ckeditor()
|
|
||||||
{
|
|
||||||
fun.url = L"ckeditor";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Ckeditor::HasAccess()
|
|
||||||
{
|
|
||||||
return functions->fun_emacs.HasAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Ckeditor::MakePost()
|
|
||||||
{
|
|
||||||
functions->fun_emacs.MakePost();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_ckeditor
|
|
||||||
#define headerfile_winix_functions_ckeditor
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Ckeditor : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Ckeditor();
|
|
||||||
bool HasAccess();
|
|
||||||
void MakePost();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "default.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
Default::Default()
|
|
||||||
{
|
|
||||||
fun.url = L"default";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Default::HasAccess()
|
|
||||||
{
|
|
||||||
return !cur->request->is_item && system->HasWriteAccess(*cur->request->dir_tab.back());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Default::MakePost()
|
|
||||||
{
|
|
||||||
Item & dir = *cur->request->dir_tab.back();
|
|
||||||
|
|
||||||
dir.link_to = cur->request->PostVar(L"linkto");
|
|
||||||
dir.link_redirect = cur->request->IsPostVar(L"makeredirect") ? 1 : 0;
|
|
||||||
TrimWhite(dir.link_to);
|
|
||||||
|
|
||||||
// !! dodac sprawdzenie czy link_to jest pusty teraz
|
|
||||||
|
|
||||||
cur->request->status = db->EditLinkItem(dir.id, dir.link_to, dir.link_redirect);
|
|
||||||
|
|
||||||
if( cur->request->status == WINIX_ERR_OK )
|
|
||||||
{
|
|
||||||
log << log2 << "Default: changed link_to: " << dir.link_to << ", for dir_id: " << dir.id << logend;
|
|
||||||
system->RedirectToLastDir();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_default
|
|
||||||
#define headerfile_winix_functions_default
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Default : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Default();
|
|
||||||
bool HasAccess();
|
|
||||||
void MakePost();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "download.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Download::Download()
|
|
||||||
{
|
|
||||||
fun.url = L"download";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Download::MakeGet()
|
|
||||||
{
|
|
||||||
// !! moze wywalic to no_item i wszedzie w takich miejscach dac poprostu permission_denied?
|
|
||||||
if( !cur->request->is_item )
|
|
||||||
{
|
|
||||||
log << log1 << "Content: download function requires an item" << logend;
|
|
||||||
cur->request->status = WINIX_ERR_NO_ITEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( !system->HasReadAccess(cur->request->item) ||
|
|
||||||
cur->request->item.file_type == WINIX_ITEM_FILETYPE_NONE ||
|
|
||||||
cur->request->item.file_path.empty() )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
|
|
||||||
|
|
||||||
if( cur->request->item.has_thumb && cur->request->IsParam(L"thumb") )
|
|
||||||
system->MakeFilePath(cur->request->item, cur->request->x_sendfile, true);
|
|
||||||
else
|
|
||||||
system->MakeFilePath(cur->request->item, cur->request->x_sendfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_download
|
|
||||||
#define headerfile_winix_functions_download
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Download : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Download();
|
|
||||||
void MakeGet();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_emacs
|
|
||||||
#define headerfile_winix_functions_emacs
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Emacs : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Emacs();
|
|
||||||
bool HasAccess();
|
|
||||||
void MakePost();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
bool HasAccess(const Item & item); // !! takie funkcje to nie powinny byc skladowe modelu?
|
|
||||||
bool PostEmacsCheckAbuse(bool adding);
|
|
||||||
void PostFunEmacsModifyMountPoint(bool adding);
|
|
||||||
int NotifyCodeEdit();
|
|
||||||
int NotifyCodeAdd();
|
|
||||||
|
|
||||||
std::wstring old_url;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
#include "functions.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FunctionBase::FunctionBase()
|
|
||||||
{
|
|
||||||
id = -1;
|
|
||||||
follow_symlinks = true;
|
|
||||||
|
|
||||||
fun.user_id = -1;
|
|
||||||
fun.group_id = -1;
|
|
||||||
fun.privileges = 0755;
|
|
||||||
fun.parent_id = -1; // !! temporarily doesn't matter
|
|
||||||
fun.id = -1;
|
|
||||||
fun.type = Item::file;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetConfig(Config * pconfig)
|
|
||||||
{
|
|
||||||
config = pconfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetCur(Cur * pcur)
|
|
||||||
{
|
|
||||||
cur = pcur;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetDb(Db * pdb)
|
|
||||||
{
|
|
||||||
db = pdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetSystem(System * psystem)
|
|
||||||
{
|
|
||||||
system = psystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetFunctions(Functions * pfunctions)
|
|
||||||
{
|
|
||||||
functions = pfunctions;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetTemplates(Templates * ptemplates)
|
|
||||||
{
|
|
||||||
templates = ptemplates;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::SetSynchro(Synchro * psynchro)
|
|
||||||
{
|
|
||||||
synchro = psynchro;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::Init()
|
|
||||||
{
|
|
||||||
// this method is called only once at the beginning
|
|
||||||
// when winix starts
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FunctionBase::HasAccess()
|
|
||||||
{
|
|
||||||
// true by default
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::MakePost()
|
|
||||||
{
|
|
||||||
// do nothing by default
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionBase::MakeGet()
|
|
||||||
{
|
|
||||||
// do nothing by default
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_functionbase
|
|
||||||
#define headerfile_winix_functions_functionbase
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "core/item.h"
|
|
||||||
#include "db/db.h"
|
|
||||||
#include "core/request.h"
|
|
||||||
#include "core/config.h"
|
|
||||||
#include "core/system.h"
|
|
||||||
#include "core/synchro.h"
|
|
||||||
#include "notify/notify.h"
|
|
||||||
#include "utf8.h"
|
|
||||||
|
|
||||||
|
|
||||||
class Functions;
|
|
||||||
class Templates;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// function id
|
|
||||||
// it is set automatically when you add the function to functions list
|
|
||||||
// is used to load a template (in templates)
|
|
||||||
long id;
|
|
||||||
|
|
||||||
FunctionBase();
|
|
||||||
|
|
||||||
// user, group, permissions, url (function name)
|
|
||||||
Item fun;
|
|
||||||
|
|
||||||
// auto follow sym links, default: true
|
|
||||||
bool follow_symlinks;
|
|
||||||
|
|
||||||
virtual void Init();
|
|
||||||
virtual bool HasAccess();
|
|
||||||
virtual void MakePost();
|
|
||||||
virtual void MakeGet();
|
|
||||||
|
|
||||||
void SetConfig(Config * pconfig);
|
|
||||||
void SetCur(Cur * pcur);
|
|
||||||
void SetDb(Db * pdb);
|
|
||||||
void SetSystem(System * psystem);
|
|
||||||
void SetFunctions(Functions * pfunctions);
|
|
||||||
void SetTemplates(Templates * ptemplates);
|
|
||||||
void SetSynchro(Synchro * psynchro);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
Config * config;
|
|
||||||
Cur * cur;
|
|
||||||
Db * db;
|
|
||||||
System * system;
|
|
||||||
Functions * functions;
|
|
||||||
Templates * templates;
|
|
||||||
Synchro * synchro;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,235 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "functionparser.h"
|
|
||||||
#include "core/log.h"
|
|
||||||
#include "core/item.h"
|
|
||||||
#include "core/error.h"
|
|
||||||
#include "functions.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::SkipEmptyString(const char * msg)
|
|
||||||
{
|
|
||||||
for( ; get_index != get_tab_len && cur->request->get_tab[get_index].empty() ; ++get_index )
|
|
||||||
log << log3 << msg << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::ParseDirectories()
|
|
||||||
{
|
|
||||||
Item * pdir = system->dirs.GetRootDir();
|
|
||||||
|
|
||||||
if( !pdir )
|
|
||||||
{
|
|
||||||
// there is no the root dir
|
|
||||||
cur->request->status = WINIX_ERR_NO_ROOT_DIR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
while( true )
|
|
||||||
{
|
|
||||||
cur->request->dir_tab.push_back( pdir );
|
|
||||||
log << log3 << "FP: Directory: ";
|
|
||||||
|
|
||||||
if( pdir->parent_id == -1 )
|
|
||||||
log << "(root)" << logend;
|
|
||||||
else
|
|
||||||
log << pdir->url << logend;
|
|
||||||
|
|
||||||
SkipEmptyString("FP: Directory: skipped empty string");
|
|
||||||
|
|
||||||
if( get_index == get_tab_len )
|
|
||||||
break;
|
|
||||||
|
|
||||||
pdir = system->dirs.GetDir(cur->request->get_tab[get_index], pdir->id);
|
|
||||||
|
|
||||||
if( !pdir )
|
|
||||||
break;
|
|
||||||
|
|
||||||
++get_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->request->last_item = cur->request->dir_tab.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::ParseItem()
|
|
||||||
{
|
|
||||||
SkipEmptyString("FP: Item: skipped empty string");
|
|
||||||
|
|
||||||
if( get_index == get_tab_len )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// cur->request->dir_tab has at least one element
|
|
||||||
long parent_id = cur->request->dir_tab.back()->id;
|
|
||||||
const std::wstring & url = cur->request->get_tab[get_index];
|
|
||||||
|
|
||||||
cur->request->status = db->GetItem(parent_id, url, cur->request->item);
|
|
||||||
|
|
||||||
if( cur->request->status == WINIX_ERR_OK )
|
|
||||||
{
|
|
||||||
cur->request->last_item = &cur->request->item;
|
|
||||||
|
|
||||||
if( cur->request->role == Request::authorizer && cur->request->item.file_type == WINIX_ITEM_FILETYPE_NONE )
|
|
||||||
{
|
|
||||||
log << log1 << "FP: item.url: " << url << " exists but has not a static content (authorizer role)" << logend;
|
|
||||||
cur->request->status = WINIX_ERR_NO_ITEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
++get_index;
|
|
||||||
cur->request->is_item = true;
|
|
||||||
log << log3 << "FP: Item: id: " << cur->request->item.id << ", url: " << cur->request->item.url << logend;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log << log3 << "FP: No Item: url: " << url << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::ParseFunction()
|
|
||||||
{
|
|
||||||
SkipEmptyString("FP: Function: skipped empty string");
|
|
||||||
|
|
||||||
if( get_index == get_tab_len )
|
|
||||||
return;
|
|
||||||
|
|
||||||
cur->request->function = functions->Find(cur->request->get_tab[get_index]);
|
|
||||||
|
|
||||||
|
|
||||||
if( cur->request->function )
|
|
||||||
{
|
|
||||||
++get_index;
|
|
||||||
log << log3 << "FP: Function: " << cur->request->function->fun.url << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::ParseParams(const std::wstring & par)
|
|
||||||
{
|
|
||||||
Param param;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if( par.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// looking for the first colon ':'
|
|
||||||
for(i=0 ; i<par.size() && par[i] != ':' ; ++i);
|
|
||||||
|
|
||||||
if( i == par.size() )
|
|
||||||
{
|
|
||||||
// there is no a colon
|
|
||||||
param.name = par;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( i > 0 )
|
|
||||||
param.name = par.substr(0, i);
|
|
||||||
|
|
||||||
if( i < par.size() - 1 )
|
|
||||||
param.value = par.substr(i+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur->request->param_tab.push_back(param);
|
|
||||||
|
|
||||||
log << log3 << "FP: Param: name=" << param.name;
|
|
||||||
|
|
||||||
if( !param.value.empty() )
|
|
||||||
log << ", value=" << param.value;
|
|
||||||
|
|
||||||
log << logend;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::ParseParams()
|
|
||||||
{
|
|
||||||
for( ; true ; ++get_index )
|
|
||||||
{
|
|
||||||
SkipEmptyString("FP: Params: skipped empty string");
|
|
||||||
|
|
||||||
if( get_index == get_tab_len )
|
|
||||||
break;
|
|
||||||
|
|
||||||
ParseParams(cur->request->get_tab[get_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FunctionParser::Parse(Cur * pcur, Db * pdb, Functions * pfunctions, System * psystem)
|
|
||||||
{
|
|
||||||
db = pdb;
|
|
||||||
cur = pcur;
|
|
||||||
system = psystem;
|
|
||||||
functions = pfunctions;
|
|
||||||
|
|
||||||
cur->request->status = WINIX_ERR_OK;
|
|
||||||
get_index = 0;
|
|
||||||
get_tab_len = cur->request->get_tab.size();
|
|
||||||
cur->request->function = 0;
|
|
||||||
cur->request->is_item = false;
|
|
||||||
|
|
||||||
ParseDirectories();
|
|
||||||
|
|
||||||
if( cur->request->status != WINIX_ERR_OK )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ParseFunction();
|
|
||||||
|
|
||||||
if( !cur->request->function )
|
|
||||||
{
|
|
||||||
ParseItem();
|
|
||||||
|
|
||||||
if( cur->request->status != WINIX_ERR_OK )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ParseFunction();
|
|
||||||
|
|
||||||
if( !cur->request->function && get_index != get_tab_len )
|
|
||||||
{
|
|
||||||
cur->request->status = WINIX_ERR_NO_FUNCTION;
|
|
||||||
log << log3 << "FP: Parse: unknown function: \"" << cur->request->get_tab[get_index] << "\"" << logend;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ParseParams();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_functionparser
|
|
||||||
#define headerfile_winix_functions_functionparser
|
|
||||||
|
|
||||||
#include "db/db.h"
|
|
||||||
#include "core/cur.h"
|
|
||||||
#include "core/system.h"
|
|
||||||
|
|
||||||
|
|
||||||
class Functions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionParser
|
|
||||||
{
|
|
||||||
Db * db;
|
|
||||||
Cur * cur;
|
|
||||||
System * system;
|
|
||||||
Functions * functions;
|
|
||||||
|
|
||||||
GetTab::size_type get_index;
|
|
||||||
GetTab::size_type get_tab_len;
|
|
||||||
|
|
||||||
void SkipEmptyString(const char * msg);
|
|
||||||
|
|
||||||
void ParseDirectories();
|
|
||||||
void ParseItem();
|
|
||||||
bool IsAppFunction();
|
|
||||||
void ParseFunction();
|
|
||||||
void ParseParams(const std::wstring & par);
|
|
||||||
void ParseParams();
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void Parse(Cur * pcur, Db * pdb, Functions * pfunctions, System * psystem);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "last.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
Last::Last()
|
|
||||||
{
|
|
||||||
fun.url = L"last";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of Winix
|
|
||||||
* and is not publicly distributed
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_winix_functions_last
|
|
||||||
#define headerfile_winix_functions_last
|
|
||||||
|
|
||||||
#include "functionbase.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Fun
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class Last : public FunctionBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
Last();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user