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:
22
functions/Makefile
Executable file
22
functions/Makefile
Executable file
@@ -0,0 +1,22 @@
|
||||
include Makefile.o.dep
|
||||
|
||||
|
||||
all: $(o)
|
||||
|
||||
|
||||
.SUFFIXES: .cpp .o
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) -c $(CXXFLAGS) $<
|
||||
|
||||
|
||||
|
||||
depend:
|
||||
makedepend -Y. -I.. -I../../ezc/src -f- *.cpp > Makefile.dep
|
||||
echo -n "o = " > Makefile.o.dep
|
||||
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
include Makefile.dep
|
568
functions/Makefile.dep
Executable file
568
functions/Makefile.dep
Executable file
@@ -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
|
1
functions/Makefile.o.dep
Executable file
1
functions/Makefile.o.dep
Executable file
@@ -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
|
105
functions/adduser.cpp
Executable file
105
functions/adduser.cpp
Executable file
@@ -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
|
37
functions/adduser.h
Executable file
37
functions/adduser.h
Executable file
@@ -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
|
43
functions/cat.cpp
Executable file
43
functions/cat.cpp
Executable file
@@ -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
|
33
functions/cat.h
Executable file
33
functions/cat.h
Executable file
@@ -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
|
45
functions/chmod.cpp
Executable file
45
functions/chmod.cpp
Executable file
@@ -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
|
38
functions/chmod.h
Executable file
38
functions/chmod.h
Executable file
@@ -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
|
45
functions/chown.cpp
Executable file
45
functions/chown.cpp
Executable file
@@ -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
|
38
functions/chown.h
Executable file
38
functions/chown.h
Executable file
@@ -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
|
334
functions/cp.cpp
Executable file
334
functions/cp.cpp
Executable file
@@ -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
|
65
functions/cp.h
Executable file
65
functions/cp.h
Executable file
@@ -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
|
148
functions/createthread.cpp
Executable file
148
functions/createthread.cpp
Executable file
@@ -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
|
40
functions/createthread.h
Executable file
40
functions/createthread.h
Executable file
@@ -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
|
147
functions/createticket.cpp
Executable file
147
functions/createticket.cpp
Executable file
@@ -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
|
40
functions/createticket.h
Executable file
40
functions/createticket.h
Executable file
@@ -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
|
114
functions/default.cpp
Executable file
114
functions/default.cpp
Executable file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "default.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Default::Default()
|
||||
{
|
||||
fun.url = "default";
|
||||
}
|
||||
|
||||
|
||||
long Default::PostFunDefaultParsePath()
|
||||
{
|
||||
Item * pdir, * pdir2;
|
||||
long defaultid = -1;
|
||||
|
||||
std::string * path = request->PostVar("defaultitem");
|
||||
|
||||
|
||||
if( path && !path->empty() )
|
||||
{
|
||||
std::string dir, file;
|
||||
Dirs::SplitPath(*path, dir, file);
|
||||
|
||||
pdir = system->dirs.GetDir(dir);
|
||||
|
||||
if( !pdir )
|
||||
throw Error(WINIX_ERR_INCORRECT_DIR);
|
||||
|
||||
if( file.empty() )
|
||||
{
|
||||
defaultid = pdir->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// checking whether the file is a directory too (the method SplitPath does not check it)
|
||||
pdir2 = system->dirs.GetDir(file, pdir->id);
|
||||
|
||||
if( !pdir2 )
|
||||
{
|
||||
defaultid = db->GetFileId(pdir->id, file);
|
||||
|
||||
if( defaultid == -1 )
|
||||
throw Error(WINIX_ERR_NO_ITEM);
|
||||
}
|
||||
else
|
||||
{
|
||||
// file is a directory
|
||||
defaultid = pdir2->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaultid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Default::MakePost()
|
||||
{
|
||||
if( !system->HasWriteAccess(*request->dir_table.back()) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
long defaultid = PostFunDefaultParsePath();
|
||||
request->status = db->EditDefaultItem(request->dir_table.back()->id, defaultid);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
request->dir_table.back()->default_item = defaultid;
|
||||
}
|
||||
catch(const Error & e)
|
||||
{
|
||||
request->status = e;
|
||||
}
|
||||
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
system->RedirectTo(*request->dir_table.back());
|
||||
else
|
||||
log << log1 << "Content: PostFunDefaultItem: Error: " << request->status << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Default::MakeGet()
|
||||
{
|
||||
if( !system->HasWriteAccess(*request->dir_table.back()) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
38
functions/default.h
Executable file
38
functions/default.h
Executable file
@@ -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 headerfilecmslucontentdefault
|
||||
#define headerfilecmslucontentdefault
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Default : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Default();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
long PostFunDefaultParsePath();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
50
functions/download.cpp
Executable file
50
functions/download.cpp
Executable file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "download.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
Download::Download()
|
||||
{
|
||||
fun.url = "download";
|
||||
}
|
||||
|
||||
|
||||
void Download::MakeGet()
|
||||
{
|
||||
// !! 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( !system->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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
35
functions/download.h
Executable file
35
functions/download.h
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentdownload
|
||||
#define headerfilecmslucontentdownload
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Download : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Download();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
214
functions/editticket.cpp
Executable file
214
functions/editticket.cpp
Executable file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "editticket.h"
|
||||
#include "functions.h"
|
||||
#include "readticket.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
EditTicket::EditTicket()
|
||||
{
|
||||
fun.url = "editticket";
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool EditTicket::HasAccess()
|
||||
{
|
||||
// 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( !system->HasWriteAccess(*request->dir_table.back()) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount || system->mounts.pmount->type != Mount::ticket )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void EditTicket::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
|
||||
functions->SetUser(item);
|
||||
system->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 EditTicket::EditTicketModTicket()
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
Ticket ticket;
|
||||
ReadTicket read_ticket;
|
||||
read_ticket.Read(system, request, &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 EditTicket::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 EditTicket::EditTicketModFirstItem()
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
// modyfing the first item (the one with content)
|
||||
functions->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 EditTicket::PostFunEditTicketLogAndRedirect()
|
||||
{
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "Content: edited a ticket" << logend;
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: problem with editing a ticket, error code: "
|
||||
<< request->status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool EditTicket::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 EditTicket::MakePost()
|
||||
{
|
||||
functions->ReadItem(request->item, Item::dir);
|
||||
// co z uzytkownikiem i grup<75>? chyba nie wczytane? !!! (wczesniej bylo SetUser() w ReadItem() - teraz nie ma)
|
||||
// dodac informacje o modyfikacji !!!
|
||||
|
||||
if( !FunCreateTicketCheckAbuse() )
|
||||
{
|
||||
functions->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 EditTicket::MakeGet()
|
||||
{
|
||||
db->GetItemById(request->ticket.item_id, request->item);
|
||||
|
||||
// the subject we get from the last directory
|
||||
request->item.subject = request->dir_table.back()->subject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
44
functions/editticket.h
Executable file
44
functions/editticket.h
Executable file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontenteditticket
|
||||
#define headerfilecmslucontenteditticket
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class EditTicket : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
EditTicket();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
void EditTicketCheckFirstItem();
|
||||
void EditTicketModTicket();
|
||||
void EditTicketModDir();
|
||||
void EditTicketModFirstItem();
|
||||
void PostFunEditTicketLogAndRedirect();
|
||||
bool FunCreateTicketCheckAbuse();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
149
functions/emacs.cpp
Executable file
149
functions/emacs.cpp
Executable file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "emacs.h"
|
||||
#include "templates/templates.h"
|
||||
#include "core/notify.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Emacs::Emacs()
|
||||
{
|
||||
fun.url = "emacs";
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Emacs::HasAccess(const Item & item)
|
||||
{
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user can use emacs everywhere
|
||||
return true;
|
||||
|
||||
if( !system->HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount->IsPar(Mount::par_emacs_on) )
|
||||
return true;
|
||||
|
||||
if( system->mounts.pmount->IsArg(Mount::par_emacs_on, request->dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Emacs::HasAccess()
|
||||
{
|
||||
if( !request->is_item )
|
||||
return HasAccess(*request->dir_table.back()); // adding a new item
|
||||
else
|
||||
return HasAccess(request->item); // editing an existing item
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Emacs::PostEmacsCheckAbuse(bool adding)
|
||||
{
|
||||
if( !system->rebus.CheckRebus() )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
// !! is tested in createthread once
|
||||
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 Emacs::PostFunEmacsModifyMountPoint(bool adding)
|
||||
{
|
||||
if( system->mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
if( adding )
|
||||
db->EditThreadAddItem(request->dir_table.back()->id, request->item.id);
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
if( system->mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mount::cms
|
||||
system->RedirectTo(request->item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Emacs::MakePost()
|
||||
{
|
||||
bool adding = !request->is_item;
|
||||
bool edit_with_url = functions->ReadItem(request->item, Item::file);
|
||||
|
||||
if( adding )
|
||||
functions->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
|
||||
system->AddFile(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
system->EditFile(request->item, edit_with_url);
|
||||
}
|
||||
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
PostFunEmacsModifyMountPoint(adding);
|
||||
system->CheckSpecialFile(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: PostFunEmacs: Error: "
|
||||
<< request->status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
40
functions/emacs.h
Executable file
40
functions/emacs.h
Executable file
@@ -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 headerfilecmslucontentemacs
|
||||
#define headerfilecmslucontentemacs
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Emacs : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Emacs();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool HasAccess(const Item & item); // !! takie funkcje to nie powinny byc skladowe modelu?
|
||||
bool PostEmacsCheckAbuse(bool adding);
|
||||
void PostFunEmacsModifyMountPoint(bool adding);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
88
functions/functionbase.cpp
Executable file
88
functions/functionbase.cpp
Executable file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
|
||||
FunctionBase::FunctionBase()
|
||||
{
|
||||
fun.user_id = -1;
|
||||
fun.group_id = -1;
|
||||
fun.privileges = 0755;
|
||||
fun.parent_id = -1; // !! temporarily doesn't matter
|
||||
fun.id = -1;
|
||||
fun.type = Item::file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionBase::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::SetFunctions(Functions * pfunctions)
|
||||
{
|
||||
functions = pfunctions;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::SetTemplates(Templates * ptemplates)
|
||||
{
|
||||
templates = ptemplates;
|
||||
}
|
||||
|
||||
void FunctionBase::SetNotify(Notify * pnotify)
|
||||
{
|
||||
notify = pnotify;
|
||||
}
|
||||
|
||||
|
||||
bool FunctionBase::HasAccess()
|
||||
{
|
||||
// true by default
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::MakePost()
|
||||
{
|
||||
// do nothing by default
|
||||
}
|
||||
|
||||
|
||||
void FunctionBase::MakeGet()
|
||||
{
|
||||
// do nothing by default
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
64
functions/functionbase.h
Executable file
64
functions/functionbase.h
Executable file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentfunctionbase
|
||||
#define headerfilecmslucontentfunctionbase
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "core/item.h"
|
||||
#include "core/db.h"
|
||||
#include "core/request.h"
|
||||
#include "core/config.h"
|
||||
#include "core/system.h"
|
||||
#include "core/notify.h"
|
||||
#include "ezc.h"
|
||||
|
||||
|
||||
class Functions;
|
||||
class Templates;
|
||||
|
||||
|
||||
|
||||
class FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
FunctionBase();
|
||||
|
||||
// user, group, permissions, url (function name)
|
||||
Item fun;
|
||||
|
||||
virtual bool HasAccess();
|
||||
virtual void MakePost();
|
||||
virtual void MakeGet();
|
||||
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetRequest(Request * prequest);
|
||||
void SetDb(Db * pdb);
|
||||
void SetSystem(System * psystem);
|
||||
void SetFunctions(Functions * pfunctions);
|
||||
void SetTemplates(Templates * ptemplates);
|
||||
void SetNotify(Notify * pnotify);
|
||||
|
||||
protected:
|
||||
|
||||
Config * config;
|
||||
Request * request;
|
||||
Db * db;
|
||||
System * system;
|
||||
Functions * functions;
|
||||
Templates * templates;
|
||||
Notify * notify;
|
||||
|
||||
// std::vector<Ezc::Pattern> pattern_tab;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
232
functions/functionparser.cpp
Executable file
232
functions/functionparser.cpp
Executable file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "functionparser.h"
|
||||
#include "core/log.h"
|
||||
#include "core/item.h"
|
||||
#include "core/error.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
|
||||
void FunctionParser::SkipEmptyString(const char * msg)
|
||||
{
|
||||
for( ; get_index != get_table_len && request->get_table[get_index].empty() ; ++get_index )
|
||||
log << log3 << msg << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FunctionParser::ParseDirectories()
|
||||
{
|
||||
Item * pdir = system->dirs.GetRootDir();
|
||||
|
||||
if( !pdir )
|
||||
{
|
||||
// there is no the root dir
|
||||
request->status = WINIX_ERR_NO_ROOT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while( true )
|
||||
{
|
||||
request->dir_table.push_back( pdir );
|
||||
log << log3 << "FP: Directory: ";
|
||||
|
||||
if( pdir->parent_id == -1 )
|
||||
log << "(root)" << logend;
|
||||
else
|
||||
log << pdir->url << logend;
|
||||
|
||||
SkipEmptyString("FP: Directory: skipped empty string");
|
||||
|
||||
if( get_index == get_table_len )
|
||||
break;
|
||||
|
||||
pdir = system->dirs.GetDir(request->get_table[get_index], pdir->id);
|
||||
|
||||
if( !pdir )
|
||||
break;
|
||||
|
||||
++get_index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionParser::ParseItem()
|
||||
{
|
||||
SkipEmptyString("FP: Item: skipped empty string");
|
||||
|
||||
if( get_index == get_table_len )
|
||||
return;
|
||||
|
||||
// request->dir_table has at least one element
|
||||
long parent_id = request->dir_table.back()->id;
|
||||
const std::string & url = request->get_table[get_index];
|
||||
|
||||
request->status = db->GetItem(parent_id, url, request->item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
if( request->role == Request::authorizer && request->item.auth == Item::auth_none )
|
||||
{
|
||||
log << log1 << "FP: item.url: " << url << " exists but has not a static content (authorizer role)" << logend;
|
||||
request->status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
++get_index;
|
||||
request->is_item = true;
|
||||
log << log3 << "FP: Item: id: " << request->item.id << ", url: " << request->item.url << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log3 << "FP: No Item: url: " << url << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionParser::ParseFunction()
|
||||
{
|
||||
SkipEmptyString("FP: Function: skipped empty string");
|
||||
|
||||
if( get_index == get_table_len )
|
||||
return;
|
||||
|
||||
request->pfunction = functions->Find(request->get_table[get_index]);
|
||||
|
||||
|
||||
if( request->pfunction )
|
||||
{
|
||||
++get_index;
|
||||
log << log3 << "FP: Function: " << request->pfunction->fun.url << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionParser::ParseParams(const std::string & par)
|
||||
{
|
||||
Param param;
|
||||
size_t i;
|
||||
|
||||
if( par.empty() )
|
||||
return;
|
||||
|
||||
// looking for the first colon ':'
|
||||
for(i=0 ; i<par.size() && par[i] != ':' ; ++i);
|
||||
|
||||
if( i == par.size() )
|
||||
{
|
||||
// there is no a colon
|
||||
param.name = par;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( i > 0 )
|
||||
param.name = par.substr(0, i);
|
||||
|
||||
if( i < par.size() - 1 )
|
||||
param.value = par.substr(i+1);
|
||||
}
|
||||
|
||||
request->param_table.push_back(param);
|
||||
|
||||
log << log3 << "FP: Param: name=" << param.name;
|
||||
|
||||
if( !param.value.empty() )
|
||||
log << ", value=" << param.value;
|
||||
|
||||
log << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionParser::ParseParams()
|
||||
{
|
||||
for( ; true ; ++get_index )
|
||||
{
|
||||
SkipEmptyString("FP: Params: skipped empty string");
|
||||
|
||||
if( get_index == get_table_len )
|
||||
break;
|
||||
|
||||
ParseParams(request->get_table[get_index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FunctionParser::Parse(Request * prequest, Db * pdb, Functions * pfunctions, System * psystem)
|
||||
{
|
||||
request = prequest;
|
||||
db = pdb;
|
||||
functions = pfunctions;
|
||||
system = psystem;
|
||||
|
||||
request->status = WINIX_ERR_OK;
|
||||
get_index = 0;
|
||||
get_table_len = request->get_table.size();
|
||||
request->pfunction = 0;
|
||||
request->is_item = false;
|
||||
|
||||
ParseDirectories();
|
||||
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
ParseFunction();
|
||||
|
||||
if( !request->pfunction )
|
||||
{
|
||||
ParseItem();
|
||||
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
ParseFunction();
|
||||
|
||||
if( !request->pfunction && get_index != get_table_len )
|
||||
{
|
||||
request->status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log3 << "FP: Parse: unknown function: \"" << request->get_table[get_index] << "\"" << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ParseParams();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
48
functions/functionparser.h
Executable file
48
functions/functionparser.h
Executable file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucorefunctionparser
|
||||
#define headerfilecmslucorefunctionparser
|
||||
|
||||
#include "core/request.h"
|
||||
#include "core/db.h"
|
||||
#include "core/system.h"
|
||||
|
||||
|
||||
class Functions;
|
||||
|
||||
|
||||
|
||||
class FunctionParser
|
||||
{
|
||||
Request * request;
|
||||
Db * db;
|
||||
Functions * functions;
|
||||
System * system;
|
||||
|
||||
GetTable::size_type get_index;
|
||||
GetTable::size_type get_table_len;
|
||||
|
||||
void SkipEmptyString(const char * msg);
|
||||
|
||||
void ParseDirectories();
|
||||
void ParseItem();
|
||||
bool IsAppFunction();
|
||||
void ParseFunction();
|
||||
void ParseParams(const std::string & par);
|
||||
void ParseParams();
|
||||
|
||||
public:
|
||||
|
||||
void Parse(Request * prequest, Db * pdb, Functions * pfunctions, System * psystem);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
413
functions/functions.cpp
Executable file
413
functions/functions.cpp
Executable file
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "functions.h"
|
||||
#include "core/log.h"
|
||||
#include "core/misc.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
|
||||
void Functions::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
void Functions::SetTemplates(Templates * ptemplates)
|
||||
{
|
||||
templates = ptemplates;
|
||||
}
|
||||
|
||||
void Functions::SetNotify(Notify * pnotify)
|
||||
{
|
||||
notify = pnotify;
|
||||
}
|
||||
|
||||
FunctionBase * Functions::Find(const std::string & function_name)
|
||||
{
|
||||
Table::iterator i = table.find(function_name);
|
||||
|
||||
if( i == table.end() )
|
||||
return 0;
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetObjects(FunctionBase * fun)
|
||||
{
|
||||
fun->SetConfig(config);
|
||||
fun->SetRequest(request);
|
||||
fun->SetDb(db);
|
||||
fun->SetSystem(system);
|
||||
fun->SetFunctions(this);
|
||||
fun->SetTemplates(templates);
|
||||
fun->SetNotify(notify);
|
||||
}
|
||||
|
||||
|
||||
void Functions::Add(FunctionBase * fun)
|
||||
{
|
||||
if( Find(fun->fun.url) )
|
||||
{
|
||||
log << log1 << "Functions: function " << fun->fun.url
|
||||
<< " already exists (skipped)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
table[fun->fun.url] = fun;
|
||||
SetObjects(fun);
|
||||
}
|
||||
|
||||
|
||||
void Functions::Add(FunctionBase & fun)
|
||||
{
|
||||
Add(&fun);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Functions::Create()
|
||||
{
|
||||
Add(fun_adduser);
|
||||
Add(fun_cat);
|
||||
Add(fun_chmod);
|
||||
Add(fun_chown);
|
||||
Add(fun_cp);
|
||||
Add(fun_createthread);
|
||||
Add(fun_createticket);
|
||||
Add(fun_default);
|
||||
Add(fun_download);
|
||||
Add(fun_editticket);
|
||||
Add(fun_emacs);
|
||||
Add(fun_last);
|
||||
Add(fun_login);
|
||||
Add(fun_logout);
|
||||
Add(fun_ls);
|
||||
Add(fun_mkdir);
|
||||
Add(fun_mv);
|
||||
Add(fun_node);
|
||||
Add(fun_priv);
|
||||
Add(fun_reload);
|
||||
Add(fun_rm);
|
||||
Add(fun_run);
|
||||
Add(fun_subject);
|
||||
Add(fun_thread);
|
||||
Add(fun_ticket);
|
||||
Add(fun_uname);
|
||||
Add(fun_upload);
|
||||
Add(fun_who);
|
||||
}
|
||||
|
||||
|
||||
void Functions::Parse()
|
||||
{
|
||||
function_parser.Parse(request, db, this, system);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::SetDefaultFunctionForFile()
|
||||
{
|
||||
if( request->item.auth != Item::auth_none )
|
||||
request->pfunction = &fun_download;
|
||||
else
|
||||
if( system->HasReadExecAccess(request->item) )
|
||||
request->pfunction = &fun_run;
|
||||
else
|
||||
request->pfunction = &fun_cat;
|
||||
|
||||
log << log3 << "Content: default function: " << request->pfunction->fun.url << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Functions::SetDefaultFunctionForDir()
|
||||
{
|
||||
long default_item = request->dir_table.back()->default_item;
|
||||
|
||||
if( default_item != -1 )
|
||||
{
|
||||
log << log3 << "Content: Default item: id: " << default_item << logend;
|
||||
system->RedirectTo(default_item);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( system->mounts.pmount->type == Mount::thread )
|
||||
{
|
||||
request->pfunction = &fun_thread;
|
||||
log << log3 << "Content: default function: " << request->pfunction->fun.url << logend;
|
||||
}
|
||||
else
|
||||
if( system->mounts.pmount->type == Mount::ticket )
|
||||
{
|
||||
request->pfunction = &fun_ticket;
|
||||
log << log3 << "Content: default function: " << request->pfunction->fun.url << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cms
|
||||
request->pfunction = &fun_ls;
|
||||
log << log3 << "Content: default function: " << request->pfunction->fun.url << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetDefaultFunction()
|
||||
{
|
||||
if( request->is_item )
|
||||
{
|
||||
SetDefaultFunctionForFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDefaultFunctionForDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Functions::MakeGet()
|
||||
{
|
||||
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 = &fun_cat;
|
||||
}
|
||||
|
||||
|
||||
if( !request->pfunction )
|
||||
SetDefaultFunction();
|
||||
|
||||
if( !request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( !request->pfunction )
|
||||
{
|
||||
request->status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log1 << "Functions: no function (neither cat nor ls)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !request->pfunction->HasAccess() )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request->pfunction->MakeGet();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::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 << "Functions: MakePost: no function" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !request->pfunction->HasAccess() )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request->pfunction->MakePost();
|
||||
}
|
||||
|
||||
|
||||
void Functions::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 << "Functions: spam +1: POST after GET sent too fast" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// returning true if the 'url' has to be changed
|
||||
bool Functions::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
|
||||
system->PrepareUrl(item);
|
||||
|
||||
return with_url;
|
||||
}
|
||||
|
||||
|
||||
void Functions::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( system->CanUseHtml(user_id) )
|
||||
item.content_type = Item::ct_html;
|
||||
}
|
||||
else
|
||||
if( temp == "3" )
|
||||
{
|
||||
if( system->CanUseBBCode(user_id) )
|
||||
item.content_type = Item::ct_bbcode;
|
||||
}
|
||||
else
|
||||
if( temp == "4" )
|
||||
{
|
||||
if( system->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 Functions::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; // !! moze to dac jako parametr?
|
||||
|
||||
bool edit_with_url = ReadItemUrlSubject(item, item_type);
|
||||
|
||||
if( item_type == Item::file )
|
||||
ReadItemContentWithType(item);
|
||||
|
||||
return edit_with_url;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetUser(Item & item)
|
||||
{
|
||||
if( request->session && 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;
|
||||
}
|
135
functions/functions.h
Executable file
135
functions/functions.h
Executable file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentfunctions
|
||||
#define headerfilecmslucontentfunctions
|
||||
|
||||
#include <string>
|
||||
#include "functionbase.h"
|
||||
#include "functionparser.h"
|
||||
#include "adduser.h"
|
||||
#include "cat.h"
|
||||
#include "chmod.h"
|
||||
#include "chown.h"
|
||||
#include "cp.h"
|
||||
#include "createthread.h"
|
||||
#include "createticket.h"
|
||||
#include "default.h"
|
||||
#include "download.h"
|
||||
#include "editticket.h"
|
||||
#include "emacs.h"
|
||||
#include "last.h"
|
||||
#include "login.h"
|
||||
#include "logout.h"
|
||||
#include "ls.h"
|
||||
#include "mkdir.h"
|
||||
#include "mv.h"
|
||||
#include "node.h"
|
||||
#include "priv.h"
|
||||
#include "reload.h"
|
||||
#include "rm.h"
|
||||
#include "run.h"
|
||||
#include "subject.h"
|
||||
#include "funthread.h"
|
||||
#include "funticket.h"
|
||||
#include "uname.h"
|
||||
#include "upload.h"
|
||||
#include "who.h"
|
||||
|
||||
|
||||
|
||||
class Templates;
|
||||
|
||||
|
||||
|
||||
class Functions
|
||||
{
|
||||
public:
|
||||
|
||||
Fun::AddUser fun_adduser;
|
||||
Fun::Cat fun_cat;
|
||||
Fun::Chmod fun_chmod;
|
||||
Fun::Chown fun_chown;
|
||||
Fun::Cp fun_cp;
|
||||
Fun::CreateThread fun_createthread;
|
||||
Fun::CreateTicket fun_createticket;
|
||||
Fun::Default fun_default;
|
||||
Fun::Download fun_download;
|
||||
Fun::EditTicket fun_editticket;
|
||||
Fun::Emacs fun_emacs;
|
||||
Fun::Last fun_last;
|
||||
Fun::Login fun_login;
|
||||
Fun::Logout fun_logout;
|
||||
Fun::Ls fun_ls;
|
||||
Fun::Mkdir fun_mkdir;
|
||||
Fun::Mv fun_mv;
|
||||
Fun::Node fun_node;
|
||||
Fun::Priv fun_priv;
|
||||
Fun::Reload fun_reload;
|
||||
Fun::Rm fun_rm;
|
||||
Fun::Run fun_run;
|
||||
Fun::Subject fun_subject;
|
||||
Fun::FunThread fun_thread;
|
||||
Fun::FunTicket fun_ticket;
|
||||
Fun::Uname fun_uname;
|
||||
Fun::Upload fun_upload;
|
||||
Fun::Who fun_who;
|
||||
|
||||
|
||||
|
||||
void Create();
|
||||
void Parse();
|
||||
|
||||
void MakeGet();
|
||||
void MakePost();
|
||||
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetRequest(Request * prequest);
|
||||
void SetDb(Db * pdb);
|
||||
void SetSystem(System * psystem);
|
||||
void SetTemplates(Templates * ptemplates);
|
||||
void SetNotify(Notify * pnotify);
|
||||
|
||||
FunctionBase * Find(const std::string & function_name);
|
||||
void SetDefaultFunction();
|
||||
|
||||
void CheckGetPostTimes(time_t difference = 10);
|
||||
|
||||
// !! dac lepsze nazwy
|
||||
void ReadItemContentWithType(Item & item);
|
||||
bool ReadItem(Item & item, Item::Type item_type);
|
||||
|
||||
void SetUser(Item & item);
|
||||
|
||||
private:
|
||||
|
||||
Config * config;
|
||||
Request * request;
|
||||
Db * db;
|
||||
System * system;
|
||||
Templates * templates;
|
||||
Notify * notify;
|
||||
|
||||
std::string temp;
|
||||
|
||||
void Add(FunctionBase * fun);
|
||||
void Add(FunctionBase & fun);
|
||||
void SetObjects(FunctionBase * fun);
|
||||
void SetDefaultFunctionForFile();
|
||||
void SetDefaultFunctionForDir();
|
||||
|
||||
bool ReadItemUrlSubject(Item & item, Item::Type item_type);
|
||||
|
||||
typedef std::map<std::string, FunctionBase*> Table;
|
||||
Table table;
|
||||
|
||||
FunctionParser function_parser;
|
||||
};
|
||||
|
||||
#endif
|
75
functions/funthread.cpp
Executable file
75
functions/funthread.cpp
Executable file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include "funthread.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
FunThread::FunThread()
|
||||
{
|
||||
fun.url = "thread";
|
||||
}
|
||||
|
||||
|
||||
void FunThread::CreateSortIndexByDate()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < request->thread_tab.size() ; ++i)
|
||||
{
|
||||
Item * pdir = system->dirs.GetDir(request->thread_tab[i].dir_id);
|
||||
|
||||
if( pdir )
|
||||
request->thread_tab[i].sort = (long)mktime(&pdir->date_creation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool FunThread::FunThreadSort(const Thread & t1, const Thread & t2)
|
||||
{
|
||||
return t1.sort > t2.sort;
|
||||
}
|
||||
|
||||
|
||||
void FunThread::MakeGet()
|
||||
{
|
||||
// !! dac do hasaccess()
|
||||
if( request->is_item )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
Db::ItemQuery iq;
|
||||
|
||||
if( system->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);
|
||||
|
||||
system->CheckAccessToItems(request->item_table);
|
||||
|
||||
CreateSortIndexByDate();
|
||||
std::sort(request->thread_tab.begin(), request->thread_tab.end(), FunThreadSort);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
38
functions/funthread.h
Executable file
38
functions/funthread.h
Executable file
@@ -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 headerfilecmslucontentthread
|
||||
#define headerfilecmslucontentthread
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "core/thread.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class FunThread : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
FunThread();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
static bool FunThreadSort(const Thread & t1, const Thread & t2);
|
||||
void CreateSortIndexByDate();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
70
functions/funticket.cpp
Executable file
70
functions/funticket.cpp
Executable file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "funticket.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
FunTicket::FunTicket()
|
||||
{
|
||||
fun.url = "ticket";
|
||||
}
|
||||
|
||||
|
||||
void FunTicket::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( !system->HasReadAccess(request->item_table[i]) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
request->item_table.erase(request->item_table.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunTicket::MakeGet()
|
||||
{
|
||||
if( request->is_item || system->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();
|
||||
system->CheckAccessToItems(request->item_table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
36
functions/funticket.h
Executable file
36
functions/funticket.h
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentticket
|
||||
#define headerfilecmslucontentticket
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class FunTicket : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
FunTicket();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
void TicketDeleteFirst();
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
23
functions/last.cpp
Executable file
23
functions/last.cpp
Executable file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "last.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Last::Last()
|
||||
{
|
||||
fun.url = "last";
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
35
functions/last.h
Executable file
35
functions/last.h
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentlast
|
||||
#define headerfilecmslucontentlast
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Last : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Last();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
43
functions/login.cpp
Executable file
43
functions/login.cpp
Executable file
@@ -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 "login.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Login::Login()
|
||||
{
|
||||
fun.url = "login";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Login::MakePost()
|
||||
{
|
||||
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) )
|
||||
system->users.LoginUser(user_id, remem != 0);
|
||||
|
||||
// !! moze zglosic komunikat o nie poprawnym logowaniu
|
||||
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
36
functions/login.h
Executable file
36
functions/login.h
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentlogin
|
||||
#define headerfilecmslucontentlogin
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Login : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Login();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
void LoginUser(long user_id, bool remember_me);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
33
functions/logout.cpp
Executable file
33
functions/logout.cpp
Executable file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "logout.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
Logout::Logout()
|
||||
{
|
||||
fun.url = "logout";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Logout::MakeGet()
|
||||
{
|
||||
system->users.LogoutCurrentUser();
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
35
functions/logout.h
Executable file
35
functions/logout.h
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentlogout
|
||||
#define headerfilecmslucontentlogout
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Logout : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Logout();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
54
functions/ls.cpp
Executable file
54
functions/ls.cpp
Executable file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ls.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Ls::Ls()
|
||||
{
|
||||
fun.url = "ls";
|
||||
}
|
||||
|
||||
|
||||
void Ls::MakeGet()
|
||||
{
|
||||
if( !request->is_item )
|
||||
{
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.sel_content = false;
|
||||
|
||||
iq.WhereParentId(request->dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
|
||||
if( request->IsParam("ckeditor_browse") )
|
||||
{
|
||||
iq.WhereAuth(Item::auth_image);
|
||||
db->GetItems(request->item_table, iq);
|
||||
}
|
||||
else
|
||||
{
|
||||
db->GetItems(request->item_table, iq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
37
functions/ls.h
Executable file
37
functions/ls.h
Executable file
@@ -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 headerfilecmslucontentls
|
||||
#define headerfilecmslucontentls
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Ls : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Ls();
|
||||
void MakeGet();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
93
functions/mkdir.cpp
Executable file
93
functions/mkdir.cpp
Executable file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mkdir.h"
|
||||
#include "functions.h"
|
||||
#include "core/notify.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Mkdir::Mkdir()
|
||||
{
|
||||
fun.url = "mkdir";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Mkdir::HasAccess(const Item & item)
|
||||
{
|
||||
// you can create a directory only in a directory
|
||||
if( item.type != Item::dir )
|
||||
return false;
|
||||
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
// super user can use mkdir everywhere
|
||||
return true;
|
||||
|
||||
if( !system->HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount->IsPar(Mount::par_mkdir_on) )
|
||||
return true;
|
||||
|
||||
if( system->mounts.pmount->IsArg(Mount::par_mkdir_on, request->dir_table.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Mkdir::HasAccess()
|
||||
{
|
||||
if( request->is_item || !HasAccess(*request->dir_table.back()) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Mkdir::PostFunMkdir(bool add_to_dir_table, int privileges)
|
||||
{
|
||||
functions->ReadItem(request->item, Item::dir);
|
||||
functions->SetUser(request->item);
|
||||
request->item.privileges = privileges;
|
||||
|
||||
request->status = system->dirs.AddDirectory(request->item, add_to_dir_table);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
request->notify_code |= WINIX_NOTIFY_DIR_ADD;
|
||||
system->RedirectTo(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: PostFunMkdir: Error: " << request->status << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Mkdir::MakePost()
|
||||
{
|
||||
PostFunMkdir(false, 0755);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
39
functions/mkdir.h
Executable file
39
functions/mkdir.h
Executable file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentmkdir
|
||||
#define headerfilecmslucontentmkdir
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Mkdir : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Mkdir();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool HasAccess(const Item & item); // !! moze to powinien byc skladnik modelu?
|
||||
bool FunMkdirCheckAccess();
|
||||
void PostFunMkdir(bool add_to_dir_table, int privileges);
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
373
functions/mv.cpp
Executable file
373
functions/mv.cpp
Executable file
@@ -0,0 +1,373 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
// !! potrzebne errno?
|
||||
#include <errno.h>
|
||||
#include "mv.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Mv::Mv()
|
||||
{
|
||||
fun.url = "mv";
|
||||
}
|
||||
|
||||
|
||||
bool Mv::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( !system->HasWriteAccess(*last) &&
|
||||
(!last_but_one || !system->HasWriteAccess(*last_but_one)) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// used in POST when the moving is performed
|
||||
|
||||
if( request->IsPostVar("onlycontent") )
|
||||
return system->HasWriteAccess(*last);
|
||||
else
|
||||
if( last_but_one )
|
||||
return system->HasWriteAccess(*last_but_one);
|
||||
else
|
||||
return false; // you cannot move the root directory
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Mv::MoveCheckAccessFrom()
|
||||
{
|
||||
if( request->is_item )
|
||||
{
|
||||
// moving a file
|
||||
|
||||
if( !system->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 Mv::MoveCheckAccessTo(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 Mv::MoveCheckMountPoints(long dir_id)
|
||||
{
|
||||
/*
|
||||
Mount * new_mount = system->mounts.CalcMount(dir_id);
|
||||
|
||||
if( !new_mount )
|
||||
{
|
||||
if( system->mounts.pmount->type != Mount::cms )
|
||||
{
|
||||
request->status = WINIX_DIFFERENT_MOUNT_POINTS;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if( new_mount->type != system->mounts.pmount->type )
|
||||
{
|
||||
request->status = WINIX_DIFFERENT_MOUNT_POINTS;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Mv::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 = 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 Mv::MoveAuth(Item & item)
|
||||
{
|
||||
if( !system->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 Mv::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 Mv::MoveFile(Item & item, bool redirect)
|
||||
{
|
||||
if( MoveIsTheSameFile(item) )
|
||||
return;
|
||||
|
||||
if( !mv_file.empty() )
|
||||
{
|
||||
item.url = mv_file;
|
||||
system->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 )
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Mv::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);
|
||||
}
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Mv::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 Mv::MoveAuthContentOfDir(const Item & item)
|
||||
{
|
||||
DirContainer::ParentIterator i = system->dirs.FindFirstParent(item.id);
|
||||
|
||||
// go through all directories
|
||||
for( ; i != system->dirs.ParentEnd() ; i = system->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 Mv::MoveDir(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 move directory to inside it" << logend;
|
||||
request->status = WINIX_ERR_INCORRECT_DIR;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !system->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;
|
||||
system->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 )
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Mv::MakePost()
|
||||
{
|
||||
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 Mv::MakeGet()
|
||||
{
|
||||
MoveCheckAccessFrom();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
56
functions/mv.h
Executable file
56
functions/mv.h
Executable file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentmv
|
||||
#define headerfilecmslucontentmv
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Mv : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Mv();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
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;
|
||||
|
||||
bool MoveCheckAccessFromToDir();
|
||||
bool MoveCheckAccessFrom();
|
||||
bool MoveCheckAccessTo(long dir_id);
|
||||
bool MoveCheckMountPoints(long dir_id);
|
||||
bool MoveParseDir(long & dir_id, std::string & dir, std::string & file);
|
||||
void MoveAuth(Item & item);
|
||||
bool MoveIsTheSameFile(const Item & item);
|
||||
void MoveFile(Item & item, bool redirect = true);
|
||||
void MoveContentOfDir();
|
||||
void MoveAuthPrepareQuery();
|
||||
void MoveAuthContentOfDir(const Item & item);
|
||||
void MoveDir(Item & item, bool redirect = true);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
38
functions/node.cpp
Executable file
38
functions/node.cpp
Executable file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "node.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Node::Node()
|
||||
{
|
||||
fun.url = "node";
|
||||
}
|
||||
|
||||
|
||||
void Node::MakeGet()
|
||||
{
|
||||
if( request->param_table.empty() )
|
||||
{
|
||||
//request->status = Error
|
||||
//!!zglosic 404
|
||||
return;
|
||||
}
|
||||
|
||||
long id = atol( request->param_table[0].name.c_str() );
|
||||
|
||||
system->RedirectTo(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
36
functions/node.h
Executable file
36
functions/node.h
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentnode
|
||||
#define headerfilecmslucontentnode
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Node : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Node();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
45
functions/priv.cpp
Executable file
45
functions/priv.cpp
Executable file
@@ -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 "priv.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
Priv::Priv()
|
||||
{
|
||||
fun.url = "priv";
|
||||
}
|
||||
|
||||
|
||||
void Priv::MakePost()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.Change(true, true);
|
||||
}
|
||||
|
||||
|
||||
void Priv::MakeGet()
|
||||
{
|
||||
priv_changer.SetRequest(request);
|
||||
priv_changer.SetSystem(system);
|
||||
priv_changer.SetDb(db);
|
||||
|
||||
priv_changer.CheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
38
functions/priv.h
Executable file
38
functions/priv.h
Executable file
@@ -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 headerfilecmslucontentpriv
|
||||
#define headerfilecmslucontentpriv
|
||||
|
||||
#include "functionbase.h"
|
||||
#include "privchanger.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Priv : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Priv();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
PrivChanger priv_changer;
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
316
functions/privchanger.cpp
Executable file
316
functions/privchanger.cpp
Executable file
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "privchanger.h"
|
||||
|
||||
|
||||
void PrivChanger::SetRequest(Request * prequest)
|
||||
{
|
||||
request = prequest;
|
||||
}
|
||||
|
||||
|
||||
void PrivChanger::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
}
|
||||
|
||||
void PrivChanger::SetDb(Db * pdb)
|
||||
{
|
||||
db = pdb;
|
||||
}
|
||||
|
||||
|
||||
bool PrivChanger::CheckAccess()
|
||||
{
|
||||
// we do not check permissions here
|
||||
// permissions depends on the user, group, and privileges
|
||||
// but we cannot use parameter 'r' on files
|
||||
// and only logged users can change permissions
|
||||
|
||||
if( !request->session->puser || (request->is_item && request->IsParam("r")) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool PrivChanger::ChangeOwner(Item & item, long user_id, long group_id)
|
||||
{
|
||||
if( user_id!=item.user_id || group_id!=item.group_id )
|
||||
{
|
||||
if( !system->CanChangeUser(item, user_id) )
|
||||
{
|
||||
log << log3 << "Content: can't change the user" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !system->CanChangeGroup(item, group_id) )
|
||||
{
|
||||
log << log3 << "Content: can't change the group" << logend;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
item.user_id = user_id;
|
||||
item.group_id = group_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool PrivChanger::ChangePrivileges(Item & item, int privileges)
|
||||
{
|
||||
if( privileges != item.privileges )
|
||||
{
|
||||
if( !system->CanChangePrivileges(item, privileges) )
|
||||
{
|
||||
log << log3 << "Content: can't change privileges" << logend;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
item.privileges = privileges;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrivChanger::ChangePriv(Item & item, long user_id, long group_id, int privileges)
|
||||
{
|
||||
if( change_owner )
|
||||
{
|
||||
if( !ChangeOwner(item, user_id, group_id) )
|
||||
return;
|
||||
}
|
||||
|
||||
if( change_priv )
|
||||
{
|
||||
if( !ChangePrivileges(item, privileges) )
|
||||
return;
|
||||
}
|
||||
|
||||
request->status = db->EditPrivById(item, item.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrivChanger::PrivLogStart(const char * what, long user, long group, int priv)
|
||||
{
|
||||
log << log2 << what;
|
||||
|
||||
if( change_owner )
|
||||
{
|
||||
User * puser = system->users.GetUser(user);
|
||||
Group * pgroup = system->groups.GetGroup(group);
|
||||
|
||||
log << "new user: ";
|
||||
|
||||
if( puser )
|
||||
log << puser->name;
|
||||
else
|
||||
log << "id: " << user;
|
||||
|
||||
log << ", new group: ";
|
||||
|
||||
if( pgroup )
|
||||
log << pgroup->name;
|
||||
else
|
||||
log << "id: " << group;
|
||||
|
||||
if( change_priv )
|
||||
log << ", ";
|
||||
}
|
||||
|
||||
if( change_priv )
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "0%o", priv);
|
||||
log << "privileges: " << buf;
|
||||
}
|
||||
|
||||
log << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrivChanger::PrivLog(const char * what, long id, const std::string & url)
|
||||
{
|
||||
Item * root = 0;
|
||||
|
||||
if( id != -1 )
|
||||
root = system->dirs.GetRootDir();
|
||||
|
||||
log << log3 << "Content: " << what;
|
||||
|
||||
if( root && root->id == id )
|
||||
log << "(root)";
|
||||
else
|
||||
log << url;
|
||||
|
||||
log << logend;
|
||||
}
|
||||
|
||||
|
||||
void PrivChanger::PrivFilesInDir(long parent_id)
|
||||
{
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.SetAll(false, false);
|
||||
iq.sel_user_id = iq.sel_group_id = iq.sel_guest_name = iq.sel_privileges = true;
|
||||
|
||||
iq.WhereParentId(parent_id);
|
||||
iq.WhereType(Item::file);
|
||||
|
||||
db->GetItems(request->item_table, iq);
|
||||
|
||||
|
||||
std::vector<Item>::iterator i = request->item_table.begin();
|
||||
|
||||
for( ; i != request->item_table.end() ; ++i)
|
||||
{
|
||||
PrivLog("changed file: ", -1, i->url);
|
||||
ChangePriv(*i, user_id_file, group_id_file, priv_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// recurrence
|
||||
void PrivChanger::PrivDir(long parent_id)
|
||||
{
|
||||
PrivFilesInDir(parent_id);
|
||||
|
||||
|
||||
DirContainer::ParentIterator i = system->dirs.FindFirstParent(parent_id);
|
||||
|
||||
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextParent(i) )
|
||||
{
|
||||
PrivLog("changed dir: ", -1, i->second->url);
|
||||
ChangePriv(*(i->second), user_id_dir, group_id_dir, priv_dir);
|
||||
|
||||
if( subdirectories )
|
||||
PrivDir(i->second->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PrivChanger::ReadPriv(const char * user_in, const char * group_in, const char * priv_in,
|
||||
long & user_id, long & group_id, int & priv)
|
||||
{
|
||||
std::string * user_str = request->PostVar(user_in);
|
||||
std::string * group_str = request->PostVar(group_in);
|
||||
std::string * priv_str = request->PostVar(priv_in);
|
||||
|
||||
if( change_owner && (!user_str || !group_str) )
|
||||
{
|
||||
log << log1 << "Content: PostFunPriv: there is no some post variables for changing the owner" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( change_priv && !priv_str )
|
||||
{
|
||||
log << log1 << "Content: PostFunPriv: there is no some post variables for changing privileges" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( change_owner )
|
||||
{
|
||||
user_id = system->users.GetUserId( *user_str );
|
||||
group_id = system->groups.GetGroupId( *group_str );
|
||||
}
|
||||
|
||||
if( change_priv )
|
||||
priv = strtol( priv_str->c_str() , 0, 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PrivChanger::PrivDir()
|
||||
{
|
||||
if( !ReadPriv("userfile", "groupfile", "privilegesfile", user_id_file, group_id_file, priv_file) )
|
||||
return;
|
||||
|
||||
if( !ReadPriv("userdir", "groupdir", "privilegesdir", user_id_dir, group_id_dir, priv_dir) )
|
||||
return;
|
||||
|
||||
PrivLogStart("Content: changes for files: ", user_id_file, group_id_file, priv_file);
|
||||
PrivLogStart("Content: changes for dirs: ", user_id_dir, group_id_dir, priv_dir);
|
||||
|
||||
|
||||
if( request->IsPostVar("changecurrentdir") )
|
||||
{
|
||||
Item & last_dir = *request->dir_table.back();
|
||||
PrivLog("changed dir: ", last_dir.id, last_dir.url);
|
||||
ChangePriv(*request->dir_table.back(), user_id_dir, group_id_dir, priv_dir);
|
||||
}
|
||||
|
||||
|
||||
subdirectories = request->IsPostVar("changesubdirs");
|
||||
|
||||
// go through all directories
|
||||
PrivDir(request->dir_table.back()->id);
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// changing only one item (either a dir or file)
|
||||
void PrivChanger::PrivOneItem()
|
||||
{
|
||||
if( !ReadPriv("user", "group", "privileges", user_id_file, group_id_file, priv_file) )
|
||||
return;
|
||||
|
||||
PrivLogStart("Content: changes: ", user_id_file, group_id_file, priv_file);
|
||||
|
||||
if( request->is_item )
|
||||
{
|
||||
ChangePriv(request->item, user_id_file, group_id_file, priv_file);
|
||||
system->RedirectTo(request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangePriv(*request->dir_table.back(), user_id_file, group_id_file, priv_file);
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrivChanger::Change(bool change_owner_, bool change_priv_)
|
||||
{
|
||||
if( !CheckAccess() )
|
||||
return;
|
||||
|
||||
change_owner = change_owner_;
|
||||
change_priv = change_priv_;
|
||||
|
||||
if( request->IsParam("r") )
|
||||
{
|
||||
PrivDir();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrivOneItem();
|
||||
}
|
||||
|
||||
system->dirs.CheckRootDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
functions/privchanger.h
Executable file
57
functions/privchanger.h
Executable file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentprivchanger
|
||||
#define headerfilecmslucontentprivchanger
|
||||
|
||||
|
||||
#include "core/request.h"
|
||||
#include "core/system.h"
|
||||
#include "core/db.h"
|
||||
|
||||
|
||||
|
||||
class PrivChanger
|
||||
{
|
||||
public:
|
||||
|
||||
bool CheckAccess();
|
||||
void Change(bool change_owner_, bool change_priv_);
|
||||
|
||||
void SetRequest(Request * prequest);
|
||||
void SetSystem(System * psystem);
|
||||
void SetDb(Db * pdb);
|
||||
|
||||
private:
|
||||
|
||||
Request * request;
|
||||
System * system;
|
||||
Db * db;
|
||||
|
||||
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 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 PrivLogStart(const char * what, long user, long group, int priv);
|
||||
void PrivLog(const char * what, long id, const std::string & url);
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
127
functions/readticket.cpp
Executable file
127
functions/readticket.cpp
Executable file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "readticket.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
ReadTicket::ReadTicket()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketType()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->PostVar("type", temp);
|
||||
ticket->type = atoi(temp.c_str());
|
||||
|
||||
if( ticket->type >= system->mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
ticket->type = system->mounts.pmount->param[Mount::par_ticket_type].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketStatus()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->PostVar("status", temp);
|
||||
ticket->status = atoi(temp.c_str());
|
||||
|
||||
if( ticket->status >= system->mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
ticket->status = system->mounts.pmount->param[Mount::par_ticket_status].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketPriority()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->PostVar("priority", temp);
|
||||
ticket->priority = atoi(temp.c_str());
|
||||
|
||||
if( ticket->priority >= system->mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
ticket->priority = system->mounts.pmount->param[Mount::par_ticket_priority].arg.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketCategory()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->PostVar("category", temp);
|
||||
ticket->category = atoi(temp.c_str());
|
||||
|
||||
if( ticket->category >= system->mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
ticket->category = system->mounts.pmount->param[Mount::par_ticket_category].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketExpected()
|
||||
{
|
||||
static std::string temp;
|
||||
|
||||
request->PostVar("expected", temp);
|
||||
ticket->expected = atoi(temp.c_str());
|
||||
|
||||
if( ticket->expected >= system->mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
ticket->expected = system->mounts.pmount->param[Mount::par_ticket_expected].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ReadTicket::ReadTicketProgress()
|
||||
{
|
||||
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 ReadTicket::Read(System * psystem, Request * prequest, Ticket * pticket)
|
||||
{
|
||||
system = psystem;
|
||||
request = prequest;
|
||||
ticket = pticket;
|
||||
|
||||
ticket->parent_id = request->dir_table.back()->id;
|
||||
|
||||
ReadTicketType();
|
||||
ReadTicketStatus();
|
||||
ReadTicketPriority();
|
||||
ReadTicketCategory();
|
||||
ReadTicketExpected();
|
||||
ReadTicketProgress();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
46
functions/readticket.h
Executable file
46
functions/readticket.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentreadticket
|
||||
#define headerfilecmslucontentreadticket
|
||||
|
||||
#include "core/request.h"
|
||||
#include "core/ticket.h"
|
||||
#include "core/system.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class ReadTicket
|
||||
{
|
||||
public:
|
||||
ReadTicket();
|
||||
void Read(System * psystem, Request * prequest, Ticket * pticket);
|
||||
|
||||
private:
|
||||
Request * request;
|
||||
Ticket * ticket;
|
||||
System * system;
|
||||
|
||||
void ReadTicketType();
|
||||
void ReadTicketStatus();
|
||||
void ReadTicketPriority();
|
||||
void ReadTicketCategory();
|
||||
void ReadTicketExpected();
|
||||
void ReadTicketProgress();
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif
|
54
functions/reload.cpp
Executable file
54
functions/reload.cpp
Executable file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "reload.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
Reload::Reload()
|
||||
{
|
||||
fun.url = "reload";
|
||||
fun.privileges = 0700;
|
||||
}
|
||||
|
||||
|
||||
void Reload::FunReloadTemplates()
|
||||
{
|
||||
log << log1 << "Content: reloading html templates" << logend;
|
||||
|
||||
templates->ReadTemplates();
|
||||
notify->ReadTemplates(); // make sure that ReadTemplates() is using some kind of locking
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Reload::MakeGet()
|
||||
{
|
||||
// !! 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
37
functions/reload.h
Executable file
37
functions/reload.h
Executable file
@@ -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 headerfilecmslucontentreload
|
||||
#define headerfilecmslucontentreload
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Reload : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Reload();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
void FunReloadTemplates();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
240
functions/rm.cpp
Executable file
240
functions/rm.cpp
Executable file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* 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 "rm.h"
|
||||
#include "core/plugin.h"
|
||||
#include "templates/templates.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Rm::Rm()
|
||||
{
|
||||
fun.url = "rm";
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Rm::HasAccess(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 = system->dirs.GetDir(item.parent_id);
|
||||
|
||||
if( !last_but_one_dir )
|
||||
// ops, there is no a parent dir
|
||||
return false;
|
||||
|
||||
if( !system->HasWriteAccess(*last_but_one_dir) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( system->mounts.pmount->IsPar(Mount::par_only_root_remove) )
|
||||
if( !request->session->puser || !request->session->puser->super_user )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Rm::HasAccess()
|
||||
{
|
||||
if( !request->is_item )
|
||||
return HasAccess(*request->dir_table.back());
|
||||
else
|
||||
return HasAccess(request->item);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Rm::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 Rm::RemoveAllDirs(long dir_id)
|
||||
{
|
||||
DirContainer::ParentIterator pnext, p = system->dirs.FindFirstParent(dir_id);
|
||||
|
||||
for( ; p != system->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 = system->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 )
|
||||
{
|
||||
system->dirs.DelDir(dir_id);
|
||||
|
||||
db->RemoveThread(dir_id);
|
||||
db->RemoveTicket(dir_id);
|
||||
|
||||
plugin.Call(WINIX_DIR_REMOVED, dir_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Rm::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
|
||||
system->dirs.CheckRootDir(); // adding a new root dir
|
||||
Item * proot = system->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 ::Make() will check that the dir_table is empty and returns
|
||||
return;
|
||||
}
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
void Rm::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 Rm::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 Rm::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( system->mounts.pmount->type == Mount::thread )
|
||||
db->EditThreadRemoveItem(request->item.parent_id);
|
||||
else
|
||||
if( system->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;
|
||||
}
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Rm::MakeGet()
|
||||
{
|
||||
if( request->IsParam("confirm") )
|
||||
return; // show confirmation dialog
|
||||
|
||||
if( request->is_item )
|
||||
RemoveFile();
|
||||
else
|
||||
RemoveDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
46
functions/rm.h
Executable file
46
functions/rm.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentrm
|
||||
#define headerfilecmslucontentrm
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Rm : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Rm();
|
||||
bool HasAccess();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
Db::ItemQuery rm_auth_iq;
|
||||
|
||||
bool HasAccess(const Item & item);
|
||||
void RemoveAuthPrepareQuery();
|
||||
void RemoveAllDirs(long dir_id);
|
||||
void RemoveAllDirs();
|
||||
void RemoveDir();
|
||||
void RemoveAuth(Item & item);
|
||||
void RemoveFile();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
47
functions/run.cpp
Executable file
47
functions/run.cpp
Executable file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "run.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Run::Run()
|
||||
{
|
||||
fun.url = "run";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Run::MakePost()
|
||||
{
|
||||
MakeGet();
|
||||
}
|
||||
|
||||
|
||||
void Run::MakeGet()
|
||||
{
|
||||
if( !request->is_item )
|
||||
{
|
||||
log << log1 << "Content: Run function requires an item" << logend;
|
||||
request->status = WINIX_ERR_NO_ITEM;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !system->HasReadExecAccess(request->item) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
37
functions/run.h
Executable file
37
functions/run.h
Executable file
@@ -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 headerfilecmslucontentrun
|
||||
#define headerfilecmslucontentrun
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Run : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Run();
|
||||
|
||||
private:
|
||||
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
88
functions/subject.cpp
Executable file
88
functions/subject.cpp
Executable file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "subject.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Subject::Subject()
|
||||
{
|
||||
fun.url = "subject";
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Subject::SubjectCheckAccess()
|
||||
{
|
||||
// super user can always
|
||||
if( request->session->puser && request->session->puser->super_user )
|
||||
return true;
|
||||
|
||||
bool access;
|
||||
|
||||
if( request->is_item )
|
||||
access = system->HasWriteAccess(request->item);
|
||||
else
|
||||
access = system->HasWriteAccess(*request->dir_table.back());
|
||||
|
||||
if( !access )
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Subject::EditDirSubject()
|
||||
{
|
||||
Item & dir = *request->dir_table.back();
|
||||
|
||||
request->PostVar("subject", dir.subject);
|
||||
db->EditSubjectById(dir, dir.id);
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Subject::EditFileSubject()
|
||||
{
|
||||
request->PostVar("subject", request->item.subject);
|
||||
db->EditSubjectById(request->item, request->item.id);
|
||||
|
||||
system->RedirectTo(request->item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Subject::MakePost()
|
||||
{
|
||||
if( !SubjectCheckAccess() )
|
||||
return;
|
||||
|
||||
if( request->is_item )
|
||||
EditFileSubject();
|
||||
else
|
||||
EditDirSubject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Subject::MakeGet()
|
||||
{
|
||||
SubjectCheckAccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
40
functions/subject.h
Executable file
40
functions/subject.h
Executable file
@@ -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 headerfilecmslucontentsubject
|
||||
#define headerfilecmslucontentsubject
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Subject : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Subject();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
bool SubjectCheckAccess();
|
||||
void EditDirSubject();
|
||||
void EditFileSubject();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
25
functions/uname.cpp
Executable file
25
functions/uname.cpp
Executable file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "uname.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Uname::Uname()
|
||||
{
|
||||
fun.url = "uname";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
34
functions/uname.h
Executable file
34
functions/uname.h
Executable file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentuname
|
||||
#define headerfilecmslucontentuname
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Uname : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Uname();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
239
functions/upload.cpp
Executable file
239
functions/upload.cpp
Executable file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* 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 "upload.h"
|
||||
#include "core/misc.h"
|
||||
#include "functions/functions.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Upload::Upload()
|
||||
{
|
||||
fun.url = "upload";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool Upload::HasAccess(const Item & item)
|
||||
{
|
||||
// you can use 'upload' only in a directory
|
||||
if( item.type != Item::dir )
|
||||
return false;
|
||||
|
||||
// we must know where to store the file
|
||||
if( !system->mounts.pmount )
|
||||
return false;
|
||||
|
||||
if( system->mounts.pmount->fs == Mount::simplefs && config->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( system->mounts.pmount->fs == Mount::hashfs && config->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( config->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( request->session->puser && request->session->puser->super_user )
|
||||
// super user can use upload everywhere
|
||||
return true;
|
||||
|
||||
if( !system->HasWriteAccess(item) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Upload::HasAccess()
|
||||
{
|
||||
if( request->is_item || !HasAccess(*request->dir_table.back()) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Upload::UploadCreatePath()
|
||||
{
|
||||
if( !system->MakePath(request->item, true) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Upload::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 Upload::FunUploadCheckAbuse()
|
||||
{
|
||||
if( !system->rebus.CheckRebus() )
|
||||
{
|
||||
request->status = WINIX_ERR_INCORRECT_REBUS;
|
||||
return false;
|
||||
}
|
||||
|
||||
functions->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 Upload::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
|
||||
functions->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);
|
||||
|
||||
system->PrepareUrl(request->item);
|
||||
request->status = system->AddFile(request->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);
|
||||
}
|
||||
}
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
|
||||
|
||||
void Upload::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 );
|
||||
|
||||
functions->ReadItem(request->item, Item::file); // ReadItem() changes the url if it is empty
|
||||
functions->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;
|
||||
system->PrepareUrl(request->item);
|
||||
}
|
||||
|
||||
request->status = system->AddFile(request->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 )
|
||||
system->RedirectTo(request->item, "/cat");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// !! dodac usuwanie plikow statycznych przez rm
|
||||
void Upload::MakePost()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
42
functions/upload.h
Executable file
42
functions/upload.h
Executable file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentupload
|
||||
#define headerfilecmslucontentupload
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Upload : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Upload();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
||||
private:
|
||||
|
||||
bool HasAccess(const Item & item);
|
||||
bool UploadCreatePath();
|
||||
void UploadSaveFile(const std::string & tmp_filename, const std::string & destination);
|
||||
bool FunUploadCheckAbuse();
|
||||
void UploadMulti();
|
||||
void UploadSingle();
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
24
functions/who.cpp
Executable file
24
functions/who.cpp
Executable file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "who.h"
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
Who::Who()
|
||||
{
|
||||
fun.url = "who";
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
34
functions/who.h
Executable file
34
functions/who.h
Executable file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucontentwho
|
||||
#define headerfilecmslucontentwho
|
||||
|
||||
#include "functionbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Fun
|
||||
{
|
||||
|
||||
|
||||
class Who : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
Who();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user