the first part of reimplementing has been done
now we have app object and singletons are only: log logn plugin and app git-svn-id: svn://ttmath.org/publicrep/winix/trunk@628 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
6897192364
commit
217cf1420b
14
Makefile
14
Makefile
|
@ -5,7 +5,8 @@ CXX = g++
|
|||
endif
|
||||
|
||||
ifndef CXXFLAGS
|
||||
CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
|
||||
#CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
|
||||
CXXFLAGS = -fPIC -Wall -pedantic -O0 -g -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
|
||||
endif
|
||||
|
||||
|
||||
|
@ -18,13 +19,12 @@ all: winix
|
|||
|
||||
winix: FORCE
|
||||
@cd core ; $(MAKE) -e
|
||||
@cd content ; $(MAKE) -e
|
||||
@cd confparser ; $(MAKE) -e
|
||||
@cd functions ; $(MAKE) -e
|
||||
@cd templates ; $(MAKE) -e
|
||||
@cd templatesnotify ; $(MAKE) -e
|
||||
@cd plugins/stats ; $(MAKE) -e
|
||||
@cd ../ezc/src ; $(MAKE) -e
|
||||
$(CXX) -shared -o winix.so $(CXXFLAGS) core/*.o content/*.o templates/*.o templatesnotify/*.o confparser/*.o ../ezc/src/ezc.a -lfcgi -lpq -lz -lpthread
|
||||
$(CXX) -shared -o winix.so $(CXXFLAGS) core/*.o functions/*.o templates/*.o templatesnotify/*.o ../ezc/src/ezc.a -lfcgi -lpq -lz -lpthread
|
||||
@cd main ; $(MAKE) -e
|
||||
# use the full path with winix.so
|
||||
$(CXX) -o winix $(CXXFLAGS) main/*.o /home/tomek/roboczy/winix/winix.so
|
||||
|
@ -32,8 +32,7 @@ winix: FORCE
|
|||
|
||||
clean:
|
||||
@cd core ; $(MAKE) -e clean
|
||||
@cd content ; $(MAKE) -e clean
|
||||
@cd confparser ; $(MAKE) -e clean
|
||||
@cd functions ; $(MAKE) -e clean
|
||||
@cd templates ; $(MAKE) -e clean
|
||||
@cd templatesnotify ; $(MAKE) -e clean
|
||||
@cd plugins/stats ; $(MAKE) -e clean
|
||||
|
@ -48,8 +47,7 @@ FORCE:
|
|||
|
||||
depend:
|
||||
@cd core ; $(MAKE) -e depend
|
||||
@cd content ; $(MAKE) -e depend
|
||||
@cd confparser ; $(MAKE) -e depend
|
||||
@cd functions ; $(MAKE) -e depend
|
||||
@cd templates ; $(MAKE) -e depend
|
||||
@cd templatesnotify ; $(MAKE) -e depend
|
||||
@cd plugins/stats ; $(MAKE) -e depend
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
# DO NOT DELETE
|
||||
|
||||
confparser.o: confparser.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
o = confparser.o
|
||||
o =
|
|
@ -1,455 +0,0 @@
|
|||
# DO NOT DELETE
|
||||
|
||||
adduser.o: content.h ../core/item.h ../templates/templates.h
|
||||
adduser.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
adduser.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
adduser.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
adduser.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
adduser.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
adduser.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
adduser.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
adduser.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
adduser.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
adduser.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
adduser.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
adduser.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
adduser.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
adduser.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
adduser.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
adduser.o: ../core/loadavg.h
|
||||
cat.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
cat.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
cat.o: ../templates/localefilter.h ../core/locale.h
|
||||
cat.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
cat.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
cat.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
cat.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
cat.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
cat.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
cat.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
cat.o: ../core/function.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
cat.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
cat.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
cat.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
|
||||
cat.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
cat.o: ../core/loadavg.h
|
||||
content.o: content.h ../core/item.h ../templates/templates.h
|
||||
content.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
content.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
content.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
content.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
content.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
content.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
content.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
content.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
content.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
content.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
content.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
content.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
content.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
content.o: ../core/dirs.h ../core/users.h ../core/groups.h
|
||||
content.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
|
||||
content.o: ../core/mount.h ../core/loadavg.h ../core/misc.h ../core/plugin.h
|
||||
content.o: ../core/request.h ../core/data.h ../core/pluginmsg.h
|
||||
cp.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
cp.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
cp.o: ../templates/localefilter.h ../core/locale.h ../confparser/confparser.h
|
||||
cp.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
cp.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
cp.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
cp.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
|
||||
cp.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
cp.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
cp.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
cp.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
cp.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
cp.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h ../core/users.h
|
||||
cp.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
|
||||
cp.o: ../core/mounts.h ../core/mount.h ../core/loadavg.h ../core/misc.h
|
||||
createthread.o: content.h ../core/item.h ../templates/templates.h
|
||||
createthread.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
createthread.o: ../templates/misc.h ../templates/localefilter.h
|
||||
createthread.o: ../core/locale.h ../confparser/confparser.h
|
||||
createthread.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
createthread.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
createthread.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
createthread.o: ../core/group.h ../core/thread.h ../core/error.h
|
||||
createthread.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
createthread.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
createthread.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
createthread.o: ../core/function.h ../core/compress.h
|
||||
createthread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
createthread.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
createthread.o: ../core/error.h ../core/mount.h ../core/data.h ../core/dirs.h
|
||||
createthread.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
createthread.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
createthread.o: ../core/loadavg.h
|
||||
createticket.o: content.h ../core/item.h ../templates/templates.h
|
||||
createticket.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
createticket.o: ../templates/misc.h ../templates/localefilter.h
|
||||
createticket.o: ../core/locale.h ../confparser/confparser.h
|
||||
createticket.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
createticket.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
createticket.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
createticket.o: ../core/group.h ../core/thread.h ../core/error.h
|
||||
createticket.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
createticket.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
createticket.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
createticket.o: ../core/function.h ../core/compress.h
|
||||
createticket.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
createticket.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
createticket.o: ../core/error.h ../core/mount.h ../core/data.h ../core/dirs.h
|
||||
createticket.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
createticket.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
createticket.o: ../core/loadavg.h
|
||||
default.o: content.h ../core/item.h ../templates/templates.h
|
||||
default.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
default.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
default.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
default.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
default.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
default.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
default.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
default.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
default.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
default.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
default.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
default.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
default.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
default.o: ../core/dirs.h ../core/users.h ../core/groups.h
|
||||
default.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
|
||||
default.o: ../core/mount.h ../core/loadavg.h
|
||||
download.o: content.h ../core/item.h ../templates/templates.h
|
||||
download.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
download.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
download.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
download.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
download.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
download.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
download.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
download.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
download.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
download.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
download.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
download.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
download.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
download.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
download.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
download.o: ../core/loadavg.h
|
||||
editticket.o: content.h ../core/item.h ../templates/templates.h
|
||||
editticket.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
editticket.o: ../templates/misc.h ../templates/localefilter.h
|
||||
editticket.o: ../core/locale.h ../confparser/confparser.h
|
||||
editticket.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
editticket.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
editticket.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
editticket.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
|
||||
editticket.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
editticket.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
editticket.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
editticket.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
editticket.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
editticket.o: ../core/postmultiparser.h ../core/error.h ../core/mount.h
|
||||
editticket.o: ../core/data.h ../core/dirs.h ../core/users.h ../core/groups.h
|
||||
editticket.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
|
||||
editticket.o: ../core/mount.h ../core/loadavg.h
|
||||
emacs.o: content.h ../core/item.h ../templates/templates.h
|
||||
emacs.o: ../../ezc/src/ezc.h ../templates/patterncacher.h ../templates/misc.h
|
||||
emacs.o: ../templates/localefilter.h ../core/locale.h
|
||||
emacs.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
emacs.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
emacs.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
emacs.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
emacs.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
emacs.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
emacs.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
emacs.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
emacs.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
emacs.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
emacs.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
emacs.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
|
||||
emacs.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
emacs.o: ../core/loadavg.h ../core/notify.h
|
||||
emacs.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
emacs.o: ../templates/misc.h ../core/misc.h
|
||||
last.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
last.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
last.o: ../templates/localefilter.h ../core/locale.h
|
||||
last.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
last.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
last.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
last.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
last.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
last.o: ../core/ticket.h
|
||||
login.o: content.h ../core/item.h ../templates/templates.h
|
||||
login.o: ../../ezc/src/ezc.h ../templates/patterncacher.h ../templates/misc.h
|
||||
login.o: ../templates/localefilter.h ../core/locale.h
|
||||
login.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
login.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
login.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
login.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
login.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
login.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
login.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
login.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
login.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
login.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
login.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
login.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
|
||||
login.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
login.o: ../core/loadavg.h
|
||||
logout.o: content.h ../core/item.h ../templates/templates.h
|
||||
logout.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
logout.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
logout.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
logout.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
logout.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
logout.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
logout.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
logout.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
logout.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
logout.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
logout.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
logout.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
logout.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
logout.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
logout.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
logout.o: ../core/loadavg.h
|
||||
ls.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
ls.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
ls.o: ../templates/localefilter.h ../core/locale.h ../confparser/confparser.h
|
||||
ls.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
ls.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
ls.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
ls.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
|
||||
ls.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
ls.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
ls.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
ls.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
ls.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
ls.o: ../core/postmultiparser.h
|
||||
misc_item.o: content.h ../core/item.h ../templates/templates.h
|
||||
misc_item.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
misc_item.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
misc_item.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
misc_item.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
misc_item.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
misc_item.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
misc_item.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
misc_item.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
misc_item.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
misc_item.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
misc_item.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
misc_item.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
misc_item.o: ../core/postmultiparser.h ../core/misc.h
|
||||
misc_specialfile.o: content.h ../core/item.h ../templates/templates.h
|
||||
misc_specialfile.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
misc_specialfile.o: ../templates/misc.h ../templates/localefilter.h
|
||||
misc_specialfile.o: ../core/locale.h ../confparser/confparser.h
|
||||
misc_specialfile.o: ../templates/ckeditorgetparser.h
|
||||
misc_specialfile.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
misc_specialfile.o: ../templates/indexpatterns.h ../core/thread.h
|
||||
misc_specialfile.o: ../core/ticket.h ../core/db.h ../core/item.h
|
||||
misc_specialfile.o: ../core/user.h ../core/group.h ../core/thread.h
|
||||
misc_specialfile.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
misc_specialfile.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
misc_specialfile.o: ../core/requesttypes.h ../core/session.h ../core/rebus.h
|
||||
misc_specialfile.o: ../core/plugindata.h ../core/function.h
|
||||
misc_specialfile.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
misc_specialfile.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
misc_specialfile.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
misc_specialfile.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
misc_specialfile.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
misc_specialfile.o: ../core/loadavg.h
|
||||
mkdir.o: content.h ../core/item.h ../templates/templates.h
|
||||
mkdir.o: ../../ezc/src/ezc.h ../templates/patterncacher.h ../templates/misc.h
|
||||
mkdir.o: ../templates/localefilter.h ../core/locale.h
|
||||
mkdir.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
mkdir.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
mkdir.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
mkdir.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
mkdir.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
mkdir.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
mkdir.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
mkdir.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
mkdir.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
mkdir.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
mkdir.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
mkdir.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
|
||||
mkdir.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
mkdir.o: ../core/loadavg.h ../core/notify.h
|
||||
mkdir.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
mkdir.o: ../templates/misc.h
|
||||
mv.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
mv.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
mv.o: ../templates/localefilter.h ../core/locale.h ../confparser/confparser.h
|
||||
mv.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
mv.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
mv.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
mv.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
|
||||
mv.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
mv.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
mv.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
mv.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
mv.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
mv.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h ../core/users.h
|
||||
mv.o: ../core/groups.h ../core/functions.h ../core/lastcontainer.h
|
||||
mv.o: ../core/mounts.h ../core/mount.h ../core/loadavg.h
|
||||
node.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
node.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
node.o: ../templates/localefilter.h ../core/locale.h
|
||||
node.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
node.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
node.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
node.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
node.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
node.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
node.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
node.o: ../core/function.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
node.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
node.o: ../core/postmultiparser.h
|
||||
priv.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
priv.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
priv.o: ../templates/localefilter.h ../core/locale.h
|
||||
priv.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
priv.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
priv.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
priv.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
priv.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
priv.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
priv.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
priv.o: ../core/function.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
priv.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
priv.o: ../core/postmultiparser.h ../core/error.h ../core/data.h
|
||||
priv.o: ../core/dirs.h ../core/users.h ../core/groups.h ../core/functions.h
|
||||
priv.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
priv.o: ../core/loadavg.h
|
||||
reload.o: content.h ../core/item.h ../templates/templates.h
|
||||
reload.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
reload.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
reload.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
reload.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
reload.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
reload.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
reload.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
reload.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
reload.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
reload.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
reload.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
reload.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
reload.o: ../core/postmultiparser.h ../core/error.h ../core/notify.h
|
||||
reload.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
reload.o: ../templates/misc.h
|
||||
rm.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
rm.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
rm.o: ../templates/localefilter.h ../core/locale.h ../confparser/confparser.h
|
||||
rm.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
rm.o: ../core/log.h ../templates/indexpatterns.h ../core/thread.h
|
||||
rm.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
|
||||
rm.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
|
||||
rm.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
rm.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
rm.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
rm.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
rm.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
rm.o: ../core/postmultiparser.h ../core/error.h ../core/data.h ../core/dirs.h
|
||||
rm.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
rm.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
rm.o: ../core/loadavg.h ../core/plugin.h ../core/request.h ../core/data.h
|
||||
rm.o: ../core/pluginmsg.h
|
||||
run.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
run.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
run.o: ../templates/localefilter.h ../core/locale.h
|
||||
run.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
run.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
run.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
run.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
run.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
run.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
run.o: ../core/session.h ../core/rebus.h ../core/plugindata.h
|
||||
run.o: ../core/function.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
run.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
run.o: ../core/postmultiparser.h ../core/error.h
|
||||
subject.o: content.h ../core/item.h ../templates/templates.h
|
||||
subject.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
subject.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
subject.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
subject.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
subject.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
subject.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
subject.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
subject.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
subject.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
subject.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
subject.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
subject.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
subject.o: ../core/postmultiparser.h
|
||||
thread.o: content.h ../core/item.h ../templates/templates.h
|
||||
thread.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
thread.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
thread.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
thread.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
thread.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
thread.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
thread.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
thread.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
thread.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
thread.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
thread.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
thread.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
thread.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
thread.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
thread.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
thread.o: ../core/loadavg.h ../core/mount.h
|
||||
ticket.o: content.h ../core/item.h ../templates/templates.h
|
||||
ticket.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
ticket.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
ticket.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
ticket.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
ticket.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
ticket.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
ticket.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
ticket.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
ticket.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
ticket.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
ticket.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
ticket.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
ticket.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
ticket.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
ticket.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
ticket.o: ../core/loadavg.h ../core/mount.h
|
||||
uname.o: content.h ../core/item.h ../templates/templates.h
|
||||
uname.o: ../../ezc/src/ezc.h ../templates/patterncacher.h ../templates/misc.h
|
||||
uname.o: ../templates/localefilter.h ../core/locale.h
|
||||
uname.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
uname.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
uname.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
uname.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
uname.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
uname.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
upload.o: content.h ../core/item.h ../templates/templates.h
|
||||
upload.o: ../../ezc/src/ezc.h ../templates/patterncacher.h
|
||||
upload.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
upload.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
upload.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
upload.o: ../templates/indexpatterns.h ../core/thread.h ../core/ticket.h
|
||||
upload.o: ../core/db.h ../core/item.h ../core/user.h ../core/group.h
|
||||
upload.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
upload.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
upload.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
upload.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
|
||||
upload.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
upload.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
upload.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
|
||||
upload.o: ../core/users.h ../core/groups.h ../core/functions.h
|
||||
upload.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
|
||||
upload.o: ../core/loadavg.h ../core/misc.h
|
||||
who.o: content.h ../core/item.h ../templates/templates.h ../../ezc/src/ezc.h
|
||||
who.o: ../templates/patterncacher.h ../templates/misc.h
|
||||
who.o: ../templates/localefilter.h ../core/locale.h
|
||||
who.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
|
||||
who.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
who.o: ../core/thread.h ../core/ticket.h ../core/db.h ../core/item.h
|
||||
who.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
who.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
who.o: ../core/ticket.h
|
|
@ -1 +0,0 @@
|
|||
o = adduser.o cat.o content.o cp.o createthread.o createticket.o default.o download.o editticket.o emacs.o last.o login.o logout.o ls.o misc_item.o misc_specialfile.o mkdir.o mv.o node.o priv.o reload.o rm.o run.o subject.o thread.o ticket.o uname.o upload.o who.o
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/db.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass)
|
||||
{
|
||||
if( !login || !pass || !conf_pass )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( login->empty() )
|
||||
{
|
||||
request.status = WINIX_ERR_LOGIN_EMPTY;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( *pass != *conf_pass )
|
||||
{
|
||||
request.status = WINIX_ERR_PASSWORDS_DIFFERENT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( pass->size() < 5 )
|
||||
{
|
||||
request.status = WINIX_ERR_PASSWORD_TOO_SHORT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( data.users.IsUser(*login) )
|
||||
{
|
||||
request.status = WINIX_ERR_USER_EXISTS;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::PostFunAddUser()
|
||||
{
|
||||
User user;
|
||||
|
||||
std::string * login = request.PostVar("login");
|
||||
std::string * pass = request.PostVar("password");
|
||||
std::string * conf_pass = request.PostVar("confirmpassword");
|
||||
std::string * email = request.PostVar("email");
|
||||
|
||||
if( !CheckAddUserVars(login, pass, conf_pass) )
|
||||
return;
|
||||
|
||||
user.name = *login;
|
||||
|
||||
if( email )
|
||||
user.email = *email;
|
||||
|
||||
request.status = db.AddUser(user, *pass);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
if( data.users.AddUser(user) )
|
||||
{
|
||||
if( !request.session->puser )
|
||||
LoginUser(user.id, false);
|
||||
|
||||
log << log2 << "Content: added a new user: " << user.name << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: I can't add to data.users: " << user.name
|
||||
<< " but the user was added to the db correctly" << logend;
|
||||
}
|
||||
|
||||
if( request.is_item )
|
||||
RedirectTo(request.item);
|
||||
else
|
||||
RedirectToLastDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunAddUser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunCat()
|
||||
{
|
||||
if( !request.is_item )
|
||||
{
|
||||
log << log1 << "Content: cat function requires an item" << logend;
|
||||
request.status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( !request.HasReadAccess(request.item) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request.send_as_attachment = request.IsParam("attachment");
|
||||
}
|
||||
|
||||
|
|
@ -1,580 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/misc.h"
|
||||
#include "../core/plugin.h"
|
||||
|
||||
|
||||
|
||||
bool Content::Init()
|
||||
{
|
||||
templates.ReadIndexFileNames();
|
||||
templates.ReadTemplates();
|
||||
templates.CreateFunctions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::DirsHaveReadExecPerm()
|
||||
{
|
||||
std::vector<Item*>::iterator i;
|
||||
|
||||
for(i = request.dir_table.begin() ; i!=request.dir_table.end() ; ++i)
|
||||
{
|
||||
if( !request.HasReadExecAccess(**i) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::SetDefaultFunctionForFile()
|
||||
{
|
||||
if( request.item.auth != Item::auth_none )
|
||||
request.pfunction = data.functions.GetFunction(FUN_DOWNLOAD);
|
||||
else
|
||||
if( request.HasReadExecAccess(request.item) )
|
||||
request.pfunction = data.functions.GetFunction(FUN_RUN);
|
||||
else
|
||||
request.pfunction = data.functions.GetFunction(FUN_CAT);
|
||||
|
||||
if( request.pfunction )
|
||||
log << log3 << "Content: default function: " << request.pfunction->item.url << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::SetDefaultFunctionForDir()
|
||||
{
|
||||
long default_item = request.dir_table.back()->default_item;
|
||||
|
||||
if( default_item != -1 )
|
||||
{
|
||||
log << log3 << "Content: Default item: id: " << default_item << logend;
|
||||
RedirectTo(default_item);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( data.mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
request.pfunction = data.functions.GetFunction(FUN_THREAD);
|
||||
|
||||
if( request.pfunction )
|
||||
log << log3 << "Content: default function: " << request.pfunction->item.url << logend;
|
||||
}
|
||||
else
|
||||
if( data.mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
request.pfunction = data.functions.GetFunction(FUN_TICKET);
|
||||
|
||||
if( request.pfunction )
|
||||
log << log3 << "Content: default function: " << request.pfunction->item.url << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cms
|
||||
request.pfunction = data.functions.GetFunction(FUN_LS);
|
||||
|
||||
if( request.pfunction )
|
||||
log << log3 << "Content: default function: " << request.pfunction->item.url << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::SetDefaultFunction()
|
||||
{
|
||||
if( request.is_item )
|
||||
{
|
||||
SetDefaultFunctionForFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDefaultFunctionForDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::FunNothing()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
|
||||
void Content::CallFunction()
|
||||
{
|
||||
static FunItem tab[] = {
|
||||
{FUN_LOGOUT, &Content::FunLogout},
|
||||
{FUN_CAT, &Content::FunCat},
|
||||
{FUN_LS, &Content::FunLs},
|
||||
{FUN_EMACS, &Content::FunEmacs},
|
||||
{FUN_MKDIR, &Content::FunMkdir},
|
||||
{FUN_DEFAULT, &Content::FunDefault},
|
||||
{FUN_PRIV, &Content::FunPriv},
|
||||
{FUN_RM, &Content::FunRm},
|
||||
{FUN_RUN, &Content::FunRun},
|
||||
{FUN_NODE, &Content::FunNode},
|
||||
{FUN_WHO, &Content::FunWho},
|
||||
{FUN_LAST, &Content::FunLast},
|
||||
{FUN_THREAD, &Content::FunThread},
|
||||
{FUN_RELOAD, &Content::FunReload},
|
||||
{FUN_UPLOAD, &Content::FunUpload},
|
||||
{FUN_TICKET, &Content::FunTicket},
|
||||
{FUN_CKEDITOR, &Content::FunEmacs},
|
||||
{FUN_TINYMCE, &Content::FunEmacs},
|
||||
{FUN_LOGIN, &Content::FunLogin},
|
||||
{FUN_MV, &Content::FunMv},
|
||||
{FUN_UNAME, &Content::FunUname},
|
||||
{FUN_CHMOD, &Content::FunPriv},
|
||||
{FUN_CHOWN, &Content::FunPriv},
|
||||
{FUN_DOWNLOAD, &Content::FunDownload},
|
||||
{FUN_ADDUSER, &Content::FunAddUser},
|
||||
{FUN_SUBJECT, &Content::FunSubject},
|
||||
{FUN_CP, &Content::FunCp},
|
||||
{FUN_UPTIME, &Content::FunNothing},
|
||||
{FUN_EDITTICKET,&Content::FunEditTicket},
|
||||
{FUN_CREATETHREAD, &Content::FunCreateThread},
|
||||
{FUN_CREATETICKET, &Content::FunCreateTicket}
|
||||
};
|
||||
|
||||
size_t len = sizeof(tab) / sizeof(FunItem);
|
||||
size_t i;
|
||||
|
||||
for(i=0 ; i<len ; ++i)
|
||||
{
|
||||
if( tab[i].code == request.pfunction->code )
|
||||
{
|
||||
(this->*tab[i].fun)();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
void Content::MakeStandardFunction()
|
||||
{
|
||||
if( request.role == Request::authorizer )
|
||||
{
|
||||
// in authorizer mode only cat function is available
|
||||
// (and must be default)
|
||||
|
||||
if( request.pfunction )
|
||||
{
|
||||
request.status = WINIX_ERR_NO_ITEM;
|
||||
log << log1 << "Content: in authorizer mode only 'cat' funtion is available and must "
|
||||
"be default (not in the url)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
request.pfunction = data.functions.GetFunction(FUN_CAT);
|
||||
}
|
||||
|
||||
if( !request.pfunction )
|
||||
SetDefaultFunction();
|
||||
|
||||
if( !request.redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( !request.pfunction )
|
||||
{
|
||||
request.status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log1 << "Content: no function (neither cat nor ls)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
CallFunction();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::CallPostFunction()
|
||||
{
|
||||
static FunItem tab[] = {
|
||||
{FUN_RUN, &Content::PostFunRun},
|
||||
{FUN_EMACS, &Content::PostFunEmacs},
|
||||
{FUN_MKDIR, &Content::PostFunMkdir},
|
||||
{FUN_DEFAULT, &Content::PostFunDefault},
|
||||
{FUN_PRIV, &Content::PostFunPriv},
|
||||
{FUN_CHMOD, &Content::PostFunPriv},
|
||||
{FUN_CHOWN, &Content::PostFunPriv},
|
||||
{FUN_LOGIN, &Content::PostFunLogin},
|
||||
{FUN_UPLOAD, &Content::PostFunUpload},
|
||||
{FUN_EDITTICKET,&Content::PostFunEditTicket},
|
||||
{FUN_CKEDITOR, &Content::PostFunEmacs},
|
||||
{FUN_TINYMCE, &Content::PostFunEmacs},
|
||||
{FUN_ADDUSER, &Content::PostFunAddUser},
|
||||
{FUN_MV, &Content::PostFunMv},
|
||||
{FUN_SUBJECT, &Content::PostFunSubject},
|
||||
{FUN_CP, &Content::PostFunCp},
|
||||
{FUN_CREATETHREAD, &Content::PostFunCreateThread},
|
||||
{FUN_CREATETICKET, &Content::PostFunCreateTicket}
|
||||
};
|
||||
|
||||
size_t len = sizeof(tab) / sizeof(FunItem);
|
||||
size_t i;
|
||||
|
||||
for(i=0 ; i<len ; ++i)
|
||||
{
|
||||
if( tab[i].code == request.pfunction->code )
|
||||
{
|
||||
(this->*tab[i].fun)();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log << log1 << "Content: unknown post function" << logend;
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
void Content::MakePost()
|
||||
{
|
||||
if( request.role == Request::authorizer )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !request.pfunction )
|
||||
SetDefaultFunction();
|
||||
|
||||
if( !request.pfunction )
|
||||
{
|
||||
request.status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log1 << "Content: MakePost: no function" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
CallPostFunction();
|
||||
}
|
||||
|
||||
|
||||
void Content::MakePage()
|
||||
{
|
||||
bool sent = false;
|
||||
|
||||
if( !request.redirect_to.empty() ||
|
||||
!request.x_sendfile.empty() )
|
||||
return;
|
||||
|
||||
|
||||
if( request.is_item && request.item.auth == Item::auth_none &&
|
||||
request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK && request.pfunction )
|
||||
{
|
||||
if( request.pfunction->code == FUN_CAT )
|
||||
{
|
||||
request.page << request.item.content;
|
||||
sent = true;
|
||||
}
|
||||
else
|
||||
if( request.pfunction->code == FUN_RUN )
|
||||
{
|
||||
templates.GenerateRunRaw();
|
||||
sent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !sent )
|
||||
{
|
||||
templates.Generate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::Make()
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
{
|
||||
log << log1 << "Content: there is no a root dir (dir_table is empty)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
// request.status can be changed by function_parser
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
if( DirsHaveReadExecPerm() )
|
||||
{
|
||||
if( request.method == Request::post )
|
||||
MakePost();
|
||||
|
||||
if( request.redirect_to.empty() && request.status == WINIX_ERR_OK )
|
||||
MakeStandardFunction();
|
||||
}
|
||||
else
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
log << log1 << "Content: spam score: " << request.session->spam_score << logend;
|
||||
|
||||
if( request.IsParam("noredirect") )
|
||||
request.redirect_to.clear();
|
||||
|
||||
if( !request.redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( request.dir_table.empty() )
|
||||
{
|
||||
log << log1 << "Content: there is no a root dir (dir_table is empty -- after calling some standard functions)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_CONTENT_MAKE);
|
||||
MakePage();
|
||||
|
||||
// !! dodac parametr do konfiga wlaczajacy te informacje
|
||||
//request.PrintGetTable();
|
||||
//request.PrintEnv();
|
||||
//request.PrintIn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// !! mozna zrobic jakas obsluge kiedy nie mozemy sie redirectnac, np gdy wystapil blad
|
||||
// !! moze zwracac jakas wartosc?
|
||||
void Content::RedirectTo(const Item & item, const char * postfix)
|
||||
{
|
||||
std::string path;
|
||||
|
||||
request.redirect_to = data.base_url;
|
||||
|
||||
|
||||
if( item.type == Item::dir )
|
||||
{
|
||||
// item_id is pointing to a directory
|
||||
data.dirs.MakePath(item.id, path);
|
||||
request.redirect_to += path;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !data.dirs.MakePath(item.parent_id, path) )
|
||||
log << log1 << "Content: Can't redirect: no dirs for item id: " << item.id << logend;
|
||||
|
||||
request.redirect_to += path;
|
||||
request.redirect_to += item.url;
|
||||
}
|
||||
|
||||
if( postfix )
|
||||
request.redirect_to += postfix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RedirectTo(long item_id, const char * postfix)
|
||||
{
|
||||
std::string path;
|
||||
Item * pdir;
|
||||
|
||||
request.redirect_to = data.base_url;
|
||||
pdir = data.dirs.GetDir(item_id);
|
||||
|
||||
|
||||
if( pdir )
|
||||
{
|
||||
// item_id is pointing to a directory
|
||||
data.dirs.MakePath(pdir->id, path);
|
||||
request.redirect_to += path;
|
||||
}
|
||||
else
|
||||
{
|
||||
// !! zrobic nowy interfejs
|
||||
// !! GetItem pozamieniac na GetFile
|
||||
db.GetItem(request.item_table, item_id);
|
||||
|
||||
if( !request.item_table.empty() )
|
||||
{
|
||||
if( !data.dirs.MakePath(request.item_table[0].parent_id, path) )
|
||||
log << log1 << "Content: Can't redirect: no dirs for item id: " << request.item_table[0].id << ", requested directory id: " << request.item_table[0].parent_id << logend;
|
||||
|
||||
request.redirect_to += path + request.item_table[0].url;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: Can't redirect: no such item: id: " << item_id << logend;
|
||||
}
|
||||
}
|
||||
|
||||
if( postfix )
|
||||
request.redirect_to += postfix;
|
||||
}
|
||||
|
||||
|
||||
void Content::RedirectToLastDir()
|
||||
{
|
||||
RedirectTo( *request.dir_table.back() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadAdditionalInfo()
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
return;
|
||||
|
||||
if( data.mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
if( db.GetThreadByDirId(request.dir_table.back()->id, request.thread) == WINIX_ERR_OK )
|
||||
request.is_thread = true;
|
||||
}
|
||||
else
|
||||
if( data.mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) == WINIX_ERR_OK )
|
||||
{
|
||||
request.is_ticket = true;
|
||||
|
||||
if( !request.is_item && (!request.pfunction || request.pfunction->code == FUN_TICKET) )
|
||||
{
|
||||
db.GetItemById(request.ticket.item_id, request.item);
|
||||
// don't set request.is_item here
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PrepareUrl(Item & item)
|
||||
{
|
||||
TrimWhite(item.url);
|
||||
|
||||
if( item.url.empty() )
|
||||
item.url = item.subject; // if the subject is empty then the url will be corrected by CorrectUrlOnlyAllowedChar()
|
||||
|
||||
CorrectUrlOnlyAllowedChar(item.url);
|
||||
|
||||
if( data.functions.GetFunction(item.url) )
|
||||
{
|
||||
// the name provided by an user is the same as a name of a function
|
||||
// we add one underscore character at the beginning
|
||||
|
||||
// names of functions should not begin with an underscore '_'
|
||||
// and we can simply add one '_' at the beginning
|
||||
// and the name will be unique
|
||||
item.url.insert(item.url.begin(), '_');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::CheckRebus()
|
||||
{
|
||||
if( request.session->puser )
|
||||
// logged user don't have to use the rebus
|
||||
return true;
|
||||
|
||||
if( request.session->rebus_checked )
|
||||
return true;
|
||||
|
||||
request.session->rebus_checked = true;
|
||||
|
||||
if( !request.session->rebus_item )
|
||||
{
|
||||
log << log1 << "Content: rebus not set" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
std::string * answer = request.PostVar("rebus");
|
||||
|
||||
if( answer && data.rebus.IsAnswerOk(request.session->rebus_item, *answer) )
|
||||
return true;
|
||||
}
|
||||
catch(const Error &)
|
||||
{
|
||||
}
|
||||
|
||||
log << log1 << "Content: rebus has an incorrect answer" << logend;
|
||||
// don't add request.session->spam_score when the rebus has incorrect answer
|
||||
// a user could have made a mistake
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Content::SetUser(Item & item)
|
||||
{
|
||||
if( request.session->puser )
|
||||
{
|
||||
item.user_id = request.session->puser->id;
|
||||
item.guest_name.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.user_id = -1;
|
||||
request.PostVar("guestname", item.guest_name);
|
||||
}
|
||||
|
||||
item.group_id = request.dir_table.back()->group_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::CheckGetPostTimes(time_t difference)
|
||||
{
|
||||
time_t now = std::time(0);
|
||||
|
||||
if( request.session->puser )
|
||||
return;
|
||||
|
||||
if( request.method != Request::post )
|
||||
return;
|
||||
|
||||
if( now - request.session->last_time_get >= (time_t)difference )
|
||||
return;
|
||||
|
||||
if( request.AllPostVarEmpty() )
|
||||
return;
|
||||
|
||||
request.session->spam_score += 1;
|
||||
log << log1 << "Content: spam +1: POST after GET sent too fast" << logend;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool Content::CreateFile(const std::string & path, const std::string & content)
|
||||
{
|
||||
std::ofstream file(path.c_str(), std::ios_base::binary | std::ios_base::out);
|
||||
|
||||
if( !file )
|
||||
{
|
||||
log << log1 << "Content: can't create file: " << path << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
file << content;
|
||||
|
||||
file.close();
|
||||
|
||||
// !! dodac sprawdzenie prawidlowosci zapisania pliku
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -1,295 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentcontent
|
||||
#define headerfilecmslucontentcontent
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fcgiapp.h>
|
||||
#include <ctime>
|
||||
|
||||
#include "../core/item.h"
|
||||
#include "../templates/templates.h"
|
||||
#include "../core/thread.h"
|
||||
#include "../core/ticket.h"
|
||||
#include "../core/db.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class Content
|
||||
{
|
||||
Templates templates;
|
||||
|
||||
std::string temp;
|
||||
|
||||
void FunDownload();
|
||||
|
||||
void CheckSpecialFile();
|
||||
|
||||
void PrepareUrl(Item & item);
|
||||
|
||||
|
||||
bool CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass);
|
||||
void PostFunAddUser();
|
||||
void FunAddUser();
|
||||
|
||||
|
||||
/*
|
||||
mv
|
||||
*/
|
||||
bool MoveIsTheSameFile(const Item & item);
|
||||
void MoveAuth(Item & item);
|
||||
void MoveFile(Item & item, bool redirect = true);
|
||||
void MoveDir(Item & item, bool redirect = true);
|
||||
void MoveAuthPrepareQuery();
|
||||
void MoveAuthContentOfDir(const Item & item);
|
||||
bool MoveParseDir(long & dir_id, std::string & dir, std::string & file);
|
||||
bool MoveCheckAccessFromToDir();
|
||||
bool MoveCheckAccessFrom();
|
||||
bool MoveCheckAccessTo(long dir_id);
|
||||
bool MoveCheckMountPoints(long dir_id);
|
||||
void MoveContentOfDir();
|
||||
void PostFunMv();
|
||||
void FunMv();
|
||||
std::string mv_dir;
|
||||
std::string mv_file;
|
||||
std::string mv_new_path;
|
||||
long mv_dir_id;
|
||||
std::vector<Item> mv_auth;
|
||||
Db::ItemQuery mv_auth_iq;
|
||||
|
||||
|
||||
/*
|
||||
cp
|
||||
*/
|
||||
bool CpCheckAccessFrom();
|
||||
void CpAuth(Item & item);
|
||||
void CpSetNewAttributes(Item & item);
|
||||
void CpItem(Item & item, long dst_dir_id);
|
||||
void CpFilesInDir(const Item & dir, long dst_dir_id);
|
||||
void CpContentOfDir(const Item & item, long dst_dir_id);
|
||||
long CpDir(const Item & item, long dst_dir_id);
|
||||
void CpItemCheck(Item & item, bool redirect = true);
|
||||
void CpContentOfDirCheck(const Item & item, bool redirect = true);
|
||||
void CpDirCheck(const Item & item, bool redirect = true);
|
||||
void PostFunCp();
|
||||
void FunCp();
|
||||
void CpPrepare();
|
||||
Item cp_temp;
|
||||
Db::ItemQuery cp_iq;
|
||||
bool cp_remove_defaults;
|
||||
bool cp_preserve_attr;
|
||||
long cp_new_user;
|
||||
long cp_new_group;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SetDefaultFunctionForFile();
|
||||
void SetDefaultFunctionForDir();
|
||||
void SetDefaultFunction();
|
||||
bool DirsHaveReadExecPerm();
|
||||
|
||||
|
||||
/*
|
||||
calling functions (standard, post)
|
||||
*/
|
||||
typedef void (Content::*Fun)();
|
||||
|
||||
struct FunItem
|
||||
{
|
||||
int code;
|
||||
Fun fun;
|
||||
};
|
||||
|
||||
void FunNothing();
|
||||
void CallFunction();
|
||||
void MakeStandardFunction();
|
||||
void CallPostFunction();
|
||||
void MakePost();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SetUser(Item & item);
|
||||
bool CheckRebus();
|
||||
|
||||
|
||||
|
||||
void FunCat();
|
||||
void FunLogout();
|
||||
void FunLs();
|
||||
void FunEmacs();
|
||||
|
||||
|
||||
void AddPathToAuth(std::string & path);
|
||||
|
||||
void FunCKEditor();
|
||||
|
||||
|
||||
void FunUname();
|
||||
|
||||
bool SubjectCheckAccess();
|
||||
void EditDirSubject();
|
||||
void EditFileSubject();
|
||||
void PostFunSubject();
|
||||
void FunSubject();
|
||||
|
||||
|
||||
/*
|
||||
rm
|
||||
*/
|
||||
bool RemoveCheckAccess();
|
||||
void RemoveAllDirs();
|
||||
void RemoveAllDirs(long dir_id);
|
||||
void RemoveDir();
|
||||
void RemoveAuthPrepareQuery();
|
||||
void RemoveAuth(Item & item);
|
||||
void RemoveFile();
|
||||
void FunRm();
|
||||
Db::ItemQuery rm_auth_iq;
|
||||
|
||||
|
||||
void FunNode();
|
||||
void FunMkdir();
|
||||
void FunDefault();
|
||||
void FunRun();
|
||||
void PostFunRun();
|
||||
void FunWho();
|
||||
void FunLast();
|
||||
|
||||
void FunReloadTemplates();
|
||||
void FunReload();
|
||||
|
||||
static bool FunThreadSort(const Thread & t1, const Thread & t2);
|
||||
void FunThread();
|
||||
void FunCreateThread();
|
||||
|
||||
bool FunUploadCheckAccess();
|
||||
void FunUpload();
|
||||
|
||||
bool ReadItemUrlSubject(Item & item, Item::Type item_type);
|
||||
bool ReadItem(Item & item, Item::Type item_type);
|
||||
|
||||
void CheckAccessToItems();
|
||||
|
||||
void LoginUser(long user_id, bool remember_me);
|
||||
void FunLogin();
|
||||
void PostFunLogin();
|
||||
|
||||
|
||||
void ReadItemContentWithType(Item & item);
|
||||
bool FunEmacsCheckAccess();
|
||||
void PostFunEmacsAdd(Item & item);
|
||||
void PostFunEmacsEdit(bool with_url);
|
||||
bool PostEmacsCheckAbuse(bool adding);
|
||||
void PostFunEmacsModifyMountPoint(bool adding);
|
||||
void PostFunEmacs();
|
||||
|
||||
bool FunMkdirCheckAccess();
|
||||
void PostFunMkdir(bool add_to_dir_table, int privileges);
|
||||
void PostFunMkdir();
|
||||
|
||||
void Mkdir(Item & item, bool add_to_dir_table);
|
||||
long PostFunDefaultParsePath();
|
||||
void PostFunDefault();
|
||||
|
||||
|
||||
/*
|
||||
function: priv, chmod, chown
|
||||
*/
|
||||
bool PrivCheckAccess();
|
||||
void PrivLogStart(const char * what, long user, long group, int priv);
|
||||
void PrivLog(const char * what, long id, const std::string & url);
|
||||
bool ChangeOwner(Item & item, long user_id, long group_id);
|
||||
bool ChangePrivileges(Item & item, int privileges);
|
||||
void ChangePriv(Item & item, long user_id, long group_id, int privileges);
|
||||
void PostFunPriv();
|
||||
void PrivFilesInDir(long parent_id);
|
||||
void PrivDir(long parent_id);
|
||||
|
||||
|
||||
bool ReadPriv(const char * user_in, const char * group_in, const char * priv_in, long & user_id, long & group_id, int & priv);
|
||||
void PrivDir();
|
||||
void PrivOneItem();
|
||||
void FunPriv();
|
||||
|
||||
long user_id_file, group_id_file, user_id_dir, group_id_dir;
|
||||
int priv_file, priv_dir;
|
||||
bool subdirectories;
|
||||
bool change_owner, change_priv;
|
||||
|
||||
|
||||
|
||||
bool FunCreateThreadCheckAccess();
|
||||
bool FunCreateThreadCheckAbuse();
|
||||
void ReadThread(Thread & thread);
|
||||
void AddThread();
|
||||
void PostFunCreateThreadLogAndRedirect();
|
||||
void PostFunCreateThread();
|
||||
|
||||
bool UploadCreatePath();
|
||||
void UploadSaveFile(const std::string & tmp_filename, const std::string & destination);
|
||||
void UploadMulti();
|
||||
void UploadSingle();
|
||||
bool FunUploadCheckAbuse();
|
||||
void PostFunUpload();
|
||||
|
||||
|
||||
bool FunCreateTicketCheckAccess();
|
||||
void FunCreateTicket();
|
||||
bool FunCreateTicketCheckAbuse();
|
||||
void PostFunCreateTicketLogAndRedirect();
|
||||
void PostFunCreateTicket();
|
||||
void FunTicket();
|
||||
void TicketDeleteFirst();
|
||||
|
||||
bool FunEditTicketCheckAccess();
|
||||
void PostFunEditTicketLogAndRedirect();
|
||||
void EditTicketCheckFirstItem();
|
||||
void EditTicketModTicket();
|
||||
void EditTicketModDir();
|
||||
void EditTicketModFirstItem();
|
||||
void PostFunEditTicket();
|
||||
void FunEditTicket();
|
||||
|
||||
void AddTicket();
|
||||
void ReadTicket(Ticket & ticket);
|
||||
void ReadTicketType(Ticket & ticket);
|
||||
void ReadTicketStatus(Ticket & ticket);
|
||||
void ReadTicketPriority(Ticket & ticket);
|
||||
void ReadTicketCategory(Ticket & ticket);
|
||||
void ReadTicketExpected(Ticket & ticket);
|
||||
void ReadTicketProgress(Ticket & ticket);
|
||||
|
||||
void RedirectTo(const Item & item, const char * postfix = 0);
|
||||
void RedirectTo(long item_id, const char * postfix = 0);
|
||||
void RedirectToLastDir();
|
||||
|
||||
void CheckGetPostTimes(time_t difference = 10);
|
||||
// bool CreateFile(const std::string & path, const std::string & content);
|
||||
void MakePage();
|
||||
|
||||
public:
|
||||
|
||||
bool Init();
|
||||
|
||||
void ReadAdditionalInfo();
|
||||
void Make();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
261
content/cp.cpp
261
content/cp.cpp
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/misc.h"
|
||||
|
||||
|
||||
bool Content::CpCheckAccessFrom()
|
||||
{
|
||||
if( request.is_item )
|
||||
{
|
||||
if( !request.HasReadAccess(request.item) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( !request.IsParam("r") )
|
||||
{
|
||||
// directories need 'r' parameter
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Content::CpAuth(Item & item)
|
||||
{
|
||||
if( !request.MakePath(item, mv_new_path, true) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( CopyFile(item.auth_path, mv_new_path) )
|
||||
{
|
||||
log << log1 << "Content: copied static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
|
||||
item.auth_path = mv_new_path;
|
||||
request.status = db.EditAuthById(item, item.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: can't copy a file from: " << item.auth_path << ", to: " << mv_new_path << logend;
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::CpSetNewAttributes(Item & item)
|
||||
{
|
||||
item.user_id = cp_new_user;
|
||||
item.group_id = cp_new_group;
|
||||
item.SetDateModifyToNow();
|
||||
}
|
||||
|
||||
|
||||
void Content::CpItem(Item & item, long dst_dir_id)
|
||||
{
|
||||
if( !request.HasReadAccess(item) )
|
||||
return; // !! w przyszlosci bedziemy dodawac komunikaty do specjalnej tablicy (narazie nie zaimplementowane)
|
||||
|
||||
item.parent_id = dst_dir_id;
|
||||
|
||||
if( !cp_preserve_attr )
|
||||
CpSetNewAttributes(item);
|
||||
|
||||
PostFunEmacsAdd(item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
if( item.auth != Item::auth_none )
|
||||
CpAuth(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::CpPrepare()
|
||||
{
|
||||
cp_iq.SetAll(true, false);
|
||||
cp_iq.WhereType(Item::file);
|
||||
|
||||
cp_new_user = -1;
|
||||
cp_new_group = -1;
|
||||
|
||||
if( request.session->puser )
|
||||
cp_new_user = request.session->puser->id;
|
||||
|
||||
Item * pdir = data.dirs.GetDir(mv_dir_id);
|
||||
|
||||
if( pdir )
|
||||
cp_new_group = pdir->group_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::CpFilesInDir(const Item & dir, long dst_dir_id)
|
||||
{
|
||||
cp_iq.WhereParentId(dir.id);
|
||||
db.GetItems(request.item_table, cp_iq);
|
||||
|
||||
for(size_t i=0 ; i<request.item_table.size() ; ++i)
|
||||
CpItem(request.item_table[i], dst_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::CpContentOfDir(const Item & item, long dst_dir_id)
|
||||
{
|
||||
DirContainer::ParentIterator i = data.dirs.FindFirstParent(item.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != data.dirs.ParentEnd() ; i = data.dirs.NextParent(i) )
|
||||
CpDir(*(i->second), dst_dir_id);
|
||||
|
||||
CpFilesInDir(item, dst_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// we shouldn't change 'item' because we have references to our data.dirs objects
|
||||
long Content::CpDir(const Item & item, long dst_dir_id)
|
||||
{
|
||||
cp_temp = item;
|
||||
cp_temp.parent_id = dst_dir_id;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
cp_temp.url = mv_file;
|
||||
mv_file.clear();
|
||||
PrepareUrl(cp_temp);
|
||||
}
|
||||
|
||||
if( !cp_preserve_attr )
|
||||
CpSetNewAttributes(cp_temp);
|
||||
|
||||
if( cp_remove_defaults )
|
||||
cp_temp.default_item = -1;
|
||||
|
||||
Mkdir(cp_temp, false);
|
||||
long new_dir_id = cp_temp.id; // remember the new dir_id
|
||||
|
||||
if( request.HasReadExecAccess(item) )
|
||||
CpContentOfDir(item, cp_temp.id);
|
||||
|
||||
return new_dir_id; // and return it
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// here 'item' can be changed in place
|
||||
void Content::CpItemCheck(Item & item, bool redirect)
|
||||
{
|
||||
if( MoveIsTheSameFile(item) )
|
||||
return;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
item.url = mv_file;
|
||||
PrepareUrl(item);
|
||||
}
|
||||
|
||||
CpItem(item, mv_dir_id);
|
||||
|
||||
if( request.status==WINIX_ERR_OK && redirect )
|
||||
RedirectTo(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::CpContentOfDirCheck(const Item & item, bool redirect)
|
||||
{
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
if( mv_dir_id == item.id )
|
||||
return; // nothing to do
|
||||
|
||||
if( data.dirs.HasParent(mv_dir_id, item.id) )
|
||||
{
|
||||
log << log1 << "Content: cannot copy directory to inside it" << logend;
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
CpContentOfDir(item, mv_dir_id);
|
||||
|
||||
if( request.status==WINIX_ERR_OK && redirect )
|
||||
RedirectTo(mv_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::CpDirCheck(const Item & item, bool redirect)
|
||||
{
|
||||
if( mv_file.empty() && mv_dir_id == item.id )
|
||||
return; // nothing to do
|
||||
|
||||
if( mv_dir_id == item.id || data.dirs.HasParent(mv_dir_id, item.id) )
|
||||
{
|
||||
log << log1 << "Content: cannot copy directory to inside it" << logend;
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
long new_dir_id = CpDir(item, mv_dir_id);
|
||||
|
||||
if( request.status==WINIX_ERR_OK && redirect )
|
||||
RedirectTo(new_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunCp()
|
||||
{
|
||||
if( CpCheckAccessFrom() &&
|
||||
MoveParseDir(mv_dir_id, mv_dir, mv_file) &&
|
||||
MoveCheckAccessTo(mv_dir_id) )
|
||||
{
|
||||
CpPrepare();
|
||||
cp_preserve_attr = request.IsPostVar("preserveattr");
|
||||
|
||||
if( request.is_item )
|
||||
{
|
||||
CpItemCheck(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
cp_remove_defaults = request.IsPostVar("removedefaults");
|
||||
|
||||
if( request.IsPostVar("onlycontent") )
|
||||
CpContentOfDirCheck(*request.dir_table.back());
|
||||
else
|
||||
CpDirCheck(*request.dir_table.back());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunCp()
|
||||
{
|
||||
CpCheckAccessFrom();
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/mount.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::FunCreateThreadCheckAccess()
|
||||
{
|
||||
if( !request.CanCreateThread() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::FunCreateThreadCheckAbuse()
|
||||
{
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckGetPostTimes();
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
{
|
||||
request.status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadThread(Thread & thread)
|
||||
{
|
||||
thread.parent_id = request.dir_table.back()->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::AddThread()
|
||||
{
|
||||
request.thread.dir_id = request.dir_table.back()->id;
|
||||
request.thread.closed = false;
|
||||
request.thread.items = 1;
|
||||
request.thread.last_item = request.item; // set by PostFunEmacsAdd()
|
||||
|
||||
request.status = db.AddThread(request.thread);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunCreateThreadLogAndRedirect()
|
||||
{
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added a new thread" << logend;
|
||||
RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with adding a new thread, error code: "
|
||||
<< request.status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunCreateThread()
|
||||
{
|
||||
if( !FunCreateThreadCheckAccess() )
|
||||
return;
|
||||
|
||||
ReadItem(request.item, Item::dir);
|
||||
SetUser(request.item);
|
||||
ReadThread(request.thread);
|
||||
request.item.privileges = 0777; // !! tymczasowo 777 aby wszyscy mogli wysylac posty
|
||||
|
||||
if( !FunCreateThreadCheckAbuse() )
|
||||
{
|
||||
ReadItemContentWithType(request.item); // for correctly displaying the form
|
||||
return;
|
||||
}
|
||||
|
||||
Mkdir(request.item, true);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
ReadItemContentWithType(request.item);
|
||||
request.item.type = Item::file;
|
||||
request.item.privileges = 0644; // !! tymczasowo
|
||||
request.item.parent_id = request.dir_table.back()->id;
|
||||
PostFunEmacsAdd(request.item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
AddThread();
|
||||
}
|
||||
|
||||
PostFunCreateThreadLogAndRedirect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunCreateThread()
|
||||
{
|
||||
FunCreateThreadCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/mount.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::FunCreateTicketCheckAccess()
|
||||
{
|
||||
if( !request.CanCreateTicket() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::FunCreateTicketCheckAbuse()
|
||||
{
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckGetPostTimes();
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
{
|
||||
request.status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadTicketType(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("type", temp);
|
||||
ticket.type = atoi(temp.c_str());
|
||||
|
||||
if( ticket.type >= data.mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
ticket.type = data.mounts.pmount->param[Mount::par_ticket_type].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadTicketStatus(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("status", temp);
|
||||
ticket.status = atoi(temp.c_str());
|
||||
|
||||
if( ticket.status >= data.mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
ticket.status = data.mounts.pmount->param[Mount::par_ticket_status].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadTicketPriority(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("priority", temp);
|
||||
ticket.priority = atoi(temp.c_str());
|
||||
|
||||
if( ticket.priority >= data.mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
ticket.priority = data.mounts.pmount->param[Mount::par_ticket_priority].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadTicketCategory(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("category", temp);
|
||||
ticket.category = atoi(temp.c_str());
|
||||
|
||||
if( ticket.category >= data.mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
ticket.category = data.mounts.pmount->param[Mount::par_ticket_category].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void Content::ReadTicketExpected(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("expected", temp);
|
||||
ticket.expected = atoi(temp.c_str());
|
||||
|
||||
if( ticket.expected >= data.mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
ticket.expected = data.mounts.pmount->param[Mount::par_ticket_expected].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void Content::ReadTicketProgress(Ticket & ticket)
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.PostVar("progress", temp);
|
||||
int p = atoi(temp.c_str());
|
||||
|
||||
if( p < 0 )
|
||||
p = 0;
|
||||
|
||||
if( p > 100 )
|
||||
p = 100;
|
||||
|
||||
ticket.progress = p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::ReadTicket(Ticket & ticket)
|
||||
{
|
||||
ticket.parent_id = request.dir_table.back()->id;
|
||||
|
||||
ReadTicketType(ticket);
|
||||
ReadTicketStatus(ticket);
|
||||
ReadTicketPriority(ticket);
|
||||
ReadTicketCategory(ticket);
|
||||
ReadTicketExpected(ticket);
|
||||
ReadTicketProgress(ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::AddTicket()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request.ticket.dir_id = request.dir_table.back()->id; // a new directory created by Mkdir()
|
||||
request.ticket.item_id = request.item.id; // this id is set by PostFunEmacsAdd()
|
||||
|
||||
request.status = db.AddTicket(request.ticket);
|
||||
}
|
||||
|
||||
|
||||
void Content::PostFunCreateTicketLogAndRedirect()
|
||||
{
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added a new ticket" << logend;
|
||||
RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with adding a new ticket, error code: "
|
||||
<< request.status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunCreateTicket()
|
||||
{
|
||||
if( !FunCreateTicketCheckAccess() )
|
||||
return;
|
||||
|
||||
ReadItem(request.item, Item::dir);
|
||||
SetUser(request.item);
|
||||
ReadTicket(request.ticket);
|
||||
request.item.privileges = 0777; // !! tymczasowo 777 aby wszyscy mogli wysylac posty
|
||||
|
||||
if( !FunCreateTicketCheckAbuse() )
|
||||
{
|
||||
ReadItemContentWithType(request.item); // for correctly displaying the form
|
||||
return;
|
||||
}
|
||||
|
||||
Mkdir(request.item, true);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
ReadItemContentWithType(request.item);
|
||||
request.item.type = Item::file;
|
||||
request.item.privileges = 0644; // !! tymczasowo
|
||||
request.item.parent_id = request.dir_table.back()->id;
|
||||
PostFunEmacsAdd(request.item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
AddTicket();
|
||||
}
|
||||
|
||||
PostFunCreateTicketLogAndRedirect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunCreateTicket()
|
||||
{
|
||||
FunCreateTicketCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -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 "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunDownload()
|
||||
{
|
||||
// !! moze wywalic to no_item i wszedzie w takich miejscach dac poprostu permission_denied?
|
||||
if( !request.is_item )
|
||||
{
|
||||
log << log1 << "Content: download function requires an item" << logend;
|
||||
request.status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( !request.HasReadAccess(request.item) ||
|
||||
request.item.auth == Item::auth_none ||
|
||||
request.item.auth_path.empty() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request.send_as_attachment = request.IsParam("attachment");
|
||||
request.x_sendfile = request.item.auth_path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/mount.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
bool Content::FunEditTicketCheckAccess()
|
||||
{
|
||||
if( !request.CanEditTicket() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::EditTicketCheckFirstItem()
|
||||
{
|
||||
if( request.status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
|
||||
if( request.ticket.item_id == -1 )
|
||||
{
|
||||
// creating a new item (the item was deleted by a user)
|
||||
|
||||
Item item;
|
||||
item.parent_id = request.dir_table.back()->id;
|
||||
item.subject = request.dir_table.back()->subject;
|
||||
item.type = Item::file;
|
||||
item.privileges = 0644; // !! tymczasowo
|
||||
SetUser(item);
|
||||
PrepareUrl(item);
|
||||
|
||||
request.status = db.AddItem(item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added the first item with content for the ticket, item.id: " << item.id << logend;
|
||||
request.ticket.item_id = item.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::EditTicketModTicket()
|
||||
{
|
||||
if( request.status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
Ticket ticket;
|
||||
ReadTicket(ticket);
|
||||
|
||||
request.ticket.type = ticket.type;
|
||||
request.ticket.status = ticket.status;
|
||||
request.ticket.priority = ticket.priority;
|
||||
request.ticket.category = ticket.category;
|
||||
request.ticket.expected = ticket.expected;
|
||||
request.ticket.progress = ticket.progress;
|
||||
|
||||
request.status = db.EditTicketById(request.ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::EditTicketModDir()
|
||||
{
|
||||
if( request.status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
// we don't modify the url
|
||||
|
||||
Item & dir = *request.dir_table.back();
|
||||
bool edit_dir_subject = (dir.subject != request.item.subject);
|
||||
|
||||
if( edit_dir_subject )
|
||||
{
|
||||
dir.subject = request.item.subject;
|
||||
request.status = db.EditItemById(dir, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::EditTicketModFirstItem()
|
||||
{
|
||||
if( request.status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
// modyfing the first item (the one with content)
|
||||
ReadItemContentWithType(request.item);
|
||||
|
||||
Item item;
|
||||
db.GetItemById(request.ticket.item_id, item);
|
||||
item.subject = request.item.subject;
|
||||
item.content = request.item.content;
|
||||
item.content_type = request.item.content_type;
|
||||
// the url doesn't matter
|
||||
|
||||
db.EditItemById(item, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEditTicketLogAndRedirect()
|
||||
{
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: edited a ticket" << logend;
|
||||
RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with editing a ticket, error code: "
|
||||
<< request.status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEditTicket()
|
||||
{
|
||||
if( !FunEditTicketCheckAccess() )
|
||||
return;
|
||||
|
||||
ReadItem(request.item, Item::dir);
|
||||
// co z uzytkownikiem i grup¹? chyba nie wczytane? !!! (wczesniej bylo SetUser() w ReadItem() - teraz nie ma)
|
||||
// dodac informacje o modyfikacji !!!
|
||||
|
||||
if( !FunCreateTicketCheckAbuse() )
|
||||
{
|
||||
ReadItemContentWithType(request.item); // for correctly displaying the form
|
||||
return;
|
||||
}
|
||||
|
||||
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) != WINIX_ERR_OK )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
EditTicketCheckFirstItem();
|
||||
EditTicketModTicket();
|
||||
EditTicketModDir();
|
||||
EditTicketModFirstItem();
|
||||
PostFunEditTicketLogAndRedirect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunEditTicket()
|
||||
{
|
||||
FunEditTicketCheckAccess();
|
||||
|
||||
db.GetItemById(request.ticket.item_id, request.item);
|
||||
|
||||
// the subject we get from the last directory
|
||||
request.item.subject = request.dir_table.back()->subject;
|
||||
}
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/notify.h"
|
||||
#include "../core/misc.h"
|
||||
|
||||
|
||||
|
||||
bool Content::FunEmacsCheckAccess()
|
||||
{
|
||||
if( !request.is_item )
|
||||
{
|
||||
// adding a new item
|
||||
if( !request.CanUseEmacs(*request.dir_table.back()) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else // editing an existing item
|
||||
if( !request.CanUseEmacs(request.item) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Content::PostFunEmacsAdd(Item & item)
|
||||
{
|
||||
request.status = db.AddItem(item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added a new item, url: " << item.url << ", id: " << item.id
|
||||
<< ", parent_id: " << item.parent_id << logend;
|
||||
|
||||
request.notify_code |= WINIX_NOTIFY_ITEM_ADD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEmacsEdit(bool with_url)
|
||||
{
|
||||
if( request.session->puser )
|
||||
request.item.modification_user_id = request.session->puser->id;
|
||||
else
|
||||
request.item.modification_user_id = -1;
|
||||
|
||||
request.item.SetDateModifyToNow();
|
||||
request.status = db.EditItemById(request.item, with_url);
|
||||
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
TemplatesFunctions::pattern_cacher.UpdatePattern(request.item);
|
||||
log << log2 << "Content: modified an item" << logend;
|
||||
|
||||
request.notify_code |= WINIX_NOTIFY_ITEM_EDIT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Content::PostEmacsCheckAbuse(bool adding)
|
||||
{
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
// !! is tested in createthread once
|
||||
CheckGetPostTimes();
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
{
|
||||
request.status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEmacsModifyMountPoint(bool adding)
|
||||
{
|
||||
if( data.mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
if( adding )
|
||||
db.EditThreadAddItem(request.dir_table.back()->id, request.item.id);
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
if( data.mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mount::cms
|
||||
RedirectTo(request.item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunEmacs()
|
||||
{
|
||||
if( !FunEmacsCheckAccess() )
|
||||
return;
|
||||
|
||||
bool adding = !request.is_item;
|
||||
bool edit_with_url = ReadItem(request.item, Item::file);
|
||||
|
||||
if( adding )
|
||||
SetUser(request.item); // set user before checking the rebus
|
||||
|
||||
if( !PostEmacsCheckAbuse(adding) )
|
||||
return;
|
||||
|
||||
if( adding )
|
||||
{
|
||||
request.is_item = true;
|
||||
request.item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
|
||||
PostFunEmacsAdd(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
PostFunEmacsEdit(edit_with_url);
|
||||
}
|
||||
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
PostFunEmacsModifyMountPoint(adding);
|
||||
CheckSpecialFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: PostFunEmacs: Error: "
|
||||
<< request.status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunEmacs()
|
||||
{
|
||||
FunEmacsCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,71 +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 "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::LoginUser(long user_id, bool remember_me)
|
||||
{
|
||||
request.session->puser = data.users.GetUser(user_id);
|
||||
request.session->spam_score = 0;
|
||||
|
||||
if( !request.session->puser )
|
||||
{
|
||||
log << log1 << "Content: user id: " << user_id << " is not in data.users" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
request.session->remember_me = remember_me;
|
||||
|
||||
data.last.UserLogin(user_id, request.session->puser->name, inet_addr(request.env_remote_addr), request.session->id);
|
||||
data.how_many_logged += 1;
|
||||
|
||||
log << log2 << "User " << request.session->puser->name << " (id: " << user_id << ") logged" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunLogin()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string * login = request.PostVar("login");
|
||||
std::string * pass = request.PostVar("password");
|
||||
std::string * remem = request.PostVar("rememberme");
|
||||
long user_id;
|
||||
|
||||
if( login && pass && db.CheckUser(*login, *pass, user_id) )
|
||||
LoginUser(user_id, remem != 0);
|
||||
|
||||
// !! moze zglosic komunikat o nie poprawnym logowaniu
|
||||
}
|
||||
catch(const Error &)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
if( request.is_item )
|
||||
RedirectTo(request.item);
|
||||
else
|
||||
RedirectTo(*request.dir_table.back());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunLogin()
|
||||
{
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunLogout()
|
||||
{
|
||||
if( request.session->puser )
|
||||
{
|
||||
log << log2 << "User: " << request.session->puser->name << ", id: " << request.session->puser->id << " logged out" << logend;
|
||||
|
||||
data.last.UserLogout(request.session->puser->id, request.session->id);
|
||||
|
||||
if( data.how_many_logged > 0 ) // for safety
|
||||
data.how_many_logged -= 1;
|
||||
|
||||
request.session->puser = 0;
|
||||
request.session->remember_me = 0;
|
||||
}
|
||||
|
||||
std::string path;
|
||||
data.dirs.MakePath(request.dir_table.back()->id, path);
|
||||
request.redirect_to = data.base_url + path;
|
||||
|
||||
if( request.is_item )
|
||||
request.redirect_to += request.item.url;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/misc.h"
|
||||
#include "../core/db.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// returning true if the 'url' has to be changed
|
||||
bool Content::ReadItemUrlSubject(Item & item, Item::Type item_type)
|
||||
{
|
||||
bool with_url = false;
|
||||
|
||||
std::string * new_url = request.PostVar("url");
|
||||
std::string * new_subject = request.PostVar("subject");
|
||||
|
||||
if( item_type == Item::file )
|
||||
{
|
||||
if( !request.is_item || (new_url && *new_url != item.url) )
|
||||
with_url = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
with_url = true;
|
||||
}
|
||||
|
||||
|
||||
if( new_url )
|
||||
item.url = *new_url;
|
||||
|
||||
if( new_subject )
|
||||
item.subject = *new_subject;
|
||||
|
||||
|
||||
if( item.subject.empty() )
|
||||
{
|
||||
item.subject = request.dir_table.back()->subject;
|
||||
item.subject += "_msg_";
|
||||
item.subject += ToStr(db.Size(request.dir_table.back()->id, Item::file));
|
||||
}
|
||||
|
||||
// if item.url is empty then it will be set from item.subject
|
||||
PrepareUrl(item);
|
||||
|
||||
return with_url;
|
||||
}
|
||||
|
||||
|
||||
void Content::ReadItemContentWithType(Item & item)
|
||||
{
|
||||
item.content_type = Item::ct_formatted_text; // default is formatted text
|
||||
request.PostVar("itemcontent", request.item.content);
|
||||
request.PostVar("contenttype", temp);
|
||||
|
||||
// ct_text and ct_formatted_text can use everyone
|
||||
|
||||
if( temp == "0" )
|
||||
item.content_type = Item::ct_text;
|
||||
else
|
||||
if( temp == "1" )
|
||||
item.content_type = Item::ct_formatted_text;
|
||||
|
||||
|
||||
// those below need special privileges
|
||||
|
||||
if( !request.session->puser )
|
||||
return;
|
||||
|
||||
long user_id = request.session->puser->id;
|
||||
|
||||
|
||||
if( temp == "2" )
|
||||
{
|
||||
if( request.CanUseHtml(user_id) )
|
||||
item.content_type = Item::ct_html;
|
||||
}
|
||||
else
|
||||
if( temp == "3" )
|
||||
{
|
||||
if( request.CanUseBBCode(user_id) )
|
||||
item.content_type = Item::ct_bbcode;
|
||||
}
|
||||
else
|
||||
if( temp == "4" )
|
||||
{
|
||||
if( request.CanUseRaw(user_id) )
|
||||
item.content_type = Item::ct_raw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// item_type - the type of an item you are expecting to read
|
||||
// returns true if the url has to be changed
|
||||
// at the moment this is only checked for Item::file - for Item::dir it returns always true
|
||||
bool Content::ReadItem(Item & item, Item::Type item_type)
|
||||
{
|
||||
if( item_type == Item::none )
|
||||
return false;
|
||||
|
||||
item.type = item_type;
|
||||
item.parent_id = request.dir_table.back()->id;
|
||||
|
||||
bool edit_with_url = ReadItemUrlSubject(item, item_type);
|
||||
|
||||
if( item_type == Item::file )
|
||||
ReadItemContentWithType(item);
|
||||
|
||||
return edit_with_url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if we don't have access we only remove the item from the table
|
||||
void Content::CheckAccessToItems()
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
while( i < request.item_table.size() )
|
||||
{
|
||||
if( !request.HasReadAccess(request.item_table[i]) )
|
||||
{
|
||||
request.item_table.erase(request.item_table.begin() + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
void Content::CheckSpecialFile()
|
||||
{
|
||||
static std::string fstab = "fstab";
|
||||
|
||||
Item * etc = data.dirs.GetEtcDir();
|
||||
|
||||
if( !etc )
|
||||
return;
|
||||
|
||||
if( request.item.parent_id != etc->id )
|
||||
return;
|
||||
|
||||
if( request.item.url == fstab )
|
||||
{
|
||||
log << log3 << "Content: reloading mount points" << logend;
|
||||
|
||||
request.status = data.mounts.ReadMounts(request.item.content);
|
||||
templates.ReadNewIndexTemplates();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/notify.h"
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::FunMkdirCheckAccess()
|
||||
{
|
||||
if( request.is_item || !request.CanUseMkdir(*request.dir_table.back()) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::Mkdir(Item & item, bool add_to_dir_table)
|
||||
{
|
||||
request.status = db.AddItem(item);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
Item * pdir = data.dirs.AddDir(item);
|
||||
|
||||
if( add_to_dir_table )
|
||||
request.dir_table.push_back(pdir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::PostFunMkdir(bool add_to_dir_table, int privileges)
|
||||
{
|
||||
if( !FunMkdirCheckAccess() )
|
||||
return;
|
||||
|
||||
ReadItem(request.item, Item::dir);
|
||||
SetUser(request.item);
|
||||
request.item.privileges = privileges;
|
||||
|
||||
Mkdir(request.item, add_to_dir_table);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
request.notify_code |= WINIX_NOTIFY_DIR_ADD;
|
||||
RedirectTo(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: PostFunMkdir: Error: " << request.status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::PostFunMkdir()
|
||||
{
|
||||
PostFunMkdir(false, 0755);
|
||||
}
|
||||
|
||||
|
||||
void Content::FunMkdir()
|
||||
{
|
||||
FunMkdirCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
364
content/mv.cpp
364
content/mv.cpp
|
@ -1,364 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
|
||||
|
||||
|
||||
bool Content::MoveCheckAccessFromToDir()
|
||||
{
|
||||
Item * last;
|
||||
Item * last_but_one = 0;
|
||||
|
||||
last = request.dir_table[request.dir_table.size()-1];
|
||||
|
||||
if( request.dir_table.size() >= 2 )
|
||||
last_but_one = request.dir_table[request.dir_table.size()-2];
|
||||
|
||||
if( request.method != Request::post )
|
||||
{
|
||||
// used in GET (HEAD in the future?)
|
||||
|
||||
if( !request.HasWriteAccess(*last) &&
|
||||
(!last_but_one || !request.HasWriteAccess(*last_but_one)) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// used in POST when the moving is performed
|
||||
|
||||
if( request.IsPostVar("onlycontent") )
|
||||
return request.HasWriteAccess(*last);
|
||||
else
|
||||
if( last_but_one )
|
||||
return request.HasWriteAccess(*last_but_one);
|
||||
else
|
||||
return false; // you cannot move the root directory
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::MoveCheckAccessFrom()
|
||||
{
|
||||
if( request.is_item )
|
||||
{
|
||||
// moving a file
|
||||
|
||||
if( !request.HasWriteAccess(*request.dir_table.back()) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !MoveCheckAccessFromToDir() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Content::MoveCheckAccessTo(long dir_id)
|
||||
{
|
||||
Item * pdir = data.dirs.GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !request.HasReadExecAccessToPath(dir_id) || !request.HasWriteAccess(*pdir) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::MoveCheckMountPoints(long dir_id)
|
||||
{
|
||||
/*
|
||||
Mount * new_mount = data.mounts.CalcMount(dir_id);
|
||||
|
||||
if( !new_mount )
|
||||
{
|
||||
if( data.mounts.pmount->type != Mount::cms )
|
||||
{
|
||||
request.status = WINIX_DIFFERENT_MOUNT_POINTS;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if( new_mount->type != data.mounts.pmount->type )
|
||||
{
|
||||
request.status = WINIX_DIFFERENT_MOUNT_POINTS;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::MoveParseDir(long & dir_id, std::string & dir, std::string & file)
|
||||
{
|
||||
std::string * move_to = request.PostVar("to");
|
||||
|
||||
if( !move_to )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
int res = data.dirs.AnalyzePath(*move_to, dir_id, dir, file);
|
||||
|
||||
if( res == 1 )
|
||||
request.status = WINIX_ERR_NO_ROOT_DIR;
|
||||
else
|
||||
if( res != 0 )
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
|
||||
return res == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveAuth(Item & item)
|
||||
{
|
||||
if( !request.MakePath(item, mv_new_path, true) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( rename(item.auth_path.c_str(), mv_new_path.c_str()) == 0 )
|
||||
{
|
||||
log << log1 << "Content: moved static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
|
||||
item.auth_path = mv_new_path;
|
||||
request.status = db.EditAuthById(item, item.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
log << log1 << "Content: can't move a file from: " << item.auth_path << ", to: " << mv_new_path << ", ";
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::MoveIsTheSameFile(const Item & item)
|
||||
{
|
||||
if( mv_file.empty() )
|
||||
{
|
||||
if( item.parent_id == mv_dir_id )
|
||||
return true; // nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
if( item.parent_id == mv_dir_id && item.url == mv_file )
|
||||
return true; // nothing to do
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveFile(Item & item, bool redirect)
|
||||
{
|
||||
if( MoveIsTheSameFile(item) )
|
||||
return;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
item.url = mv_file;
|
||||
PrepareUrl(item);
|
||||
}
|
||||
|
||||
item.parent_id = mv_dir_id;
|
||||
request.status = db.EditParentUrlById(item, item.id);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: the file was moved to: " << mv_dir << item.url << logend;
|
||||
|
||||
if( item.auth != Item::auth_none )
|
||||
MoveAuth(item);
|
||||
|
||||
if( redirect )
|
||||
RedirectTo(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveContentOfDir()
|
||||
{
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.sel_parent_id = true;
|
||||
iq.sel_type = true;
|
||||
iq.sel_url = true;
|
||||
iq.sel_auth = true;
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
|
||||
db.GetItems(request.item_table, iq);
|
||||
|
||||
for(size_t i=0 ; i<request.item_table.size() ; ++i)
|
||||
{
|
||||
if( request.item_table[i].type == Item::dir )
|
||||
MoveDir(request.item_table[i], false);
|
||||
else
|
||||
MoveFile(request.item_table[i], false);
|
||||
}
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveAuthPrepareQuery()
|
||||
{
|
||||
mv_auth_iq.SetAll(false, false);
|
||||
|
||||
mv_auth_iq.sel_parent_id = true;
|
||||
mv_auth_iq.sel_type = true;
|
||||
mv_auth_iq.sel_url = true;
|
||||
mv_auth_iq.sel_auth = true;
|
||||
|
||||
mv_auth_iq.WhereType(Item::file);
|
||||
mv_auth_iq.WhereAuth(Item::auth_none, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveAuthContentOfDir(const Item & item)
|
||||
{
|
||||
DirContainer::ParentIterator i = data.dirs.FindFirstParent(item.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != data.dirs.ParentEnd() ; i = data.dirs.NextParent(i) )
|
||||
MoveAuthContentOfDir(*(i->second));
|
||||
|
||||
mv_auth_iq.WhereParentId(item.id);
|
||||
|
||||
// don't use request.item here (is used in MoveContentOfDir())
|
||||
db.GetItems(mv_auth, mv_auth_iq);
|
||||
|
||||
for(size_t i=0 ; i<mv_auth.size() ; ++i)
|
||||
MoveAuth(mv_auth[i]);
|
||||
|
||||
mv_auth.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::MoveDir(Item & item, bool redirect)
|
||||
{
|
||||
if( mv_file.empty() && mv_dir_id == item.id )
|
||||
return; // nothing to do
|
||||
|
||||
if( mv_dir_id == item.id || data.dirs.HasParent(mv_dir_id, item.id) )
|
||||
{
|
||||
log << log1 << "Content: cannot move directory to inside it" << logend;
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !data.dirs.ChangeParent(item.id, mv_dir_id) )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
item.parent_id = mv_dir_id;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
item.url = mv_file;
|
||||
PrepareUrl(item);
|
||||
}
|
||||
|
||||
request.status = db.EditParentUrlById(item, item.id);
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: the directory was moved to: " << mv_dir << item.url << logend;
|
||||
MoveAuthContentOfDir(item);
|
||||
|
||||
if( redirect )
|
||||
RedirectToLastDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::PostFunMv()
|
||||
{
|
||||
if( MoveCheckAccessFrom() &&
|
||||
MoveParseDir(mv_dir_id, mv_dir, mv_file) &&
|
||||
MoveCheckAccessTo(mv_dir_id) &&
|
||||
MoveCheckMountPoints(mv_dir_id) )
|
||||
{
|
||||
if( request.is_item )
|
||||
{
|
||||
MoveFile(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveAuthPrepareQuery();
|
||||
|
||||
if( request.IsPostVar("onlycontent") )
|
||||
{
|
||||
if( mv_file.empty() )
|
||||
MoveContentOfDir();
|
||||
else
|
||||
request.status = WINIX_ERR_INCORRECT_DIR;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDir(*request.dir_table.back());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunMv()
|
||||
{
|
||||
MoveCheckAccessFrom();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunNode()
|
||||
{
|
||||
if( request.param_table.empty() )
|
||||
{
|
||||
//request.status = Error
|
||||
//!!zglosic 404
|
||||
return;
|
||||
}
|
||||
|
||||
long id = atol( request.param_table[0].name.c_str() );
|
||||
|
||||
RedirectTo(id);
|
||||
}
|
||||
|
|
@ -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 "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
#include "../core/notify.h"
|
||||
|
||||
|
||||
|
||||
void Content::FunReloadTemplates()
|
||||
{
|
||||
log << log1 << "Content: reloading html templates" << logend;
|
||||
|
||||
templates.ReadTemplates();
|
||||
notify.ReadTemplates(); // make sure that ReadTemplates() is using some kind of locking
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunReload()
|
||||
{
|
||||
// !! temporarily only an admin has access
|
||||
|
||||
if( !request.session->puser || !request.session->puser->super_user )
|
||||
{
|
||||
log << log1 << "Content: Only an admin has access to reload function" << logend;
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( request.IsParam("templates") )
|
||||
FunReloadTemplates();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
210
content/rm.cpp
210
content/rm.cpp
|
@ -1,210 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
#include "content.h"
|
||||
#include "core/request.h"
|
||||
#include "core/error.h"
|
||||
#include "core/data.h"
|
||||
#include "core/plugin.h"
|
||||
|
||||
|
||||
bool Content::RemoveCheckAccess()
|
||||
{
|
||||
if( !request.is_item )
|
||||
{
|
||||
if( !request.CanRemove(*request.dir_table.back()) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( !request.CanRemove(request.item) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RemoveAuthPrepareQuery()
|
||||
{
|
||||
rm_auth_iq.SetAll(true, false);
|
||||
|
||||
rm_auth_iq.sel_parent_id = true;
|
||||
rm_auth_iq.sel_type = true;
|
||||
rm_auth_iq.sel_auth = true;
|
||||
|
||||
rm_auth_iq.WhereType(Item::file);
|
||||
rm_auth_iq.WhereAuth(Item::auth_none, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RemoveAllDirs(long dir_id)
|
||||
{
|
||||
DirContainer::ParentIterator pnext, p = data.dirs.FindFirstParent(dir_id);
|
||||
|
||||
for( ; p != data.dirs.ParentEnd() ; p = pnext )
|
||||
{
|
||||
// this iterator p will be deleted by the next DeleteDir(p->second->id)
|
||||
// (the next iterator we must calculate beforehand)
|
||||
pnext = data.dirs.NextParent(p);
|
||||
RemoveAllDirs(p->second->id);
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, dir_id);
|
||||
|
||||
rm_auth_iq.WhereParentId(dir_id);
|
||||
db.GetItems(request.item_table, rm_auth_iq);
|
||||
|
||||
for(size_t i=0 ; i<request.item_table.size() ; ++i)
|
||||
RemoveAuth(request.item_table[i]);
|
||||
|
||||
if( db.DelDirById(dir_id) == WINIX_ERR_OK )
|
||||
{
|
||||
data.dirs.DelDir(dir_id);
|
||||
|
||||
db.RemoveThread(dir_id);
|
||||
db.RemoveTicket(dir_id);
|
||||
|
||||
plugin.Call(WINIX_DIR_REMOVED, dir_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RemoveAllDirs()
|
||||
{
|
||||
RemoveAuthPrepareQuery();
|
||||
|
||||
// this method deletes recursively all directories
|
||||
RemoveAllDirs(request.dir_table.back()->id);
|
||||
request.dir_table.erase(--request.dir_table.end());
|
||||
|
||||
if( request.dir_table.empty() )
|
||||
{
|
||||
// we have deleted the root directory
|
||||
data.dirs.CheckRootDir(); // adding a new root dir
|
||||
Item * proot = data.dirs.GetRootDir();
|
||||
|
||||
if( proot )
|
||||
request.dir_table.push_back(proot);
|
||||
else
|
||||
// there is no a root dir
|
||||
// CheckRootDir() didn't add the root dir (probably problem with the database)
|
||||
// make sure that Content::Make() will check that the dir_table is empty and returns
|
||||
return;
|
||||
}
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
void Content::RemoveDir()
|
||||
{
|
||||
if( request.param_table.empty() )
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED; // use parameter "r" for removing a directory
|
||||
else
|
||||
if( request.IsParam("r") )
|
||||
RemoveAllDirs();
|
||||
else
|
||||
request.status = WINIX_ERR_UNKNOWN_PARAM;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RemoveAuth(Item & item)
|
||||
{
|
||||
if( item.auth_path.empty() )
|
||||
{
|
||||
log << log1 << "Content: can't remove a static file: auth_path is empty" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( remove(item.auth_path.c_str()) == 0 )
|
||||
{
|
||||
log << log1 << "Content: removed static file: " << item.auth_path << logend;
|
||||
item.auth_path.clear();
|
||||
item.auth = Item::auth_none;
|
||||
// we don't store it to db (will be removed or is removed already)
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
log << log1 << "Content: can't remove a file: " << item.auth_path;
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::RemoveFile()
|
||||
{
|
||||
// for safety we check if param_table is empty
|
||||
// a user can use "confirm" but can make a mistake when typing
|
||||
if( !request.param_table.empty() )
|
||||
{
|
||||
request.status = WINIX_ERR_UNKNOWN_PARAM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( db.DelItem( request.item ) )
|
||||
{
|
||||
log << log2 << "Content: deleted item: subject: " << request.item.subject << ", id: " << request.item.id << logend;
|
||||
TemplatesFunctions::pattern_cacher.DeletePattern(request.item);
|
||||
|
||||
plugin.Call(WINIX_FILE_REMOVED, request.item.id);
|
||||
|
||||
if( data.mounts.pmount->type == Mount::thread )
|
||||
db.EditThreadRemoveItem(request.item.parent_id);
|
||||
else
|
||||
if( data.mounts.pmount->type == Mount::ticket )
|
||||
db.EditTicketRemoveItem(request.item.id);
|
||||
|
||||
if( request.item.auth != Item::auth_none )
|
||||
RemoveAuth(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
request.status = WINIX_ERR_NO_ITEM;
|
||||
}
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunRm()
|
||||
{
|
||||
if( !RemoveCheckAccess() )
|
||||
return;
|
||||
|
||||
if( request.IsParam("confirm") )
|
||||
return; // show confirmation dialog
|
||||
|
||||
if( request.is_item )
|
||||
RemoveFile();
|
||||
else
|
||||
RemoveDir();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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 "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/error.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunRun()
|
||||
{
|
||||
if( !request.is_item )
|
||||
{
|
||||
log << log1 << "Content: Run function requires an item" << logend;
|
||||
request.status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !request.HasReadExecAccess(request.item) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Content::PostFunRun()
|
||||
{
|
||||
FunRun();
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/log.h"
|
||||
|
||||
|
||||
|
||||
bool Content::SubjectCheckAccess()
|
||||
{
|
||||
// super user can always
|
||||
if( request.session->puser && request.session->puser->super_user )
|
||||
return true;
|
||||
|
||||
bool access;
|
||||
|
||||
if( request.is_item )
|
||||
access = request.HasWriteAccess(request.item);
|
||||
else
|
||||
access = request.HasWriteAccess(*request.dir_table.back());
|
||||
|
||||
if( !access )
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::EditDirSubject()
|
||||
{
|
||||
Item & dir = *request.dir_table.back();
|
||||
|
||||
request.PostVar("subject", dir.subject);
|
||||
db.EditSubjectById(dir, dir.id);
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::EditFileSubject()
|
||||
{
|
||||
request.PostVar("subject", request.item.subject);
|
||||
db.EditSubjectById(request.item, request.item.id);
|
||||
|
||||
RedirectTo(request.item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::PostFunSubject()
|
||||
{
|
||||
if( !SubjectCheckAccess() )
|
||||
return;
|
||||
|
||||
if( request.is_item )
|
||||
EditFileSubject();
|
||||
else
|
||||
EditDirSubject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunSubject()
|
||||
{
|
||||
SubjectCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/mount.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
bool Content::FunThreadSort(const Thread & t1, const Thread & t2)
|
||||
{
|
||||
Item * pdir1 = data.dirs.GetDir(t1.dir_id);
|
||||
Item * pdir2 = data.dirs.GetDir(t2.dir_id);
|
||||
|
||||
if( !pdir1 || !pdir2 )
|
||||
return false;
|
||||
|
||||
time_t time1 = mktime(&pdir1->date_creation);
|
||||
time_t time2 = mktime(&pdir2->date_creation);
|
||||
|
||||
return time1 > time2;
|
||||
}
|
||||
|
||||
|
||||
void Content::FunThread()
|
||||
{
|
||||
if( request.is_item )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
Db::ItemQuery iq;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_thread, "sort_desc") )
|
||||
iq.sort_asc = false;
|
||||
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereAuth(Item::auth_none);
|
||||
|
||||
db.GetItems(request.item_table, iq);
|
||||
db.GetThreads(request.dir_table.back()->id, request.thread_tab);
|
||||
|
||||
CheckAccessToItems();
|
||||
|
||||
std::sort(request.thread_tab.begin(), request.thread_tab.end(), FunThreadSort);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/db.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/mount.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::TicketDeleteFirst()
|
||||
{
|
||||
if( !request.is_ticket )
|
||||
return;
|
||||
|
||||
for(size_t i=0 ; i<request.item_table.size() ; ++i)
|
||||
{
|
||||
if( request.item_table[i].id == request.ticket.item_id )
|
||||
{
|
||||
// this is the first item with the content for the ticket
|
||||
|
||||
if( !request.HasReadAccess(request.item_table[i]) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
request.item_table.erase(request.item_table.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunTicket()
|
||||
{
|
||||
if( request.is_item || data.mounts.pmount->type != Mount::ticket )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereAuth(Item::auth_none);
|
||||
|
||||
db.GetItems(request.item_table, iq);
|
||||
db.GetTickets(request.dir_table.back()->id, request.ticket_tab);
|
||||
|
||||
TicketDeleteFirst();
|
||||
CheckAccessToItems();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,200 +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/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
#include "content.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/misc.h"
|
||||
|
||||
|
||||
|
||||
|
||||
bool Content::FunUploadCheckAccess()
|
||||
{
|
||||
if( request.is_item || !request.CanUseUpload(*request.dir_table.back()) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::UploadCreatePath()
|
||||
{
|
||||
if( !request.MakePath(request.item, true) )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::UploadSaveFile(const std::string & tmp_filename, const std::string & destination)
|
||||
{
|
||||
if( rename(tmp_filename.c_str(), destination.c_str()) == 0 )
|
||||
{
|
||||
log << log1 << "Content: uploaded a new file: " << destination << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
// !! skasowac takze plik z bazy danych?
|
||||
log << log1 << "Content: can't move the tmp file from: " << tmp_filename << ", to: " << destination << ", ";
|
||||
log.SystemErr(err);
|
||||
log << logend;
|
||||
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Content::FunUploadCheckAbuse()
|
||||
{
|
||||
if( !CheckRebus() )
|
||||
{
|
||||
request.status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckGetPostTimes(4);
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
{
|
||||
request.status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::UploadMulti()
|
||||
{
|
||||
request.item.Clear(); // clearing and setting date
|
||||
request.item.parent_id = request.dir_table.back()->id;
|
||||
request.item.type = Item::file;
|
||||
request.item.privileges = 0644; // !! tymczasowo
|
||||
SetUser(request.item);
|
||||
|
||||
PostFileTable::iterator i = request.post_file_table.begin();
|
||||
|
||||
for( ; i != request.post_file_table.end() ; ++i)
|
||||
{
|
||||
const char * file_name = i->second.filename.c_str();
|
||||
|
||||
request.item.subject = file_name;
|
||||
request.item.url = file_name;
|
||||
request.item.auth = SelectFileType(file_name);
|
||||
|
||||
PrepareUrl(request.item);
|
||||
PostFunEmacsAdd(request.item); // always adding a new item
|
||||
|
||||
if( !UploadCreatePath() )
|
||||
return;
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
UploadSaveFile(i->second.tmp_filename, request.item.auth_path);
|
||||
request.status = db.EditAuthById(request.item, request.item.id);
|
||||
}
|
||||
}
|
||||
|
||||
RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
void Content::UploadSingle()
|
||||
{
|
||||
std::string * new_subject = request.PostVar("subject");
|
||||
std::string * new_url = request.PostVar("url");
|
||||
bool has_subject = (new_subject && (*new_subject)[0] != 0 );
|
||||
bool has_url = (new_url && (*new_url)[0] != 0 );
|
||||
|
||||
ReadItem(request.item, Item::file); // ReadItem() changes the url if it is empty
|
||||
SetUser(request.item);
|
||||
request.item.privileges = 0644; // !! tymczasowo
|
||||
|
||||
const char * file_name = request.post_file_table.begin()->second.filename.c_str();
|
||||
request.item.auth = SelectFileType(file_name);
|
||||
|
||||
if( !has_subject )
|
||||
request.item.subject = file_name;
|
||||
|
||||
if( !has_url )
|
||||
{
|
||||
request.item.url = file_name;
|
||||
PrepareUrl(request.item);
|
||||
}
|
||||
|
||||
PostFunEmacsAdd(request.item); // always adding a new item
|
||||
|
||||
// url can be changed by PostFunEmacsAdd()
|
||||
if( !UploadCreatePath() )
|
||||
return;
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
const std::string & tmp_filename = request.post_file_table.begin()->second.tmp_filename;
|
||||
UploadSaveFile(tmp_filename, request.item.auth_path);
|
||||
request.status = db.EditAuthById(request.item, request.item.id);
|
||||
}
|
||||
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
RedirectTo(request.item, "/cat");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// !! dodac usuwanie plikow statycznych przez rm
|
||||
void Content::PostFunUpload()
|
||||
{
|
||||
if( !FunUploadCheckAccess() )
|
||||
return;
|
||||
|
||||
if( request.post_file_table.empty() )
|
||||
{
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !FunUploadCheckAbuse() )
|
||||
return;
|
||||
|
||||
if( request.post_file_table.size() > 1 )
|
||||
UploadMulti();
|
||||
else
|
||||
UploadSingle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Content::FunUpload()
|
||||
{
|
||||
FunUploadCheckAccess();
|
||||
}
|
||||
|
|
@ -1,128 +1,261 @@
|
|||
# DO NOT DELETE
|
||||
|
||||
Kopia config.o: ../core/log.h ../core/request.h requesttypes.h session.h
|
||||
Kopia config.o: item.h error.h log.h user.h plugindata.h rebus.h thread.h
|
||||
Kopia config.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
Kopia config.o: htmlfilter.h postmultiparser.h config.h confparser.h ticket.h
|
||||
Kopia config.o: ../core/config.h ../core/db.h group.h dircontainer.h
|
||||
Kopia config.o: ugcontainer.h
|
||||
acceptbaseparser.o: acceptbaseparser.h
|
||||
app.o: app.h config.h confparser.h system.h dirs.h item.h dircontainer.h db.h
|
||||
app.o: user.h group.h thread.h error.h log.h ugcontainer.h ticket.h request.h
|
||||
app.o: requesttypes.h session.h plugindata.h rebus.h compress.h
|
||||
app.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
app.o: postmultiparser.h mounts.h mount.h users.h lastcontainer.h groups.h
|
||||
app.o: loadavg.h sessionmanager.h sessioncontainer.h notify.h
|
||||
app.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
app.o: ../core/mount.h ../core/locale.h ../core/config.h ../templates/misc.h
|
||||
app.o: ../templates/localefilter.h ../core/locale.h ../functions/functions.h
|
||||
app.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
app.o: ../core/request.h ../core/system.h ../core/notify.h
|
||||
app.o: ../functions/functionparser.h ../functions/adduser.h
|
||||
app.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
||||
app.o: ../functions/chown.h ../functions/cp.h ../functions/createthread.h
|
||||
app.o: ../functions/createticket.h ../functions/default.h
|
||||
app.o: ../functions/download.h ../functions/editticket.h ../functions/emacs.h
|
||||
app.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
||||
app.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
app.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
|
||||
app.o: ../functions/rm.h ../functions/run.h ../functions/subject.h
|
||||
app.o: ../functions/funthread.h ../core/thread.h ../functions/funticket.h
|
||||
app.o: ../functions/uname.h ../functions/upload.h ../functions/who.h
|
||||
app.o: ../templates/templates.h ../templates/patterncacher.h ../core/item.h
|
||||
app.o: misc.h ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
app.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
app.o: plugin.h pluginmsg.h
|
||||
bbcodeparser.o: bbcodeparser.h htmlfilter.h
|
||||
compress.o: compress.h log.h
|
||||
config.o: config.h ../confparser/confparser.h log.h data.h dirs.h item.h
|
||||
config.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
|
||||
config.o: functions.h function.h lastcontainer.h mounts.h mount.h error.h
|
||||
config.o: rebus.h loadavg.h plugin.h request.h requesttypes.h session.h
|
||||
config.o: plugindata.h thread.h compress.h acceptencodingparser.h
|
||||
config.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
config.o: pluginmsg.h misc.h
|
||||
data.o: data.h dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
|
||||
data.o: log.h groups.h group.h functions.h function.h lastcontainer.h
|
||||
data.o: mounts.h mount.h error.h rebus.h loadavg.h
|
||||
config.o: config.h confparser.h log.h plugin.h pluginmsg.h plugindata.h
|
||||
config.o: request.h requesttypes.h session.h item.h error.h user.h rebus.h
|
||||
config.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
config.o: htmlfilter.h postmultiparser.h ticket.h system.h dirs.h
|
||||
config.o: dircontainer.h db.h group.h ugcontainer.h mounts.h mount.h users.h
|
||||
config.o: lastcontainer.h groups.h loadavg.h sessionmanager.h
|
||||
config.o: sessioncontainer.h ../functions/functions.h
|
||||
config.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
config.o: ../core/request.h ../core/config.h ../core/system.h
|
||||
config.o: ../core/notify.h ../../ezc/src/ezc.h ../functions/functionparser.h
|
||||
config.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
config.o: ../functions/privchanger.h ../functions/chown.h ../functions/cp.h
|
||||
config.o: ../functions/createthread.h ../functions/createticket.h
|
||||
config.o: ../functions/default.h ../functions/download.h
|
||||
config.o: ../functions/editticket.h ../functions/emacs.h ../functions/last.h
|
||||
config.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
config.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
config.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
config.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
config.o: ../core/thread.h ../functions/funticket.h ../functions/uname.h
|
||||
config.o: ../functions/upload.h ../functions/who.h ../templates/templates.h
|
||||
config.o: ../templates/patterncacher.h ../core/item.h misc.h
|
||||
config.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
config.o: ../core/log.h ../templates/indexpatterns.h
|
||||
config.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h
|
||||
config.o: ../core/sessionmanager.h
|
||||
confparser.o: confparser.h misc.h item.h
|
||||
db.o: db.h item.h user.h group.h thread.h error.h log.h dircontainer.h
|
||||
db.o: ugcontainer.h ticket.h misc.h
|
||||
db_itemcolumns.o: db.h item.h user.h group.h thread.h error.h log.h
|
||||
db_itemcolumns.o: dircontainer.h ugcontainer.h ticket.h
|
||||
dircontainer.o: dircontainer.h item.h log.h
|
||||
dirs.o: dirs.h item.h dircontainer.h error.h log.h db.h user.h group.h
|
||||
dirs.o: thread.h ugcontainer.h ticket.h data.h users.h groups.h functions.h
|
||||
dirs.o: function.h lastcontainer.h mounts.h mount.h rebus.h loadavg.h
|
||||
dirs.o: request.h requesttypes.h session.h plugindata.h compress.h
|
||||
dirs.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
dirs.o: postmultiparser.h
|
||||
function.o: function.h item.h
|
||||
functioncodeparser.o: functioncodeparser.h item.h function.h log.h
|
||||
functionparser.o: functionparser.h requesttypes.h log.h item.h error.h data.h
|
||||
functionparser.o: dirs.h dircontainer.h users.h user.h ugcontainer.h groups.h
|
||||
functionparser.o: group.h functions.h function.h lastcontainer.h mounts.h
|
||||
functionparser.o: mount.h rebus.h loadavg.h db.h thread.h ticket.h request.h
|
||||
functionparser.o: session.h plugindata.h compress.h acceptencodingparser.h
|
||||
functionparser.o: acceptbaseparser.h htmlfilter.h postmultiparser.h
|
||||
functions.o: functions.h function.h item.h
|
||||
dirs.o: dirs.h item.h dircontainer.h db.h user.h group.h thread.h error.h
|
||||
dirs.o: log.h ugcontainer.h ticket.h request.h requesttypes.h session.h
|
||||
dirs.o: plugindata.h rebus.h compress.h acceptencodingparser.h
|
||||
dirs.o: acceptbaseparser.h htmlfilter.h postmultiparser.h config.h
|
||||
dirs.o: confparser.h
|
||||
groups.o: groups.h group.h ugcontainer.h log.h db.h item.h user.h thread.h
|
||||
groups.o: error.h dircontainer.h ticket.h
|
||||
htmlfilter.o: htmlfilter.h
|
||||
httpsimpleparser.o: httpsimpleparser.h
|
||||
lastcontainer.o: lastcontainer.h log.h
|
||||
loadavg.o: loadavg.h log.h
|
||||
locale.o: locale.h ../confparser/confparser.h log.h
|
||||
locale.o: locale.h confparser.h log.h
|
||||
log.o: log.h
|
||||
misc.o: misc.h item.h log.h data.h dirs.h dircontainer.h users.h user.h
|
||||
misc.o: ugcontainer.h groups.h group.h functions.h function.h lastcontainer.h
|
||||
misc.o: mounts.h mount.h error.h rebus.h loadavg.h
|
||||
misc.o: misc.h item.h log.h
|
||||
mount.o: mount.h
|
||||
mountparser.o: mountparser.h mount.h item.h error.h log.h data.h dirs.h
|
||||
mountparser.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
|
||||
mountparser.o: functions.h function.h lastcontainer.h mounts.h rebus.h
|
||||
mountparser.o: loadavg.h misc.h
|
||||
mounts.o: mounts.h mount.h error.h log.h data.h dirs.h item.h dircontainer.h
|
||||
mounts.o: users.h user.h ugcontainer.h groups.h group.h functions.h
|
||||
mounts.o: function.h lastcontainer.h rebus.h loadavg.h request.h
|
||||
mounts.o: requesttypes.h session.h plugindata.h thread.h compress.h
|
||||
mountparser.o: mountparser.h mount.h item.h error.h log.h dirs.h
|
||||
mountparser.o: dircontainer.h db.h user.h group.h thread.h ugcontainer.h
|
||||
mountparser.o: ticket.h request.h requesttypes.h session.h plugindata.h
|
||||
mountparser.o: rebus.h compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
mountparser.o: htmlfilter.h postmultiparser.h config.h confparser.h misc.h
|
||||
mounts.o: mounts.h mount.h error.h log.h dirs.h item.h dircontainer.h db.h
|
||||
mounts.o: user.h group.h thread.h ugcontainer.h ticket.h request.h
|
||||
mounts.o: requesttypes.h session.h plugindata.h rebus.h compress.h
|
||||
mounts.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
mounts.o: postmultiparser.h ticket.h mountparser.h db.h
|
||||
notify.o: log.h notify.h ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
notify.o: ../core/locale.h ../confparser/confparser.h ../templates/misc.h
|
||||
notify.o: ../templates/localefilter.h ../../ezc/src/ezc.h data.h dirs.h
|
||||
notify.o: item.h dircontainer.h users.h user.h ugcontainer.h groups.h group.h
|
||||
notify.o: functions.h function.h lastcontainer.h mounts.h mount.h error.h
|
||||
notify.o: rebus.h loadavg.h misc.h request.h requesttypes.h session.h
|
||||
notify.o: plugindata.h thread.h compress.h acceptencodingparser.h
|
||||
notify.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
plugin.o: plugin.h request.h requesttypes.h session.h item.h error.h log.h
|
||||
plugin.o: user.h rebus.h plugindata.h function.h thread.h compress.h
|
||||
plugin.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
plugin.o: postmultiparser.h ticket.h data.h dirs.h dircontainer.h users.h
|
||||
plugin.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h mounts.h
|
||||
plugin.o: mount.h loadavg.h pluginmsg.h
|
||||
plugindata.o: plugindata.h plugin.h request.h requesttypes.h session.h item.h
|
||||
plugindata.o: error.h log.h user.h rebus.h function.h thread.h compress.h
|
||||
plugindata.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
plugindata.o: postmultiparser.h ticket.h data.h dirs.h dircontainer.h users.h
|
||||
plugindata.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h
|
||||
plugindata.o: mounts.h mount.h loadavg.h pluginmsg.h
|
||||
postmultiparser.o: postmultiparser.h error.h log.h requesttypes.h data.h
|
||||
postmultiparser.o: dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
|
||||
postmultiparser.o: groups.h group.h functions.h function.h lastcontainer.h
|
||||
postmultiparser.o: mounts.h mount.h rebus.h loadavg.h
|
||||
rebus.o: log.h rebus.h misc.h item.h
|
||||
mounts.o: postmultiparser.h config.h confparser.h mountparser.h
|
||||
notify.o: log.h notify.h ../templatesnotify/templatesnotify.h
|
||||
notify.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h confparser.h
|
||||
notify.o: ../core/config.h ../templates/misc.h ../templates/localefilter.h
|
||||
notify.o: ../core/locale.h request.h requesttypes.h session.h item.h error.h
|
||||
notify.o: user.h plugindata.h rebus.h thread.h compress.h
|
||||
notify.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
notify.o: postmultiparser.h config.h ticket.h system.h dirs.h dircontainer.h
|
||||
notify.o: db.h group.h ugcontainer.h mounts.h mount.h users.h lastcontainer.h
|
||||
notify.o: groups.h loadavg.h misc.h
|
||||
plugin.o: plugin.h pluginmsg.h log.h plugindata.h config.h confparser.h
|
||||
plugin.o: request.h requesttypes.h session.h item.h error.h user.h rebus.h
|
||||
plugin.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
plugin.o: htmlfilter.h postmultiparser.h ticket.h system.h dirs.h
|
||||
plugin.o: dircontainer.h db.h group.h ugcontainer.h mounts.h mount.h users.h
|
||||
plugin.o: lastcontainer.h groups.h loadavg.h sessionmanager.h
|
||||
plugin.o: sessioncontainer.h ../functions/functions.h
|
||||
plugin.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
plugin.o: ../core/request.h ../core/config.h ../core/system.h
|
||||
plugin.o: ../core/notify.h ../../ezc/src/ezc.h ../functions/functionparser.h
|
||||
plugin.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
plugin.o: ../functions/privchanger.h ../functions/chown.h ../functions/cp.h
|
||||
plugin.o: ../functions/createthread.h ../functions/createticket.h
|
||||
plugin.o: ../functions/default.h ../functions/download.h
|
||||
plugin.o: ../functions/editticket.h ../functions/emacs.h ../functions/last.h
|
||||
plugin.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
plugin.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
plugin.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
plugin.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
plugin.o: ../core/thread.h ../functions/funticket.h ../functions/uname.h
|
||||
plugin.o: ../functions/upload.h ../functions/who.h ../templates/templates.h
|
||||
plugin.o: ../templates/patterncacher.h ../core/item.h misc.h
|
||||
plugin.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
plugin.o: ../core/log.h ../templates/indexpatterns.h
|
||||
plugin.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h
|
||||
plugin.o: ../core/sessionmanager.h
|
||||
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h config.h confparser.h
|
||||
plugindata.o: request.h requesttypes.h session.h item.h error.h user.h
|
||||
plugindata.o: rebus.h thread.h compress.h acceptencodingparser.h
|
||||
plugindata.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
plugindata.o: system.h dirs.h dircontainer.h db.h group.h ugcontainer.h
|
||||
plugindata.o: mounts.h mount.h users.h lastcontainer.h groups.h loadavg.h
|
||||
plugindata.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
|
||||
plugindata.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
plugindata.o: ../core/request.h ../core/config.h ../core/system.h
|
||||
plugindata.o: ../core/notify.h ../../ezc/src/ezc.h
|
||||
plugindata.o: ../functions/functionparser.h ../functions/adduser.h
|
||||
plugindata.o: ../functions/cat.h ../functions/chmod.h
|
||||
plugindata.o: ../functions/privchanger.h ../functions/chown.h
|
||||
plugindata.o: ../functions/cp.h ../functions/createthread.h
|
||||
plugindata.o: ../functions/createticket.h ../functions/default.h
|
||||
plugindata.o: ../functions/download.h ../functions/editticket.h
|
||||
plugindata.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
|
||||
plugindata.o: ../functions/logout.h ../functions/ls.h ../functions/mkdir.h
|
||||
plugindata.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
|
||||
plugindata.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
|
||||
plugindata.o: ../functions/subject.h ../functions/funthread.h
|
||||
plugindata.o: ../core/thread.h ../functions/funticket.h ../functions/uname.h
|
||||
plugindata.o: ../functions/upload.h ../functions/who.h
|
||||
plugindata.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
plugindata.o: ../core/item.h misc.h ../templates/ckeditorgetparser.h
|
||||
plugindata.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
plugindata.o: ../templates/indexpatterns.h ../templates/localefilter.h
|
||||
plugindata.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h
|
||||
postmultiparser.o: postmultiparser.h error.h log.h requesttypes.h config.h
|
||||
postmultiparser.o: confparser.h
|
||||
rebus.o: log.h rebus.h misc.h item.h request.h requesttypes.h session.h
|
||||
rebus.o: error.h user.h plugindata.h thread.h compress.h
|
||||
rebus.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
rebus.o: postmultiparser.h config.h confparser.h ticket.h
|
||||
request.o: request.h requesttypes.h session.h item.h error.h log.h user.h
|
||||
request.o: rebus.h plugindata.h function.h thread.h compress.h
|
||||
request.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
request.o: postmultiparser.h ticket.h getparser.h httpsimpleparser.h
|
||||
request.o: postparser.h cookieparser.h data.h dirs.h dircontainer.h users.h
|
||||
request.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h
|
||||
request.o: mounts.h mount.h loadavg.h plugin.h pluginmsg.h misc.h db.h
|
||||
requestcontroller.o: requestcontroller.h ../content/content.h ../core/item.h
|
||||
requestcontroller.o: ../templates/templates.h ../../ezc/src/ezc.h
|
||||
requestcontroller.o: ../templates/patterncacher.h misc.h item.h
|
||||
requestcontroller.o: ../templates/ckeditorgetparser.h
|
||||
requestcontroller.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
requestcontroller.o: ../core/locale.h ../confparser/confparser.h
|
||||
requestcontroller.o: ../templates/indexpatterns.h ../templates/localefilter.h
|
||||
requestcontroller.o: ../core/thread.h ../core/ticket.h ../core/db.h user.h
|
||||
requestcontroller.o: group.h thread.h error.h log.h dircontainer.h
|
||||
requestcontroller.o: ugcontainer.h ticket.h sessionmanager.h
|
||||
requestcontroller.o: sessioncontainer.h session.h rebus.h plugindata.h
|
||||
requestcontroller.o: functionparser.h requesttypes.h data.h dirs.h users.h
|
||||
requestcontroller.o: groups.h functions.h function.h lastcontainer.h mounts.h
|
||||
requestcontroller.o: mount.h loadavg.h request.h compress.h
|
||||
requestcontroller.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
requestcontroller.o: postmultiparser.h postparser.h httpsimpleparser.h
|
||||
requestcontroller.o: cookieparser.h notify.h
|
||||
requestcontroller.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
requestcontroller.o: ../templates/misc.h
|
||||
session.o: session.h item.h error.h log.h user.h rebus.h plugindata.h
|
||||
request.o: plugindata.h rebus.h thread.h compress.h acceptencodingparser.h
|
||||
request.o: acceptbaseparser.h htmlfilter.h postmultiparser.h config.h
|
||||
request.o: confparser.h ticket.h getparser.h httpsimpleparser.h postparser.h
|
||||
request.o: cookieparser.h plugin.h pluginmsg.h system.h dirs.h dircontainer.h
|
||||
request.o: db.h group.h ugcontainer.h mounts.h mount.h users.h
|
||||
request.o: lastcontainer.h groups.h loadavg.h sessionmanager.h
|
||||
request.o: sessioncontainer.h ../functions/functions.h
|
||||
request.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
request.o: ../core/request.h ../core/config.h ../core/system.h
|
||||
request.o: ../core/notify.h ../../ezc/src/ezc.h ../functions/functionparser.h
|
||||
request.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
request.o: ../functions/privchanger.h ../functions/chown.h ../functions/cp.h
|
||||
request.o: ../functions/createthread.h ../functions/createticket.h
|
||||
request.o: ../functions/default.h ../functions/download.h
|
||||
request.o: ../functions/editticket.h ../functions/emacs.h ../functions/last.h
|
||||
request.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
request.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
request.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
request.o: ../core/thread.h ../functions/funticket.h ../functions/uname.h
|
||||
request.o: ../functions/upload.h ../functions/who.h ../templates/templates.h
|
||||
request.o: ../templates/patterncacher.h ../core/item.h misc.h
|
||||
request.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
request.o: ../core/log.h ../templates/indexpatterns.h
|
||||
request.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h
|
||||
request.o: ../core/sessionmanager.h ../functions/functionbase.h
|
||||
session.o: session.h item.h error.h log.h user.h plugindata.h rebus.h
|
||||
sessioncontainer.o: sessioncontainer.h session.h item.h error.h log.h user.h
|
||||
sessioncontainer.o: rebus.h plugindata.h data.h dirs.h dircontainer.h users.h
|
||||
sessioncontainer.o: ugcontainer.h groups.h group.h functions.h function.h
|
||||
sessioncontainer.o: lastcontainer.h mounts.h mount.h loadavg.h
|
||||
sessioncontainer.o: plugindata.h rebus.h lastcontainer.h
|
||||
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
|
||||
sessionmanager.o: error.h log.h user.h rebus.h plugindata.h request.h
|
||||
sessionmanager.o: requesttypes.h function.h thread.h compress.h
|
||||
sessionmanager.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
sessionmanager.o: postmultiparser.h ticket.h data.h dirs.h dircontainer.h
|
||||
sessionmanager.o: users.h ugcontainer.h groups.h group.h functions.h
|
||||
sessionmanager.o: lastcontainer.h mounts.h mount.h loadavg.h sessionparser.h
|
||||
sessionmanager.o: plugin.h pluginmsg.h
|
||||
sessionmanager.o: error.h log.h user.h plugindata.h rebus.h lastcontainer.h
|
||||
sessionmanager.o: config.h confparser.h request.h requesttypes.h thread.h
|
||||
sessionmanager.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
sessionmanager.o: htmlfilter.h postmultiparser.h ticket.h system.h dirs.h
|
||||
sessionmanager.o: dircontainer.h db.h group.h ugcontainer.h mounts.h mount.h
|
||||
sessionmanager.o: users.h groups.h loadavg.h sessionparser.h plugin.h
|
||||
sessionmanager.o: pluginmsg.h ../functions/functions.h
|
||||
sessionmanager.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
sessionmanager.o: ../core/request.h ../core/config.h ../core/system.h
|
||||
sessionmanager.o: ../core/notify.h ../../ezc/src/ezc.h
|
||||
sessionmanager.o: ../functions/functionparser.h ../functions/adduser.h
|
||||
sessionmanager.o: ../functions/cat.h ../functions/chmod.h
|
||||
sessionmanager.o: ../functions/privchanger.h ../functions/chown.h
|
||||
sessionmanager.o: ../functions/cp.h ../functions/createthread.h
|
||||
sessionmanager.o: ../functions/createticket.h ../functions/default.h
|
||||
sessionmanager.o: ../functions/download.h ../functions/editticket.h
|
||||
sessionmanager.o: ../functions/emacs.h ../functions/last.h
|
||||
sessionmanager.o: ../functions/login.h ../functions/logout.h
|
||||
sessionmanager.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
sessionmanager.o: ../functions/node.h ../functions/priv.h
|
||||
sessionmanager.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
|
||||
sessionmanager.o: ../functions/subject.h ../functions/funthread.h
|
||||
sessionmanager.o: ../core/thread.h ../functions/funticket.h
|
||||
sessionmanager.o: ../functions/uname.h ../functions/upload.h
|
||||
sessionmanager.o: ../functions/who.h ../templates/templates.h
|
||||
sessionmanager.o: ../templates/patterncacher.h ../core/item.h misc.h
|
||||
sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
sessionmanager.o: ../core/log.h ../templates/indexpatterns.h
|
||||
sessionmanager.o: ../templates/localefilter.h ../core/locale.h
|
||||
sessionmanager.o: ../core/locale.h ../core/sessionmanager.h
|
||||
sessionparser.o: sessionparser.h session.h item.h error.h log.h user.h
|
||||
sessionparser.o: rebus.h plugindata.h sessioncontainer.h data.h dirs.h
|
||||
sessionparser.o: dircontainer.h users.h ugcontainer.h groups.h group.h
|
||||
sessionparser.o: functions.h function.h lastcontainer.h mounts.h mount.h
|
||||
sessionparser.o: loadavg.h
|
||||
users.o: users.h user.h ugcontainer.h log.h db.h item.h group.h thread.h
|
||||
users.o: error.h dircontainer.h ticket.h
|
||||
sessionparser.o: plugindata.h rebus.h sessioncontainer.h lastcontainer.h
|
||||
sessionparser.o: users.h ugcontainer.h request.h requesttypes.h thread.h
|
||||
sessionparser.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
sessionparser.o: htmlfilter.h postmultiparser.h config.h confparser.h
|
||||
sessionparser.o: ticket.h db.h group.h dircontainer.h
|
||||
system.o: system.h dirs.h item.h dircontainer.h db.h user.h group.h thread.h
|
||||
system.o: error.h log.h ugcontainer.h ticket.h request.h requesttypes.h
|
||||
system.o: session.h plugindata.h rebus.h compress.h acceptencodingparser.h
|
||||
system.o: acceptbaseparser.h htmlfilter.h postmultiparser.h config.h
|
||||
system.o: confparser.h mounts.h mount.h users.h lastcontainer.h groups.h
|
||||
system.o: loadavg.h misc.h notify.h ../templatesnotify/templatesnotify.h
|
||||
system.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
system.o: ../core/config.h ../templates/misc.h ../templates/localefilter.h
|
||||
system.o: ../core/locale.h ../functions/functions.h
|
||||
system.o: ../functions/functionbase.h ../core/item.h ../core/db.h
|
||||
system.o: ../core/request.h ../core/system.h ../core/notify.h
|
||||
system.o: ../functions/functionparser.h ../functions/adduser.h
|
||||
system.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
||||
system.o: ../functions/chown.h ../functions/cp.h ../functions/createthread.h
|
||||
system.o: ../functions/createticket.h ../functions/default.h
|
||||
system.o: ../functions/download.h ../functions/editticket.h
|
||||
system.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
|
||||
system.o: ../functions/logout.h ../functions/ls.h ../functions/mkdir.h
|
||||
system.o: ../functions/mv.h ../functions/node.h ../functions/priv.h
|
||||
system.o: ../functions/reload.h ../functions/rm.h ../functions/run.h
|
||||
system.o: ../functions/subject.h ../functions/funthread.h ../core/thread.h
|
||||
system.o: ../functions/funticket.h ../functions/uname.h ../functions/upload.h
|
||||
system.o: ../functions/who.h ../templates/templates.h
|
||||
system.o: ../templates/patterncacher.h ../core/item.h
|
||||
system.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
system.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
users.o: users.h user.h ugcontainer.h log.h lastcontainer.h request.h
|
||||
users.o: requesttypes.h session.h item.h error.h plugindata.h rebus.h
|
||||
users.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
users.o: htmlfilter.h postmultiparser.h config.h confparser.h ticket.h db.h
|
||||
users.o: group.h dircontainer.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
o = acceptbaseparser.o bbcodeparser.o compress.o config.o data.o db.o db_itemcolumns.o dircontainer.o dirs.o function.o functioncodeparser.o functionparser.o functions.o groups.o htmlfilter.o httpsimpleparser.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o plugindata.o postmultiparser.o rebus.o request.o requestcontroller.o session.o sessioncontainer.o sessionmanager.o sessionparser.o users.o
|
||||
o = Kopia config.o acceptbaseparser.o app.o bbcodeparser.o compress.o config.o confparser.o db.o db_itemcolumns.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o plugindata.o postmultiparser.o rebus.o request.o session.o sessioncontainer.o sessionmanager.o sessionparser.o system.o users.o
|
||||
|
|
|
@ -0,0 +1,398 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "app.h"
|
||||
#include "plugin.h"
|
||||
|
||||
|
||||
|
||||
App::App()
|
||||
{
|
||||
stdout_is_closed = false;
|
||||
last_sessions_save = time(0);
|
||||
|
||||
plugin.SetDb(&db);
|
||||
plugin.SetConfig(&config);
|
||||
plugin.SetRequest(&request);
|
||||
plugin.SetSystem(&system);
|
||||
plugin.SetFunctions(&functions);
|
||||
plugin.SetTemplates(&templates);
|
||||
plugin.SetSessionManager(&session_manager);
|
||||
|
||||
request.SetConfig(&config);
|
||||
|
||||
functions.SetConfig(&config);
|
||||
functions.SetRequest(&request);
|
||||
functions.SetDb(&db);
|
||||
functions.SetSystem(&system);
|
||||
functions.SetTemplates(&templates);
|
||||
functions.SetNotify(¬ify);
|
||||
|
||||
system.SetConfig(&config);
|
||||
system.SetRequest(&request);
|
||||
system.SetDb(&db);
|
||||
system.SetFunctions(&functions); // !! czy model musi cos wiedziec o funkcjach?
|
||||
system.SetTemplates(&templates);
|
||||
|
||||
templates_notify.SetConfig(&config);
|
||||
|
||||
notify.SetRequest(&request);
|
||||
notify.SetConfig(&config);
|
||||
notify.SetSystem(&system);
|
||||
notify.SetTemplatesNotify(&templates_notify);
|
||||
|
||||
templates.SetConfig(&config);
|
||||
templates.SetRequest(&request);
|
||||
templates.SetDb(&db);
|
||||
templates.SetSystem(&system);
|
||||
templates.SetFunctions(&functions);
|
||||
templates.SetSessionManager(&session_manager);
|
||||
|
||||
session_manager.SetLastContainer(&system.users.last);
|
||||
session_manager.SetConfig(&config);
|
||||
session_manager.SetRequest(&request);
|
||||
session_manager.SetSystem(&system);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool App::CreateFCGISocket()
|
||||
{
|
||||
const char * sock = config.fcgi_socket.c_str();
|
||||
|
||||
unlink(sock);
|
||||
|
||||
|
||||
|
||||
int s = FCGX_OpenSocket(sock, 10);
|
||||
|
||||
if( s < 0 )
|
||||
{
|
||||
log << log1 << "An error during creating a socket" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
chmod(sock, config.fcgi_socket_chmod);
|
||||
|
||||
passwd * pw = getpwnam(config.fcgi_socket_user.c_str());
|
||||
|
||||
if( !pw )
|
||||
{
|
||||
log << log1 << "There is no user: " << config.fcgi_socket_user << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
group * gr = getgrnam(config.fcgi_socket_group.c_str());
|
||||
|
||||
if( !gr )
|
||||
{
|
||||
log << log1 << "There is no group: " << config.fcgi_socket_group << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
chown(sock, pw->pw_uid, gr->gr_gid);
|
||||
|
||||
|
||||
if( setuid(pw->pw_uid) < 0 )
|
||||
{
|
||||
log << log1 << "I can't change the user into: " << config.fcgi_socket_user << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if( setgid(gr->gr_gid) < 0 )
|
||||
{
|
||||
int e = errno;
|
||||
|
||||
log << log1 << "I can't change the group into: " << config.fcgi_socket_group << " " << gr->gr_gid << logend;
|
||||
log << log1 << "errno: " << e << logend;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
dup2(s, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool App::Init()
|
||||
{
|
||||
request.Init();
|
||||
|
||||
if( !CreateFCGISocket() )
|
||||
return false;
|
||||
|
||||
system.Init();
|
||||
|
||||
functions.Create();
|
||||
|
||||
// !! teraz mamy dwa katalogi z templetami
|
||||
// !! o co chodzilo?
|
||||
if( !notify.Init() )
|
||||
return false;
|
||||
|
||||
|
||||
templates.ReadIndexFileNames();
|
||||
templates.ReadTemplates();
|
||||
templates.CreateFunctions();
|
||||
|
||||
|
||||
session_manager.LoadSessions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::Close()
|
||||
{
|
||||
session_manager.SaveSessions();
|
||||
session_manager.DeleteAllPluginsData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool App::BaseUrlRedirect()
|
||||
{
|
||||
if( request.role == Request::responder )
|
||||
{
|
||||
if( config.base_url_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( config.base_url_http_host == request.env_http_host )
|
||||
return false;
|
||||
|
||||
request.redirect_to = config.base_url + request.env_request_uri;
|
||||
}
|
||||
else
|
||||
{
|
||||
// authorizer
|
||||
|
||||
if( config.base_url_auth_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( config.base_url_auth_http_host == request.env_http_host )
|
||||
return false;
|
||||
|
||||
request.redirect_to = config.base_url_auth + request.env_request_uri;
|
||||
}
|
||||
|
||||
log << log3 << "RC: BaseUrlRedirect from: " << request.env_http_host << logend;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void App::ProcessRequest()
|
||||
{
|
||||
request.Clear();
|
||||
request.Read();
|
||||
|
||||
// when BaseUrlRedirect() return true we didn't have to set everything in request.Read()
|
||||
// in the future request.Read() can be split and at the beginning only environment variables will be read
|
||||
// and then BaseUrlRedirect() will be called (for performance)
|
||||
if( !BaseUrlRedirect() )
|
||||
{
|
||||
session_manager.DeleteOldSessions();
|
||||
session_manager.SetSession(); // set request.session as well
|
||||
|
||||
// !! tutaj dodac to ustawianie request.session
|
||||
|
||||
functions.Parse();
|
||||
|
||||
system.mounts.CalcCurMount();
|
||||
|
||||
ReadAdditionalInfo();
|
||||
Make();
|
||||
}
|
||||
|
||||
request.SendAll(); // !! czemu request sam sie chce wyslac? wrzucic to tutaj do app
|
||||
notify.ItemChanged(request.notify_code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void App::Start()
|
||||
{
|
||||
while( FCGX_Accept(&request.in, &request.out, &request.err, &request.env) == 0 )
|
||||
{
|
||||
system.load_avg.StartRequest();
|
||||
log << log2 << "---------------------------------------------------------------------------------" << logend;
|
||||
|
||||
try
|
||||
{
|
||||
ProcessRequest();
|
||||
}
|
||||
catch(const std::logic_error & e)
|
||||
{
|
||||
log << log1 << "std logic exception: " << e.what() << logend;
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
log << log1 << "std exception: " << e.what() << logend;
|
||||
}
|
||||
catch(const Error & e)
|
||||
{
|
||||
log << log1 << "exception: Error: " << e << logend;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
log << log1 << "uncaught unknown exception" << logend;
|
||||
}
|
||||
|
||||
SaveSessionsIfNeeded();
|
||||
|
||||
// !! this should be immediately after FCGX_Accept() but signals don't want to break FCGX_Accept
|
||||
//if( signal_hup )
|
||||
if( false )
|
||||
{
|
||||
log << logsave;
|
||||
FCGX_Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
request.ClearPostFileTmp();
|
||||
system.load_avg.StopRequest();
|
||||
log << logsave;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void App::SaveSessionsIfNeeded()
|
||||
{
|
||||
time_t t = time(0);
|
||||
|
||||
if( last_sessions_save + 86400 > t )
|
||||
return;
|
||||
|
||||
// saving once a day for safety
|
||||
last_sessions_save = t;
|
||||
session_manager.SaveSessions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// !! zmienic na lepsza nazwe
|
||||
void App::MakePage()
|
||||
{
|
||||
bool sent = false;
|
||||
|
||||
if( !request.redirect_to.empty() || !request.x_sendfile.empty() )
|
||||
return;
|
||||
|
||||
|
||||
if( request.is_item && request.item.auth == Item::auth_none &&
|
||||
request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK && request.pfunction )
|
||||
{
|
||||
if( request.pfunction->fun.url == "cat" )
|
||||
{
|
||||
request.page << request.item.content;
|
||||
sent = true;
|
||||
}
|
||||
else
|
||||
if( request.pfunction->fun.url == "run" )
|
||||
{
|
||||
templates.GenerateRunRaw();
|
||||
sent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !sent )
|
||||
{
|
||||
templates.Generate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::Make()
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
{
|
||||
log << log1 << "Content: there is no a root dir (dir_table is empty)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
// request->status can be changed by function_parser
|
||||
if( request.status == WINIX_ERR_OK )
|
||||
{
|
||||
if( system.DirsHaveReadExecPerm() )
|
||||
{
|
||||
if( request.method == Request::post )
|
||||
functions.MakePost();
|
||||
|
||||
if( request.redirect_to.empty() && request.status == WINIX_ERR_OK )
|
||||
functions.MakeGet();
|
||||
}
|
||||
else
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if( request.session->spam_score > 0 )
|
||||
log << log1 << "App: spam score: " << request.session->spam_score << logend;
|
||||
|
||||
if( request.IsParam("noredirect") )
|
||||
request.redirect_to.clear();
|
||||
|
||||
if( !request.redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( request.dir_table.empty() )
|
||||
{
|
||||
log << log1 << "App: there is no a root dir (dir_table is empty -- after calling a function)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.Call(WINIX_CONTENT_MAKE);
|
||||
MakePage();
|
||||
|
||||
// !! dodac parametr do konfiga wlaczajacy te informacje
|
||||
//request->PrintGetTable();
|
||||
//request->PrintEnv();
|
||||
//request->PrintIn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// !! dac lepsza nazwe i czy napewno w app to ma byc?
|
||||
void App::ReadAdditionalInfo()
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
return;
|
||||
|
||||
if( system.mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
if( db.GetThreadByDirId(request.dir_table.back()->id, request.thread) == WINIX_ERR_OK )
|
||||
request.is_thread = true;
|
||||
}
|
||||
else
|
||||
if( system.mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) == WINIX_ERR_OK )
|
||||
{
|
||||
request.is_ticket = true;
|
||||
|
||||
if( !request.is_item && (!request.pfunction || request.pfunction->fun.url == "ticket") )
|
||||
{
|
||||
db.GetItemById(request.ticket.item_id, request.item);
|
||||
// don't set request->is_item here
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucoreapp
|
||||
#define headerfilecmslucoreapp
|
||||
|
||||
#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 "config.h"
|
||||
#include "system.h"
|
||||
#include "mounts.h"
|
||||
#include "request.h"
|
||||
#include "sessionmanager.h"
|
||||
#include "notify.h"
|
||||
#include "db.h"
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
#include "templatesnotify/templatesnotify.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class App
|
||||
{
|
||||
public:
|
||||
|
||||
App();
|
||||
|
||||
bool Init();
|
||||
void Start();
|
||||
void Close();
|
||||
|
||||
|
||||
|
||||
// configuration read from a config file
|
||||
Config config;
|
||||
|
||||
// current request
|
||||
Request request;
|
||||
|
||||
// users sessions
|
||||
SessionManager session_manager;
|
||||
|
||||
// notifications (by emails)
|
||||
Notify notify;
|
||||
|
||||
// database
|
||||
Db db;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
model
|
||||
*/
|
||||
|
||||
// file system
|
||||
System system;
|
||||
|
||||
// false at the beginning
|
||||
bool stdout_is_closed;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
controller
|
||||
*/
|
||||
|
||||
// functions (ls, cat, emacs, ...)
|
||||
Functions functions;
|
||||
|
||||
|
||||
/*
|
||||
view
|
||||
*/
|
||||
|
||||
Templates templates;
|
||||
TemplatesNotify templates_notify;
|
||||
|
||||
|
||||
private:
|
||||
bool CreateFCGISocket();
|
||||
void ProcessRequest();
|
||||
bool BaseUrlRedirect();
|
||||
void DeleteAllPluginsData();
|
||||
void MakePage();
|
||||
void Make();
|
||||
void ReadAdditionalInfo();
|
||||
void SaveSessionsIfNeeded(); // !! wywalic do managara sesji??
|
||||
|
||||
// !! dodac do session managera?
|
||||
time_t last_sessions_save;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
208
core/config.cpp
208
core/config.cpp
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
#include "plugin.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
@ -17,10 +16,6 @@
|
|||
|
||||
Config::Config()
|
||||
{
|
||||
default_str.clear();
|
||||
default_int = 0;
|
||||
default_bool = false;
|
||||
|
||||
errors_to_stdout = true;
|
||||
}
|
||||
|
||||
|
@ -33,7 +28,7 @@ Config::Config()
|
|||
void Config::ShowError()
|
||||
{
|
||||
|
||||
switch( conf_parser.status )
|
||||
switch( parser.status )
|
||||
{
|
||||
case ConfParser::ok:
|
||||
log << log2 << "Config: syntax ok" << logend;
|
||||
|
@ -41,16 +36,16 @@ void Config::ShowError()
|
|||
|
||||
case ConfParser::cant_open_file:
|
||||
if( errors_to_stdout )
|
||||
std::cout << "Config: cant open a config file: " << data.config_file << std::endl;
|
||||
std::cout << "Config: cant open a config file: " << config_file << std::endl;
|
||||
|
||||
log << log1 << "Config: cant open a config file: " << data.config_file << logend;
|
||||
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: " << conf_parser.line << std::endl;
|
||||
std::cout << "Config: syntax error, line: " << parser.line << std::endl;
|
||||
|
||||
log << log1 << "Config: syntax error, line: " << conf_parser.line << logend;
|
||||
log << log1 << "Config: syntax error, line: " << parser.line << logend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +55,11 @@ void Config::ShowError()
|
|||
|
||||
|
||||
|
||||
bool Config::ReadConfig(bool errors_to_stdout_)
|
||||
bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
|
||||
{
|
||||
errors_to_stdout = errors_to_stdout_;
|
||||
|
||||
if( data.config_file.empty() )
|
||||
if( config_file.empty() )
|
||||
{
|
||||
log << log2 << "Config: name of the config file is empty" << logend;
|
||||
return false;
|
||||
|
@ -72,14 +67,14 @@ bool Config::ReadConfig(bool errors_to_stdout_)
|
|||
|
||||
log << log2 << "Config: reading a config file" << logend;
|
||||
|
||||
conf_parser.SplitSingle(true);
|
||||
ConfParser::Status status = conf_parser.Parse( data.config_file );
|
||||
parser.SplitSingle(true);
|
||||
ConfParser::Status status = parser.Parse( config_file );
|
||||
|
||||
|
||||
if( status == ConfParser::ok )
|
||||
{
|
||||
AssignValues();
|
||||
data.SetAdditionalVariables();
|
||||
AssignValues(stdout_is_closed);
|
||||
SetAdditionalVariables();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -92,177 +87,148 @@ bool Config::ReadConfig(bool errors_to_stdout_)
|
|||
|
||||
|
||||
|
||||
void Config::AssignValues()
|
||||
void Config::AssignValues(bool stdout_is_closed)
|
||||
{
|
||||
data.log_file = Text("log_file");
|
||||
data.log_notify_file = Text("log_notify_file");
|
||||
data.fcgi_socket = Text("fcgi_socket");
|
||||
data.fcgi_socket_chmod = Int("fcgi_socket_chmod", 0770);
|
||||
data.fcgi_socket_user = Text("fcgi_socket_user");
|
||||
data.fcgi_socket_group = Text("fcgi_socket_group");
|
||||
data.log_level = Int("log_level", 1);
|
||||
data.log_request = Int("log_request", 1);
|
||||
log_file = Text("log_file");
|
||||
log_notify_file = Text("log_notify_file");
|
||||
fcgi_socket = Text("fcgi_socket");
|
||||
fcgi_socket_chmod = Int("fcgi_socket_chmod", 0770);
|
||||
fcgi_socket_user = Text("fcgi_socket_user");
|
||||
fcgi_socket_group = Text("fcgi_socket_group");
|
||||
log_level = Int("log_level", 1);
|
||||
log_request = Int("log_request", 1);
|
||||
log_stdout = Bool("log_stdout", false);
|
||||
|
||||
if( !data.stdout_is_closed )
|
||||
data.log_stdout = Bool("log_stdout", false);
|
||||
else
|
||||
data.log_stdout = false;
|
||||
post_file_max = Int("post_file_max", 8388608); // 8 MB
|
||||
auth_simplefs_dir = Text("auth_simplefs_dir");
|
||||
auth_hashfs_dir = Text("auth_hashfs_dir");
|
||||
auth_tmp_dir = Text("auth_tmp_dir");
|
||||
|
||||
data.post_file_max = Int("post_file_max", 8388608); // 8 MB
|
||||
data.auth_simplefs_dir = Text("auth_simplefs_dir");
|
||||
data.auth_hashfs_dir = Text("auth_hashfs_dir");
|
||||
data.auth_tmp_dir = Text("auth_tmp_dir");
|
||||
templates_dir = Text("templates_dir");
|
||||
templates_dir_default = Text("templates_dir_default");
|
||||
http_session_id_name = Text("http_session_id_name");
|
||||
db_database = Text("db_database");
|
||||
db_user = Text("db_user");
|
||||
db_pass = Text("db_pass");
|
||||
item_url_empty = Text("item_url_empty");
|
||||
|
||||
data.templates_dir = Text("templates_dir");
|
||||
data.templates_dir_default = Text("templates_dir_default");
|
||||
data.http_session_id_name = Text("http_session_id_name");
|
||||
data.db_database = Text("db_database");
|
||||
data.db_user = Text("db_user");
|
||||
data.db_pass = Text("db_pass");
|
||||
data.item_url_empty = Text("item_url_empty");
|
||||
base_server = Text("base_server");
|
||||
base_url = Text("base_url");
|
||||
base_url_auth = Text("base_url_auth");
|
||||
base_url_static = Text("base_url_static");
|
||||
base_url_common = Text("base_url_common");
|
||||
|
||||
data.base_server = Text("base_server");
|
||||
data.base_url = Text("base_url");
|
||||
data.base_url_auth = Text("base_url_auth");
|
||||
data.base_url_static = Text("base_url_static");
|
||||
data.base_url_common = Text("base_url_common");
|
||||
NoLastSlash(base_server);
|
||||
NoLastSlash(base_url);
|
||||
NoLastSlash(base_url_auth);
|
||||
NoLastSlash(base_url_static);
|
||||
NoLastSlash(base_url_common);
|
||||
|
||||
NoLastSlash(data.base_server);
|
||||
NoLastSlash(data.base_url);
|
||||
NoLastSlash(data.base_url_auth);
|
||||
NoLastSlash(data.base_url_static);
|
||||
NoLastSlash(data.base_url_common);
|
||||
priv_no_user = Text("priv_no_user", "-- no user --");
|
||||
priv_no_group = Text("priv_no_group", "-- no group --");
|
||||
|
||||
data.priv_no_user = Text("priv_no_user", "-- no user --");
|
||||
data.priv_no_group = Text("priv_no_group", "-- no group --");
|
||||
session_max_idle = Int("session_max_idle", 10800); // 3h
|
||||
session_remember_max_idle = Int("session_remember_max_idle", 16070400); // 3 months
|
||||
session_file = Text("session_file");
|
||||
|
||||
data.session_max_idle = Int("session_max_idle", 10800); // 3h
|
||||
data.session_remember_max_idle = Int("session_remember_max_idle", 16070400); // 3 months
|
||||
data.session_file = Text("session_file");
|
||||
compression = Bool("compression", true);
|
||||
html_filter = Bool("html_filter", true);
|
||||
|
||||
data.compression = Bool("compression", true);
|
||||
data.html_filter = Bool("html_filter", true);
|
||||
locale_str = Text("locale", "en");
|
||||
locale_dir = Text("locale_dir");
|
||||
locale_dir_default = Text("locale_dir_default");
|
||||
|
||||
data.locale_str = Text("locale", "en");
|
||||
data.locale_dir = Text("locale_dir");
|
||||
data.locale_dir_default = Text("locale_dir_default");
|
||||
title_separator = Text("title_separator", " / ");
|
||||
|
||||
data.title_separator = Text("title_separator", " / ");
|
||||
|
||||
|
||||
ListText(data.plugin_file, "plugins");
|
||||
parser.ListText("plugins", plugin_file);
|
||||
}
|
||||
|
||||
|
||||
void Config::SetAdditionalVariables()
|
||||
{
|
||||
SetHttpHost(base_url, base_url_http_host);
|
||||
SetHttpHost(base_url_auth, base_url_auth_http_host);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Config::SetHttpHost(const std::string & in, std::string & out)
|
||||
{
|
||||
if( strncmp(in.c_str(), "http://", 7) == 0 )
|
||||
out = in.substr(7);
|
||||
else
|
||||
if( strncmp(in.c_str(), "https://", 8) == 0 )
|
||||
out = in.substr(8);
|
||||
else
|
||||
out.clear(); // if empty the RequestController::BaseUrlRedirect() returns false and no redirecting will be done
|
||||
}
|
||||
|
||||
|
||||
std::string Config::Text(const char * name)
|
||||
{
|
||||
return Text(std::string(name), default_str);
|
||||
return parser.Text(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string Config::Text(const char * name, const char * def)
|
||||
{
|
||||
return Text(std::string(name), std::string(def));
|
||||
return parser.Text(name, def);
|
||||
}
|
||||
|
||||
|
||||
std::string Config::Text(const std::string & name, const std::string & def)
|
||||
{
|
||||
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
|
||||
|
||||
if( i == conf_parser.table_single.end() )
|
||||
return def;
|
||||
|
||||
return i->second;
|
||||
return parser.Text(name, def);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Config::Int(const char * name)
|
||||
{
|
||||
return Int(std::string(name), default_int);
|
||||
return parser.Int(name);
|
||||
}
|
||||
|
||||
|
||||
int Config::Int(const char * name, int def)
|
||||
{
|
||||
return Int(std::string(name), def);
|
||||
return parser.Int(name, def);
|
||||
}
|
||||
|
||||
|
||||
int Config::Int(const std::string & name, int def)
|
||||
{
|
||||
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
|
||||
|
||||
if( i == conf_parser.table_single.end() || i->second.empty() )
|
||||
return def;
|
||||
|
||||
long res = (i->second[0] == '0')? strtol(i->second.c_str() + 1, 0, 8) : strtol(i->second.c_str(), 0, 10);
|
||||
|
||||
return res;
|
||||
return parser.Int(name, def);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const char * name)
|
||||
{
|
||||
return Bool(std::string(name), default_bool);
|
||||
return parser.Bool(name);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const char * name, bool def)
|
||||
{
|
||||
return Bool(std::string(name), def);
|
||||
return parser.Bool(name, def);
|
||||
}
|
||||
|
||||
|
||||
bool Config::Bool(const std::string & name, bool def)
|
||||
{
|
||||
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
|
||||
|
||||
if( i == conf_parser.table_single.end() || i->second.empty() )
|
||||
return def;
|
||||
|
||||
bool res = false;
|
||||
|
||||
if( EqualNoCase(i->second.c_str(), "true") ||
|
||||
EqualNoCase(i->second.c_str(), "yes") ||
|
||||
EqualNoCase(i->second.c_str(), "1")
|
||||
)
|
||||
res = true;
|
||||
|
||||
return res;
|
||||
return parser.Bool(name, def);
|
||||
}
|
||||
|
||||
|
||||
// in lists we don't use default values
|
||||
void Config::ListText(std::vector<std::string> & list, const char * name)
|
||||
|
||||
void Config::ListText(const char * name, std::vector<std::string> & list)
|
||||
{
|
||||
ListText(list, std::string(name));
|
||||
parser.ListText(name, list);
|
||||
}
|
||||
|
||||
|
||||
void Config::ListText(std::vector<std::string> & list, const std::string & name)
|
||||
void Config::ListText(const std::string & name, std::vector<std::string> & list)
|
||||
{
|
||||
list.clear();
|
||||
|
||||
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
|
||||
|
||||
if( i != conf_parser.table_single.end() )
|
||||
{
|
||||
list.push_back(i->second);
|
||||
return;
|
||||
}
|
||||
|
||||
ConfParser::Table::iterator z = conf_parser.table.find(name);
|
||||
|
||||
if( z != conf_parser.table.end() )
|
||||
{
|
||||
list = z->second;
|
||||
return;
|
||||
}
|
||||
parser.ListText(name, list);
|
||||
}
|
||||
|
||||
|
||||
|
|
142
core/config.h
142
core/config.h
|
@ -11,43 +11,157 @@
|
|||
#define headerfilecmslucoreconfig
|
||||
|
||||
#include <string>
|
||||
#include "../confparser/confparser.h"
|
||||
#include "confparser.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class Config
|
||||
{
|
||||
|
||||
public:
|
||||
Config();
|
||||
bool ReadConfig(bool errors_to_stdout_);
|
||||
|
||||
// name of the config file (full path can be)
|
||||
std::string config_file;
|
||||
|
||||
// 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
|
||||
bool log_stdout;
|
||||
|
||||
// how many requests should be logged in the same time
|
||||
// default: 1
|
||||
int log_request;
|
||||
|
||||
// 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::string templates_dir;
|
||||
std::string templates_dir_default; // templates from winix
|
||||
|
||||
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::string priv_no_user;
|
||||
std::string 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;
|
||||
|
||||
// allow the html ouput to be compressed
|
||||
bool compression;
|
||||
|
||||
// plugins
|
||||
std::vector<std::string> plugin_file;
|
||||
|
||||
// the html code is cleaned by our filter
|
||||
bool html_filter;
|
||||
|
||||
// the url of a new empty item (if there is not the subject too)
|
||||
std::string item_url_empty;
|
||||
|
||||
// maximum length of a file send by post multipart form
|
||||
// 0 - not used
|
||||
int post_file_max;
|
||||
|
||||
// directories for static files
|
||||
std::string auth_simplefs_dir;
|
||||
std::string auth_hashfs_dir;
|
||||
|
||||
// temporary directory for static content used by the upload function
|
||||
// should be on the same partition as auth_simplefs_dir and auth_hashfs_dir
|
||||
std::string auth_tmp_dir;
|
||||
|
||||
// default locale: en pl
|
||||
std::string locale_str;
|
||||
|
||||
// directory with locale files
|
||||
std::string locale_dir;
|
||||
|
||||
// directory with default locale files (those from winix)
|
||||
std::string locale_dir_default;
|
||||
|
||||
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
|
||||
std::string base_server;
|
||||
|
||||
// the main address of the site (e.g. http://www.someserver.com)
|
||||
std::string base_url;
|
||||
|
||||
// static content authorized by winix
|
||||
std::string base_url_auth;
|
||||
|
||||
// static content not authorized by winix
|
||||
std::string base_url_static;
|
||||
|
||||
// additional static server for common content (not authorized)
|
||||
std::string base_url_common;
|
||||
|
||||
// separator used in <title> html tag
|
||||
std::string title_separator;
|
||||
|
||||
|
||||
// based on base_url
|
||||
// set by SetAdditionalVariables()
|
||||
// without the first part http:// (or https://) or the whole string is empty
|
||||
std::string base_url_http_host;
|
||||
std::string base_url_auth_http_host;
|
||||
|
||||
|
||||
Config();
|
||||
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
||||
|
||||
std::string Text(const char * name);
|
||||
std::string Text(const char * name, const char * def);
|
||||
std::string Text(const std::string & name, const std::string & def);
|
||||
|
||||
int Int(const char *);
|
||||
int Int(const char * name, int def);
|
||||
int Int(const std::string & name, int def);
|
||||
|
||||
bool Bool(const char *);
|
||||
bool Bool(const char * name, bool def);
|
||||
bool Bool(const std::string & name, bool def);
|
||||
|
||||
void ListText(std::vector<std::string> & list, const char * name);
|
||||
void ListText(std::vector<std::string> & list, const std::string & name);
|
||||
void ListText(const char * name, std::vector<std::string> & list);
|
||||
void ListText(const std::string & name, std::vector<std::string> & list);
|
||||
|
||||
void NoLastSlash(std::string & s);
|
||||
void NoFirstHttp(std::string & s);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
ConfParser conf_parser;
|
||||
void ShowError();
|
||||
void AssignValues();
|
||||
void AssignValues(bool stdout_is_closed);
|
||||
void SetHttpHost(const std::string & in, std::string & out);
|
||||
void SetAdditionalVariables();
|
||||
|
||||
ConfParser parser;
|
||||
|
||||
std::string default_str;
|
||||
int default_int;
|
||||
|
@ -58,7 +172,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
extern Config config;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "confparser.h"
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
|
||||
|
@ -24,6 +24,10 @@ ConfParser::ConfParser()
|
|||
list_delimiter = ',';
|
||||
split_single = false;
|
||||
skip_empty = false;
|
||||
|
||||
default_str = "";
|
||||
default_int = 0;
|
||||
default_bool = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -377,3 +381,161 @@ std::string::size_type i;
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::string ConfParser::Text(const char * name)
|
||||
{
|
||||
return Text(std::string(name), default_str);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string ConfParser::Text(const char * name, const char * def)
|
||||
{
|
||||
return Text(std::string(name), std::string(def));
|
||||
}
|
||||
|
||||
|
||||
std::string ConfParser::Text(const std::string & name, const std::string & 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ConfParser::Int(const char * name)
|
||||
{
|
||||
return Int(std::string(name), default_int);
|
||||
}
|
||||
|
||||
|
||||
int ConfParser::Int(const char * name, int def)
|
||||
{
|
||||
return Int(std::string(name), def);
|
||||
}
|
||||
|
||||
|
||||
int ConfParser::ToInt(const std::string & value)
|
||||
{
|
||||
long res = (value[0] == '0')? strtol(value.c_str() + 1, 0, 8) : strtol(value.c_str(), 0, 10);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int ConfParser::Int(const std::string & 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);
|
||||
}
|
||||
|
||||
|
||||
bool ConfParser::Bool(const char * name)
|
||||
{
|
||||
return Bool(std::string(name), default_bool);
|
||||
}
|
||||
|
||||
|
||||
bool ConfParser::Bool(const char * name, bool def)
|
||||
{
|
||||
return Bool(std::string(name), def);
|
||||
}
|
||||
|
||||
|
||||
bool ConfParser::ToBool(const std::string & value)
|
||||
{
|
||||
return ( EqualNoCase(value.c_str(), "true") ||
|
||||
EqualNoCase(value.c_str(), "yes") ||
|
||||
EqualNoCase(value.c_str(), "1")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool ConfParser::Bool(const std::string & 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::string & def)
|
||||
{
|
||||
default_str = def;
|
||||
}
|
||||
|
||||
void ConfParser::SetDefaultInt(int def)
|
||||
{
|
||||
default_int = def;
|
||||
}
|
||||
|
||||
void ConfParser::SetDefaultBool(bool def)
|
||||
{
|
||||
default_bool = def;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// in lists we don't use default values
|
||||
void ConfParser::ListText(const char * name, std::vector<std::string> & list)
|
||||
{
|
||||
ListText(std::string(name), list);
|
||||
}
|
||||
|
||||
|
||||
void ConfParser::ListText(const std::string & name, std::vector<std::string> & 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -202,8 +202,45 @@ public:
|
|||
void SkipEmpty(bool skip);
|
||||
|
||||
|
||||
/*
|
||||
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::string Text(const char * name);
|
||||
std::string Text(const char * name, const char * def);
|
||||
std::string Text(const std::string & name, const std::string & def);
|
||||
int Int(const char *);
|
||||
int Int(const char * name, int def);
|
||||
int Int(const std::string & name, int def);
|
||||
bool Bool(const char *);
|
||||
bool Bool(const char * name, bool def);
|
||||
bool Bool(const std::string & 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 is: 0
|
||||
default bool is: false
|
||||
*/
|
||||
void SetDefaultText(const std::string & def);
|
||||
void SetDefaultInt(int 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 char * name, std::vector<std::string> & list);
|
||||
void ListText(const std::string & name, std::vector<std::string> & list);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -284,6 +321,14 @@ private:
|
|||
bool skip_empty;
|
||||
|
||||
|
||||
|
||||
std::string default_str;
|
||||
int default_int;
|
||||
bool default_bool;
|
||||
|
||||
int ToInt(const std::string & value);
|
||||
bool ToBool(const std::string & value);
|
||||
|
||||
Status ParseFile();
|
||||
void AddOption();
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Data::Data()
|
||||
{
|
||||
signal_hup = false;
|
||||
stdout_is_closed = false;
|
||||
how_many_logged = 0;
|
||||
|
||||
// the rest will be read from a config file
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Data::SetAdditionalVariables()
|
||||
{
|
||||
SetHttpHost(base_url, base_url_http_host);
|
||||
SetHttpHost(base_url_auth, base_url_auth_http_host);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Data::SetHttpHost(const std::string & in, std::string & out)
|
||||
{
|
||||
if( strncmp(in.c_str(), "http://", 7) == 0 )
|
||||
out = in.substr(7);
|
||||
else
|
||||
if( strncmp(in.c_str(), "https://", 8) == 0 )
|
||||
out = in.substr(8);
|
||||
else
|
||||
out.clear(); // if empty the RequestController::BaseUrlRedirect() returns false and no redirecting will be done
|
||||
}
|
213
core/data.h
213
core/data.h
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucoredata
|
||||
#define headerfilecmslucoredata
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string.h>
|
||||
|
||||
#include "dirs.h"
|
||||
#include "users.h"
|
||||
#include "groups.h"
|
||||
#include "functions.h"
|
||||
#include "lastcontainer.h"
|
||||
#include "mounts.h"
|
||||
#include "rebus.h"
|
||||
#include "loadavg.h"
|
||||
|
||||
|
||||
class Data
|
||||
{
|
||||
public:
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// members read from a config file
|
||||
|
||||
// name of the config file (full path can be)
|
||||
std::string config_file;
|
||||
|
||||
// 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
|
||||
bool log_stdout;
|
||||
|
||||
// how many requests should be logged in the same time
|
||||
// default: 1
|
||||
int log_request;
|
||||
|
||||
// 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::string templates_dir;
|
||||
std::string templates_dir_default; // templates from winix
|
||||
|
||||
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::string priv_no_user;
|
||||
std::string 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;
|
||||
|
||||
// allow the html ouput to be compressed
|
||||
bool compression;
|
||||
|
||||
// plugins
|
||||
std::vector<std::string> plugin_file;
|
||||
|
||||
// the html code is cleaned by our filter
|
||||
bool html_filter;
|
||||
|
||||
// the url of a new empty item (if there is not the subject too)
|
||||
std::string item_url_empty;
|
||||
|
||||
// maximum length of a file send by post multipart form
|
||||
// 0 - not used
|
||||
int post_file_max;
|
||||
|
||||
// directories for static files
|
||||
std::string auth_simplefs_dir;
|
||||
std::string auth_hashfs_dir;
|
||||
|
||||
// temporary directory for static content used by the upload function
|
||||
// should be on the same partition as auth_simplefs_dir and auth_hashfs_dir
|
||||
std::string auth_tmp_dir;
|
||||
|
||||
// default locale: en pl
|
||||
std::string locale_str;
|
||||
|
||||
// directory with locale files
|
||||
std::string locale_dir;
|
||||
|
||||
// directory with default locale files (those from winix)
|
||||
std::string locale_dir_default;
|
||||
|
||||
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
|
||||
std::string base_server;
|
||||
|
||||
// the main address of the site (e.g. http://www.someserver.com)
|
||||
std::string base_url;
|
||||
|
||||
// static content authorized by winix
|
||||
std::string base_url_auth;
|
||||
|
||||
// static content not authorized by winix
|
||||
std::string base_url_static;
|
||||
|
||||
// additional static server for common content (not authorized)
|
||||
std::string base_url_common;
|
||||
|
||||
// separator used in <title> html tag
|
||||
std::string title_separator;
|
||||
|
||||
|
||||
|
||||
// end config members
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// false at the beginning
|
||||
bool stdout_is_closed;
|
||||
|
||||
// true if there was SIGHUP signal
|
||||
volatile bool signal_hup;
|
||||
|
||||
// contains current directories tree
|
||||
Dirs dirs;
|
||||
|
||||
// based on base_url
|
||||
// set by SetAdditionalVariables()
|
||||
// without the first part http:// (or https://) or the whole string is empty
|
||||
std::string base_url_http_host;
|
||||
std::string base_url_auth_http_host;
|
||||
|
||||
|
||||
|
||||
// call this method after the config file is read
|
||||
void SetAdditionalVariables();
|
||||
|
||||
|
||||
|
||||
// users
|
||||
Users users;
|
||||
|
||||
// groups
|
||||
Groups groups;
|
||||
|
||||
// functions (ls, cat, etc)
|
||||
Functions functions;
|
||||
|
||||
// for 'last' function
|
||||
LastContainer last;
|
||||
|
||||
// mount points
|
||||
Mounts mounts;
|
||||
|
||||
// rebus (captcha)
|
||||
Rebus rebus;
|
||||
|
||||
// the time when the winix starts
|
||||
time_t system_start;
|
||||
|
||||
// how many logged users
|
||||
long how_many_logged;
|
||||
|
||||
// load averages
|
||||
LoadAvg load_avg;
|
||||
|
||||
Data();
|
||||
|
||||
|
||||
private:
|
||||
void SetHttpHost(const std::string & in, std::string & out);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
extern Data data;
|
||||
|
||||
|
||||
#endif
|
|
@ -10,9 +10,19 @@
|
|||
#include "dirs.h"
|
||||
#include "error.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "data.h"
|
||||
#include "request.h"
|
||||
|
||||
|
||||
|
||||
void Dirs::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
void Dirs::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void Dirs::Clear()
|
||||
|
@ -21,6 +31,12 @@ void Dirs::Clear()
|
|||
}
|
||||
|
||||
|
||||
bool Dirs::HasReadExecAccessForRoot(const Item & item)
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
return (item.privileges & 01111) != 0; // !! in the future there'll be another 'x'
|
||||
}
|
||||
|
||||
|
||||
void Dirs::CheckRootDir()
|
||||
{
|
||||
|
@ -28,11 +44,11 @@ void Dirs::CheckRootDir()
|
|||
|
||||
if( i != dir_table.End() )
|
||||
{
|
||||
if( !request.HasReadExecAccessForRoot(*i) )
|
||||
if( !HasReadExecAccessForRoot(*i) )
|
||||
{
|
||||
i->privileges = 0755;
|
||||
log << log1 << "Dirs: there is no access for root (admin) to the root dir, setting 0755 for root dir" << logend;
|
||||
db.EditPrivById(*i, i->id);
|
||||
db->EditPrivById(*i, i->id);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -52,7 +68,7 @@ void Dirs::CheckRootDir()
|
|||
|
||||
// !! upewnic sie ze baza nie zmieni url (gdyby wczesniej juz byl w bazie pusty url)
|
||||
// !! zrobic jakis wyjatek do wprowadzania roota?
|
||||
if( db.AddItem(root) == WINIX_ERR_OK )
|
||||
if( db->AddItem(root) == WINIX_ERR_OK )
|
||||
{
|
||||
dir_table.PushBack(root);
|
||||
}
|
||||
|
@ -65,7 +81,7 @@ void Dirs::ReadDirs()
|
|||
{
|
||||
Clear();
|
||||
|
||||
db.GetDirs(dir_table);
|
||||
db->GetDirs(dir_table);
|
||||
CheckRootDir();
|
||||
dir_table.FindSpecialFolders();
|
||||
}
|
||||
|
@ -301,7 +317,7 @@ size_t Dirs::AnalyzeDir(Item * pdir, const std::string & path, long & dir_id, st
|
|||
for( ; i<path.size() && path[i] != '/' ; ++i)
|
||||
analyze_temp += path[i];
|
||||
|
||||
pdir = data.dirs.GetDir(analyze_temp, pdir->id);
|
||||
pdir = GetDir(analyze_temp, pdir->id);
|
||||
|
||||
if( !pdir )
|
||||
return old_i; // analyze_temp is not a directory
|
||||
|
@ -327,7 +343,7 @@ size_t Dirs::AnalyzeDir(Item * pdir, const std::string & path, long & dir_id, st
|
|||
*/
|
||||
int Dirs::AnalyzePath(const std::string & path, long & dir_id, std::string & dir, std::string & file)
|
||||
{
|
||||
Item * pdir = data.dirs.GetRootDir();
|
||||
Item * pdir = GetRootDir();
|
||||
dir = '/';
|
||||
file.clear();
|
||||
|
||||
|
@ -386,13 +402,30 @@ void Dirs::SplitPath(const std::string & path, std::string & dir, std::string &
|
|||
}
|
||||
|
||||
|
||||
|
||||
// !! dodac kasowanie z bazy
|
||||
bool Dirs::DelDir(long dir_id)
|
||||
{
|
||||
return dir_table.DelById(dir_id);
|
||||
}
|
||||
|
||||
|
||||
Error Dirs::AddDirectory(Item & item, bool add_to_dir_table)
|
||||
{
|
||||
if( item.type != Item::dir )
|
||||
return WINIX_ERR_DIR_EXPECTED;
|
||||
|
||||
Error status = db->AddItem(item);
|
||||
|
||||
if( status == WINIX_ERR_OK )
|
||||
{
|
||||
Item * pdir = AddDir(item);
|
||||
|
||||
if( add_to_dir_table && request->dir_table.back()->id == item.parent_id )
|
||||
request->dir_table.push_back(pdir);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
13
core/dirs.h
13
core/dirs.h
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "item.h"
|
||||
#include "dircontainer.h"
|
||||
#include "db.h"
|
||||
#include "request.h"
|
||||
|
||||
|
||||
// we do not support '..' in a path (for simplicity and security reasons)
|
||||
|
@ -29,6 +31,8 @@ public:
|
|||
void Clear();
|
||||
void ReadDirs();
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void SetDb(Db * pdb);
|
||||
|
||||
// these methods return false if there is no such a dir
|
||||
bool IsDir(long dir_id);
|
||||
|
@ -47,6 +51,7 @@ public:
|
|||
|
||||
|
||||
// these methods return null if there is no such a dir
|
||||
// !! zmienic nazwy wskazujace ze operujemy tylko na lokalnej tablicy
|
||||
Item * GetRootDir();
|
||||
Item * GetEtcDir();
|
||||
Item * GetDir(const std::string & name, long parent);
|
||||
|
@ -57,15 +62,21 @@ public:
|
|||
void CheckRootDir();
|
||||
|
||||
|
||||
// !! jak juz wczesniejsze nazwy beda zmienione to tutaj damy AddDir()
|
||||
Error AddDirectory(Item & item, bool add_to_dir_table = false);
|
||||
|
||||
private:
|
||||
|
||||
Request * request;
|
||||
Db * db;
|
||||
|
||||
DirContainer dir_table;
|
||||
|
||||
size_t AnalyzeDir(Item * pdir, const std::string & path, long & dir_id, std::string & dir);
|
||||
std::string analyze_temp;
|
||||
|
||||
bool ExtractName(const char * & s, std::string & name);
|
||||
|
||||
bool HasReadExecAccessForRoot(const Item & item);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -64,9 +64,11 @@
|
|||
#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;
|
||||
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "function.h"
|
||||
|
||||
|
||||
|
||||
Function::Function()
|
||||
{
|
||||
code = FUN_NONE;
|
||||
}
|
||||
|
||||
void Function::Clear()
|
||||
{
|
||||
code = FUN_NONE;
|
||||
item.Clear();
|
||||
}
|
||||
|
||||
|
||||
Function::Function(const Function & f)
|
||||
{
|
||||
code = f.code;
|
||||
item = f.item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Function & Function::operator=(const Function & f)
|
||||
{
|
||||
code = f.code;
|
||||
item = f.item;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucorefunction
|
||||
#define headerfilecmslucorefunction
|
||||
|
||||
#include <iostream>
|
||||
#include "item.h"
|
||||
|
||||
|
||||
#define FUN_NONE 0
|
||||
#define FUN_LS 1
|
||||
#define FUN_CAT 2
|
||||
#define FUN_NODE 3
|
||||
#define FUN_EMACS 4
|
||||
#define FUN_MKDIR 5
|
||||
#define FUN_DEFAULT 6
|
||||
#define FUN_PRIV 7
|
||||
#define FUN_RM 8
|
||||
#define FUN_LOGIN 9
|
||||
#define FUN_LOGOUT 10
|
||||
#define FUN_RUN 11
|
||||
#define FUN_WHO 12
|
||||
#define FUN_LAST 13
|
||||
#define FUN_CREATETHREAD 14
|
||||
#define FUN_THREAD 15
|
||||
#define FUN_RELOAD 16
|
||||
#define FUN_UPLOAD 17
|
||||
#define FUN_CREATETICKET 18
|
||||
#define FUN_EDITTICKET 19
|
||||
#define FUN_TICKET 20
|
||||
#define FUN_UPTIME 21
|
||||
#define FUN_MV 23
|
||||
#define FUN_UNAME 24
|
||||
#define FUN_CHMOD 25
|
||||
#define FUN_CHOWN 26
|
||||
#define FUN_CKEDITOR 27
|
||||
#define FUN_DOWNLOAD 28
|
||||
#define FUN_ADDUSER 29
|
||||
#define FUN_SUBJECT 30
|
||||
#define FUN_CP 31
|
||||
#define FUN_TINYMCE 32
|
||||
|
||||
|
||||
|
||||
class Function
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
int code;
|
||||
Item item;
|
||||
|
||||
void Clear();
|
||||
|
||||
Function();
|
||||
Function(const Function & f);
|
||||
Function & operator=(const Function & f);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "functioncodeparser.h"
|
||||
#include "function.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
|
||||
bool FunctionCodeParser::ContentHasOneRow(const Item & item)
|
||||
{
|
||||
for(size_t i=0 ; i<item.content.size() ; ++i)
|
||||
if( item.content[i] == '\n' )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int FunctionCodeParser::ParseValue(const char * s)
|
||||
{
|
||||
if( strncmp(s, "[fun:", 5) != 0 )
|
||||
return FUN_NONE;
|
||||
|
||||
const char * send;
|
||||
int result = strtol(s+5, (char**)&send, 10);
|
||||
|
||||
if( send==s+5 || strcmp(send, "]") != 0 )
|
||||
return FUN_NONE;
|
||||
|
||||
log << log2 << "FCP: function code: " << result << logend;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int FunctionCodeParser::Parse(const Item & item)
|
||||
{
|
||||
// format: [fun:1]
|
||||
// minimum size: 7 characters
|
||||
if( item.content.size() < 7 )
|
||||
return FUN_NONE;
|
||||
|
||||
if( !ContentHasOneRow(item) )
|
||||
return FUN_NONE;
|
||||
|
||||
return ParseValue(item.content.c_str());
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucorefunctioncodeparser
|
||||
#define headerfilecmslucorefunctioncodeparser
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "item.h"
|
||||
|
||||
|
||||
class FunctionCodeParser
|
||||
{
|
||||
bool ContentHasOneRow(const Item & item);
|
||||
int ParseValue(const char * s);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
int Parse(const Item & item);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Functions::Clear()
|
||||
{
|
||||
table.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::AddFun(int code, const char * url)
|
||||
{
|
||||
fun.code = code;
|
||||
fun.item.url = url;
|
||||
table.insert( std::make_pair(fun.item.url, fun) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// in the future we will read these functions from the database
|
||||
void Functions::ReadFunctions()
|
||||
{
|
||||
Clear();
|
||||
|
||||
fun.item.user_id = -1;
|
||||
fun.item.group_id = -1;
|
||||
fun.item.privileges = 0755;
|
||||
fun.item.parent_id = -1; // !! temporarily doesn't matter
|
||||
fun.item.id = -1;
|
||||
fun.item.type = Item::file;
|
||||
|
||||
|
||||
AddFun(FUN_LS, "ls");
|
||||
AddFun(FUN_CAT, "cat");
|
||||
AddFun(FUN_NODE, "node");
|
||||
AddFun(FUN_EMACS, "emacs");
|
||||
AddFun(FUN_MKDIR, "mkdir");
|
||||
AddFun(FUN_DEFAULT, "default");
|
||||
AddFun(FUN_PRIV, "priv");
|
||||
AddFun(FUN_RM, "rm");
|
||||
AddFun(FUN_LOGOUT, "logout");
|
||||
AddFun(FUN_LOGIN, "login");
|
||||
AddFun(FUN_RUN, "run");
|
||||
AddFun(FUN_WHO, "who");
|
||||
AddFun(FUN_LAST, "last");
|
||||
AddFun(FUN_CREATETHREAD, "createthread");
|
||||
AddFun(FUN_THREAD, "thread");
|
||||
AddFun(FUN_UPLOAD, "upload");
|
||||
AddFun(FUN_CREATETICKET, "createticket");
|
||||
AddFun(FUN_EDITTICKET, "editticket");
|
||||
AddFun(FUN_TICKET, "ticket");
|
||||
AddFun(FUN_UPTIME, "uptime");
|
||||
AddFun(FUN_MV, "mv");
|
||||
AddFun(FUN_UNAME, "uname");
|
||||
AddFun(FUN_CHMOD, "chmod");
|
||||
AddFun(FUN_CHOWN, "chown");
|
||||
AddFun(FUN_CKEDITOR, "ckeditor");
|
||||
AddFun(FUN_DOWNLOAD, "download");
|
||||
AddFun(FUN_ADDUSER, "adduser");
|
||||
AddFun(FUN_SUBJECT, "subject");
|
||||
AddFun(FUN_CP, "cp");
|
||||
AddFun(FUN_TINYMCE, "tinymce");
|
||||
|
||||
|
||||
// functions which need more privileges
|
||||
fun.item.privileges = 0700;
|
||||
|
||||
AddFun(FUN_RELOAD, "reload");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function * Functions::GetFunction(const std::string & name)
|
||||
{
|
||||
Table::iterator i = table.find(name);
|
||||
|
||||
if( i == table.end() )
|
||||
return 0;
|
||||
|
||||
return &(i->second);
|
||||
}
|
||||
|
||||
|
||||
// !! in the future there will be a special container where we can search through the Code object
|
||||
Function * Functions::GetFunction(int code)
|
||||
{
|
||||
Table::iterator i = table.begin();
|
||||
|
||||
for( ; i != table.end() ; ++i )
|
||||
{
|
||||
if( i->second.code == code )
|
||||
return &(i->second);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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 headerfilecmslucorefunctions
|
||||
#define headerfilecmslucorefunctions
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "function.h"
|
||||
|
||||
|
||||
|
||||
class Functions
|
||||
{
|
||||
|
||||
typedef std::map<std::string, Function> Table;
|
||||
Table table;
|
||||
|
||||
Function fun;
|
||||
|
||||
void AddFun(int code, const char * url);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void Clear();
|
||||
void ReadFunctions();
|
||||
|
||||
Function * GetFunction(const std::string & name);
|
||||
Function * GetFunction(int code);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
#include "groups.h"
|
||||
#include "db.h"
|
||||
|
||||
|
||||
|
||||
|
@ -25,11 +24,11 @@ void Groups::Clear()
|
|||
}
|
||||
|
||||
|
||||
void Groups::ReadGroups()
|
||||
void Groups::ReadGroups(Db * db)
|
||||
{
|
||||
Clear();
|
||||
|
||||
db.GetGroups(table);
|
||||
db->GetGroups(table);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "group.h"
|
||||
#include "ugcontainer.h"
|
||||
#include "db.h"
|
||||
|
||||
|
||||
|
||||
class Groups
|
||||
|
@ -29,7 +31,7 @@ public:
|
|||
|
||||
Groups();
|
||||
void Clear();
|
||||
void ReadGroups();
|
||||
void ReadGroups(Db * db);
|
||||
Group * GetGroup(long group_id);
|
||||
Group * GetGroup(const std::string & name);
|
||||
long GetGroupId(const std::string & name);
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#ifndef headerfilecmslucorelocale
|
||||
#define headerfilecmslucorelocale
|
||||
|
||||
#include "../confparser/confparser.h"
|
||||
#include "confparser.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
// !! locale nie powinny byc w templates?
|
||||
class Locale
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include "misc.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -100,17 +100,18 @@ void CorrectUrlOnlyAllowedChar(std::string & url)
|
|||
|
||||
if( url.empty() || url == "." )
|
||||
{
|
||||
if( data.item_url_empty.empty() )
|
||||
// !! brakuje config->
|
||||
//if( config->item_url_empty.empty() )
|
||||
url = "unnamed";
|
||||
else
|
||||
{
|
||||
url = data.item_url_empty;
|
||||
//else
|
||||
//{
|
||||
// url = config->item_url_empty;
|
||||
|
||||
CorrectUrlDots(url);
|
||||
CorrectUrlChars(url);
|
||||
ToSmall(url);
|
||||
// CorrectUrlDots(url);
|
||||
// CorrectUrlChars(url);
|
||||
// ToSmall(url);
|
||||
// we don't trim here and the string will not be empty
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if( url[0] >= '0' && url[0] <= '9' )
|
||||
|
|
|
@ -8,11 +8,16 @@
|
|||
*/
|
||||
|
||||
#include "mountparser.h"
|
||||
#include "data.h"
|
||||
#include "log.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
void MountParser::SetDirs(Dirs * pdirs)
|
||||
{
|
||||
dirs = pdirs;
|
||||
}
|
||||
|
||||
|
||||
bool MountParser::IsWhite(int c)
|
||||
{
|
||||
if( c==' ' || c=='\t' || c==13 || c==160 )
|
||||
|
@ -229,7 +234,7 @@ void MountParser::ReadMountPoint()
|
|||
{
|
||||
ReadWord(temp);
|
||||
|
||||
pdir = data.dirs.GetDir(temp);
|
||||
pdir = dirs->GetDir(temp);
|
||||
|
||||
if( pdir )
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mount.h"
|
||||
#include "item.h"
|
||||
#include "error.h"
|
||||
#include "dirs.h"
|
||||
|
||||
|
||||
|
||||
|
@ -27,10 +28,12 @@ class MountParser
|
|||
public:
|
||||
|
||||
Error Parse(const std::string & input, std::map<long, Mount> & output);
|
||||
|
||||
void SetDirs(Dirs * pdirs);
|
||||
|
||||
private:
|
||||
|
||||
Dirs * dirs;
|
||||
|
||||
bool IsWhite(int c);
|
||||
void SkipWhite();
|
||||
void SkipLine();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
#include "mounts.h"
|
||||
#include "data.h"
|
||||
#include "request.h"
|
||||
#include "log.h"
|
||||
#include "mountparser.h"
|
||||
|
@ -23,12 +22,29 @@ Mounts::Mounts()
|
|||
}
|
||||
|
||||
|
||||
void Mounts::SetDirs(Dirs * pdirs)
|
||||
{
|
||||
dirs = pdirs;
|
||||
}
|
||||
|
||||
|
||||
void Mounts::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
void Mounts::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reading from 'mounts'
|
||||
Error Mounts::ReadMounts(const std::string & mounts)
|
||||
{
|
||||
MountParser mp;
|
||||
mp.SetDirs(dirs);
|
||||
Error err = mp.Parse(mounts, mount_tab);
|
||||
|
||||
if( err != WINIX_ERR_OK )
|
||||
|
@ -49,7 +65,7 @@ Error Mounts::ReadMounts()
|
|||
{
|
||||
static std::string file = "fstab";
|
||||
|
||||
Item * etc = data.dirs.GetEtcDir();
|
||||
Item * etc = dirs->GetEtcDir();
|
||||
|
||||
if( !etc )
|
||||
{
|
||||
|
@ -58,7 +74,7 @@ Error Mounts::ReadMounts()
|
|||
}
|
||||
|
||||
Item fstab;
|
||||
Error err = db.GetItem(etc->id, file, fstab);
|
||||
Error err = db->GetItem(etc->id, file, fstab);
|
||||
|
||||
if( err == WINIX_ERR_NO_ITEM )
|
||||
{
|
||||
|
@ -82,7 +98,7 @@ void Mounts::MountCmsForRoot()
|
|||
mount.type = Mount::cms;
|
||||
mount.fs = Mount::simplefs;
|
||||
|
||||
Item * proot = data.dirs.GetRootDir();
|
||||
Item * proot = dirs->GetRootDir();
|
||||
|
||||
if( proot )
|
||||
mount.dir_id = proot->id;
|
||||
|
@ -105,10 +121,10 @@ std::vector<Item*>::reverse_iterator i;
|
|||
|
||||
// when the program starts (when the dir_table is empty()
|
||||
// we don't want to call MountCmsForRoot()
|
||||
if( request.dir_table.empty() )
|
||||
if( request->dir_table.empty() )
|
||||
return;
|
||||
|
||||
for(i = request.dir_table.rbegin() ; i!=request.dir_table.rend() ; ++i)
|
||||
for(i = request->dir_table.rbegin() ; i!=request->dir_table.rend() ; ++i)
|
||||
{
|
||||
std::map<long, Mount>::iterator m = mount_tab.find( (*i)->id );
|
||||
|
||||
|
@ -135,7 +151,7 @@ Mount * Mounts::CalcMount(long dir_id)
|
|||
{
|
||||
while( true )
|
||||
{
|
||||
Item * pdir = data.dirs.GetDir(dir_id);
|
||||
Item * pdir = dirs->GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
return 0;
|
||||
|
|
|
@ -16,12 +16,20 @@
|
|||
#include <string>
|
||||
#include "mount.h"
|
||||
#include "error.h"
|
||||
#include "dirs.h"
|
||||
#include "db.h"
|
||||
#include "request.h"
|
||||
|
||||
|
||||
|
||||
class Mounts
|
||||
{
|
||||
public:
|
||||
|
||||
void SetDirs(Dirs * pdirs);
|
||||
void SetDb(Db * pdb);
|
||||
void SetRequest(Request * prequest);
|
||||
|
||||
// dir_id, mount_point
|
||||
typedef std::map<long, Mount> MountTab;
|
||||
|
||||
|
@ -41,6 +49,10 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
Dirs * dirs;
|
||||
Db * db;
|
||||
Request * request;
|
||||
|
||||
MountTab mount_tab;
|
||||
|
||||
void MountCmsForRoot();
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "log.h"
|
||||
#include "notify.h"
|
||||
#include "data.h"
|
||||
#include "misc.h"
|
||||
#include "request.h"
|
||||
|
||||
|
@ -26,6 +25,30 @@ Notify * Notify::obj;
|
|||
|
||||
|
||||
|
||||
void Notify::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void Notify::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void Notify::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
void Notify::SetTemplatesNotify(TemplatesNotify * ptemplates_notify)
|
||||
{
|
||||
templates_notify = ptemplates_notify;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
methods for the second thread
|
||||
|
@ -71,10 +94,10 @@ void Notify::SendEmail(NotifyMsg & n)
|
|||
TemplatesNotifyFunctions::notify_msg = &n;
|
||||
|
||||
obj->Lock(); // templates can be reloaded from the first thread
|
||||
obj->templates_notify.Generate(n.lang);
|
||||
obj->templates_notify->Generate(n.lang);
|
||||
obj->Unlock();
|
||||
|
||||
SendEmail(n.email, obj->templates_notify.notify_str.str());
|
||||
SendEmail(n.email, obj->templates_notify->notify_str.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,7 +165,7 @@ void Notify::ReadTemplates()
|
|||
// the second thread can use our templates and we must Lock()
|
||||
// (the second thread is using Lock() too)
|
||||
Lock();
|
||||
templates_notify.Read();
|
||||
templates_notify->Read();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
@ -150,7 +173,7 @@ void Notify::ReadTemplates()
|
|||
|
||||
bool Notify::Init()
|
||||
{
|
||||
templates_notify.CreateFunctions();
|
||||
templates_notify->CreateFunctions();
|
||||
|
||||
|
||||
int t = pthread_create(&thread, 0, ThreadRoutine, (void*)this);
|
||||
|
@ -188,9 +211,9 @@ void Notify::CreateItemDir(std::string & dir, bool clear)
|
|||
if( clear )
|
||||
dir.clear();
|
||||
|
||||
for(size_t a=0 ; a<request.dir_table.size() ; ++a)
|
||||
for(size_t a=0 ; a<request->dir_table.size() ; ++a)
|
||||
{
|
||||
dir += request.dir_table[a]->url;
|
||||
dir += request->dir_table[a]->url;
|
||||
dir += '/';
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +221,9 @@ void Notify::CreateItemDir(std::string & dir, bool clear)
|
|||
|
||||
void Notify::CreateItemLink(std::string & link)
|
||||
{
|
||||
link = data.base_url;
|
||||
link = config->base_url;
|
||||
CreateItemDir(link, false);
|
||||
link += request.item.url;
|
||||
link += request->item.url;
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,8 +236,8 @@ Users::Iterator i;
|
|||
return;
|
||||
|
||||
n.notify_code = notify_code;
|
||||
n.current_mount_type = data.mounts.pmount->type;
|
||||
n.doc_base_url = data.base_url;
|
||||
n.current_mount_type = system->mounts.pmount->type;
|
||||
n.doc_base_url = config->base_url;
|
||||
CreateItemDir(n.item_dir);
|
||||
CreateItemLink(n.item_link);
|
||||
|
||||
|
@ -225,17 +248,17 @@ Users::Iterator i;
|
|||
{
|
||||
// don't clear notify_pool here -- it is used (and will be cleared) by the second thread
|
||||
|
||||
for(i=data.users.Begin() ; i != data.users.End() ; ++i)
|
||||
for(i=system->users.Begin() ; i != system->users.End() ; ++i)
|
||||
{
|
||||
sending = false;
|
||||
|
||||
if( data.mounts.pmount->type == Mount::thread )
|
||||
if( system->mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
if( (i->thread_notify & notify_code) != 0 )
|
||||
sending = true;
|
||||
}
|
||||
else
|
||||
if( data.mounts.pmount->type == Mount::cms )
|
||||
if( system->mounts.pmount->type == Mount::cms )
|
||||
{
|
||||
if( (i->cms_notify & notify_code) != 0 )
|
||||
sending = true;
|
||||
|
@ -244,7 +267,7 @@ Users::Iterator i;
|
|||
if( sending )
|
||||
{
|
||||
n.email = i->email;
|
||||
n.lang = Locale::StrToLang(data.locale_str);// !! bedzie osobno dla kazdego uzytkownika
|
||||
n.lang = Locale::StrToLang(config->locale_str);// !! bedzie osobno dla kazdego uzytkownika
|
||||
|
||||
if( n.lang == Locale::lang_unknown )
|
||||
n.lang = Locale::lang_en;
|
||||
|
|
|
@ -13,7 +13,12 @@
|
|||
#include <list>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "../templatesnotify/templatesnotify.h"
|
||||
#include "templatesnotify/templatesnotify.h"
|
||||
|
||||
#include "request.h"
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "users.h"
|
||||
|
||||
|
||||
#define WINIX_NOTIFY_ITEM_ADD 1
|
||||
|
@ -30,6 +35,11 @@ public:
|
|||
Notify();
|
||||
~Notify();
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetSystem(System * psystem);
|
||||
void SetTemplatesNotify(TemplatesNotify * ptemplates_notify);
|
||||
|
||||
void ReadTemplates();
|
||||
|
||||
bool Init();
|
||||
|
@ -43,6 +53,10 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
Request * request;
|
||||
Config * config;
|
||||
System * system;
|
||||
TemplatesNotify * templates_notify;
|
||||
|
||||
static void * ThreadRoutine(void * arg);
|
||||
bool Lock();
|
||||
|
@ -66,12 +80,12 @@ private:
|
|||
std::list<NotifyMsg> notify_pool;
|
||||
static Notify * obj;
|
||||
std::string command;
|
||||
TemplatesNotify templates_notify;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern Notify notify;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,15 @@ size_t i;
|
|||
Plugin::Plugin()
|
||||
{
|
||||
current_plugin = -1;
|
||||
request = 0;
|
||||
|
||||
db = 0;
|
||||
config = 0;
|
||||
request = 0;
|
||||
system = 0;
|
||||
functions = 0;
|
||||
templates = 0;
|
||||
session_manager = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,6 +48,67 @@ Plugin::~Plugin()
|
|||
}
|
||||
|
||||
|
||||
void Plugin::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
void Plugin::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void Plugin::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void Plugin::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
|
||||
void Plugin::SetFunctions(Functions * pfunctions)
|
||||
{
|
||||
functions = pfunctions;
|
||||
}
|
||||
|
||||
|
||||
void Plugin::SetTemplates(Templates * ptemplates)
|
||||
{
|
||||
templates = ptemplates;
|
||||
}
|
||||
|
||||
|
||||
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 && request && system && functions && templates && 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.request = request;
|
||||
info.system = system;
|
||||
info.functions = functions;
|
||||
info.templates = templates;
|
||||
info.session_manager = session_manager;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void Plugin::LoadPlugins(const std::vector<std::string> & plugins)
|
||||
{
|
||||
size_t i;
|
||||
|
@ -60,7 +130,8 @@ void * Plugin::LoadInitFun(const char * filename, Fun1 & fun_init)
|
|||
|
||||
if( !p )
|
||||
{
|
||||
log << log1 << "Plugin: cannot load a plugin: " << filename << logend;
|
||||
log << log1 << "Plugin: cannot load a plugin: \"" << filename << "\"" << logend;
|
||||
log << log1 << "Plugin: dlerror: " << dlerror() << logend;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -90,6 +161,9 @@ Fun1 fun_init;
|
|||
void * plugin_handle;
|
||||
int old_current_plugin;
|
||||
|
||||
if( !SetPointers(info) )
|
||||
return;
|
||||
|
||||
if( !(plugin_handle = LoadInitFun(filename, fun_init)) )
|
||||
return;
|
||||
|
||||
|
@ -102,7 +176,7 @@ int old_current_plugin;
|
|||
|
||||
PluginsItem item;
|
||||
item.handle = plugin_handle;
|
||||
item.plugin_name = (const char *)info.p1;
|
||||
item.plugin_name = reinterpret_cast<const char *>(info.p1);
|
||||
|
||||
plugins.push_back(item);
|
||||
|
||||
|
@ -113,11 +187,14 @@ int old_current_plugin;
|
|||
|
||||
void Plugin::Call(int message, Slots::iterator & slot)
|
||||
{
|
||||
if( !SetPointers(info) )
|
||||
return;
|
||||
|
||||
current_plugin = slot->second.index;
|
||||
info.plugin_id = current_plugin;
|
||||
|
||||
if( request.session && current_plugin != -1 )
|
||||
info.plugin_data_base = request.session->plugin_data.Get(current_plugin);
|
||||
if( request && request->session && current_plugin != -1 )
|
||||
info.plugin_data_base = request->session->plugin_data.Get(current_plugin);
|
||||
else
|
||||
info.plugin_data_base = 0;
|
||||
|
||||
|
@ -168,36 +245,43 @@ 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);
|
||||
|
|
|
@ -14,11 +14,15 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "request.h"
|
||||
#include "data.h"
|
||||
#include "pluginmsg.h"
|
||||
#include "log.h"
|
||||
#include "plugindata.h"
|
||||
#include "config.h"
|
||||
#include "request.h"
|
||||
#include "system.h"
|
||||
#include "sessionmanager.h"
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -33,6 +37,8 @@
|
|||
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)
|
||||
*/
|
||||
|
||||
|
||||
|
@ -50,10 +56,19 @@ struct PluginInfo
|
|||
// unique plugin identifier
|
||||
int plugin_id;
|
||||
|
||||
// objects from winix which are accessible from a plugin
|
||||
Db * db;
|
||||
Config * config;
|
||||
Request * request;
|
||||
System * system;
|
||||
Functions * functions;
|
||||
Templates * templates;
|
||||
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;
|
||||
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)
|
||||
|
@ -62,6 +77,8 @@ struct PluginInfo
|
|||
|
||||
void Clear()
|
||||
{
|
||||
// pointers to winix objects are not cleared here
|
||||
|
||||
p1 = 0;
|
||||
p2 = 0;
|
||||
l1 = 0;
|
||||
|
@ -109,6 +126,14 @@ public:
|
|||
Plugin();
|
||||
~Plugin();
|
||||
|
||||
void SetDb(Db * pdb);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetRequest(Request * prequest);
|
||||
void SetSystem(System * psystem);
|
||||
void SetFunctions(Functions * pfunctions);
|
||||
void SetTemplates(Templates * ptemplates);
|
||||
void SetSessionManager(SessionManager * psession_manager);
|
||||
|
||||
void LoadPlugin(const char * filename);
|
||||
void LoadPlugin(const std::string & filename);
|
||||
void LoadPlugins(const std::vector<std::string> & plugins);
|
||||
|
@ -134,6 +159,14 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
Db * db;
|
||||
Config * config;
|
||||
Request * request;
|
||||
System * system;
|
||||
Functions * functions;
|
||||
Templates * templates;
|
||||
SessionManager * session_manager;
|
||||
|
||||
|
||||
struct PluginsItem
|
||||
{
|
||||
|
@ -151,6 +184,8 @@ private:
|
|||
|
||||
void * LoadInitFun(const char * filename, Fun1 & fun_init);
|
||||
void Call(int message, Slots::iterator & slot);
|
||||
|
||||
bool SetPointers(PluginInfo & info);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
// when a session is changed (you can save a pointer to your data here)
|
||||
#define WINIX_SESSION_CHANGED 3002
|
||||
|
||||
// all plugins have been started, now you can init
|
||||
#define WINIX_PLUGIN_INIT 3003
|
||||
|
||||
// the winix is closing
|
||||
#define WINIX_CLOSE 3004
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "postmultiparser.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
|
||||
|
||||
|
||||
PostMultiParser::PostMultiParser()
|
||||
|
@ -18,16 +18,17 @@ PostMultiParser::PostMultiParser()
|
|||
}
|
||||
|
||||
|
||||
PostMultiParser::PostMultiParser(const PostMultiParser &)
|
||||
PostMultiParser::PostMultiParser(const PostMultiParser & p)
|
||||
{
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
config = p.config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PostMultiParser & PostMultiParser::operator=(const PostMultiParser &)
|
||||
PostMultiParser & PostMultiParser::operator=(const PostMultiParser & p)
|
||||
{
|
||||
in_buffer = new unsigned char[WINIX_POSTMULTI_INPUT_BUFFER];
|
||||
config = p.config;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -39,6 +40,11 @@ PostMultiParser::~PostMultiParser()
|
|||
}
|
||||
|
||||
|
||||
void PostMultiParser::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void PostMultiParser::ReadBoundary()
|
||||
{
|
||||
|
@ -263,10 +269,10 @@ bool has_boundary = false;
|
|||
content.erase(0, WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
}
|
||||
|
||||
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
|
||||
if( config->post_file_max != 0 && content_len > (size_t)config->post_file_max )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
|
||||
log << log1 << "PMP: content greater than " << config->post_file_max << " (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -317,10 +323,10 @@ bool has_boundary = false;
|
|||
content_len += 1;
|
||||
ReadChar();
|
||||
|
||||
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
|
||||
if( config->post_file_max != 0 && content_len > (size_t)config->post_file_max )
|
||||
{
|
||||
err = WINIX_ERR_INPUT_TOO_LARGE;
|
||||
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
|
||||
log << log1 << "PMP: content greater than " << config->post_file_max << " (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -433,14 +439,14 @@ void PostMultiParser::CreateTmpFile()
|
|||
{
|
||||
char buf[100];
|
||||
|
||||
if( data.auth_tmp_dir.empty() )
|
||||
if( config->auth_tmp_dir.empty() )
|
||||
{
|
||||
log << log1 << "PMP: auth_tmp_dir is not set in the config" << logend;
|
||||
err = WINIX_ERR_CANT_CREATE_FILE;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/winix_%u_%d_%u", data.auth_tmp_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
sprintf(buf, "%s/winix_%u_%d_%u", config->auth_tmp_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand());
|
||||
tmp_filename_postfix += 1;
|
||||
|
||||
tmp_file.open(buf, std::ios_base::binary | std::ios_base::out);
|
||||
|
@ -457,6 +463,8 @@ char buf[100];
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PostMultiParser::ReadPart()
|
||||
{
|
||||
name.clear();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <fstream>
|
||||
#include "error.h"
|
||||
#include "requesttypes.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
// 2 MB
|
||||
#define WINIX_POSTMULTI_INPUT_BUFFER 2097152
|
||||
|
@ -31,10 +33,13 @@ public:
|
|||
PostMultiParser & operator=(const PostMultiParser &);
|
||||
~PostMultiParser();
|
||||
|
||||
void SetConfig(Config * pconfig);
|
||||
Error Parse(FCGX_Stream * in_, PostTable & post_table_, PostFileTable & post_file_table_);
|
||||
|
||||
private:
|
||||
|
||||
Config * config;
|
||||
|
||||
FCGX_Stream * in;
|
||||
unsigned char * in_buffer;
|
||||
std::ofstream tmp_file;
|
||||
|
|
|
@ -12,9 +12,16 @@
|
|||
#include "log.h"
|
||||
#include "rebus.h"
|
||||
#include "misc.h"
|
||||
#include "request.h"
|
||||
|
||||
|
||||
|
||||
void Rebus::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
bool Rebus::InitPair(int a, int b, Item & item)
|
||||
{
|
||||
char buffer[100];
|
||||
|
@ -118,6 +125,37 @@ return result;
|
|||
|
||||
|
||||
|
||||
bool Rebus::CheckRebus()
|
||||
{
|
||||
if( !request->session )
|
||||
return false;
|
||||
|
||||
if( request->session->puser )
|
||||
// logged users don't have to use the rebus
|
||||
return true;
|
||||
|
||||
if( request->session->rebus_checked )
|
||||
return true;
|
||||
|
||||
request->session->rebus_checked = true;
|
||||
|
||||
if( !request->session->rebus_item )
|
||||
{
|
||||
log << log1 << "Rebus: rebus not set" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string * answer = request->PostVar("rebus");
|
||||
|
||||
if( answer && IsAnswerOk(request->session->rebus_item, *answer) )
|
||||
return true;
|
||||
|
||||
log << log1 << "Rebus: rebus has an incorrect answer" << logend;
|
||||
// don't add request->session->spam_score when the rebus has incorrect answer
|
||||
// a user could have made a mistake
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
class Request;
|
||||
|
||||
|
||||
class Rebus
|
||||
{
|
||||
public:
|
||||
|
@ -27,12 +30,17 @@ public:
|
|||
};
|
||||
|
||||
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void Init();
|
||||
Item * Rand();
|
||||
bool IsAnswerOk(Item * item, const std::string & answer);
|
||||
bool CheckRebus();
|
||||
|
||||
private:
|
||||
|
||||
Request * request;
|
||||
|
||||
bool InitPair(int a, int b, Item & item);
|
||||
|
||||
std::vector<Item> table;
|
||||
|
|
544
core/request.cpp
544
core/request.cpp
|
@ -15,10 +15,13 @@
|
|||
#include "postparser.h"
|
||||
#include "cookieparser.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
#include "plugin.h"
|
||||
#include "misc.h"
|
||||
#include "db.h"
|
||||
#include "functions/functionbase.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Request::Request() : char_empty(0)
|
||||
|
@ -27,6 +30,13 @@ Request::Request() : char_empty(0)
|
|||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void Request::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void Request::Init()
|
||||
{
|
||||
compress.Init();
|
||||
|
@ -125,7 +135,7 @@ void Request::SetCookie(const char * name, const char * value, tm * expires)
|
|||
if( expires )
|
||||
headers << "; expires=" << DateToStrCookie(expires) << " GMT";
|
||||
|
||||
headers << "; path=/; domain=." << data.base_server << "\r\n";
|
||||
headers << "; path=/; domain=." << config->base_server << "\r\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +147,7 @@ void Request::SetCookie(const char * name, long value, tm * expires)
|
|||
if( expires )
|
||||
headers << "; expires=" << DateToStrCookie(expires) << " GMT";
|
||||
|
||||
headers << "; path=/; domain=." << data.base_server << "\r\n";
|
||||
headers << "; path=/; domain=." << config->base_server << "\r\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,6 +337,8 @@ return true;
|
|||
}
|
||||
|
||||
|
||||
|
||||
// !! czy te parsery powinny byc skladowymi Request?
|
||||
void Request::ReadParameters()
|
||||
{
|
||||
// !! wrzucic jako skladowa klasy
|
||||
|
@ -339,6 +351,7 @@ void Request::ReadParameters()
|
|||
{
|
||||
log << log3 << "Request: post content type: multipart/form-data" << logend;
|
||||
|
||||
post_multi_parser.SetConfig(config);
|
||||
post_multi_parser.Parse(in, post_table, post_file_table);
|
||||
}
|
||||
else
|
||||
|
@ -390,21 +403,21 @@ void Request::SendSessionCookie()
|
|||
|
||||
if( !session->puser || !session->remember_me )
|
||||
{
|
||||
SetCookie(data.http_session_id_name.c_str(), session->id);
|
||||
SetCookie(config->http_session_id_name.c_str(), session->id);
|
||||
return;
|
||||
}
|
||||
|
||||
time_t t = time(0) + data.session_remember_max_idle;
|
||||
time_t t = time(0) + config->session_remember_max_idle;
|
||||
tm * expires = localtime(&t);
|
||||
|
||||
if( !expires )
|
||||
{
|
||||
// oops, something wrong
|
||||
SetCookie(data.http_session_id_name.c_str(), session->id);
|
||||
SetCookie(config->http_session_id_name.c_str(), session->id);
|
||||
return;
|
||||
}
|
||||
|
||||
SetCookie(data.http_session_id_name.c_str(), session->id, expires);
|
||||
SetCookie(config->http_session_id_name.c_str(), session->id, expires);
|
||||
}
|
||||
|
||||
|
||||
|
@ -472,15 +485,15 @@ void Request::AddDebugInfo()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// !! to powinno isc do kontrolera app
|
||||
void Request::SendPage(bool compressing, const std::string & source_ref)
|
||||
{
|
||||
const std::string * source = &source_ref;
|
||||
|
||||
bool raw = request.is_item && request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK &&
|
||||
request.pfunction && (request.pfunction->code == FUN_CAT || request.pfunction->code == FUN_RUN);
|
||||
bool raw = is_item && item.content_type == Item::ct_raw && status == WINIX_ERR_OK &&
|
||||
pfunction && (pfunction->fun.url == "cat" || pfunction->fun.url == "run");
|
||||
|
||||
if( data.html_filter && !raw )
|
||||
if( config->html_filter && !raw )
|
||||
{
|
||||
html_filter.TrimWhite(true);
|
||||
html_filter.BreakLines(60);
|
||||
|
@ -502,7 +515,7 @@ void Request::SendAll()
|
|||
{
|
||||
const std::string & source = page.str();
|
||||
Header header = h_200;
|
||||
bool compressing = data.compression && role == responder && redirect_to.empty() && x_sendfile.empty() &&
|
||||
bool compressing = config->compression && role == responder && redirect_to.empty() && x_sendfile.empty() &&
|
||||
!browser_msie && !browser_konqueror &&
|
||||
accept_encoding_parser.AcceptDeflate() && source.size() >= 512;
|
||||
|
||||
|
@ -567,514 +580,7 @@ return str_empty;
|
|||
}
|
||||
|
||||
|
||||
bool Request::CanChangeUser(const Item & item, long new_user_id)
|
||||
{
|
||||
if( !session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( session->puser && session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.user_id != new_user_id )
|
||||
// only super user can change the owner of an item
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanChangeGroup(const Item & item, long new_group_id)
|
||||
{
|
||||
if( !session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( session->puser && session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.group_id != new_group_id )
|
||||
{
|
||||
// user is allowed to change the group only if he is an owner of the item
|
||||
// he can change only into a group in which he is a member of, or into a 'no_group'
|
||||
|
||||
if( !session->puser )
|
||||
return false;
|
||||
|
||||
if( session->puser->id != item.user_id )
|
||||
return false;
|
||||
|
||||
if( new_group_id == -1 )
|
||||
return true;
|
||||
|
||||
if( !session->puser->IsMemberOf(new_group_id) )
|
||||
return false;
|
||||
|
||||
// is logged, is the owner of the item, is the member of the new group
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanChangePrivileges(const Item & item, int new_priv)
|
||||
{
|
||||
if( !session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( session->puser && session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.privileges != new_priv )
|
||||
{
|
||||
// the owner of an item is allowed to change the privileges
|
||||
|
||||
if( !session->puser )
|
||||
return false;
|
||||
|
||||
if( session->puser->id != item.user_id )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::HasAccess(const Item & item, int mask)
|
||||
{
|
||||
if( !session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( session->puser && session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( session->puser && session->puser->id == item.user_id )
|
||||
{
|
||||
// the owner
|
||||
return ((item.privileges >> 6) & mask) == mask;
|
||||
}
|
||||
|
||||
if( session->puser && session->puser->IsMemberOf(item.group_id) )
|
||||
{
|
||||
// group
|
||||
return ((item.privileges >> 3) & mask) == mask;
|
||||
}
|
||||
|
||||
// others
|
||||
|
||||
return (item.privileges & mask) == mask;
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasReadAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 4);
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasWriteAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 2);
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasReadWriteAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 6); // r+w
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasReadExecAccess(const Item & item)
|
||||
{
|
||||
if( session && session->puser && session->puser->super_user )
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
|
||||
return (item.privileges & 0111) != 0;
|
||||
}
|
||||
|
||||
return HasAccess(item, 5); // r+x
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasReadExecAccessForRoot(const Item & item)
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
|
||||
return (item.privileges & 0111) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::HasReadExecAccessToPath(long dir_id)
|
||||
{
|
||||
while( true )
|
||||
{
|
||||
Item * pdir = data.dirs.GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
return false;
|
||||
|
||||
if( !HasReadExecAccess(*pdir) )
|
||||
return false;
|
||||
|
||||
dir_id = pdir->parent_id;
|
||||
|
||||
if( dir_id == -1 )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returning true if we can create a thread in the current directory
|
||||
bool Request::CanCreateThread(bool check_root)
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
return false;
|
||||
|
||||
if( request.is_item )
|
||||
return false;
|
||||
|
||||
if( !HasWriteAccess(*request.dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !data.mounts.pmount || data.mounts.pmount->type != Mount::thread )
|
||||
return false;
|
||||
|
||||
if( !check_root && session && session->puser && session->puser->super_user )
|
||||
// super can create thread regardless of the restrictcreatethread option
|
||||
return true;
|
||||
|
||||
if( !data.mounts.pmount->IsPar(Mount::par_createthread_on) )
|
||||
return true;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_createthread_on, request.dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returning true if we can create a ticket in the current directory
|
||||
bool Request::CanCreateTicket(bool check_root)
|
||||
{
|
||||
if( request.dir_table.empty() )
|
||||
return false;
|
||||
|
||||
if( request.is_item )
|
||||
return false;
|
||||
|
||||
if( !HasWriteAccess(*request.dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !data.mounts.pmount || data.mounts.pmount->type != Mount::ticket )
|
||||
return false;
|
||||
|
||||
|
||||
// checking for par_createticket_on mount option
|
||||
|
||||
if( !check_root && session && session->puser && session->puser->super_user )
|
||||
// super can create tickets regardless of the createticket_on option
|
||||
return true;
|
||||
|
||||
if( !data.mounts.pmount->IsPar(Mount::par_createticket_on) )
|
||||
return true;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_createticket_on, request.dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::CanEditTicket()
|
||||
{
|
||||
// not logged users cannot edit tickets
|
||||
if( !request.session->puser )
|
||||
return false;
|
||||
|
||||
if( request.dir_table.empty() )
|
||||
return false;
|
||||
|
||||
if( request.is_item || !request.is_ticket )
|
||||
return false;
|
||||
|
||||
if( !HasWriteAccess(*request.dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !data.mounts.pmount || data.mounts.pmount->type != Mount::ticket )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::CanRemove(const Item & item)
|
||||
{
|
||||
// !! temporarily (we're waiting for the sticky bit to be implemented)
|
||||
// not logged users cannot remove anything
|
||||
if( !request.session->puser )
|
||||
return false;
|
||||
|
||||
if( item.parent_id == -1 )
|
||||
{
|
||||
// rm for the root dir
|
||||
// only the superuser can do it
|
||||
if( !request.session->puser || !request.session->puser->super_user )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Item * last_but_one_dir = data.dirs.GetDir(item.parent_id);
|
||||
|
||||
if( !last_but_one_dir )
|
||||
// ops, there is no a parent dir
|
||||
return false;
|
||||
|
||||
if( !request.HasWriteAccess(*last_but_one_dir) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( data.mounts.pmount->IsPar(Mount::par_only_root_remove) )
|
||||
if( !request.session->puser || !request.session->puser->super_user )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseEmacs(const Item & item, bool check_root)
|
||||
{
|
||||
if( !check_root && request.session->puser && request.session->puser->super_user )
|
||||
// super user can use emacs everywhere
|
||||
return true;
|
||||
|
||||
if( !request.HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
if( !data.mounts.pmount->IsPar(Mount::par_emacs_on) )
|
||||
return true;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_emacs_on, request.dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseMkdir(const Item & item, bool check_root)
|
||||
{
|
||||
// you can create a directory only in a directory
|
||||
if( item.type != Item::dir )
|
||||
return false;
|
||||
|
||||
if( !check_root && request.session->puser && request.session->puser->super_user )
|
||||
// super user can use mkdir everywhere
|
||||
return true;
|
||||
|
||||
if( !request.HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
if( !data.mounts.pmount->IsPar(Mount::par_mkdir_on) )
|
||||
return true;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_mkdir_on, request.dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseUpload(const Item & item, bool check_root)
|
||||
{
|
||||
// you can use 'upload' only in a directory
|
||||
if( item.type != Item::dir )
|
||||
return false;
|
||||
|
||||
// we must know where to store the file
|
||||
if( !data.mounts.pmount )
|
||||
return false;
|
||||
|
||||
if( data.mounts.pmount->fs == Mount::simplefs && data.auth_simplefs_dir.empty() )
|
||||
{
|
||||
log << log1 << "Request: can't use upload function, auth_simplefs_dir must be set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( data.mounts.pmount->fs == Mount::hashfs && data.auth_hashfs_dir.empty() )
|
||||
{
|
||||
log << log1 << "Request: can't use upload function, auth_hashfs_dir must be set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( data.auth_tmp_dir.empty() )
|
||||
{
|
||||
log << log1 << "Request: can't use upload function, auth_tmp_dir must be set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !check_root && request.session->puser && request.session->puser->super_user )
|
||||
// super user can use upload everywhere
|
||||
return true;
|
||||
|
||||
if( !request.HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseHtml(long user_id)
|
||||
{
|
||||
return CanUse(user_id, "allow_html");
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseBBCode(long user_id)
|
||||
{
|
||||
// logged users can use bbcode
|
||||
return (user_id != -1);
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUseRaw(long user_id)
|
||||
{
|
||||
return CanUse(user_id, "allow_raw");
|
||||
}
|
||||
|
||||
|
||||
bool Request::CanUse(long user_id, const char * group_name)
|
||||
{
|
||||
User * puser = data.users.GetUser(user_id);
|
||||
|
||||
if( !puser )
|
||||
return false;
|
||||
|
||||
if( puser->super_user )
|
||||
return true;
|
||||
|
||||
long group = data.groups.GetGroupId(group_name);
|
||||
|
||||
if( group == -1 )
|
||||
// there is no such a group
|
||||
return false;
|
||||
|
||||
if( puser->IsMemberOf(group) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool Request::MakePathSimpleFs(std::string & path, long dir_id, bool create_dir)
|
||||
{
|
||||
if( data.auth_simplefs_dir.empty() )
|
||||
{
|
||||
log << log1 << "Request: auth_simplefs_dir is not set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !data.dirs.MakePath(dir_id, path) )
|
||||
return false;
|
||||
|
||||
if( create_dir && !CreateDirs(data.auth_simplefs_dir, path, 0755) )
|
||||
return false;
|
||||
|
||||
path.insert(0, data.auth_simplefs_dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// the path depends on id
|
||||
bool Request::MakePathHashFs(std::string & path, long id, bool create_dir)
|
||||
{
|
||||
char buffer[50];
|
||||
char * hash = buffer;
|
||||
|
||||
// get 'id' as hexadecimal
|
||||
buffer[0] = '0';
|
||||
sprintf(buffer+1, "%lx", (unsigned long)id);
|
||||
|
||||
path = data.auth_hashfs_dir;
|
||||
if( path.empty() )
|
||||
{
|
||||
log << log1 << "Request: auth_hashfs_dir is not set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
path += '/';
|
||||
|
||||
// make sure that the length is even
|
||||
if( (strlen(hash) & 1) != 0 )
|
||||
hash = buffer + 1; // the first character was zero
|
||||
|
||||
// creating dirs without the last part
|
||||
// the last part is a part of a file
|
||||
for(size_t i=0 ; hash[i] != 0 ; i+=2)
|
||||
{
|
||||
path += hash[i];
|
||||
path += hash[i+1];
|
||||
|
||||
if( hash[i+2] != 0 )
|
||||
{
|
||||
if( create_dir && !CreateDir(path, 0755) )
|
||||
return false;
|
||||
|
||||
path += '/';
|
||||
}
|
||||
}
|
||||
|
||||
// one character more to make sure the path is unique
|
||||
// (we can have a directory without the character)
|
||||
path += "_";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// making a complete path to a static file
|
||||
bool Request::MakePath(const Item & item, std::string & path, bool create_dir)
|
||||
{
|
||||
bool res;
|
||||
|
||||
Mount * pmount = data.mounts.CalcMount(item.parent_id);
|
||||
|
||||
if( !pmount || pmount->fs == Mount::simplefs )
|
||||
{
|
||||
res = MakePathSimpleFs(path, item.parent_id, create_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = MakePathHashFs(path, item.id, create_dir);
|
||||
}
|
||||
|
||||
if( res )
|
||||
path += item.url;
|
||||
else
|
||||
path.clear();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::MakePath(Item & item, bool create_dir)
|
||||
{
|
||||
return MakePath(item, item.auth_path, create_dir);
|
||||
}
|
||||
|
|
|
@ -19,16 +19,19 @@
|
|||
#include "session.h"
|
||||
#include "item.h"
|
||||
#include "error.h"
|
||||
#include "function.h"
|
||||
#include "thread.h"
|
||||
#include "compress.h"
|
||||
#include "acceptencodingparser.h"
|
||||
#include "htmlfilter.h"
|
||||
#include "postmultiparser.h"
|
||||
#include "ticket.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
|
||||
class FunctionBase;
|
||||
|
||||
|
||||
struct Request
|
||||
{
|
||||
// request id
|
||||
|
@ -87,7 +90,7 @@ struct Request
|
|||
Item item;
|
||||
|
||||
// null if there is no a function
|
||||
Function * pfunction;
|
||||
FunctionBase * pfunction;
|
||||
|
||||
// parameters (name:value)
|
||||
ParamTable param_table;
|
||||
|
@ -149,37 +152,12 @@ struct Request
|
|||
void SendAll();
|
||||
void SendNotify();
|
||||
|
||||
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 HasReadExecAccessForRoot(const Item & item);
|
||||
bool HasReadExecAccessToPath(long dir_id);
|
||||
|
||||
bool CanCreateThread(bool check_root = false);
|
||||
bool CanCreateTicket(bool check_root = false);
|
||||
bool CanEditTicket();
|
||||
bool CanRemove(const Item & item);
|
||||
bool CanUseEmacs(const Item & item, bool check_root = false);
|
||||
bool CanUseMkdir(const Item & item, bool check_root = false);
|
||||
bool CanUseUpload(const Item & item, bool check_root = false);
|
||||
|
||||
bool CanUseHtml(long user_id);
|
||||
bool CanUseBBCode(long user_id);
|
||||
bool CanUseRaw(long user_id);
|
||||
|
||||
bool MakePathSimpleFs(std::string & path, long dir_id, bool create_dir = false);
|
||||
bool MakePathHashFs(std::string & path, long id, bool create_dir = false);
|
||||
bool MakePath(const Item & item, std::string & path, bool create_dir = false);
|
||||
bool MakePath(Item & item, bool create_dir = false);
|
||||
void SetConfig(Config * pconfig);
|
||||
|
||||
private:
|
||||
|
||||
Config * config;
|
||||
|
||||
enum Header
|
||||
{
|
||||
h_200,
|
||||
|
@ -204,6 +182,7 @@ private:
|
|||
// used in ParamValue(const char * param_name) when there is no such a param
|
||||
const std::string str_empty;
|
||||
|
||||
|
||||
PostMultiParser post_multi_parser;
|
||||
|
||||
const char * SetEnvVar(const char * var);
|
||||
|
@ -221,7 +200,7 @@ private:
|
|||
|
||||
|
||||
|
||||
extern Request request;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,260 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "requestcontroller.h"
|
||||
#include "data.h"
|
||||
#include "log.h"
|
||||
#include "request.h"
|
||||
#include "postparser.h"
|
||||
#include "cookieparser.h"
|
||||
#include "notify.h"
|
||||
|
||||
|
||||
|
||||
RequestController::RequestController()
|
||||
{
|
||||
last_sessions_save = time(0);
|
||||
}
|
||||
|
||||
|
||||
RequestController::~RequestController()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
void RequestController::Close()
|
||||
{
|
||||
// don't call close(0)
|
||||
// it will be closed next time during dup(s,0)
|
||||
|
||||
// if you closed the descriptor here
|
||||
// then the database would have that descriptor (during connecting)
|
||||
// and there'll be a problem in the next loop (after SIGHUP)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool RequestController::Init()
|
||||
{
|
||||
const char * sock = data.fcgi_socket.c_str();
|
||||
|
||||
unlink(sock);
|
||||
|
||||
|
||||
|
||||
int s = FCGX_OpenSocket(sock, 10);
|
||||
|
||||
if( s < 0 )
|
||||
{
|
||||
log << log1 << "An error during creating a socket" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
chmod(sock, data.fcgi_socket_chmod);
|
||||
|
||||
passwd * pw = getpwnam(data.fcgi_socket_user.c_str());
|
||||
|
||||
if( !pw )
|
||||
{
|
||||
log << log1 << "There is no user: " << data.fcgi_socket_user << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
group * gr = getgrnam(data.fcgi_socket_group.c_str());
|
||||
|
||||
if( !gr )
|
||||
{
|
||||
log << log1 << "There is no group: " << data.fcgi_socket_group << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
chown(sock, pw->pw_uid, gr->gr_gid);
|
||||
|
||||
|
||||
|
||||
if( setuid(pw->pw_uid) < 0 )
|
||||
{
|
||||
log << log1 << "I can't change the user into: " << data.fcgi_socket_user << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if( setgid(gr->gr_gid) < 0 )
|
||||
{
|
||||
int e = errno;
|
||||
|
||||
log << log1 << "I can't change the group into: " << data.fcgi_socket_group << " " << gr->gr_gid << logend;
|
||||
log << log1 << "errno: " << e << logend;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
dup2(s, 0);
|
||||
|
||||
//
|
||||
data.dirs.ReadDirs();
|
||||
data.users.ReadUsers();
|
||||
data.groups.ReadGroups();
|
||||
data.functions.ReadFunctions();
|
||||
data.mounts.ReadMounts();
|
||||
data.rebus.Init();
|
||||
//
|
||||
|
||||
|
||||
|
||||
if( !content.Init() )
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RequestController::LoadSessions()
|
||||
{
|
||||
session_manager.LoadSessions();
|
||||
}
|
||||
|
||||
void RequestController::SaveSessions()
|
||||
{
|
||||
session_manager.SaveSessions();
|
||||
}
|
||||
|
||||
|
||||
void RequestController::DeleteAllPluginsData()
|
||||
{
|
||||
session_manager.DeleteAllPluginsData();
|
||||
}
|
||||
|
||||
|
||||
void RequestController::SaveSessionsIfNeeded()
|
||||
{
|
||||
time_t t = time(0);
|
||||
|
||||
if( last_sessions_save + 86400 > t )
|
||||
return;
|
||||
|
||||
// saving once a day for safety
|
||||
last_sessions_save = t;
|
||||
SaveSessions();
|
||||
}
|
||||
|
||||
|
||||
bool RequestController::BaseUrlRedirect()
|
||||
{
|
||||
if( request.role == Request::responder )
|
||||
{
|
||||
if( data.base_url_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( data.base_url_http_host == request.env_http_host )
|
||||
return false;
|
||||
|
||||
request.redirect_to = data.base_url + request.env_request_uri;
|
||||
}
|
||||
else
|
||||
{
|
||||
// authorizer
|
||||
|
||||
if( data.base_url_auth_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( data.base_url_auth_http_host == request.env_http_host )
|
||||
return false;
|
||||
|
||||
request.redirect_to = data.base_url_auth + request.env_request_uri;
|
||||
}
|
||||
|
||||
log << log3 << "RC: BaseUrlRedirect from: " << request.env_http_host << logend;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RequestController::Loop()
|
||||
{
|
||||
while( FCGX_Accept(&request.in, &request.out, &request.err, &request.env) == 0 )
|
||||
{
|
||||
data.load_avg.StartRequest();
|
||||
log << log2 << "---------------------------------------------------------------------------------" << logend;
|
||||
|
||||
try
|
||||
{
|
||||
request.Clear();
|
||||
request.Read();
|
||||
|
||||
// when BaseUrlRedirect() return true we didn't have to set everything in request.Read()
|
||||
// in the future request.Read() can be split and at the beginning only environment variables will be read
|
||||
// and then BaseUrlRedirect() will be called (for performance)
|
||||
if( !BaseUrlRedirect() )
|
||||
{
|
||||
session_manager.DeleteOldSessions();
|
||||
session_manager.SetSession(); // set request.session as well
|
||||
|
||||
function_parser.Parse();
|
||||
data.mounts.CalcCurMount();
|
||||
|
||||
content.ReadAdditionalInfo();
|
||||
content.Make();
|
||||
}
|
||||
|
||||
request.SendAll();
|
||||
notify.ItemChanged(request.notify_code);
|
||||
}
|
||||
catch(const std::logic_error & e)
|
||||
{
|
||||
log << log1 << "std logic exception: " << e.what() << logend;
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
log << log1 << "std exception: " << e.what() << logend;
|
||||
}
|
||||
catch(const Error & e)
|
||||
{
|
||||
log << log1 << "exception: Error: " << e << logend;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
log << log1 << "uncaught unknown exception" << logend;
|
||||
}
|
||||
|
||||
SaveSessionsIfNeeded();
|
||||
|
||||
// !! this should be immediately after FCGX_Accept() but signals don't want to break FCGX_Accept
|
||||
if( data.signal_hup )
|
||||
{
|
||||
log << logsave;
|
||||
FCGX_Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
request.ClearPostFileTmp();
|
||||
data.load_avg.StopRequest();
|
||||
log << logsave;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SessionContainer::Iterator RequestController::SessionBegin()
|
||||
{
|
||||
return session_manager.SessionBegin();
|
||||
}
|
||||
|
||||
|
||||
SessionContainer::Iterator RequestController::SessionEnd()
|
||||
{
|
||||
return session_manager.SessionEnd();
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucorerequestcontroller
|
||||
#define headerfilecmslucorerequestcontroller
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <errno.h>
|
||||
#include <ctime>
|
||||
|
||||
#include "../content/content.h"
|
||||
#include "sessionmanager.h"
|
||||
#include "functionparser.h"
|
||||
#include "sessioncontainer.h"
|
||||
|
||||
|
||||
class RequestController
|
||||
{
|
||||
Content content;
|
||||
|
||||
|
||||
SessionManager session_manager;
|
||||
|
||||
bool BaseUrlRedirect();
|
||||
|
||||
FunctionParser function_parser;
|
||||
|
||||
public:
|
||||
|
||||
RequestController();
|
||||
~RequestController();
|
||||
|
||||
bool Init();
|
||||
void Close();
|
||||
void Loop();
|
||||
|
||||
void LoadSessions();
|
||||
void SaveSessions();
|
||||
void SaveSessionsIfNeeded(); // saving only once a day
|
||||
void DeleteAllPluginsData();
|
||||
|
||||
SessionContainer::Iterator SessionBegin();
|
||||
SessionContainer::Iterator SessionEnd();
|
||||
|
||||
time_t last_sessions_save;
|
||||
};
|
||||
|
||||
|
||||
extern RequestController req_controller;
|
||||
|
||||
#endif
|
|
@ -14,11 +14,8 @@
|
|||
#include "item.h"
|
||||
#include "error.h"
|
||||
#include "user.h"
|
||||
#include "rebus.h"
|
||||
#include "plugindata.h"
|
||||
|
||||
|
||||
|
||||
#include "rebus.h"
|
||||
|
||||
|
||||
struct Session
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
#include "sessioncontainer.h"
|
||||
#include "data.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
|
@ -22,6 +21,12 @@ void SessionContainer::Clear()
|
|||
}
|
||||
|
||||
|
||||
void SessionContainer::SetLastContainer(LastContainer * plast_container)
|
||||
{
|
||||
last_container = plast_container;
|
||||
}
|
||||
|
||||
|
||||
SessionContainer::TableSize SessionContainer::Size()
|
||||
{
|
||||
return table.size();
|
||||
|
@ -96,7 +101,7 @@ time_t limit = std::time(0) - interval;
|
|||
continue;
|
||||
|
||||
if( iold->second->puser )
|
||||
data.last.UserLogout(iold->second->puser->id, iold->second->id);
|
||||
last_container->UserLogout(iold->second->puser->id, iold->second->id);
|
||||
|
||||
// we're logging session.id (call this before table.erase())
|
||||
DelFromIdIndex(iold->second);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <ctime>
|
||||
|
||||
#include "session.h"
|
||||
|
||||
#include "lastcontainer.h"
|
||||
|
||||
|
||||
|
||||
|
@ -30,8 +30,12 @@ public:
|
|||
typedef std::map<long, Iterator> IndexId;
|
||||
typedef std::multimap<time_t, Iterator> IndexTime;
|
||||
|
||||
void SetLastContainer(LastContainer * plast_container);
|
||||
|
||||
private:
|
||||
|
||||
LastContainer * last_container;
|
||||
|
||||
Table table;
|
||||
IndexId index_id;
|
||||
IndexTime index_time;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "sessionmanager.h"
|
||||
#include "request.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
#include "session.h"
|
||||
#include "sessionparser.h"
|
||||
#include "plugin.h"
|
||||
|
@ -27,6 +26,28 @@ SessionManager::SessionManager()
|
|||
}
|
||||
|
||||
|
||||
void SessionManager::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
void SessionManager::SetLastContainer(LastContainer * plast_container)
|
||||
{
|
||||
session_table.SetLastContainer(plast_container);
|
||||
}
|
||||
|
||||
|
||||
bool SessionManager::IsSession(long id)
|
||||
{
|
||||
|
@ -79,11 +100,11 @@ void SessionManager::CreateTemporarySession()
|
|||
s.id = 0;
|
||||
|
||||
session_table.PushBack(s);
|
||||
request.session = &session_table.Back();
|
||||
request->session = &session_table.Back();
|
||||
}
|
||||
else
|
||||
{
|
||||
request.session = &(*i);
|
||||
request->session = &(*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,10 +123,10 @@ int attempts = 100;
|
|||
|
||||
if( added )
|
||||
{
|
||||
request.session = &session_table.Back();
|
||||
request.session->new_session = true;
|
||||
request->session = &session_table.Back();
|
||||
request->session->new_session = true;
|
||||
|
||||
log << log2 << "SM: created a new session: " << request.session->id << logend;
|
||||
log << log2 << "SM: created a new session: " << request->session->id << logend;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -129,17 +150,17 @@ bool SessionManager::SetSessionFromCookie(const std::string & cookie)
|
|||
return false;
|
||||
|
||||
// that session is in the table
|
||||
request.session = &(*s);
|
||||
request.session->new_session = false;
|
||||
request->session = &(*s);
|
||||
request->session->new_session = false;
|
||||
session_table.UpdateLastTime(s, std::time(0));
|
||||
|
||||
if( request.method == Request::get )
|
||||
request.session->last_time_get = request.session->last_time;
|
||||
if( request->method == Request::get )
|
||||
request->session->last_time_get = request->session->last_time;
|
||||
|
||||
log << log2 << "SM: session: " << s->id;
|
||||
|
||||
if( request.session->puser )
|
||||
log << log2 << ", user: " << request.session->puser->name << ", id: " << request.session->puser->id;
|
||||
if( request->session->puser )
|
||||
log << log2 << ", user: " << request->session->puser->name << ", id: " << request->session->puser->id;
|
||||
|
||||
log << log2 << logend;
|
||||
|
||||
|
@ -150,9 +171,9 @@ return true;
|
|||
|
||||
void SessionManager::SetSession()
|
||||
{
|
||||
CookieTable::iterator i = request.cookie_table.find(data.http_session_id_name);
|
||||
CookieTable::iterator i = request->cookie_table.find(config->http_session_id_name);
|
||||
|
||||
if( i == request.cookie_table.end() )
|
||||
if( i == request->cookie_table.end() )
|
||||
{
|
||||
CreateSession();
|
||||
}
|
||||
|
@ -162,18 +183,18 @@ void SessionManager::SetSession()
|
|||
{
|
||||
// there is no such a session
|
||||
// deleting the old cookie
|
||||
request.cookie_table.erase(i);
|
||||
request->cookie_table.erase(i);
|
||||
|
||||
// and creating a new one
|
||||
CreateSession();
|
||||
}
|
||||
}
|
||||
|
||||
// request.session is set now
|
||||
// request->session is set now
|
||||
|
||||
if( request.session->new_session )
|
||||
if( request->session->new_session )
|
||||
{
|
||||
request.session->plugin_data.Resize(plugin.Size());
|
||||
request->session->plugin_data.Resize(plugin.Size());
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
|
@ -199,7 +220,7 @@ SessionContainer::Iterator SessionManager::SessionEnd()
|
|||
|
||||
void SessionManager::DeleteOldSessions()
|
||||
{
|
||||
session_table.DelFirstByTimeInterval(data.session_max_idle);
|
||||
session_table.DelFirstByTimeInterval(config->session_max_idle);
|
||||
|
||||
if( ++session_checker > 1000 )
|
||||
{
|
||||
|
@ -207,7 +228,7 @@ void SessionManager::DeleteOldSessions()
|
|||
log << log3 << "SM: checking sessions which have 'remember me' flag set" << logend;
|
||||
|
||||
session_checker = 0;
|
||||
session_table.DelFirstByTimeInterval(data.session_remember_max_idle, false);
|
||||
session_table.DelFirstByTimeInterval(config->session_remember_max_idle, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,15 +238,15 @@ void SessionManager::DeleteAllPluginsData()
|
|||
{
|
||||
SessionContainer::Iterator i = session_table.Begin();
|
||||
|
||||
Session * old_session = request.session;
|
||||
Session * old_session = request->session;
|
||||
|
||||
for( ; i!=session_table.End() ; ++i )
|
||||
{
|
||||
request.session = &(*i);
|
||||
request->session = &(*i);
|
||||
i->plugin_data.DeleteAll();
|
||||
}
|
||||
|
||||
request.session = old_session;
|
||||
request->session = old_session;
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,19 +258,20 @@ void SessionManager::LoadSessions()
|
|||
SessionParser sp;
|
||||
SessionContainer::Iterator i;
|
||||
|
||||
Session * old_session = request.session;
|
||||
sp.SetUsers(&system->users);
|
||||
Session * old_session = request->session;
|
||||
|
||||
sp.Parse(data.session_file, session_table);
|
||||
sp.Parse(config->session_file, session_table);
|
||||
i = session_table.Begin();
|
||||
|
||||
for( ; i!=session_table.End() ; ++i )
|
||||
{
|
||||
i->plugin_data.Resize(plugin.Size());
|
||||
request.session = &(*i);
|
||||
request->session = &(*i);
|
||||
plugin.Call(WINIX_SESSION_CREATED);
|
||||
}
|
||||
|
||||
request.session = old_session;
|
||||
request->session = old_session;
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,10 +280,10 @@ SessionContainer::Iterator i;
|
|||
|
||||
void SessionManager::SaveSessions()
|
||||
{
|
||||
if( data.session_file.empty() )
|
||||
if( config->session_file.empty() )
|
||||
return;
|
||||
|
||||
std::ofstream file(data.session_file.c_str());
|
||||
std::ofstream file(config->session_file.c_str());
|
||||
|
||||
if( !file )
|
||||
{
|
||||
|
@ -286,7 +308,7 @@ void SessionManager::SaveSessions()
|
|||
}
|
||||
|
||||
file.close();
|
||||
chmod(data.session_file.c_str(), 0600);
|
||||
chmod(config->session_file.c_str(), 0600);
|
||||
|
||||
log << log2 << "SM: saved " << len << " session(s)" << logend;
|
||||
}
|
||||
|
|
|
@ -14,15 +14,21 @@
|
|||
#include <ctime>
|
||||
|
||||
#include "sessioncontainer.h"
|
||||
#include "config.h"
|
||||
#include "request.h"
|
||||
#include "lastcontainer.h"
|
||||
#include "system.h"
|
||||
|
||||
|
||||
|
||||
class SessionManager
|
||||
{
|
||||
Config * config;
|
||||
Request * request;
|
||||
System * system;
|
||||
|
||||
SessionContainer session_table;
|
||||
|
||||
|
||||
|
||||
bool IsSession(long s);
|
||||
|
||||
long CreateSessionId();
|
||||
|
@ -34,6 +40,12 @@ class SessionManager
|
|||
public:
|
||||
|
||||
SessionManager();
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetSystem(System * psystem);
|
||||
void SetLastContainer(LastContainer * plast_container);
|
||||
|
||||
void SetSession();
|
||||
void DeleteAllPluginsData();
|
||||
void DeleteOldSessions();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "sessionparser.h"
|
||||
#include "log.h"
|
||||
#include "data.h"
|
||||
|
||||
|
||||
|
||||
bool SessionParser::Parse(const std::string & path, SessionContainer & container)
|
||||
|
@ -18,6 +18,12 @@ bool SessionParser::Parse(const std::string & path, SessionContainer & container
|
|||
}
|
||||
|
||||
|
||||
void SessionParser::SetUsers(Users * pusers)
|
||||
{
|
||||
users = pusers;
|
||||
}
|
||||
|
||||
|
||||
bool SessionParser::Parse(const char * path, SessionContainer & container)
|
||||
{
|
||||
container.Clear();
|
||||
|
@ -66,7 +72,7 @@ bool SessionParser::Parse(SessionContainer & container)
|
|||
|
||||
if( MakeSession(user_id) )
|
||||
{
|
||||
data.how_many_logged += 1;
|
||||
users->IncrementLoggedUsers();
|
||||
container.PushBack(session);
|
||||
log << log2 << "SP: read session id: " << session.id << " for user: " << session.puser->name << logend;
|
||||
}
|
||||
|
@ -82,7 +88,7 @@ return true;
|
|||
|
||||
bool SessionParser::MakeSession(long user_id)
|
||||
{
|
||||
User * puser = data.users.GetUser(user_id);
|
||||
User * puser = users->GetUser(user_id);
|
||||
|
||||
if( !puser )
|
||||
{
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include <string>
|
||||
#include "session.h"
|
||||
#include "sessioncontainer.h"
|
||||
#include "users.h"
|
||||
|
||||
|
||||
|
||||
class SessionParser
|
||||
{
|
||||
|
@ -21,10 +24,12 @@ 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);
|
||||
|
||||
|
|
|
@ -0,0 +1,589 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
#include "misc.h"
|
||||
#include "error.h"
|
||||
#include "notify.h"
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
|
||||
void System::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void System::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void System::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
void System::SetFunctions(Functions * pfunctions)
|
||||
{
|
||||
functions = pfunctions;
|
||||
}
|
||||
|
||||
|
||||
void System::SetTemplates(Templates * ptemplates)
|
||||
{
|
||||
templates = ptemplates;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void System::Init()
|
||||
{
|
||||
dirs.SetDb(db);
|
||||
dirs.SetRequest(request);
|
||||
|
||||
dirs.ReadDirs();
|
||||
|
||||
mounts.SetDirs(&dirs);
|
||||
mounts.SetDb(db);
|
||||
mounts.SetRequest(request);
|
||||
mounts.ReadMounts();
|
||||
|
||||
users.SetRequest(request);
|
||||
users.ReadUsers(db);
|
||||
groups.ReadGroups(db); // !! chwilowe przekazanie argumentu, db bedzie zmienione
|
||||
|
||||
rebus.SetRequest(request);
|
||||
rebus.Init();
|
||||
}
|
||||
|
||||
|
||||
// !! mozna zrobic jakas obsluge kiedy nie mozemy sie redirectnac, np gdy wystapil blad
|
||||
// !! moze zwracac jakas wartosc?
|
||||
void System::RedirectTo(const Item & item, const char * postfix)
|
||||
{
|
||||
request->redirect_to = config->base_url;
|
||||
|
||||
if( item.type == Item::dir )
|
||||
{
|
||||
// item_id is pointing to a directory
|
||||
dirs.MakePath(item.id, path);
|
||||
request->redirect_to += path;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !dirs.MakePath(item.parent_id, path) )
|
||||
log << log1 << "Content: Can't redirect: no dirs for item id: " << item.id << logend;
|
||||
|
||||
request->redirect_to += path;
|
||||
request->redirect_to += item.url;
|
||||
}
|
||||
|
||||
if( postfix )
|
||||
request->redirect_to += postfix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void System::RedirectTo(long item_id, const char * postfix)
|
||||
{
|
||||
std::string path;
|
||||
Item * pdir;
|
||||
|
||||
request->redirect_to = config->base_url;
|
||||
pdir = dirs.GetDir(item_id);
|
||||
|
||||
|
||||
if( pdir )
|
||||
{
|
||||
// item_id is pointing to a directory
|
||||
dirs.MakePath(pdir->id, path);
|
||||
request->redirect_to += path;
|
||||
}
|
||||
else
|
||||
{
|
||||
// !! zrobic nowy interfejs
|
||||
// !! GetItem pozamieniac na GetFile
|
||||
// !! i nie uzywac request->item_table (zrobic sobie lokalny tutaj)
|
||||
db->GetItem(request->item_table, item_id);
|
||||
|
||||
if( !request->item_table.empty() )
|
||||
{
|
||||
if( !dirs.MakePath(request->item_table[0].parent_id, path) )
|
||||
log << log1 << "Content: Can't redirect: no dirs for item id: " << request->item_table[0].id << ", requested directory id: " << request->item_table[0].parent_id << logend;
|
||||
|
||||
request->redirect_to += path + request->item_table[0].url;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: Can't redirect: no such item: id: " << item_id << logend;
|
||||
}
|
||||
}
|
||||
|
||||
if( postfix )
|
||||
request->redirect_to += postfix;
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastDir()
|
||||
{
|
||||
// !! dac sprawdzenie czy istnieje
|
||||
RedirectTo( *request->dir_table.back() );
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastItem()
|
||||
{
|
||||
if( request->is_item )
|
||||
RedirectTo(request->item);
|
||||
else
|
||||
RedirectTo( *request->dir_table.back() );// !! dac sprawdzenie czy istnieje
|
||||
}
|
||||
|
||||
|
||||
void System::PrepareUrl(Item & item)
|
||||
{
|
||||
TrimWhite(item.url);
|
||||
|
||||
if( item.url.empty() )
|
||||
item.url = item.subject; // if the subject is empty then the url will be corrected by CorrectUrlOnlyAllowedChar()
|
||||
|
||||
CorrectUrlOnlyAllowedChar(item.url);
|
||||
|
||||
if( functions->Find(item.url) )
|
||||
{
|
||||
// the name provided by an user is the same as a name of a function
|
||||
// we add one underscore character at the beginning
|
||||
|
||||
// names of functions should not begin with an underscore '_'
|
||||
// and we can simply add one '_' at the beginning
|
||||
// and the name will be unique
|
||||
item.url.insert(item.url.begin(), '_');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool System::CanChangeUser(const Item & item, long new_user_id)
|
||||
{
|
||||
if( !request->session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.user_id != new_user_id )
|
||||
// only super user can change the owner of an item
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool System::CanChangeGroup(const Item & item, long new_group_id)
|
||||
{
|
||||
if( !request->session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.group_id != new_group_id )
|
||||
{
|
||||
// user is allowed to change the group only if he is an owner of the item
|
||||
// he can change only into a group in which he is a member of, or into a 'no_group'
|
||||
|
||||
if( !request->session->puser )
|
||||
return false;
|
||||
|
||||
if( request->session->puser->id != item.user_id )
|
||||
return false;
|
||||
|
||||
if( new_group_id == -1 )
|
||||
return true;
|
||||
|
||||
if( !request->session->puser->IsMemberOf(new_group_id) )
|
||||
return false;
|
||||
|
||||
// is logged, is the owner of the item, is the member of the new group
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool System::CanChangePrivileges(const Item & item, int new_priv)
|
||||
{
|
||||
if( !request->session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( item.privileges != new_priv )
|
||||
{
|
||||
// the owner of an item is allowed to change the privileges
|
||||
|
||||
if( !request->session->puser )
|
||||
return false;
|
||||
|
||||
if( request->session->puser->id != item.user_id )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::HasAccess(const Item & item, int mask)
|
||||
{
|
||||
if( !request->session )
|
||||
// session must be set
|
||||
return false;
|
||||
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
|
||||
if( request->session->puser && request->session->puser->id == item.user_id )
|
||||
{
|
||||
// the owner
|
||||
return ((item.privileges >> 6) & mask) == mask;
|
||||
}
|
||||
|
||||
if( request->session->puser && request->session->puser->IsMemberOf(item.group_id) )
|
||||
{
|
||||
// group
|
||||
return ((item.privileges >> 3) & mask) == mask;
|
||||
}
|
||||
|
||||
// others
|
||||
|
||||
return (item.privileges & mask) == mask;
|
||||
}
|
||||
|
||||
|
||||
bool System::HasReadAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 4);
|
||||
}
|
||||
|
||||
|
||||
bool System::HasWriteAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 2);
|
||||
}
|
||||
|
||||
|
||||
bool System::HasReadWriteAccess(const Item & item)
|
||||
{
|
||||
return HasAccess(item, 6); // r+w
|
||||
}
|
||||
|
||||
|
||||
bool System::HasReadExecAccess(const Item & item)
|
||||
{
|
||||
if( request->session && request->session->puser && request->session->puser->super_user )
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
|
||||
return (item.privileges & 0111) != 0;
|
||||
}
|
||||
|
||||
return HasAccess(item, 5); // r+x
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool System::HasReadExecAccessToPath(long dir_id)
|
||||
{
|
||||
while( true )
|
||||
{
|
||||
Item * pdir = dirs.GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
return false;
|
||||
|
||||
if( !HasReadExecAccess(*pdir) )
|
||||
return false;
|
||||
|
||||
dir_id = pdir->parent_id;
|
||||
|
||||
if( dir_id == -1 )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool System::DirsHaveReadExecPerm()
|
||||
{
|
||||
std::vector<Item*>::iterator i;
|
||||
|
||||
for(i = request->dir_table.begin() ; i!=request->dir_table.end() ; ++i)
|
||||
{
|
||||
if( !HasReadExecAccess(**i) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// if we don't have access we only remove the item from the table
|
||||
void System::CheckAccessToItems(std::vector<Item> & item_table)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
while( i < item_table.size() )
|
||||
{
|
||||
if( !HasReadAccess(item_table[i]) )
|
||||
{
|
||||
item_table.erase(item_table.begin() + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::CanUseHtml(long user_id)
|
||||
{
|
||||
return IsMemberOfGroup(user_id, "allow_html");
|
||||
}
|
||||
|
||||
|
||||
bool System::CanUseBBCode(long user_id)
|
||||
{
|
||||
// logged users can use bbcode
|
||||
return (user_id != -1);
|
||||
}
|
||||
|
||||
|
||||
bool System::CanUseRaw(long user_id)
|
||||
{
|
||||
return IsMemberOfGroup(user_id, "allow_raw");
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::IsMemberOfGroup(long user_id, const char * group_name)
|
||||
{
|
||||
User * puser = users.GetUser(user_id);
|
||||
|
||||
if( !puser )
|
||||
return false;
|
||||
|
||||
if( puser->super_user )
|
||||
return true;
|
||||
|
||||
long group = groups.GetGroupId(group_name);
|
||||
|
||||
if( group == -1 )
|
||||
// there is no such a group
|
||||
return false;
|
||||
|
||||
if( puser->IsMemberOf(group) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool System::MakePathSimpleFs(std::string & path, long dir_id, bool create_dir)
|
||||
{
|
||||
if( config->auth_simplefs_dir.empty() )
|
||||
{
|
||||
log << log1 << "System: auth_simplefs_dir is not set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !dirs.MakePath(dir_id, path) )
|
||||
return false;
|
||||
|
||||
if( create_dir && !CreateDirs(config->auth_simplefs_dir, path, 0755) )
|
||||
return false;
|
||||
|
||||
path.insert(0, config->auth_simplefs_dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// the path depends on id
|
||||
bool System::MakePathHashFs(std::string & path, long id, bool create_dir)
|
||||
{
|
||||
char buffer[50];
|
||||
char * hash = buffer;
|
||||
|
||||
// get 'id' as hexadecimal
|
||||
buffer[0] = '0';
|
||||
sprintf(buffer+1, "%lx", (unsigned long)id);
|
||||
|
||||
path = config->auth_hashfs_dir;
|
||||
if( path.empty() )
|
||||
{
|
||||
log << log1 << "System: auth_hashfs_dir is not set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
path += '/';
|
||||
|
||||
// make sure that the length is even
|
||||
if( (strlen(hash) & 1) != 0 )
|
||||
hash = buffer + 1; // the first character was zero
|
||||
|
||||
// creating dirs without the last part
|
||||
// the last part is a part of a file
|
||||
for(size_t i=0 ; hash[i] != 0 ; i+=2)
|
||||
{
|
||||
path += hash[i];
|
||||
path += hash[i+1];
|
||||
|
||||
if( hash[i+2] != 0 )
|
||||
{
|
||||
if( create_dir && !CreateDir(path, 0755) )
|
||||
return false;
|
||||
|
||||
path += '/';
|
||||
}
|
||||
}
|
||||
|
||||
// one character more to make sure the path is unique
|
||||
// (we can have a directory without the character)
|
||||
path += "_";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// making a complete path to a static file
|
||||
bool System::MakePath(const Item & item, std::string & path, bool create_dir)
|
||||
{
|
||||
bool res;
|
||||
|
||||
Mount * pmount = mounts.CalcMount(item.parent_id);
|
||||
|
||||
if( !pmount || pmount->fs == Mount::simplefs )
|
||||
{
|
||||
res = MakePathSimpleFs(path, item.parent_id, create_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = MakePathHashFs(path, item.id, create_dir);
|
||||
}
|
||||
|
||||
if( res )
|
||||
path += item.url;
|
||||
else
|
||||
path.clear();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::MakePath(Item & item, bool create_dir)
|
||||
{
|
||||
return MakePath(item, item.auth_path, create_dir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Error System::AddFile(Item & item)
|
||||
{
|
||||
if( item.type == Item::dir )
|
||||
return WINIX_ERR_FILE_EXPECTED;
|
||||
|
||||
Error status = db->AddItem(item);
|
||||
|
||||
if( status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "System: added a new file, url: " << item.url << ", id: " << item.id
|
||||
<< ", parent_id: " << item.parent_id << logend;
|
||||
|
||||
request->notify_code |= WINIX_NOTIFY_ITEM_ADD;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Error System::EditFile(Item & item, bool with_url)
|
||||
{
|
||||
if( item.type == Item::dir )
|
||||
return WINIX_ERR_FILE_EXPECTED;
|
||||
|
||||
if( request->session && request->session->puser )
|
||||
request->item.modification_user_id = request->session->puser->id;
|
||||
else
|
||||
request->item.modification_user_id = -1;
|
||||
|
||||
item.SetDateModifyToNow();
|
||||
Error status = db->EditItemById(item, with_url);
|
||||
|
||||
if( status == WINIX_ERR_OK )
|
||||
{
|
||||
TemplatesFunctions::pattern_cacher.UpdatePattern(item);
|
||||
log << log2 << "System: modified an item" << logend;
|
||||
|
||||
request->notify_code |= WINIX_NOTIFY_ITEM_EDIT;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Error System::CheckSpecialFile(const Item & item)
|
||||
{
|
||||
static std::string fstab = "fstab";
|
||||
|
||||
Item * etc = dirs.GetEtcDir();
|
||||
|
||||
if( !etc )
|
||||
return WINIX_NOTHING_TO_DO;
|
||||
|
||||
if( item.parent_id != etc->id )
|
||||
return WINIX_NOTHING_TO_DO;
|
||||
|
||||
if( item.url == fstab )
|
||||
{
|
||||
log << log3 << "System: reloading mount points" << logend;
|
||||
|
||||
Error status = mounts.ReadMounts(item.content);
|
||||
templates->ReadNewIndexTemplates();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
return WINIX_NOTHING_TO_DO;
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucorefs
|
||||
#define headerfilecmslucorefs
|
||||
|
||||
|
||||
#include "dirs.h"
|
||||
#include "mounts.h"
|
||||
#include "db.h"
|
||||
#include "request.h"
|
||||
#include "config.h"
|
||||
#include "users.h"
|
||||
#include "groups.h"
|
||||
#include "rebus.h"
|
||||
#include "loadavg.h"
|
||||
|
||||
|
||||
class Functions;
|
||||
class Templates;
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
// the time when the winix starts
|
||||
time_t system_start;
|
||||
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetDb(Db * pdb);
|
||||
void SetFunctions(Functions * pfunctions);
|
||||
void SetTemplates(Templates * ptemplates);
|
||||
void Init();
|
||||
|
||||
void RedirectTo(const Item & item, const char * postfix = 0);
|
||||
void RedirectTo(long item_id, const char * postfix = 0);
|
||||
void RedirectToLastDir();
|
||||
void RedirectToLastItem(); // redirect to an item if exists or to the last directory
|
||||
|
||||
void PrepareUrl(Item & item);
|
||||
|
||||
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 DirsHaveReadExecPerm();
|
||||
void CheckAccessToItems(std::vector<Item> & item_table);
|
||||
|
||||
bool CanUseHtml(long user_id);
|
||||
bool CanUseBBCode(long user_id);
|
||||
bool CanUseRaw(long user_id);
|
||||
|
||||
bool IsMemberOfGroup(long user_id, const char * group_name);
|
||||
|
||||
bool MakePath(const Item & item, std::string & path, bool create_dir);
|
||||
bool MakePath(Item & item, bool create_dir); // output path is: item.auth_path
|
||||
|
||||
Error AddFile(Item & item);
|
||||
Error EditFile(Item & item, bool with_url = true);
|
||||
|
||||
Error CheckSpecialFile(const Item & item);
|
||||
|
||||
private:
|
||||
Request * request;
|
||||
Config * config;
|
||||
Db * db;
|
||||
Functions * functions;
|
||||
Templates * templates;
|
||||
|
||||
std::string path;
|
||||
bool MakePathSimpleFs(std::string & path, long dir_id, bool create_dir);
|
||||
bool MakePathHashFs(std::string & path, long id, bool create_dir);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -31,12 +31,16 @@ public:
|
|||
// at the moment only used: id, date_modification, user_id
|
||||
Item last_item;
|
||||
|
||||
// used when sorting
|
||||
long sort;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
id = parent_id = dir_id = -1;
|
||||
last_item.Clear();
|
||||
closed = false;
|
||||
items = 0;
|
||||
sort = 0;
|
||||
}
|
||||
|
||||
Thread()
|
||||
|
|
|
@ -7,17 +7,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include "users.h"
|
||||
#include "db.h"
|
||||
|
||||
|
||||
|
||||
Users::Users()
|
||||
{
|
||||
how_many_logged = 0;
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void Users::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void Users::Clear()
|
||||
{
|
||||
|
@ -26,11 +32,10 @@ void Users::Clear()
|
|||
|
||||
|
||||
|
||||
void Users::ReadUsers()
|
||||
void Users::ReadUsers(Db * db)
|
||||
{
|
||||
Clear();
|
||||
|
||||
db.GetUsers(table);
|
||||
db->GetUsers(table);
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,13 +115,59 @@ User & Users::operator[](Users::SizeType pos)
|
|||
}
|
||||
|
||||
|
||||
void Users::LoginUser(long user_id, bool remember_me)
|
||||
{
|
||||
if( !request->session )
|
||||
return;
|
||||
|
||||
request->session->puser = GetUser(user_id);
|
||||
request->session->spam_score = 0;
|
||||
|
||||
if( !request->session->puser )
|
||||
{
|
||||
log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
request->session->remember_me = remember_me;
|
||||
|
||||
last.UserLogin(user_id, request->session->puser->name, inet_addr(request->env_remote_addr), request->session->id);
|
||||
how_many_logged += 1;
|
||||
|
||||
log << log2 << "User " << request->session->puser->name << " (id: " << user_id << ") logged" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Users::LogoutCurrentUser()
|
||||
{
|
||||
if( !request->session || !request->session->puser )
|
||||
return;
|
||||
|
||||
log << log2 << "Users: user " << request->session->puser->name << ", id: "
|
||||
<< request->session->puser->id << " logged out" << logend;
|
||||
|
||||
last.UserLogout(request->session->puser->id, request->session->id);
|
||||
|
||||
if( how_many_logged > 0 ) // for safety
|
||||
how_many_logged -= 1;
|
||||
|
||||
request->session->puser = 0;
|
||||
request->session->remember_me = 0;
|
||||
}
|
||||
|
||||
|
||||
void Users::IncrementLoggedUsers()
|
||||
{
|
||||
how_many_logged += 1;
|
||||
}
|
||||
|
||||
|
||||
long Users::HowManyLogged()
|
||||
{
|
||||
return how_many_logged;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
20
core/users.h
20
core/users.h
|
@ -13,26 +13,32 @@
|
|||
#include <map>
|
||||
#include "user.h"
|
||||
#include "ugcontainer.h"
|
||||
|
||||
|
||||
#include "lastcontainer.h"
|
||||
#include "request.h"
|
||||
#include "db.h"
|
||||
|
||||
|
||||
class Users
|
||||
{
|
||||
|
||||
typedef UGContainer<User> Table;
|
||||
Table table;
|
||||
|
||||
Request * request;
|
||||
long how_many_logged;
|
||||
|
||||
public:
|
||||
|
||||
typedef Table::Iterator Iterator;
|
||||
typedef Table::SizeType SizeType;
|
||||
|
||||
LastContainer last;
|
||||
|
||||
Users();
|
||||
|
||||
void SetRequest(Request * request);
|
||||
|
||||
void Clear();
|
||||
void ReadUsers();
|
||||
void ReadUsers(Db * db);
|
||||
bool AddUser(const User & user);
|
||||
bool IsUser(const std::string & name);
|
||||
User * GetUser(long user_id);
|
||||
|
@ -42,6 +48,12 @@ public:
|
|||
Iterator End();
|
||||
SizeType Size();
|
||||
User & operator[](SizeType pos);
|
||||
|
||||
void LoginUser(long user_id, bool remember_me);
|
||||
void LogoutCurrentUser();
|
||||
|
||||
void IncrementLoggedUsers();
|
||||
long HowManyLogged();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
|
||||
#define WINIX_VER_MAJOR 0
|
||||
#define WINIX_VER_MINOR 3
|
||||
#define WINIX_VER_REVISION 3
|
||||
#define WINIX_VER_MINOR 4
|
||||
#define WINIX_VER_REVISION 0
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,568 @@
|
|||
# DO NOT DELETE
|
||||
|
||||
adduser.o: adduser.h functionbase.h ../core/item.h ../core/db.h
|
||||
adduser.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
adduser.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
adduser.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
adduser.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
adduser.o: ../core/rebus.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
adduser.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
adduser.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
adduser.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
adduser.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
adduser.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
adduser.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
adduser.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
adduser.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
adduser.o: ../core/system.h
|
||||
cat.o: cat.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
cat.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
cat.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
cat.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
cat.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
cat.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
cat.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
cat.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
cat.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
cat.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
cat.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
cat.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
cat.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
cat.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
cat.o: ../core/system.h
|
||||
chmod.o: chmod.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
chmod.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
chmod.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
chmod.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
chmod.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
chmod.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
chmod.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
chmod.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
chmod.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
chmod.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
chmod.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
chmod.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
chmod.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
chmod.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
chmod.o: ../core/system.h privchanger.h
|
||||
chown.o: chown.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
chown.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
chown.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
chown.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
chown.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
chown.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
chown.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
chown.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
chown.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
chown.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
chown.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
chown.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
chown.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
chown.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
chown.o: ../core/system.h privchanger.h
|
||||
cp.o: cp.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
cp.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
cp.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
cp.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
cp.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
cp.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
cp.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
cp.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
cp.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
cp.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
cp.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
cp.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
cp.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
cp.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
cp.o: ../core/system.h ../core/misc.h
|
||||
createthread.o: createthread.h functionbase.h ../core/item.h ../core/db.h
|
||||
createthread.o: ../core/item.h ../core/user.h ../core/group.h
|
||||
createthread.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
createthread.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
createthread.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
createthread.o: ../core/plugindata.h ../core/rebus.h ../core/compress.h
|
||||
createthread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
createthread.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
createthread.o: ../core/config.h ../core/confparser.h ../core/config.h
|
||||
createthread.o: ../core/system.h ../core/dirs.h ../core/db.h
|
||||
createthread.o: ../core/request.h ../core/mounts.h ../core/mount.h
|
||||
createthread.o: ../core/users.h ../core/lastcontainer.h ../core/groups.h
|
||||
createthread.o: ../core/loadavg.h ../core/notify.h
|
||||
createthread.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
createthread.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
createthread.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
createthread.o: functions.h functionparser.h adduser.h cat.h chmod.h
|
||||
createthread.o: privchanger.h chown.h cp.h createticket.h default.h
|
||||
createthread.o: download.h editticket.h emacs.h last.h login.h logout.h ls.h
|
||||
createthread.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h subject.h
|
||||
createthread.o: funthread.h ../core/thread.h funticket.h uname.h upload.h
|
||||
createthread.o: who.h
|
||||
createticket.o: createticket.h functionbase.h ../core/item.h ../core/db.h
|
||||
createticket.o: ../core/item.h ../core/user.h ../core/group.h
|
||||
createticket.o: ../core/thread.h ../core/error.h ../core/log.h
|
||||
createticket.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
|
||||
createticket.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
createticket.o: ../core/plugindata.h ../core/rebus.h ../core/compress.h
|
||||
createticket.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
createticket.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
createticket.o: ../core/config.h ../core/confparser.h ../core/config.h
|
||||
createticket.o: ../core/system.h ../core/dirs.h ../core/db.h
|
||||
createticket.o: ../core/request.h ../core/mounts.h ../core/mount.h
|
||||
createticket.o: ../core/users.h ../core/lastcontainer.h ../core/groups.h
|
||||
createticket.o: ../core/loadavg.h ../core/notify.h
|
||||
createticket.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
createticket.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
createticket.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
createticket.o: readticket.h ../core/ticket.h functions.h functionparser.h
|
||||
createticket.o: adduser.h cat.h chmod.h privchanger.h chown.h cp.h
|
||||
createticket.o: createthread.h default.h download.h editticket.h emacs.h
|
||||
createticket.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h
|
||||
createticket.o: reload.h rm.h run.h subject.h funthread.h ../core/thread.h
|
||||
createticket.o: funticket.h uname.h upload.h who.h
|
||||
default.o: default.h functionbase.h ../core/item.h ../core/db.h
|
||||
default.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
default.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
default.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
default.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
default.o: ../core/rebus.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
default.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
default.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
default.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
default.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
default.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
default.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
default.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
default.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
default.o: ../core/system.h
|
||||
download.o: download.h functionbase.h ../core/item.h ../core/db.h
|
||||
download.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
download.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
download.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
download.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
download.o: ../core/rebus.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
download.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
download.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
download.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
download.o: ../core/request.h ../core/mounts.h ../core/mount.h
|
||||
download.o: ../core/users.h ../core/lastcontainer.h ../core/groups.h
|
||||
download.o: ../core/loadavg.h ../core/notify.h
|
||||
download.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
download.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
download.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
editticket.o: editticket.h functionbase.h ../core/item.h ../core/db.h
|
||||
editticket.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
editticket.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
editticket.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
editticket.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
editticket.o: ../core/rebus.h ../core/compress.h
|
||||
editticket.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
editticket.o: ../core/htmlfilter.h ../core/postmultiparser.h ../core/config.h
|
||||
editticket.o: ../core/confparser.h ../core/config.h ../core/system.h
|
||||
editticket.o: ../core/dirs.h ../core/db.h ../core/request.h ../core/mounts.h
|
||||
editticket.o: ../core/mount.h ../core/users.h ../core/lastcontainer.h
|
||||
editticket.o: ../core/groups.h ../core/loadavg.h ../core/notify.h
|
||||
editticket.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
editticket.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
editticket.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
editticket.o: functions.h functionparser.h adduser.h cat.h chmod.h
|
||||
editticket.o: privchanger.h chown.h cp.h createthread.h createticket.h
|
||||
editticket.o: default.h download.h emacs.h last.h login.h logout.h ls.h
|
||||
editticket.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h subject.h
|
||||
editticket.o: funthread.h ../core/thread.h funticket.h uname.h upload.h who.h
|
||||
editticket.o: readticket.h ../core/ticket.h
|
||||
emacs.o: emacs.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
emacs.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
emacs.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
emacs.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
emacs.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
emacs.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
emacs.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
emacs.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
emacs.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
emacs.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
emacs.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
emacs.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
emacs.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
emacs.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
emacs.o: ../core/system.h ../templates/templates.h
|
||||
emacs.o: ../templates/patterncacher.h ../core/item.h ../templates/misc.h
|
||||
emacs.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
emacs.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
emacs.o: ../core/sessioncontainer.h functions.h functionparser.h adduser.h
|
||||
emacs.o: cat.h chmod.h privchanger.h chown.h cp.h createthread.h
|
||||
emacs.o: createticket.h default.h download.h editticket.h last.h login.h
|
||||
emacs.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
||||
emacs.o: subject.h funthread.h ../core/thread.h funticket.h uname.h upload.h
|
||||
emacs.o: who.h
|
||||
functionbase.o: functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
functionbase.o: ../core/user.h ../core/group.h ../core/thread.h
|
||||
functionbase.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
functionbase.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
functionbase.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
functionbase.o: ../core/rebus.h ../core/compress.h
|
||||
functionbase.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
functionbase.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
functionbase.o: ../core/config.h ../core/confparser.h ../core/config.h
|
||||
functionbase.o: ../core/system.h ../core/dirs.h ../core/db.h
|
||||
functionbase.o: ../core/request.h ../core/mounts.h ../core/mount.h
|
||||
functionbase.o: ../core/users.h ../core/lastcontainer.h ../core/groups.h
|
||||
functionbase.o: ../core/loadavg.h ../core/notify.h
|
||||
functionbase.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
functionbase.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
functionbase.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
functionbase.o: functions.h functionparser.h adduser.h cat.h chmod.h
|
||||
functionbase.o: privchanger.h chown.h cp.h createthread.h createticket.h
|
||||
functionbase.o: default.h download.h editticket.h emacs.h last.h login.h
|
||||
functionbase.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
||||
functionbase.o: subject.h funthread.h ../core/thread.h funticket.h uname.h
|
||||
functionbase.o: upload.h who.h
|
||||
functionparser.o: functionparser.h ../core/request.h ../core/requesttypes.h
|
||||
functionparser.o: ../core/session.h ../core/item.h ../core/error.h
|
||||
functionparser.o: ../core/log.h ../core/user.h ../core/plugindata.h
|
||||
functionparser.o: ../core/rebus.h ../core/thread.h ../core/compress.h
|
||||
functionparser.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
functionparser.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
functionparser.o: ../core/config.h ../core/confparser.h ../core/ticket.h
|
||||
functionparser.o: ../core/db.h ../core/group.h ../core/dircontainer.h
|
||||
functionparser.o: ../core/ugcontainer.h ../core/system.h ../core/dirs.h
|
||||
functionparser.o: ../core/db.h ../core/request.h ../core/mounts.h
|
||||
functionparser.o: ../core/mount.h ../core/users.h ../core/lastcontainer.h
|
||||
functionparser.o: ../core/groups.h ../core/loadavg.h ../core/log.h
|
||||
functionparser.o: ../core/item.h ../core/error.h functions.h functionbase.h
|
||||
functionparser.o: ../core/config.h ../core/notify.h
|
||||
functionparser.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
functionparser.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
functionparser.o: ../templates/localefilter.h ../core/locale.h
|
||||
functionparser.o: ../core/system.h adduser.h cat.h chmod.h privchanger.h
|
||||
functionparser.o: chown.h cp.h createthread.h createticket.h default.h
|
||||
functionparser.o: download.h editticket.h emacs.h last.h login.h logout.h
|
||||
functionparser.o: ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h
|
||||
functionparser.o: subject.h funthread.h ../core/thread.h funticket.h uname.h
|
||||
functionparser.o: upload.h who.h
|
||||
functions.o: functions.h functionbase.h ../core/item.h ../core/db.h
|
||||
functions.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
functions.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
functions.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
functions.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
functions.o: ../core/rebus.h ../core/compress.h
|
||||
functions.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
functions.o: ../core/htmlfilter.h ../core/postmultiparser.h ../core/config.h
|
||||
functions.o: ../core/confparser.h ../core/config.h ../core/system.h
|
||||
functions.o: ../core/dirs.h ../core/db.h ../core/request.h ../core/mounts.h
|
||||
functions.o: ../core/mount.h ../core/users.h ../core/lastcontainer.h
|
||||
functions.o: ../core/groups.h ../core/loadavg.h ../core/notify.h
|
||||
functions.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
functions.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
functions.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
functions.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h
|
||||
functions.o: cp.h createthread.h createticket.h default.h download.h
|
||||
functions.o: editticket.h emacs.h last.h login.h logout.h ls.h mkdir.h mv.h
|
||||
functions.o: node.h priv.h reload.h rm.h run.h subject.h funthread.h
|
||||
functions.o: ../core/thread.h funticket.h uname.h upload.h who.h
|
||||
functions.o: ../core/log.h ../core/misc.h ../templates/templates.h
|
||||
functions.o: ../templates/patterncacher.h ../core/item.h ../templates/misc.h
|
||||
functions.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
functions.o: ../core/log.h ../templates/indexpatterns.h
|
||||
functions.o: ../core/sessionmanager.h ../core/sessioncontainer.h
|
||||
funthread.o: funthread.h functionbase.h ../core/item.h ../core/db.h
|
||||
funthread.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
funthread.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
funthread.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
funthread.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
funthread.o: ../core/rebus.h ../core/compress.h
|
||||
funthread.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
funthread.o: ../core/htmlfilter.h ../core/postmultiparser.h ../core/config.h
|
||||
funthread.o: ../core/confparser.h ../core/config.h ../core/system.h
|
||||
funthread.o: ../core/dirs.h ../core/db.h ../core/request.h ../core/mounts.h
|
||||
funthread.o: ../core/mount.h ../core/users.h ../core/lastcontainer.h
|
||||
funthread.o: ../core/groups.h ../core/loadavg.h ../core/notify.h
|
||||
funthread.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
funthread.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
funthread.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
funthread.o: ../core/thread.h
|
||||
funticket.o: funticket.h functionbase.h ../core/item.h ../core/db.h
|
||||
funticket.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
funticket.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
funticket.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
funticket.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
funticket.o: ../core/rebus.h ../core/compress.h
|
||||
funticket.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
funticket.o: ../core/htmlfilter.h ../core/postmultiparser.h ../core/config.h
|
||||
funticket.o: ../core/confparser.h ../core/config.h ../core/system.h
|
||||
funticket.o: ../core/dirs.h ../core/db.h ../core/request.h ../core/mounts.h
|
||||
funticket.o: ../core/mount.h ../core/users.h ../core/lastcontainer.h
|
||||
funticket.o: ../core/groups.h ../core/loadavg.h ../core/notify.h
|
||||
funticket.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
|
||||
funticket.o: ../core/mount.h ../core/locale.h ../templates/misc.h
|
||||
funticket.o: ../templates/localefilter.h ../core/locale.h ../core/system.h
|
||||
last.o: last.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
last.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
last.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
last.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
last.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
last.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
last.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
last.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
last.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
last.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
last.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
last.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
last.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
last.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
last.o: ../core/system.h
|
||||
login.o: login.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
login.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
login.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
login.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
login.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
login.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
login.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
login.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
login.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
login.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
login.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
login.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
login.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
login.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
login.o: ../core/system.h
|
||||
logout.o: logout.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
logout.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
logout.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
logout.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
logout.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
logout.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
logout.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
logout.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
logout.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
logout.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
logout.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
logout.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
logout.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
logout.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
logout.o: ../core/system.h
|
||||
ls.o: ls.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
ls.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
ls.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
ls.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
ls.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
ls.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
ls.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
ls.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
ls.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
ls.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
ls.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
ls.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
ls.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
ls.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
ls.o: ../core/system.h
|
||||
mkdir.o: mkdir.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
mkdir.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
mkdir.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
mkdir.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
mkdir.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
mkdir.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
mkdir.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
mkdir.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
mkdir.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
mkdir.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
mkdir.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
mkdir.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
mkdir.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
mkdir.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
mkdir.o: ../core/system.h functions.h functionparser.h adduser.h cat.h
|
||||
mkdir.o: chmod.h privchanger.h chown.h cp.h createthread.h createticket.h
|
||||
mkdir.o: default.h download.h editticket.h emacs.h last.h login.h logout.h
|
||||
mkdir.o: ls.h mv.h node.h priv.h reload.h rm.h run.h subject.h funthread.h
|
||||
mkdir.o: ../core/thread.h funticket.h uname.h upload.h who.h
|
||||
mv.o: mv.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
mv.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
mv.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
mv.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
mv.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
mv.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
mv.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
mv.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
mv.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
mv.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
mv.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
mv.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
mv.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
mv.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
mv.o: ../core/system.h
|
||||
node.o: node.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
node.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
node.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
node.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
node.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
node.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
node.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
node.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
node.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
node.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
node.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
node.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
node.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
node.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
node.o: ../core/system.h
|
||||
priv.o: priv.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
priv.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
priv.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
priv.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
priv.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
priv.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
priv.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
priv.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
priv.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
priv.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
priv.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
priv.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
priv.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
priv.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
priv.o: ../core/system.h privchanger.h
|
||||
privchanger.o: privchanger.h ../core/request.h ../core/requesttypes.h
|
||||
privchanger.o: ../core/session.h ../core/item.h ../core/error.h ../core/log.h
|
||||
privchanger.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||
privchanger.o: ../core/thread.h ../core/compress.h
|
||||
privchanger.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
privchanger.o: ../core/htmlfilter.h ../core/postmultiparser.h
|
||||
privchanger.o: ../core/config.h ../core/confparser.h ../core/ticket.h
|
||||
privchanger.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
||||
privchanger.o: ../core/db.h ../core/request.h ../core/mounts.h
|
||||
privchanger.o: ../core/mount.h ../core/users.h ../core/ugcontainer.h
|
||||
privchanger.o: ../core/lastcontainer.h ../core/groups.h ../core/group.h
|
||||
privchanger.o: ../core/loadavg.h ../core/db.h
|
||||
readticket.o: readticket.h ../core/request.h ../core/requesttypes.h
|
||||
readticket.o: ../core/session.h ../core/item.h ../core/error.h ../core/log.h
|
||||
readticket.o: ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||
readticket.o: ../core/thread.h ../core/compress.h
|
||||
readticket.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
|
||||
readticket.o: ../core/htmlfilter.h ../core/postmultiparser.h ../core/config.h
|
||||
readticket.o: ../core/confparser.h ../core/ticket.h ../core/ticket.h
|
||||
readticket.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h
|
||||
readticket.o: ../core/db.h ../core/request.h ../core/mounts.h ../core/mount.h
|
||||
readticket.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
|
||||
readticket.o: ../core/groups.h ../core/group.h ../core/loadavg.h
|
||||
reload.o: reload.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
reload.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
reload.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
reload.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
reload.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
reload.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
reload.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
reload.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
reload.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
reload.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
reload.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
reload.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
reload.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
reload.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
reload.o: ../core/system.h ../templates/templates.h
|
||||
reload.o: ../templates/patterncacher.h ../core/item.h ../templates/misc.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
|
||||
rm.o: rm.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
rm.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
rm.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
rm.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
rm.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
rm.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
rm.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
rm.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
rm.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
rm.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
rm.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
rm.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
rm.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
rm.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
rm.o: ../core/system.h ../core/plugin.h ../core/pluginmsg.h
|
||||
rm.o: ../core/sessionmanager.h ../core/sessioncontainer.h
|
||||
rm.o: ../functions/functions.h functionparser.h adduser.h cat.h chmod.h
|
||||
rm.o: privchanger.h chown.h cp.h createthread.h createticket.h default.h
|
||||
rm.o: download.h editticket.h emacs.h last.h login.h logout.h ls.h mkdir.h
|
||||
rm.o: mv.h node.h priv.h reload.h run.h subject.h funthread.h
|
||||
rm.o: ../core/thread.h funticket.h uname.h upload.h who.h
|
||||
rm.o: ../templates/templates.h ../templates/patterncacher.h ../core/item.h
|
||||
rm.o: ../templates/misc.h ../templates/ckeditorgetparser.h
|
||||
rm.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
|
||||
rm.o: ../core/sessionmanager.h
|
||||
run.o: run.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
run.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
run.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
run.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
run.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
run.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
run.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
run.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
run.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
run.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
run.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
run.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
run.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
run.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
run.o: ../core/system.h
|
||||
subject.o: subject.h functionbase.h ../core/item.h ../core/db.h
|
||||
subject.o: ../core/item.h ../core/user.h ../core/group.h ../core/thread.h
|
||||
subject.o: ../core/error.h ../core/log.h ../core/dircontainer.h
|
||||
subject.o: ../core/ugcontainer.h ../core/ticket.h ../core/request.h
|
||||
subject.o: ../core/requesttypes.h ../core/session.h ../core/plugindata.h
|
||||
subject.o: ../core/rebus.h ../core/compress.h ../core/acceptencodingparser.h
|
||||
subject.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
subject.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
subject.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
subject.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
subject.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
subject.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
subject.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
subject.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
subject.o: ../core/system.h
|
||||
uname.o: uname.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
uname.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
uname.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
uname.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
uname.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
uname.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
uname.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
uname.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
uname.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
uname.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
uname.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
uname.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
uname.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
uname.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
uname.o: ../core/system.h
|
||||
upload.o: upload.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
upload.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
upload.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
upload.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
upload.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
upload.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
upload.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
upload.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
upload.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
upload.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
upload.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
upload.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
upload.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
upload.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
upload.o: ../core/system.h ../core/misc.h ../functions/functions.h
|
||||
upload.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h cp.h
|
||||
upload.o: createthread.h createticket.h default.h download.h editticket.h
|
||||
upload.o: emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h
|
||||
upload.o: reload.h rm.h run.h subject.h funthread.h ../core/thread.h
|
||||
upload.o: funticket.h uname.h who.h
|
||||
who.o: who.h functionbase.h ../core/item.h ../core/db.h ../core/item.h
|
||||
who.o: ../core/user.h ../core/group.h ../core/thread.h ../core/error.h
|
||||
who.o: ../core/log.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
who.o: ../core/ticket.h ../core/request.h ../core/requesttypes.h
|
||||
who.o: ../core/session.h ../core/plugindata.h ../core/rebus.h
|
||||
who.o: ../core/compress.h ../core/acceptencodingparser.h
|
||||
who.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
|
||||
who.o: ../core/postmultiparser.h ../core/config.h ../core/confparser.h
|
||||
who.o: ../core/config.h ../core/system.h ../core/dirs.h ../core/db.h
|
||||
who.o: ../core/request.h ../core/mounts.h ../core/mount.h ../core/users.h
|
||||
who.o: ../core/lastcontainer.h ../core/groups.h ../core/loadavg.h
|
||||
who.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
who.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h
|
||||
who.o: ../templates/misc.h ../templates/localefilter.h ../core/locale.h
|
||||
who.o: ../core/system.h
|
|
@ -0,0 +1 @@
|
|||
o = adduser.o cat.o chmod.o chown.o cp.o createthread.o createticket.o default.o download.o editticket.o emacs.o functionbase.o functionparser.o functions.o funthread.o funticket.o last.o login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o readticket.o reload.o rm.o run.o subject.o uname.o upload.o who.o
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "adduser.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
AddUser::AddUser()
|
||||
{
|
||||
fun.url = "adduser";
|
||||
}
|
||||
|
||||
|
||||
bool AddUser::CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass)
|
||||
{
|
||||
if( !login || !pass || !conf_pass )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( login->empty() )
|
||||
{
|
||||
request->status = WINIX_ERR_LOGIN_EMPTY;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( *pass != *conf_pass )
|
||||
{
|
||||
request->status = WINIX_ERR_PASSWORDS_DIFFERENT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( pass->size() < 5 )
|
||||
{
|
||||
request->status = WINIX_ERR_PASSWORD_TOO_SHORT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( system->users.IsUser(*login) )
|
||||
{
|
||||
request->status = WINIX_ERR_USER_EXISTS;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void AddUser::MakePost()
|
||||
{
|
||||
User user;
|
||||
|
||||
std::string * login = request->PostVar("login");
|
||||
std::string * pass = request->PostVar("password");
|
||||
std::string * conf_pass = request->PostVar("confirmpassword");
|
||||
std::string * email = request->PostVar("email");
|
||||
|
||||
if( !CheckAddUserVars(login, pass, conf_pass) )
|
||||
return;
|
||||
|
||||
user.name = *login;
|
||||
|
||||
if( email )
|
||||
user.email = *email;
|
||||
|
||||
request->status = db->AddUser(user, *pass);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
if( system->users.AddUser(user) )
|
||||
{
|
||||
if( !request->session->puser )
|
||||
system->users.LoginUser(user.id, false);
|
||||
|
||||
log << log2 << "Content: added a new user: " << user.name << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: I can't add to system->users: " << user.name
|
||||
<< " but the user was added to the db correctly" << logend;
|
||||
}
|
||||
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentadduser
|
||||
#define headerfilecmslucontentadduser
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class AddUser : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
AddUser();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 = "cat";
|
||||
}
|
||||
|
||||
|
||||
void Cat::MakeGet()
|
||||
{
|
||||
if( !request->is_item )
|
||||
{
|
||||
log << log1 << "Content: cat function requires an item" << logend;
|
||||
request->status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( !system->HasReadAccess(request->item) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request->send_as_attachment = request->IsParam("attachment");
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentfuncatcat
|
||||
#define headerfilecmslucontentfuncatcat
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Cat : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Cat();
|
||||
void MakeGet();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace Fun
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 = "chmod";
|
||||
}
|
||||
|
||||
|
||||
void Chmod::MakePost()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.Change(false, true);
|
||||
}
|
||||
|
||||
|
||||
void Chmod::MakeGet()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.CheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentchmod
|
||||
#define headerfilecmslucontentchmod
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "privchanger.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Chmod : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Chmod();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
PrivChanger priv_changer;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 = "chown";
|
||||
}
|
||||
|
||||
|
||||
void Chown::MakePost()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.Change(true, false);
|
||||
}
|
||||
|
||||
|
||||
void Chown::MakeGet()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.CheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentchown
|
||||
#define headerfilecmslucontentchown
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "privchanger.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Chown : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Chown();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
PrivChanger priv_changer;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,334 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "cp.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Cp::Cp()
|
||||
{
|
||||
fun.url = "cp";
|
||||
}
|
||||
|
||||
|
||||
bool Cp::CpCheckAccessFrom()
|
||||
{
|
||||
if( request->is_item )
|
||||
{
|
||||
if( !system->HasReadAccess(request->item) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( !request->IsParam("r") )
|
||||
{
|
||||
// directories need 'r' parameter
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Cp::CheckAccessTo(long dir_id)
|
||||
{
|
||||
Item * pdir = system->dirs.GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !system->HasReadExecAccessToPath(dir_id) || !system->HasWriteAccess(*pdir) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Cp::ParseDir(long & dir_id, std::string & dir, std::string & file)
|
||||
{
|
||||
std::string * move_to = request->PostVar("to");
|
||||
|
||||
if( !move_to )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
int res = system->dirs.AnalyzePath(*move_to, dir_id, dir, file);
|
||||
|
||||
if( res == 1 )
|
||||
request->status = WINIX_ERR_NO_ROOT_DIR;
|
||||
else
|
||||
if( res != 0 )
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
|
||||
return res == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::CpAuth(Item & item)
|
||||
{
|
||||
if( !system->MakePath(item, mv_new_path, true) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( CopyFile(item.auth_path, mv_new_path) )
|
||||
{
|
||||
log << log1 << "Content: copied static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
|
||||
item.auth_path = mv_new_path;
|
||||
request->status = db->EditAuthById(item, item.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: can't copy a file from: " << item.auth_path << ", to: " << mv_new_path << logend;
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Cp::CpSetNewAttributes(Item & item)
|
||||
{
|
||||
item.user_id = cp_new_user;
|
||||
item.group_id = cp_new_group;
|
||||
item.SetDateModifyToNow();
|
||||
}
|
||||
|
||||
|
||||
void Cp::CpItem(Item & item, long dst_dir_id)
|
||||
{
|
||||
if( !system->HasReadAccess(item) )
|
||||
return; // !! w przyszlosci bedziemy dodawac komunikaty do specjalnej tablicy (narazie nie zaimplementowane)
|
||||
|
||||
item.parent_id = dst_dir_id;
|
||||
|
||||
if( !cp_preserve_attr )
|
||||
CpSetNewAttributes(item);
|
||||
|
||||
request->status = system->AddFile(item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
if( item.auth != Item::auth_none )
|
||||
CpAuth(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Cp::CpPrepare()
|
||||
{
|
||||
cp_iq.SetAll(true, false);
|
||||
cp_iq.WhereType(Item::file);
|
||||
|
||||
cp_new_user = -1;
|
||||
cp_new_group = -1;
|
||||
|
||||
if( request->session->puser )
|
||||
cp_new_user = request->session->puser->id;
|
||||
|
||||
Item * pdir = system->dirs.GetDir(mv_dir_id);
|
||||
|
||||
if( pdir )
|
||||
cp_new_group = pdir->group_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::CpFilesInDir(const Item & dir, long dst_dir_id)
|
||||
{
|
||||
cp_iq.WhereParentId(dir.id);
|
||||
db->GetItems(request->item_table, cp_iq);
|
||||
|
||||
for(size_t i=0 ; i<request->item_table.size() ; ++i)
|
||||
CpItem(request->item_table[i], dst_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::CpContentOfDir(const Item & item, long dst_dir_id)
|
||||
{
|
||||
DirContainer::ParentIterator i = system->dirs.FindFirstParent(item.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextParent(i) )
|
||||
CpDir(*(i->second), dst_dir_id);
|
||||
|
||||
CpFilesInDir(item, dst_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// we shouldn't change 'item' because we have references to our app.dirs objects
|
||||
long Cp::CpDir(const Item & item, long dst_dir_id)
|
||||
{
|
||||
cp_temp = item;
|
||||
cp_temp.parent_id = dst_dir_id;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
cp_temp.url = mv_file;
|
||||
mv_file.clear();
|
||||
system->PrepareUrl(cp_temp);
|
||||
}
|
||||
|
||||
if( !cp_preserve_attr )
|
||||
CpSetNewAttributes(cp_temp);
|
||||
|
||||
if( cp_remove_defaults )
|
||||
cp_temp.default_item = -1;
|
||||
|
||||
request->status = system->dirs.AddDirectory(cp_temp);
|
||||
long new_dir_id = cp_temp.id; // remember the new dir_id
|
||||
|
||||
if( system->HasReadExecAccess(item) )
|
||||
CpContentOfDir(item, cp_temp.id);
|
||||
|
||||
return new_dir_id; // and return it
|
||||
}
|
||||
|
||||
|
||||
bool Cp::IsTheSameFile(const Item & item)
|
||||
{
|
||||
if( mv_file.empty() )
|
||||
{
|
||||
if( item.parent_id == mv_dir_id )
|
||||
return true; // nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
if( item.parent_id == mv_dir_id && item.url == mv_file )
|
||||
return true; // nothing to do
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// here 'item' can be changed in place
|
||||
void Cp::CpItemCheck(Item & item, bool redirect)
|
||||
{
|
||||
if( IsTheSameFile(item) )
|
||||
return;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
item.url = mv_file;
|
||||
system->PrepareUrl(item);
|
||||
}
|
||||
|
||||
CpItem(item, mv_dir_id);
|
||||
|
||||
if( request->status==WINIX_ERR_OK && redirect )
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::CpContentOfDirCheck(const Item & item, bool redirect)
|
||||
{
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
if( mv_dir_id == item.id )
|
||||
return; // nothing to do
|
||||
|
||||
if( system->dirs.HasParent(mv_dir_id, item.id) )
|
||||
{
|
||||
log << log1 << "Content: cannot copy directory to inside it" << logend;
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
CpContentOfDir(item, mv_dir_id);
|
||||
|
||||
if( request->status==WINIX_ERR_OK && redirect )
|
||||
system->RedirectTo(mv_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::CpDirCheck(const Item & item, bool redirect)
|
||||
{
|
||||
if( mv_file.empty() && mv_dir_id == item.id )
|
||||
return; // nothing to do
|
||||
|
||||
if( mv_dir_id == item.id || system->dirs.HasParent(mv_dir_id, item.id) )
|
||||
{
|
||||
log << log1 << "Content: cannot copy directory to inside it" << logend;
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
long new_dir_id = CpDir(item, mv_dir_id);
|
||||
|
||||
if( request->status==WINIX_ERR_OK && redirect )
|
||||
system->RedirectTo(new_dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::MakePost()
|
||||
{
|
||||
if( CpCheckAccessFrom() &&
|
||||
ParseDir(mv_dir_id, mv_dir, mv_file) &&
|
||||
CheckAccessTo(mv_dir_id) )
|
||||
{
|
||||
CpPrepare();
|
||||
cp_preserve_attr = request->IsPostVar("preserveattr");
|
||||
|
||||
if( request->is_item )
|
||||
{
|
||||
CpItemCheck(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
cp_remove_defaults = request->IsPostVar("removedefaults");
|
||||
|
||||
if( request->IsPostVar("onlycontent") )
|
||||
CpContentOfDirCheck(*request->dir_table.back());
|
||||
else
|
||||
CpDirCheck(*request->dir_table.back());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Cp::MakeGet()
|
||||
{
|
||||
CpCheckAccessFrom();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentcp
|
||||
#define headerfilecmslucontentcp
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Cp : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Cp();
|
||||
|
||||
private:
|
||||
|
||||
// !! wywalic przedrostki cp_ Cp
|
||||
|
||||
Item cp_temp;
|
||||
Db::ItemQuery cp_iq;
|
||||
bool cp_remove_defaults;
|
||||
bool cp_preserve_attr;
|
||||
long cp_new_user;
|
||||
long cp_new_group;
|
||||
|
||||
std::string mv_dir;
|
||||
std::string mv_file;
|
||||
std::string mv_new_path;
|
||||
long mv_dir_id;
|
||||
|
||||
bool CpCheckAccessFrom();
|
||||
bool CheckAccessTo(long dir_id);
|
||||
bool ParseDir(long & dir_id, std::string & dir, std::string & file);
|
||||
void CpAuth(Item & item);
|
||||
void CpSetNewAttributes(Item & item);
|
||||
void CpItem(Item & item, long dst_dir_id);
|
||||
void CpPrepare();
|
||||
void CpFilesInDir(const Item & dir, long dst_dir_id);
|
||||
void CpContentOfDir(const Item & item, long dst_dir_id);
|
||||
long CpDir(const Item & item, long dst_dir_id);
|
||||
bool IsTheSameFile(const Item & item);
|
||||
void CpItemCheck(Item & item, bool redirect = true);
|
||||
void CpContentOfDirCheck(const Item & item, bool redirect = true);
|
||||
void CpDirCheck(const Item & item, bool redirect = true);
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "createthread.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
CreateThread::CreateThread()
|
||||
{
|
||||
fun.url = "createthread";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returning true if we can create a thread in the current directory
|
||||
bool CreateThread::HasAccess()
|
||||
{
|
||||
if( request->dir_table.empty() )
|
||||
return false;
|
||||
|
||||
if( request->is_item )
|
||||
return false;
|
||||
|
||||
if( !system->HasWriteAccess(*request->dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount || system->mounts.pmount->type != Mount::thread )
|
||||
return false;
|
||||
|
||||
if( request->session && request->session->puser && request->session->puser->super_user )
|
||||
// super can create thread regardless of the restrictcreatethread option
|
||||
return true;
|
||||
|
||||
if( !system->mounts.pmount->IsPar(Mount::par_createthread_on) )
|
||||
return true;
|
||||
|
||||
if( system->mounts.pmount->IsArg(Mount::par_createthread_on, request->dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CreateThread::FunCreateThreadCheckAbuse()
|
||||
{
|
||||
if( !system->rebus.CheckRebus() )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
functions->CheckGetPostTimes();
|
||||
|
||||
if( request->session->spam_score > 0 )
|
||||
{
|
||||
request->status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateThread::ReadThread(Thread & thread)
|
||||
{
|
||||
thread.parent_id = request->dir_table.back()->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateThread::AddThread()
|
||||
{
|
||||
request->thread.dir_id = request->dir_table.back()->id;
|
||||
request->thread.closed = false;
|
||||
request->thread.items = 1;
|
||||
request->thread.last_item = request->item; // set by PostFunEmacsAdd()
|
||||
|
||||
request->status = db->AddThread(request->thread);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateThread::PostFunCreateThreadLogAndRedirect()
|
||||
{
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added a new thread" << logend;
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with adding a new thread, error code: "
|
||||
<< request->status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateThread::MakePost()
|
||||
{
|
||||
functions->ReadItem(request->item, Item::dir);
|
||||
functions->SetUser(request->item);
|
||||
ReadThread(request->thread);
|
||||
request->item.privileges = 0777; // !! tymczasowo 777 aby wszyscy mogli wysylac posty
|
||||
|
||||
if( !FunCreateThreadCheckAbuse() )
|
||||
{
|
||||
functions->ReadItemContentWithType(request->item); // for correctly displaying the form
|
||||
return;
|
||||
}
|
||||
|
||||
request->status = system->dirs.AddDirectory(request->item, true);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
functions->ReadItemContentWithType(request->item);
|
||||
request->item.type = Item::file;
|
||||
request->item.privileges = 0644; // !! tymczasowo
|
||||
request->item.parent_id = request->dir_table.back()->id;
|
||||
request->status = system->AddFile(request->item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
AddThread();
|
||||
}
|
||||
|
||||
PostFunCreateThreadLogAndRedirect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentcreatethread
|
||||
#define headerfilecmslucontentcreatethread
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class CreateThread : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
CreateThread();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool FunCreateThreadCheckAbuse();
|
||||
void ReadThread(Thread & thread);
|
||||
void AddThread();
|
||||
void PostFunCreateThreadLogAndRedirect();
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "createticket.h"
|
||||
#include "readticket.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
CreateTicket::CreateTicket()
|
||||
{
|
||||
fun.url = "createticket";
|
||||
}
|
||||
|
||||
|
||||
// returning true if we can create a ticket in the current directory
|
||||
bool CreateTicket::HasAccess()
|
||||
{
|
||||
if( request->dir_table.empty() )
|
||||
return false;
|
||||
|
||||
if( request->is_item )
|
||||
return false;
|
||||
|
||||
if( !system->HasWriteAccess(*request->dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount || system->mounts.pmount->type != Mount::ticket )
|
||||
return false;
|
||||
|
||||
|
||||
// checking for par_createticket_on mount option
|
||||
|
||||
if( request->session && request->session->puser && request->session->puser->super_user )
|
||||
// super can create tickets regardless of the createticket_on option
|
||||
return true;
|
||||
|
||||
if( !system->mounts.pmount->IsPar(Mount::par_createticket_on) )
|
||||
return true;
|
||||
|
||||
if( system->mounts.pmount->IsArg(Mount::par_createticket_on, request->dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool CreateTicket::FunCreateTicketCheckAbuse()
|
||||
{
|
||||
if( !system->rebus.CheckRebus() )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
functions->CheckGetPostTimes();
|
||||
|
||||
if( request->session->spam_score > 0 )
|
||||
{
|
||||
request->status = WINIX_ERR_SPAM;
|
||||
log << log1 << "Content: ignoring due to suspected spamming" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::AddTicket()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->ticket.dir_id = request->dir_table.back()->id; // a new directory created by Mkdir()
|
||||
request->ticket.item_id = request->item.id; // this id is set by PostFunEmacsAdd()
|
||||
|
||||
request->status = db->AddTicket(request->ticket);
|
||||
}
|
||||
|
||||
|
||||
void CreateTicket::PostFunCreateTicketLogAndRedirect()
|
||||
{
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: added a new ticket" << logend;
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with adding a new ticket, error code: "
|
||||
<< request->status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::MakePost()
|
||||
{
|
||||
functions->ReadItem(request->item, Item::dir);
|
||||
functions->SetUser(request->item);
|
||||
|
||||
ReadTicket read_ticket;
|
||||
read_ticket.Read(system, request, &request->ticket);
|
||||
|
||||
request->item.privileges = 0777; // !! tymczasowo 777 aby wszyscy mogli wysylac posty
|
||||
|
||||
if( !FunCreateTicketCheckAbuse() )
|
||||
{
|
||||
functions->ReadItemContentWithType(request->item); // for correctly displaying the form
|
||||
return;
|
||||
}
|
||||
|
||||
request->status = system->dirs.AddDirectory(request->item, true);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
functions->ReadItemContentWithType(request->item);
|
||||
request->item.type = Item::file;
|
||||
request->item.privileges = 0644; // !! tymczasowo
|
||||
request->item.parent_id = request->dir_table.back()->id;
|
||||
|
||||
request->status = system->AddFile(request->item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
AddTicket();
|
||||
}
|
||||
|
||||
PostFunCreateTicketLogAndRedirect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentcreateticket
|
||||
#define headerfilecmslucontentcreateticket
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class CreateTicket : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
CreateTicket();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool FunCreateTicketCheckAbuse();
|
||||
void AddTicket();
|
||||
void PostFunCreateTicketLogAndRedirect();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue