From 8154c403d89293ea777357d241bf0ff227c7237c Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 5 Jan 2011 21:24:11 +0000 Subject: [PATCH] we can create links (hard links, symbolic links) now added winix functions: ln winix function 'default' can be used without redirecting now added new tickets types: TypeProgress, TypeString, TypeMultistring, TypeImages, TypeFiles now tickets are combined with files added winix functions: showtickets fixed mountpoints: when the default root mount was created its parameter table was empty and it caused accessing to a non-existing objects fixed logger: modifiers (log1, log2, log3) were incorrectly treated added modifier: log4 (debug info) now we are moving threads to a new plugin 'thread' created directory: plugins/thread (not finished yet) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@704 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/Makefile.dep | 138 +++-- core/app.cpp | 57 +- core/config.cpp | 4 + core/config.h | 14 +- core/dircontainer.cpp | 16 +- core/dircontainer.h | 4 +- core/dirs.cpp | 204 ++++++- core/dirs.h | 20 +- core/error.h | 3 +- core/item.cpp | 6 +- core/item.h | 21 +- core/log.cpp | 144 +++-- core/log.h | 54 +- core/misc.cpp | 48 ++ core/misc.h | 7 + core/mounts.cpp | 3 + core/plugin.cpp | 6 +- core/postmultiparser.cpp | 2 +- core/system.cpp | 419 ++++++++++++-- core/system.h | 35 +- core/thread.h | 22 +- core/thumb.cpp | 135 ++++- core/thumb.h | 29 +- core/ugcontainer.h | 6 +- core/version.h | 2 +- db/db.cpp | 975 ++++++++++++-------------------- db/db.h | 35 +- db/dbbase.cpp | 41 +- db/dbbase.h | 2 + db/dbitemcolumns.cpp | 23 +- db/dbitemcolumns.h | 5 +- db/dbitemquery.cpp | 10 +- db/dbitemquery.h | 9 +- functions/Makefile.dep | 782 ++++++++++++------------- functions/Makefile.o.dep | 2 +- functions/cp.cpp | 344 ++++++----- functions/cp.h | 67 ++- functions/createthread.cpp | 2 +- functions/createthread.h | 8 +- functions/default.cpp | 94 +-- functions/default.h | 6 +- functions/emacs.cpp | 5 +- functions/functionbase.cpp | 7 +- functions/functionbase.h | 5 +- functions/functionparser.cpp | 5 +- functions/functions.cpp | 156 +++-- functions/functions.h | 13 +- functions/funthread.cpp | 5 +- functions/funthread.h | 10 +- functions/ln.cpp | 111 ++++ functions/ln.h | 42 ++ functions/ls.cpp | 2 +- functions/mv.cpp | 425 +++++++------- functions/mv.h | 57 +- functions/privchanger.cpp | 6 +- functions/rm.cpp | 272 +++++---- functions/rm.h | 25 +- functions/upload.cpp | 11 +- functions/upload.h | 5 +- html/fun_cp.html | 1 + html/fun_createticket.html | 50 +- html/fun_default.html | 7 +- html/fun_ln.html | 31 + html/fun_ls.html | 4 +- html/fun_rm.html | 49 +- html/fun_showtickets.html | 40 ++ html/fun_ticket.html | 98 ++-- html/item_options.html | 2 +- locale/en | 26 +- locale/pl | 23 +- main/Makefile.dep | 5 +- main/main.cpp | 20 +- notify/Makefile.dep | 29 +- notify/notifythread.cpp | 3 +- plugins/stats/Makefile.dep | 20 +- plugins/thread/Makefile | 27 + plugins/thread/Makefile.dep | 374 ++++++++++++ plugins/thread/Makefile.o.dep | 1 + plugins/thread/init.cpp | 141 +++++ plugins/thread/showthreads.cpp | 23 + plugins/thread/showthreads.h | 35 ++ plugins/thread/tdb.cpp | 277 +++++++++ plugins/thread/tdb.h | 47 ++ plugins/thread/threadinfo.h | 36 ++ plugins/ticket/Makefile.dep | 227 +++++--- plugins/ticket/Makefile.o.dep | 2 +- plugins/ticket/createticket.cpp | 169 +++--- plugins/ticket/createticket.h | 9 +- plugins/ticket/editticket.cpp | 217 +++---- plugins/ticket/editticket.h | 14 +- plugins/ticket/funticket.cpp | 92 +-- plugins/ticket/funticket.h | 17 +- plugins/ticket/init.cpp | 62 +- plugins/ticket/sessiondata.cpp | 42 ++ plugins/ticket/sessiondata.h | 53 ++ plugins/ticket/showtickets.cpp | 138 +++++ plugins/ticket/showtickets.h | 58 ++ plugins/ticket/tdb.cpp | 91 ++- plugins/ticket/tdb.h | 9 +- plugins/ticket/templates.cpp | 475 +++++++++------- plugins/ticket/ticket.h | 21 +- plugins/ticket/ticketconf.cpp | 6 +- plugins/ticket/ticketconf.h | 10 +- plugins/ticket/ticketinfo.cpp | 301 +++++++--- plugins/ticket/ticketinfo.h | 85 +-- plugins/ticket/ticketparser.cpp | 118 +++- plugins/ticket/ticketparser.h | 8 + static/layout1/winix.css | 8 +- templates/Makefile.dep | 53 +- templates/dir.cpp | 48 +- templates/item.cpp | 96 ++++ templates/templates.cpp | 27 +- templates/templates.h | 21 +- 113 files changed, 5840 insertions(+), 2972 deletions(-) create mode 100755 functions/ln.cpp create mode 100755 functions/ln.h create mode 100755 html/fun_ln.html create mode 100755 html/fun_showtickets.html create mode 100755 plugins/thread/Makefile create mode 100755 plugins/thread/Makefile.dep create mode 100755 plugins/thread/Makefile.o.dep create mode 100755 plugins/thread/init.cpp create mode 100755 plugins/thread/showthreads.cpp create mode 100755 plugins/thread/showthreads.h create mode 100755 plugins/thread/tdb.cpp create mode 100755 plugins/thread/tdb.h create mode 100755 plugins/thread/threadinfo.h create mode 100755 plugins/ticket/sessiondata.cpp create mode 100755 plugins/ticket/sessiondata.h create mode 100755 plugins/ticket/showtickets.cpp create mode 100755 plugins/ticket/showtickets.h diff --git a/core/Makefile.dep b/core/Makefile.dep index 59fa4a1..8c053be 100755 --- a/core/Makefile.dep +++ b/core/Makefile.dep @@ -23,12 +23,13 @@ app.o: ../functions/functionbase.h ../core/request.h ../core/system.h app.o: ../core/synchro.h ../functions/functionparser.h ../functions/adduser.h app.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h app.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h -app.o: ../functions/createthread.h ../functions/default.h -app.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -app.o: ../functions/login.h ../functions/logout.h ../functions/ls.h -app.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -app.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -app.o: ../functions/run.h ../functions/specialdefault.h ../functions/stat.h +app.o: ../functions/createthread.h ../functions/functionbase.h +app.o: ../functions/default.h ../functions/download.h ../functions/emacs.h +app.o: ../functions/last.h ../functions/login.h ../functions/logout.h +app.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +app.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +app.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +app.o: ../functions/specialdefault.h ../functions/stat.h app.o: ../functions/subject.h ../functions/funthread.h app.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h app.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h @@ -65,13 +66,14 @@ config.o: ../core/request.h ../core/system.h ../core/synchro.h config.o: ../functions/functionparser.h ../functions/adduser.h config.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h config.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h -config.o: ../functions/createthread.h ../functions/default.h -config.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -config.o: ../functions/login.h ../functions/logout.h ../functions/ls.h -config.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -config.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -config.o: ../functions/run.h ../functions/specialdefault.h -config.o: ../functions/stat.h ../functions/subject.h ../functions/funthread.h +config.o: ../functions/createthread.h ../functions/functionbase.h +config.o: ../functions/default.h ../functions/download.h ../functions/emacs.h +config.o: ../functions/last.h ../functions/login.h ../functions/logout.h +config.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +config.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +config.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +config.o: ../functions/specialdefault.h ../functions/stat.h +config.o: ../functions/subject.h ../functions/funthread.h config.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h config.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h config.o: ../functions/vim.h ../core/htmlfilter.h ../templates/templates.h @@ -164,13 +166,14 @@ mounts.o: ../core/synchro.h ../functions/functionparser.h mounts.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h mounts.o: ../functions/privchanger.h ../functions/chown.h mounts.o: ../functions/ckeditor.h ../functions/cp.h -mounts.o: ../functions/createthread.h ../functions/default.h -mounts.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -mounts.o: ../functions/login.h ../functions/logout.h ../functions/ls.h -mounts.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -mounts.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -mounts.o: ../functions/run.h ../functions/specialdefault.h -mounts.o: ../functions/stat.h ../functions/subject.h ../functions/funthread.h +mounts.o: ../functions/createthread.h ../functions/functionbase.h +mounts.o: ../functions/default.h ../functions/download.h ../functions/emacs.h +mounts.o: ../functions/last.h ../functions/login.h ../functions/logout.h +mounts.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +mounts.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +mounts.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +mounts.o: ../functions/specialdefault.h ../functions/stat.h +mounts.o: ../functions/subject.h ../functions/funthread.h mounts.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h mounts.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h mounts.o: ../functions/vim.h ../core/htmlfilter.h ../templates/templates.h @@ -201,13 +204,14 @@ plugin.o: ../core/request.h ../core/system.h ../core/synchro.h plugin.o: ../functions/functionparser.h ../functions/adduser.h plugin.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h plugin.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h -plugin.o: ../functions/createthread.h ../functions/default.h -plugin.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -plugin.o: ../functions/login.h ../functions/logout.h ../functions/ls.h -plugin.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -plugin.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -plugin.o: ../functions/run.h ../functions/specialdefault.h -plugin.o: ../functions/stat.h ../functions/subject.h ../functions/funthread.h +plugin.o: ../functions/createthread.h ../functions/functionbase.h +plugin.o: ../functions/default.h ../functions/download.h ../functions/emacs.h +plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h +plugin.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +plugin.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +plugin.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +plugin.o: ../functions/specialdefault.h ../functions/stat.h +plugin.o: ../functions/subject.h ../functions/funthread.h plugin.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h plugin.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h plugin.o: ../functions/vim.h ../core/htmlfilter.h ../templates/templates.h @@ -239,21 +243,22 @@ plugindata.o: ../core/synchro.h ../functions/functionparser.h plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h plugindata.o: ../functions/privchanger.h ../functions/chown.h plugindata.o: ../functions/ckeditor.h ../functions/cp.h -plugindata.o: ../functions/createthread.h ../functions/default.h -plugindata.o: ../functions/download.h ../functions/emacs.h -plugindata.o: ../functions/last.h ../functions/login.h ../functions/logout.h -plugindata.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h -plugindata.o: ../functions/node.h ../functions/priv.h ../functions/reload.h -plugindata.o: ../functions/rm.h ../functions/run.h -plugindata.o: ../functions/specialdefault.h ../functions/stat.h -plugindata.o: ../functions/subject.h ../functions/funthread.h -plugindata.o: ../functions/template.h ../functions/tinymce.h -plugindata.o: ../functions/uname.h ../functions/upload.h -plugindata.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h -plugindata.o: ../core/htmlfilter.h ../templates/templates.h -plugindata.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h -plugindata.o: ../core/httpsimpleparser.h ../core/log.h -plugindata.o: ../templates/indexpatterns.h ../core/sessionmanager.h +plugindata.o: ../functions/createthread.h ../functions/functionbase.h +plugindata.o: ../functions/default.h ../functions/download.h +plugindata.o: ../functions/emacs.h ../functions/last.h ../functions/login.h +plugindata.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h +plugindata.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h +plugindata.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h +plugindata.o: ../functions/run.h ../functions/specialdefault.h +plugindata.o: ../functions/stat.h ../functions/subject.h +plugindata.o: ../functions/funthread.h ../functions/template.h +plugindata.o: ../functions/tinymce.h ../functions/uname.h +plugindata.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h +plugindata.o: ../functions/vim.h ../core/htmlfilter.h +plugindata.o: ../templates/templates.h ../templates/patterncacher.h +plugindata.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +plugindata.o: ../core/log.h ../templates/indexpatterns.h +plugindata.o: ../core/sessionmanager.h postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h postmultiparser.o: confparser.h htmlfilter.h log.h textstream.h postmultiparser.o: ../../ezc/src/utf8.h misc.h item.h @@ -284,9 +289,10 @@ request.o: ../core/request.h ../core/system.h ../core/synchro.h request.o: ../functions/functionparser.h ../functions/adduser.h request.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h request.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h -request.o: ../functions/createthread.h ../functions/default.h -request.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -request.o: ../functions/login.h ../functions/logout.h ../functions/ls.h +request.o: ../functions/createthread.h ../functions/functionbase.h +request.o: ../functions/default.h ../functions/download.h +request.o: ../functions/emacs.h ../functions/last.h ../functions/login.h +request.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h request.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h request.o: ../functions/run.h ../functions/specialdefault.h @@ -332,19 +338,20 @@ sessionmanager.o: ../functions/functionparser.h ../functions/adduser.h sessionmanager.o: ../functions/cat.h ../functions/chmod.h sessionmanager.o: ../functions/privchanger.h ../functions/chown.h sessionmanager.o: ../functions/ckeditor.h ../functions/cp.h -sessionmanager.o: ../functions/createthread.h ../functions/default.h -sessionmanager.o: ../functions/download.h ../functions/emacs.h -sessionmanager.o: ../functions/last.h ../functions/login.h -sessionmanager.o: ../functions/logout.h ../functions/ls.h -sessionmanager.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -sessionmanager.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -sessionmanager.o: ../functions/run.h ../functions/specialdefault.h -sessionmanager.o: ../functions/stat.h ../functions/subject.h -sessionmanager.o: ../functions/funthread.h ../functions/template.h -sessionmanager.o: ../functions/tinymce.h ../functions/uname.h -sessionmanager.o: ../functions/upload.h ../functions/uptime.h -sessionmanager.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h -sessionmanager.o: ../templates/templates.h ../templates/patterncacher.h +sessionmanager.o: ../functions/createthread.h ../functions/functionbase.h +sessionmanager.o: ../functions/default.h ../functions/download.h +sessionmanager.o: ../functions/emacs.h ../functions/last.h +sessionmanager.o: ../functions/login.h ../functions/logout.h +sessionmanager.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +sessionmanager.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +sessionmanager.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +sessionmanager.o: ../functions/specialdefault.h ../functions/stat.h +sessionmanager.o: ../functions/subject.h ../functions/funthread.h +sessionmanager.o: ../functions/template.h ../functions/tinymce.h +sessionmanager.o: ../functions/uname.h ../functions/upload.h +sessionmanager.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +sessionmanager.o: ../core/htmlfilter.h ../templates/templates.h +sessionmanager.o: ../templates/patterncacher.h sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h sessionmanager.o: ../core/log.h ../templates/indexpatterns.h sessionmanager.o: ../core/sessionmanager.h @@ -376,11 +383,24 @@ system.o: ../templates/templates.h ../templates/patterncacher.h system.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h system.o: ../core/log.h ../templates/indexpatterns.h ../core/request.h system.o: ../core/system.h ../core/sessionmanager.h +system.o: ../functions/functionbase.h textstream.o: textstream.h misc.h item.h thumb.o: thumb.h basethread.h textstream.h ../db/db.h ../db/dbbase.h thumb.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h thumb.o: item.h ../core/error.h log.h ../db/dbitemquery.h ../core/item.h thumb.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h thumb.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h -thumb.o: ../../ezc/src/utf8.h +thumb.o: ../core/config.h ../../ezc/src/utf8.h system.h dirs.h dircontainer.h +thumb.o: request.h requesttypes.h session.h error.h user.h plugindata.h +thumb.o: rebus.h config.h confparser.h htmlfilter.h +thumb.o: ../templates/htmltextstream.h ../notify/notify.h +thumb.o: ../notify/notifypool.h ../templates/locale.h ../core/confparser.h +thumb.o: ../templates/misc.h ../templates/localefilter.h +thumb.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/generator.h +thumb.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h +thumb.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h +thumb.o: ../templates/htmltextstream.h ../notify/notifythread.h +thumb.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h +thumb.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h mount.h +thumb.o: mountparser.h users.h groups.h group.h loadavg.h users.o: users.h diff --git a/core/app.cpp b/core/app.cpp index 36aec5e..0c60c92 100755 --- a/core/app.cpp +++ b/core/app.cpp @@ -182,7 +182,7 @@ return true; void App::ProcessRequestThrow() { - ReadRequest(); + ReadRequest(); // when BaseUrlRedirect() return true we didn't have to set everything in request.Read() // in the future request.Read() can be split and at the beginning only environment variables will be read @@ -214,15 +214,11 @@ void App::ProcessRequest() log << log2 << config.log_delimiter << logend; ProcessRequestThrow(); - - SaveSessionsIfNeeded(); - - if( request.function ) - request.function->Clear(); + SaveSessionsIfNeeded(); // !! przerzucic to na watek sesji request.Clear(); system.load_avg.StopRequest(); - log << logsave; + log << logendrequest; } catch(const std::exception & e) { @@ -313,20 +309,13 @@ void App::Make() // request.status can be changed by function_parser if( request.status == WINIX_ERR_OK ) - { plugin.Call(WINIX_PREPARE_REQUEST); - if( system.DirsHaveReadExecPerm() ) - { - if( request.method == Request::post ) - functions.MakePost(); - - if( request.redirect_to.empty() && request.status == WINIX_ERR_OK ) - functions.MakeGet(); - } - else - request.status = WINIX_ERR_PERMISSION_DENIED; - } + if( request.status == WINIX_ERR_OK ) + functions.CheckFunctionAndSymlink(); + + if( request.status == WINIX_ERR_OK ) + functions.MakeFunction(); if( request.session->spam_score > 0 ) log << log1 << "App: spam score: " << request.session->spam_score << logend; @@ -538,17 +527,17 @@ void App::SendHeaders(bool compressing, Header header) if( !request.redirect_to.empty() ) { FCGX_PutS("Status: 301 Moved Permanently\r\n", fcgi_request.out); - AssignString(request.redirect_to, request.aredirect_to); + UrlEncode(request.redirect_to, request.aredirect_to); FCGX_FPrintF(fcgi_request.out, "Location: %s\r\n", request.aredirect_to.c_str()); - log << log2 << "Redirect to: " << request.redirect_to << logend; + log << log2 << "Redirect to: " << request.aredirect_to << logend; } else if( !request.x_sendfile.empty() ) { static std::string temp, temp2; // !! wrzucic gdzies to - AssignString(config.http_header_send_file, temp); - AssignString(request.x_sendfile, temp2); + Ezc::WideToUTF8(config.http_header_send_file, temp); + Ezc::WideToUTF8(request.x_sendfile, temp2); FCGX_FPrintF(fcgi_request.out, "%s: %s\r\n", temp.c_str(), temp2.c_str()); FCGX_PutS("Status: 200 OK\r\n", fcgi_request.out); @@ -833,7 +822,7 @@ bool App::DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool ad { if( initgroups(user.c_str(), gid) < 0 ) { - log << log1 << "App: I can't init groups for user: " << user << logend << logsave; + log << log1 << "App: I can't init groups for user: " << user << logend; return false; } } @@ -841,7 +830,7 @@ bool App::DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool ad { if( setgroups(1, &gid) < 0 ) { - log << log1 << "App: I can't init groups for user: " << user << logend << logsave; + log << log1 << "App: I can't init groups for user: " << user << logend; return false; } } @@ -849,20 +838,20 @@ bool App::DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool ad // for setting real and saved gid too if( setgid(gid) ) { - log << log1 << "App: I can't change real and saved gid" << logend << logsave; + log << log1 << "App: I can't change real and saved gid" << logend; return false; } if( setuid(uid) < 0 ) { log << log1 << "App: I can't drop privileges to user: " << user - << " (uid:" << (int)uid << ")" << logend << logsave; + << " (uid:" << (int)uid << ")" << logend; return false; } if( getuid()==0 || geteuid()==0 ) { - log << log1 << "App: sorry, for security reasons you should not run me as the root" << logend << logsave; + log << log1 << "App: sorry, for security reasons you should not run me as the root" << logend; return false; } @@ -880,14 +869,14 @@ bool App::DropPrivileges() if( config.user.empty() ) { log << log1 << "App: you should specify user name in the config file " - << "to which I have to drop privileges" << logend << logsave; + << "to which I have to drop privileges" << logend; return false; } if( config.group.empty() ) { log << log1 << "App: you should specify group name in the config file " - << "to which I have to drop privileges" << logend << logsave; + << "to which I have to drop privileges" << logend; return false; } @@ -896,13 +885,13 @@ bool App::DropPrivileges() if( !p ) { - log << log1 << "App: there is no such a user as: \"" << config.user << "\"" << logend << logsave; + log << log1 << "App: there is no such a user as: \"" << config.user << "\"" << logend; return false; } if( !g ) { - log << log1 << "App: there is no such a group as: \"" << config.group << "\"" << logend << logsave; + log << log1 << "App: there is no such a group as: \"" << config.group << "\"" << logend; return false; } @@ -922,7 +911,7 @@ bool App::Demonize() if( pid == -1 ) { - log << log1 << "App: I can't demonize myself (fork problem)" << logend << logsave; + log << log1 << "App: I can't demonize myself (fork problem)" << logend; return false; } @@ -935,7 +924,7 @@ bool App::Demonize() // child if( setsid() == -1 ) { - log << log1 << "App: I can't demonize myself (setsid problem)" << logend << logsave; + log << log1 << "App: I can't demonize myself (setsid problem)" << logend; return false; } diff --git a/core/config.cpp b/core/config.cpp index dd2c1d1..6a5c0de 100755 --- a/core/config.cpp +++ b/core/config.cpp @@ -105,6 +105,7 @@ void Config::AssignValues(bool stdout_is_closed) fcgi_socket_group = AText(L"fcgi_socket_group"); log_level = Int(L"log_level", 1); log_request = Int(L"log_request", 1); + log_save_each_line = Bool(L"log_save_each_line", false); log_stdout = Bool(L"log_stdout", false); log_db_query = Bool(L"log_db_query", false); log_plugin_call = Bool(L"log_plugin_call", false); @@ -184,6 +185,9 @@ void Config::AssignValues(bool stdout_is_closed) time_zone_offset_guest = Int(L"time_zone_offset_guest", 0); utf8 = Bool(L"utf8", true); + symlinks_follow_max = Size(L"symlinks_follow_max", 20); + + ticket_form_prefix = Text(L"ticket_form_prefix", L"ticketparam"); } diff --git a/core/config.h b/core/config.h index 0e032dc..34472b5 100755 --- a/core/config.h +++ b/core/config.h @@ -56,10 +56,14 @@ public: // default: false bool log_stdout; - // how many requests should be logged in the same time + // how many requests should be saved in the same time // default: 1 int log_request; + // whether to save each line of the config (use it for debug purposes) + // default: false + bool log_save_each_line; + // logging db queries // default: false bool log_db_query; @@ -285,6 +289,14 @@ public: // if false it means 8-bit ASCII bool utf8; + // how many maximum symlinks can be followed + // (symlinks on directories as well) + // default: 20 + size_t symlinks_follow_max; + + // the prefix of a name of html form controls used in the ticket plugin + // default: ticketparam + std::wstring ticket_form_prefix; /* */ diff --git a/core/dircontainer.cpp b/core/dircontainer.cpp index 3b7057e..bff1273 100755 --- a/core/dircontainer.cpp +++ b/core/dircontainer.cpp @@ -91,9 +91,9 @@ void DirContainer::FindSpecialFolders() if( !is_root ) return; - DirContainer::ParentIterator i = FindFirstParent(root_iter->id); + DirContainer::ParentIterator i = FindFirstChild(root_iter->id); - for( ; i!=ParentEnd() ; i = NextParent(i) ) + for( ; i!=ParentEnd() ; i = NextChild(i) ) { if( i->second->url == dir_etc ) { @@ -126,14 +126,14 @@ void DirContainer::CheckSpecialFolder(const Item & item, Iterator iter) { is_etc = true; etc_iter = iter; - log << log1 << "DirCont: added special folder: /etc" << logend; + log << log2 << "DirCont: added special folder: /etc" << logend; } if( item.parent_id==root_iter->id && item.url==dir_var ) { is_var = true; var_iter = iter; - log << log1 << "DirCont: added special folder: /var" << logend; + log << log2 << "DirCont: added special folder: /var" << logend; } } @@ -172,10 +172,10 @@ bool DirContainer::ChangeParent(long dir_id, long new_parent_id) if( i->parent_id == new_parent_id ) return true; // nothing to do - ParentIterator p = FindFirstParent(i->parent_id); + ParentIterator p = FindFirstChild(i->parent_id); bool found = false; - for( ; p != table_parent.end() ; p = NextParent(p) ) + for( ; p != table_parent.end() ; p = NextChild(p) ) { if( p->second->id == dir_id ) { @@ -251,7 +251,7 @@ bool DirContainer::ParentEmpty() } -DirContainer::ParentIterator DirContainer::FindFirstParent(long parent) +DirContainer::ParentIterator DirContainer::FindFirstChild(long parent) { ParentIterator i = table_parent.lower_bound(parent); @@ -262,7 +262,7 @@ return i; } -DirContainer::ParentIterator DirContainer::NextParent(ParentIterator i) +DirContainer::ParentIterator DirContainer::NextChild(ParentIterator i) { if( i == table_parent.end() ) return table_parent.end(); diff --git a/core/dircontainer.h b/core/dircontainer.h index a18a235..8ffa3b3 100755 --- a/core/dircontainer.h +++ b/core/dircontainer.h @@ -52,8 +52,8 @@ public: ParentIterator ParentEnd(); ParentSizeType ParentSize(); bool ParentEmpty(); - ParentIterator FindFirstParent(long parent); - ParentIterator NextParent(ParentIterator pi); + ParentIterator FindFirstChild(long parent); + ParentIterator NextChild(ParentIterator pi); bool IsNameOfSpecialFolder(const std::wstring & name); void FindSpecialFolders(); diff --git a/core/dirs.cpp b/core/dirs.cpp index 43c0752..84ecd24 100755 --- a/core/dirs.cpp +++ b/core/dirs.cpp @@ -70,7 +70,6 @@ void Dirs::CheckRootDir() root.user_id = -1; root.group_id = -1; root.privileges = 0755; - root.default_item = -1; // !! upewnic sie ze baza nie zmieni url (gdyby wczesniej juz byl w bazie pusty url) // !! zrobic jakis wyjatek do wprowadzania roota? @@ -129,26 +128,26 @@ bool Dirs::GetDirChilds(long parent, std::vector & childs_tab) if( parent != -1 && !IsDir(parent) ) return false; - DirContainer::ParentIterator i = dir_tab.FindFirstParent(parent); + DirContainer::ParentIterator i = dir_tab.FindFirstChild(parent); - for( ; i != dir_tab.ParentEnd() ; i = dir_tab.NextParent(i) ) + for( ; i != dir_tab.ParentEnd() ; i = dir_tab.NextChild(i) ) childs_tab.push_back( &(*i->second) ); return true; } -DirContainer::ParentIterator Dirs::FindFirstParent(long parent_id) +DirContainer::ParentIterator Dirs::FindFirstChild(long parent_id) { - DirContainer::ParentIterator i = dir_tab.FindFirstParent(parent_id); + DirContainer::ParentIterator i = dir_tab.FindFirstChild(parent_id); return i; } -DirContainer::ParentIterator Dirs::NextParent(DirContainer::ParentIterator i) +DirContainer::ParentIterator Dirs::NextChild(DirContainer::ParentIterator i) { - return dir_tab.NextParent(i); + return dir_tab.NextChild(i); } @@ -162,11 +161,14 @@ DirContainer::ParentIterator Dirs::ParentEnd() // albo tutaj stringa nie czyscic? // O(m * log n) (m- how many parts are in 'id') // path with a slash at the end -bool Dirs::MakePath(long id, std::wstring & path) +bool Dirs::MakePath(long id, std::wstring & path, bool clear_path) { DirContainer::Iterator i; - path = '/'; + if( clear_path ) + path.clear(); + + temp_path = '/'; while( true ) { @@ -174,16 +176,21 @@ DirContainer::Iterator i; if( i == dir_tab.End() || i->parent_id == id ) // means a loop (something wrong in the db) + { + // we don't change path if there is no such a directory return false; + } if( i->parent_id == -1 ) + { + path += temp_path; return true; + } id = i->parent_id; - - path.insert(0, i->url); - path.insert(path.begin(), '/'); + temp_path.insert(0, i->url); + temp_path.insert(temp_path.begin(), '/'); } } @@ -220,6 +227,33 @@ DirContainer::Iterator i; +bool Dirs::CreateDirTab(long dir_id, std::vector & out_dir_tab) +{ +DirContainer::Iterator i; + + out_dir_tab.clear(); + + do + { + i = dir_tab.FindId(dir_id); + + if( i == dir_tab.End() ) + return false; + + if( out_dir_tab.empty() ) + out_dir_tab.insert(out_dir_tab.end(), &(*i)); // !! I am not sure whether begin() can be used on an empty container + else + out_dir_tab.insert(out_dir_tab.begin(), &(*i)); + + dir_id = i->parent_id; + } + while( dir_id != -1 ); + +return true; +} + + + Item * Dirs::GetRootDir() { DirContainer::Iterator root = dir_tab.GetRoot(); @@ -255,9 +289,9 @@ return &(*etc); Item * Dirs::GetDir(const std::wstring & name, long parent) { - DirContainer::ParentIterator i = dir_tab.FindFirstParent(parent); + DirContainer::ParentIterator i = dir_tab.FindFirstChild(parent); - for( ; i!=dir_tab.ParentEnd() ; i = dir_tab.NextParent(i) ) + for( ; i!=dir_tab.ParentEnd() ; i = dir_tab.NextChild(i) ) if( i->second->url == name ) return &(*i->second); @@ -276,7 +310,7 @@ Item * Dirs::GetDir(const std::wstring & path) Item * pitem = &(*root); - std::wstring name; + std::wstring name; // !! dodac jako skladowa klasy const wchar_t * s = path.c_str(); while( ExtractName(s, name) ) @@ -287,7 +321,6 @@ Item * Dirs::GetDir(const std::wstring & path) return 0; } - return pitem; } @@ -392,6 +425,135 @@ return 0; +// current_dir_tab can be the same container as out_dir_tab +void Dirs::CopyDirTab(const std::vector & in, std::vector & out) +{ + if( &in != &out ) + { + out.resize(in.size()); + + for(size_t i=0 ; i & dir_tab, const std::wstring & link_to) +{ + if( dir_tab.empty() ) + return 0; + + size_t i = 0; + size_t old_i; + + while( true ) + { + // skipping slashes + for( ; iid); + + if( !pdir ) + return old_i; // analyze_temp is not a directory + + dir_tab.push_back(pdir); + } +} + + + + + + +int Dirs::FollowLink(std::vector & dir_tab, const std::wstring & link_to, std::wstring & out_item) +{ + size_t i = AnalyzeDir(dir_tab, link_to); + + if( i < link_to.size() ) + { + // checking if at least one slash has left + for(size_t a=i ; a < link_to.size() ; ++a) + if( link_to[a] == '/' ) + return 2; // there is not such a directory + + // the rest of the path is a file name + out_item = link_to.c_str() + i; + return 1; + } + +return 0; +} + + + + + +/* + return codes: + ok: + 0 - the link_to is a path to a directory (out_item skipped, out_dir_tab will not be empty) + 1 - the link_to is a path to a file (out_item is used, out_dir_tab will not be empty) + + error: + 2 - incorrect link_to + 3 - there is not a root dir + 4 - current_dir_tab was empty + + current_dir_tab can be the same container as out_dir_tab + link_to can be a relative path (without the first slash) +*/ +int Dirs::FollowLink(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, std::wstring & out_item) +{ + temp_link_to = link_to; // link_to can be from the out_item and would be cleared next + out_item.clear(); + + if( current_dir_tab.empty() ) + return 4; + + if( temp_link_to.empty() ) + { + CopyDirTab(current_dir_tab, out_dir_tab); + return 0; + } + + if( temp_link_to[0] == '/' ) + { + // temp_link_to is an absolute path + Item * pdir = GetRootDir(); + + if( !pdir ) + return 3; + + out_dir_tab.clear(); + out_dir_tab.push_back(pdir); + } + else + { + // temp_link_to is a relative path + CopyDirTab(current_dir_tab, out_dir_tab); + } + +return FollowLink(out_dir_tab, temp_link_to, out_item); +} + + + + + + void Dirs::SplitPath(const std::wstring & path, std::wstring & dir, std::wstring & file) { @@ -483,5 +645,15 @@ return var; } +// printing first and last slash +void Dirs::LogDir(const std::vector & dir_tab) +{ + log << '/'; + + // skipping the first (root) directory + for(size_t i=1 ; iurl << '/'; +} + diff --git a/core/dirs.h b/core/dirs.h index 8e1079b..ef29bc4 100755 --- a/core/dirs.h +++ b/core/dirs.h @@ -39,16 +39,24 @@ public: // these methods return false if there is no such a dir bool IsDir(long dir_id); bool GetDirChilds(long parent_id, std::vector & childs_tab); // !! zamienic na GetChilds() - bool MakePath(long dir_id, std::wstring & path); + bool MakePath(long dir_id, std::wstring & path, bool clear_path = true); bool ChangeParent(long dir_id, long new_parent_id); + bool HasParent(long dir_id, long parent_id); + bool DelDir(long dir_id); + bool CreateDirTab(long dir_id, std::vector & out_dir_tab); + + void LogDir(const std::vector & dir_tab); + int AnalyzePath(const std::wstring & path, long & dir_id, std::wstring & dir, std::wstring & file); + int FollowLink(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, std::wstring & out_item); static void SplitPath(const std::wstring & path, std::wstring & dir, std::wstring & file); - DirContainer::ParentIterator FindFirstParent(long parent_id); // !! zmienic w koncu nazwe na FindFirstChild - DirContainer::ParentIterator NextParent(DirContainer::ParentIterator i); + DirContainer::ParentIterator FindFirstChild(long parent_id); // !! zmienic w koncu nazwe na FindFirstChild + DirContainer::ParentIterator NextChild(DirContainer::ParentIterator i); DirContainer::ParentIterator ParentEnd(); @@ -76,10 +84,16 @@ private: Notify * notify; DirContainer dir_tab; + std::wstring temp_path; + std::wstring temp_link_to; size_t AnalyzeDir(Item * pdir, const std::wstring & path, long & dir_id, std::wstring & dir); + size_t AnalyzeDir(std::vector & dir_tab, const std::wstring & link_to); std::wstring analyze_temp; + void CopyDirTab(const std::vector & in, std::vector & out); + int FollowLink(std::vector & dir_tab, const std::wstring & link_to, std::wstring & out_item); + bool ExtractName(const wchar_t * & s, std::wstring & name); bool HasReadExecAccessForRoot(const Item & item); diff --git a/core/error.h b/core/error.h index eff50df..205190e 100755 --- a/core/error.h +++ b/core/error.h @@ -55,7 +55,6 @@ #define WINIX_DIFFERENT_MOUNT_POINTS 29 - #define WINIX_ERR_DB_FATAL_ERROR_DURING_CONNECTING 100 #define WINIX_ERR_DB_INCORRECT_QUERY 101 #define WINIX_ERR_DB_INCORRENT_RESULT_STATUS 102 @@ -70,6 +69,8 @@ //#define WINIX_ERR_UNKNOWN 1000 #define WINIX_NOTHING_TO_DO 109 + + typedef int Error; diff --git a/core/item.cpp b/core/item.cpp index 1db80fb..9601251 100755 --- a/core/item.cpp +++ b/core/item.cpp @@ -44,15 +44,19 @@ void Item::Clear() subject.clear(); content.clear(); + modify_index = 0; url.clear(); content_type = ct_formatted_text; type = none; parent_id = -1; - default_item = -1; + + link_to.clear(); + link_redirect = false; content_id = -1; + ref = 1; file_path.clear(); file_fs = -1; diff --git a/core/item.h b/core/item.h index 25b915f..9ba682d 100755 --- a/core/item.h +++ b/core/item.h @@ -19,6 +19,8 @@ #define WINIX_ITEM_FILETYPE_UNKNOWN 3 + + struct Item { long id; @@ -38,8 +40,9 @@ tm date_modification; std::wstring subject; std::wstring content; -long content_id; // used by the database + std::wstring url; +int modify_index; enum ContentType { @@ -58,22 +61,24 @@ enum Type { dir = 0, file = 1, + symlink = 2, - none = 1000 // !! pozbyc sie tego + none = 1000 }; Type type; -long default_item; +// used when type is symlink or to a directory too (function 'default') +std::wstring link_to; +int link_redirect; // static file (if exists) std::wstring file_path; // relative file path int file_fs; // file system type where the file was saved int file_type; // file type (none, image, doc, etc) - bool has_thumb; @@ -86,6 +91,14 @@ std::wstring html_template; void SetDateModifyToNow(); void Clear(); + +private: + // used by the database + long content_id; // content id in 'content' table + int ref; // content references + +friend class Db; +friend class DbItemColumns; }; diff --git a/core/log.cpp b/core/log.cpp index 451f834..ad8e73f 100755 --- a/core/log.cpp +++ b/core/log.cpp @@ -15,21 +15,29 @@ Log::Log() { - log_level = 3; - current_level = 4; // nothing to log (call Init() first) - item = 0; - item_save = 1; + log_level = 1; + current_level = 100; // nothing to log (call Init() first) + request = 0; + max_requests = 1; lines = 0; + max_lines = 5000; log_file_open = false; } -void Log::Init(int log_l, const std::string & log_f, bool log_std, int log_request) +Log::~Log() { - log_level = log_l; - log_file = log_f; - log_stdout = log_std; - item_save = log_request; + SaveLogAndClear(); +} + + +void Log::Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests) +{ + log_level = log_level_; + log_file = log_file_; + log_stdout = log_std; + max_requests = log_max_requests; + save_each_line = save_each_line_; // don't open the file here // because it would be created with the root as an owner @@ -67,6 +75,9 @@ void Log::PutDate(Manipulators m) Log & Log::operator<<(const void * s) { + if( current_level > log_level ) + return *this; + buffer << s; return *this; } @@ -75,6 +86,9 @@ Log & Log::operator<<(const void * s) Log & Log::operator<<(const char * s) { + if( current_level > log_level ) + return *this; + if( !s ) return *this; @@ -87,7 +101,10 @@ return *this; Log & Log::operator<<(const std::string & s) { - buffer << s; + if( current_level > log_level ) + return *this; + + buffer << s; return *this; } @@ -95,7 +112,10 @@ Log & Log::operator<<(const std::string & s) Log & Log::operator<<(const std::string * s) { - buffer << *s; + if( current_level > log_level ) + return *this; + + buffer << *s; return *this; } @@ -106,10 +126,11 @@ Log & Log::operator<<(const std::string * s) Log & Log::operator<<(const wchar_t * s) { - if( !s ) - return *this; - - buffer << s; + if( current_level <= log_level ) + { + if( s ) + buffer << s; + } return *this; } @@ -118,7 +139,11 @@ return *this; Log & Log::operator<<(const std::wstring & s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -126,7 +151,11 @@ Log & Log::operator<<(const std::wstring & s) Log & Log::operator<<(const std::wstring * s) { - buffer << *s; + if( current_level <= log_level ) + { + buffer << *s; + } + return *this; } @@ -136,7 +165,11 @@ Log & Log::operator<<(const std::wstring * s) Log & Log::operator<<(int s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -144,7 +177,11 @@ Log & Log::operator<<(int s) Log & Log::operator<<(long s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -153,7 +190,11 @@ Log & Log::operator<<(long s) Log & Log::operator<<(char s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -161,7 +202,11 @@ Log & Log::operator<<(char s) Log & Log::operator<<(size_t s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -169,7 +214,11 @@ Log & Log::operator<<(size_t s) Log & Log::operator<<(double s) { - buffer << s; + if( current_level <= log_level ) + { + buffer << s; + } + return *this; } @@ -180,36 +229,23 @@ Log & Log::operator<<(Manipulators m) switch(m) { case logend: - buffer << '\n'; - lines += 1; - - //if( lines > 3000 ) + if( current_level <= log_level ) { - SaveLog(); - buffer.Clear(); - item = 0; - lines = 0; + buffer << '\n'; + lines += 1; + + if( save_each_line ) + SaveLogAndClear(); } - - break; - - case logsavenow: - SaveLog(); - buffer.Clear(); - item = 0; - lines = 0; break; case logsave: - item += 1; + SaveLogAndClear(); + break; - if( item >= item_save || lines > 3000 ) - { - SaveLog(); - buffer.Clear(); - item = 0; - lines = 0; - } + case logendrequest: + if( ++request >= max_requests || lines > max_lines ) + SaveLogAndClear(); break; case log1: @@ -223,6 +259,10 @@ Log & Log::operator<<(Manipulators m) case log3: current_level = 3; break; + + case log4: + current_level = 4; + break; } return *this; @@ -240,12 +280,18 @@ void Log::SystemErr(int err) } +void Log::SaveLogAndClear() +{ + SaveLog(); + + buffer.Clear(); + request = 0; + lines = 0; +} + void Log::SaveLog() { - if( current_level > log_level ) - return; - if( buffer.Str().empty() ) return; diff --git a/core/log.h b/core/log.h index c1024ee..b2498de 100755 --- a/core/log.h +++ b/core/log.h @@ -18,19 +18,24 @@ #include "textstream.h" -// !! dodac manipulator logsave, logi zostana zapisane pod koniec wykonywania jednego requesta (albo po kilku w zaleznosci od jakiejs opcji w konfigu) -// logsave zostanie wywolane w requestcontroller.cpp przy konczeniu wykonywania requesta -enum Manipulators { logsave, logsavenow, logend, log1, log2, log3 }; - +// log1 - the first level +// log2 +// log3 +// log4 - the last level (debug level) +// logend - the end of a line +// logendrequest - end of a current request +// logsave - current log buffer is saved and cleared +enum Manipulators { log1, log2, log3, log4, logend, logendrequest, logsave }; class Log { public: - + Log(); - - void Init(int log_l, const std::string & log_f, bool log_std, int log_request); + ~Log(); + + void Init(int log_level_, bool save_each_line_, const std::string & log_file_, bool log_std, int log_max_requests); void PutDate(Manipulators m); Log & operator<<(const void * s); @@ -49,17 +54,46 @@ public: void SystemErr(int err); void SaveLog(); + void SaveLogAndClear(); private: + + // buffer for the log TextStream buffer; - int log_level, current_level; - int item, item_save; + + // log lovel from the config file + int log_level; + + // current level set by a modifier (e.g. log << log3) + int current_level; + + // current request for logging + // starts from zero and incremented after logendrequest modifier + int request; + + // how many request to save at once + int max_requests; + + // file log std::string log_file; - bool log_stdout; std::ofstream file; + + // logging to stdout + bool log_stdout; + + // how many lines there are in the buffer int lines; + + // is the config file already open bool log_file_open; + // how many lines can be in the config buffer + // default: 5000 + int max_lines; + + // whether to save each line (for debug) + bool save_each_line; + void OpenFile(); }; diff --git a/core/misc.cpp b/core/misc.cpp index 2b12826..ee30025 100755 --- a/core/misc.cpp +++ b/core/misc.cpp @@ -860,6 +860,11 @@ return WINIX_ITEM_FILETYPE_UNKNOWN; } +int SelectFileType(const std::wstring & file_name) +{ + return SelectFileType(file_name.c_str()); +} + time_t Time(const tm & par) { @@ -904,3 +909,46 @@ tm Time(time_t par) return res; } + + + + +void UrlEncode(const std::string & in, std::string & out, bool clear_out) +{ +char buffer[10]; + + if( clear_out ) + out.clear(); + + for(size_t i=0 ; i= 'a' && in[i] <= 'z') || + (in[i] >= 'A' && in[i] <= 'Z') || + (in[i] >= '0' && in[i] <= '9') || + in[i] == '.' || in[i] == ',' || in[i] == '/' || in[i] == ':' || in[i] == '#' || + in[i] == '-' || in[i] == '_' || in[i] == '(' || in[i] == ')' ) + { + out += in[i]; + } + else + { + Toa(static_cast(in[i]), buffer, 10, 16); + out += '%'; + + if( buffer[1] == 0 ) + out += '0'; // there is only one characters in the buffer + + out += buffer; + } + } +} + + +void UrlEncode(const std::wstring & in, std::string & out, bool clear_out) +{ +static std::string ain; + + Ezc::WideToUTF8(in, ain); + UrlEncode(ain, out, clear_out); +} + diff --git a/core/misc.h b/core/misc.h index 16ded02..7ae442f 100755 --- a/core/misc.h +++ b/core/misc.h @@ -415,9 +415,16 @@ bool RenameFile(const std::wstring & from, const std::wstring & to); const wchar_t * GetFileExt(const wchar_t * name); int SelectFileType(const wchar_t * file_name); +int SelectFileType(const std::wstring & file_name); + time_t Time(const tm & par); time_t Time(const tm * par); tm Time(time_t par); + +void UrlEncode(const std::string & in, std::string & out, bool clear_out = true); +void UrlEncode(const std::wstring & in, std::string & out, bool clear_out = true); + + #endif diff --git a/core/mounts.cpp b/core/mounts.cpp index fc54e1e..9f52b70 100755 --- a/core/mounts.cpp +++ b/core/mounts.cpp @@ -232,6 +232,9 @@ void Mounts::MountCmsForRoot() log << log1 << "M: there is no a root dir" << logend; } + mount.param.resize(mount_par_tab.size()); + mount.ClearParams(); + std::pair res = mount_tab.insert( std::make_pair(mount.dir_id, mount) ); pmount = &(res.first->second); } diff --git a/core/plugin.cpp b/core/plugin.cpp index 7271ccd..fbead69 100755 --- a/core/plugin.cpp +++ b/core/plugin.cpp @@ -168,7 +168,7 @@ void * Plugin::LoadInitFun(const char * filename, Fun1 & fun_init) return 0; } - log << log1 << "Plugin: plugin loaded" + log << log2 << "Plugin: plugin loaded" << ", file: " << filename << ", index: " << plugins.size() << logend; @@ -258,7 +258,7 @@ void Plugin::Call(int message, Slots::iterator & slot) if( !slot->second.is_running ) { if( config->log_plugin_call ) - log << log3 << "Plugin: calling plugin id: " << slot->second.index << ", message: " << message << logend; + log << log1 << "Plugin: calling plugin id: " << slot->second.index << ", message: " << message << logend; slot->second.is_running = true; @@ -271,7 +271,7 @@ void Plugin::Call(int message, Slots::iterator & slot) slot->second.is_running = false; if( config->log_plugin_call ) - log << log3 << "Plugin: returning from plugin id: " << slot->second.index << ", message: " << message << logend; + log << log1 << "Plugin: returning from plugin id: " << slot->second.index << ", message: " << message << logend; } else diff --git a/core/postmultiparser.cpp b/core/postmultiparser.cpp index 265b090..a7251d0 100755 --- a/core/postmultiparser.cpp +++ b/core/postmultiparser.cpp @@ -483,7 +483,7 @@ size_t buf_len = sizeof(buf)/sizeof(wchar_t); return; } - swprintf(buf, buf_len, L"%ls/tmp/winix_%u_%d_%u", config->upload_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand()); + swprintf(buf, buf_len, L"%ls/tmp/pmp_%u_%d_%u", config->upload_dir.c_str(), (unsigned)getpid(), tmp_filename_postfix, rand()); tmp_filename_postfix += 1; tmp_filename = buf; diff --git a/core/system.cpp b/core/system.cpp index 4d887ac..342059d 100755 --- a/core/system.cpp +++ b/core/system.cpp @@ -11,6 +11,7 @@ #include "misc.h" #include "error.h" #include "templates/templates.h" +#include "functions/functionbase.h" @@ -69,8 +70,9 @@ void System::Init() notify.Init(); thumb.SetSynchro(synchro); - thumb.SetConvertCmd(config->convert_cmd); thumb.SetDb(db); + thumb.SetConfig(config); + thumb.SetSystem(this); } @@ -83,16 +85,13 @@ void System::RedirectTo(const Item & item, const wchar_t * postfix) if( item.type == Item::dir ) { // item_id is pointing to a directory - dirs.MakePath(item.id, path); - request->redirect_to += path; + dirs.MakePath(item.id, request->redirect_to, false); } else { - if( !dirs.MakePath(item.parent_id, path) ) - log << log1 << "Content: Can't redirect: no dirs for item id: " << item.id << logend; - - request->redirect_to += path; - request->redirect_to += item.url; + // item_id is pointing to a file or a symlink + if( dirs.MakePath(item.parent_id, request->redirect_to, false) ) + request->redirect_to += item.url; } if( postfix ) @@ -103,37 +102,32 @@ void System::RedirectTo(const Item & item, const wchar_t * postfix) void System::RedirectTo(long item_id, const wchar_t * postfix) { -Item * pdir; - request->redirect_to = config->base_url; - pdir = dirs.GetDir(item_id); - + Item * pdir = dirs.GetDir(item_id); if( pdir ) { // item_id is pointing to a directory - dirs.MakePath(pdir->id, path); - request->redirect_to += path; + dirs.MakePath(pdir->id, request->redirect_to, false); } else { - // !! zrobic nowy interfejs - // !! GetItem pozamieniac na GetFile - // !! i nie uzywac request->item_tab (zrobic sobie lokalny tutaj) - db->GetItem(request->item_tab, item_id); - - if( !request->item_tab.empty() ) + // item_id is pointing to a file + DbItemQuery iq; + + iq.SetAllSel(false); + iq.WhereId(item_id); + iq.sel_parent_id = true; + iq.sel_url = true; + + if( db->GetItem(item_temp, iq) == WINIX_ERR_OK ) { - if( !dirs.MakePath(request->item_tab[0].parent_id, path) ) - log << log1 << "Content: Can't redirect: no dirs for item id: " - << request->item_tab[0].id << ", requested directory id: " - << request->item_tab[0].parent_id << logend; - - request->redirect_to += path + request->item_tab[0].url; + if( dirs.MakePath(item_temp.parent_id, request->redirect_to, false) ) + request->redirect_to += item_temp.url; } else { - log << log1 << "Content: Can't redirect: no such item: id: " << item_id << logend; + log << log1 << "System: can't redirect: no such item: id: " << item_id << logend; } } @@ -142,6 +136,66 @@ Item * pdir; } +void System::RedirectTo(const std::wstring & url) +{ + request->redirect_to = config->base_url; + + if( !url.empty() && url[0] == '/' ) + { + // absolute path + request->redirect_to += url; + } + else + { + // relative path + if( !request->dir_tab.empty() ) + { + if( dirs.MakePath(request->dir_tab.back()->id, request->redirect_to, false) ) + request->redirect_to += url; + } + else + { + request->redirect_to += '/'; + request->redirect_to += url; + } + } +} + + +void System::AddParams(const ParamTab & param_tab, std::wstring & str, bool clear_str) +{ + if( clear_str ) + str.clear(); + + for(size_t i=0 ; ifunction ) + return; + + request->redirect_to += '/'; + request->redirect_to += request->function->fun.url; + + AddParams(request->param_tab, request->redirect_to, false); +} + + void System::RedirectToLastDir() { if( !request->dir_tab.empty() ) @@ -319,13 +373,11 @@ bool System::HasReadExecAccessToPath(long dir_id) } -bool System::DirsHaveReadExecPerm() +bool System::HasReadExecAccessToPath(const std::vector & dir_tab) { - std::vector::iterator i; - - for(i = request->dir_tab.begin() ; i!=request->dir_tab.end() ; ++i) + for(size_t i=0 ; i < dir_tab.size() ; ++i) { - if( !HasReadExecAccess(**i) ) + if( !HasReadExecAccess(*dir_tab[i]) ) return false; } @@ -333,6 +385,12 @@ return true; } +bool System::DirsHaveReadExecPerm() +{ + return HasReadExecAccessToPath(request->dir_tab); +} + + // if we don't have access we only remove the item from the table void System::CheckAccessToItems(std::vector & item_tab) { @@ -488,7 +546,7 @@ return res; } -// making a global file path +// making a global file path (in the unix file system) // you should call CreateNewFile before bool System::MakeFilePath(const Item & item, std::wstring & path, bool thumb, bool create_dir, int chmod) { @@ -530,12 +588,36 @@ return true; } +// item can be a directory, file or a symlink +// if item is a directory then the path will be with a slash at the end +bool System::MakePath(const Item & item, std::wstring & path, bool clear_path) +{ +bool res; + + if( clear_path ) + path.clear(); + + if( item.type == Item::dir ) + { + res = dirs.MakePath(item.id, path); + } + else + { + res = dirs.MakePath(item.parent_id, path); + + if( res ) + path += item.url; + } + +return res; +} + Error System::AddFile(Item & item, int notify_code) { - if( item.type == Item::dir ) + if( item.type != Item::file ) return WINIX_ERR_FILE_EXPECTED; Error status = db->AddItem(item); @@ -557,7 +639,7 @@ return status; Error System::EditFile(Item & item, bool with_url, int notify_code) { - if( item.type == Item::dir ) + if( item.type != Item::file ) return WINIX_ERR_FILE_EXPECTED; if( request->session && request->session->puser ) @@ -613,3 +695,270 @@ tm System::LocalTime(const tm & ptm) { return LocalTime(&ptm); } + + + +/* + return codes: + ok: + 0 - the link_to is a path to a directory (out_item skipped, out_dir_tab will not be empty) + 1 - the link_to is a path to a file or a symlink (out_item is used, out_dir_tab will not be empty) + + error: + 2 - incorrect link_to + 3 - there is not a root dir + 4 - current_dir_tab was empty + + current_dir_tab can be the same container as out_dir_tab + link_to can be a relative path (without the first slash) +*/ +int System::FollowLink(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item) +{ + link_to_temp = link_to; // copy the link because it can be from out_item (and will be cleared) + out_item.Clear(); + + int res = dirs.FollowLink(current_dir_tab, link_to_temp, out_dir_tab, name_temp); + + if( res == 1 ) + { + if( db->GetItem(out_dir_tab.back()->id, name_temp, out_item) == WINIX_ERR_OK ) + return 1; + else + return 2; + } + +return res; +} + + + + + + + + +bool System::FollowAllLinksDirFound(std::vector & out_dir_tab, + bool follow_dir_default, bool stop_on_link_redirect, bool check_access) +{ + log << log3 << "System: link to a directory: "; + dirs.LogDir(out_dir_tab); + log << logend; + + if( check_access && !HasReadExecAccessToPath(out_dir_tab) ) + { + log << log1 << "System: no access to the directory structure" << logend; + return false; + } + + if( !out_dir_tab.back()->link_to.empty() ) + { + if( follow_dir_default ) + { + if( !(stop_on_link_redirect && out_dir_tab.back()->link_redirect==1) ) + link_to_temp = out_dir_tab.back()->link_to; + } + } + +return true; +} + + + +bool System::FollowAllLinksFileOrSymlinkFound(std::vector & out_dir_tab, Item & out_item, + bool stop_on_link_redirect, bool check_access) +{ + if( out_item.type == Item::symlink ) + log << log3 << "System: link to a symlink: "; + else + log << log3 << "System: link to a file: "; + + dirs.LogDir(out_dir_tab); + log << out_item.url << logend; + + if( check_access && !HasReadExecAccessToPath(out_dir_tab) ) + { + log << log1 << "System: no access to the directory structure" << logend; + return false; + } + + if( out_item.type == Item::symlink ) + { + if( out_item.link_to.empty() ) + { + log << log1 << "System: symlink empty" << logend; + return false; + } + else + { + if( !check_access || HasReadAccess(out_item) ) + { + if( !(stop_on_link_redirect && out_item.link_redirect==1) ) + link_to_temp = out_item.link_to; + } + else + { + log << log1 << "System: no read access to the symlink" << logend; + return false; + } + } + } + +return true; +} + + + + + + +/* + return codes: + ok: + 0 - the link_to is a path to a directory (out_item skipped, out_dir_tab will not be empty) + 1 - the link_to is a path to a file (out_item is used, out_dir_tab will not be empty) + (link_to can be a path to a symlink if stop_on_link_redirect is true) + + error: + 2 - incorrect link_to + 3 - there is not a root dir + 4 - current_dir_tab was empty + 5 - limit of symlinks exceeded + 6 - permission denied to a file/symlink or a directory (or a symlink is empty) + + current_dir_tab can be the same container as out_dir_tab + link_to can be a relative path (without the first slash) + + if follow_dir_default is true then directories with 'default' flags are followed as well + + if stop_on_link_redirect is true then the method stops on a symbolic link (or a directory + with 'default' flag set) where the redirection should be done, you should check then whether + the out_item.back()->link_to is not empty (if the result was 0 ) or + whether out_item.type is symlink (if the result was 1) + to make the redirection +*/ +int System::FollowAllLinks(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item, + bool follow_dir_default, bool stop_on_link_redirect, bool check_access) +{ + int res; + size_t level = 0; + link_to_temp = link_to; + + if( current_dir_tab.empty() ) + return 4; + + do + { + if( ++level > config->symlinks_follow_max ) + { + log << log1 << "System: the number of maximum symlinks exceeded (" + << config->symlinks_follow_max << ")" << logend; + + res = 5; + } + else + { + res = FollowLink(current_dir_tab, link_to_temp, out_dir_tab, out_item); + link_to_temp.clear(); + + if( res == 0 ) + { + out_item.Clear(); + res = FollowAllLinksDirFound(out_dir_tab, follow_dir_default, stop_on_link_redirect, check_access) ? 0 : 6; + } + else + if( res == 1 ) + { + res = FollowAllLinksFileOrSymlinkFound(out_dir_tab, out_item, stop_on_link_redirect, check_access) ? 1 : 6; + } + else + { + log << log2 << "System: incorrect link: " << link_to << logend; + } + } + } + while( !link_to_temp.empty() ); + +return res; +} + + +// the same as FollowAllLinks but starts from the root directory +// link_to must begin with a slash (or can be empty then the root directory is returned) +int System::FollowAllLinks(const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item, + bool follow_dir_default, bool stop_on_link_redirect, bool check_access) +{ + if( !link_to.empty() && link_to[0] != '/' ) + return 2; + + if( root_follow_dir_tab.size() != 1 ) + root_follow_dir_tab.resize(1); + + Item * root_dir = dirs.GetRootDir(); + + if( !root_dir ) + return 3; + + root_follow_dir_tab[0] = root_dir; + + return FollowAllLinks(root_follow_dir_tab, link_to, + out_dir_tab, out_item, follow_dir_default, stop_on_link_redirect, check_access); +} + + + +// the same as FollowAllLinks but operates on request->dir_tab and request->item +// and returns bool +// the method is making a redirection if needed +bool System::FollowAllLinks(const std::wstring & link_to, + bool follow_dir_default, bool stop_on_link_redirect, bool check_access) +{ + int res = FollowAllLinks(request->dir_tab, link_to, temp_follow_dir_tab, temp_follow_item, + follow_dir_default, stop_on_link_redirect, check_access); + + bool ok = (res == 0 || res == 1); + + if( ok ) + { + request->dir_tab = temp_follow_dir_tab; + + if( res == 0 ) + { + request->is_item = false; + request->item.Clear(); + request->last_item = request->dir_tab.back(); + + if( !request->dir_tab.back()->link_to.empty() ) + RedirectTo(request->dir_tab.back()->link_to); + + log << log3 << "System: current directory changed" << logend; + } + else + { + request->is_item = true; + request->item = temp_follow_item; + request->last_item = &request->item; + + if( request->item.type == Item::symlink ) + RedirectTo(request->item.link_to); // request->item.link_to is not empty + + log << log3 << "System: current directory changed and the new file loaded" << logend; + } + + mounts.CalcCurMount(); + } + else + { + if( res == 5 || res == 6 ) + request->status = WINIX_ERR_PERMISSION_DENIED; + else + request->status = WINIX_ERR_NO_ITEM; + } + +return ok; +} + + + diff --git a/core/system.h b/core/system.h index 8d19d1f..6f35def 100755 --- a/core/system.h +++ b/core/system.h @@ -66,8 +66,12 @@ public: void SetSynchro(Synchro * psynchro); void Init(); + void AddParams(const ParamTab & param_tab, std::wstring & str, bool clear_str = true); + void RedirectTo(const Item & item, const wchar_t * postfix = 0); void RedirectTo(long item_id, const wchar_t * postfix = 0); + void RedirectTo(const std::wstring & url); + void RedirectWithFunctionAndParamsTo(const std::wstring & url); void RedirectToLastDir(); void RedirectToLastItem(); // redirect to an item if exists or to the last directory @@ -80,6 +84,7 @@ public: bool HasReadWriteAccess(const Item & item); bool HasReadExecAccess(const Item & item); bool HasReadExecAccessToPath(long dir_id); + bool HasReadExecAccessToPath(const std::vector & dir_tab); bool DirsHaveReadExecPerm(); void CheckAccessToItems(std::vector & item_tab); @@ -93,6 +98,8 @@ public: bool CreateNewFile(Item & item); bool MakeFilePath(const Item & item, std::wstring & path, bool thumb = false, bool create_dir = false, int chmod = 0755); + bool MakePath(const Item & item, std::wstring & path, bool clear_path = true); + Error AddFile(Item & item, int notify_code = 0); Error EditFile(Item & item, bool with_url = true, int notify_code = 0); @@ -101,7 +108,21 @@ public: tm LocalTime(const tm * ptm); tm LocalTime(const tm & ptm); + int FollowLink(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item); + int FollowAllLinks(const std::vector & current_dir_tab, const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item, + bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true); + + // starting from root dir + int FollowAllLinks(const std::wstring & link_to, + std::vector & out_dir_tab, Item & out_item, + bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true); + + // using request->dir_tab and request->item + bool FollowAllLinks(const std::wstring & link_to, + bool follow_dir_default = false, bool stop_on_link_redirect = false, bool check_access = true); private: Request * request; @@ -109,10 +130,22 @@ private: Db * db; Synchro * synchro; - std::wstring path; + Item item_temp; + std::wstring link_to_temp, name_temp; + + // for FollowAllLinks + std::vector temp_follow_dir_tab; + std::vector root_follow_dir_tab; + Item temp_follow_item; + bool CreateNewFileSimpleFs(Item & item); bool CreateNewFileHashFs(Item & item); + bool FollowAllLinksDirFound(std::vector & out_dir_tab, + bool follow_dir_default, bool stop_on_link_redirect, bool check_access); + + bool FollowAllLinksFileOrSymlinkFound(std::vector & out_dir_tab, Item & out_item, + bool stop_on_link_redirect, bool check_access); }; diff --git a/core/thread.h b/core/thread.h index 42dc823..009c59c 100755 --- a/core/thread.h +++ b/core/thread.h @@ -2,24 +2,30 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2009, Tomasz Sowa + * Copyright (c) 2009-2010, Tomasz Sowa * All rights reserved. * */ -#ifndef headerfilecmslucorecorethread -#define headerfilecmslucorecorethread +#ifndef headerfile_winix_plugins_thread_thread +#define headerfile_winix_plugins_thread_thread #include +namespace Thread +{ + + + class Thread { public: - long id; - long parent_id; + long file_id; + + //long parent_id; long dir_id; bool closed; @@ -50,4 +56,10 @@ public: }; + + +} // namespace + #endif + + diff --git a/core/thumb.cpp b/core/thumb.cpp index 218dadf..60a1da9 100755 --- a/core/thumb.cpp +++ b/core/thumb.cpp @@ -7,17 +7,14 @@ * */ +#include #include "thumb.h" #include "utf8.h" #include "log.h" +#include "system.h" -void Thumb::SetConvertCmd(const std::wstring & cmd) -{ - convert_cmd = cmd; -} - void Thumb::SetDb(Db * pdb) { @@ -25,12 +22,22 @@ void Thumb::SetDb(Db * pdb) } -// first thread (objects locked) -void Thumb::CreateThumb(long item_id, const std::wstring & source, const std::wstring & dst, size_t cx, size_t cy, int aspect_mode) +void Thumb::SetConfig(Config * pconfig) { - item_temp.item_id = item_id; - item_temp.source = source; - item_temp.dst = dst; + config = pconfig; +} + + +void Thumb::SetSystem(System * psystem) +{ + system = psystem; +} + + +// first thread (objects locked) +void Thumb::CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode) +{ + item_temp.file = item; item_temp.cx = cx; item_temp.cy = cy; item_temp.aspect_mode = aspect_mode; @@ -155,33 +162,107 @@ void Thumb::SelectAspect() } -// second thread (objects are not locked) -void Thumb::CreateThumbnail() -{ - command.Clear(); - Ezc::WideToUTF8(convert_cmd, tempa); +// second thread (objects are not locked) +bool Thumb::CreateCommand() +{ +bool res; + + command.Clear(); + stream_tmp_path.Clear(); + + Lock(); + + Ezc::WideToUTF8(config->convert_cmd, tempa); command << tempa << " -quiet -strip -thumbnail "; SelectAspect(); command << " "; - Ezc::WideToUTF8(item_work.source, tempa); - EscapePath(tempa); - - Ezc::WideToUTF8(item_work.dst, tempa); - EscapePath(tempa); - - if( system(command.CStr()) == 0 ) + if( system->MakeFilePath(item_work.file, src_path) ) { - Lock(); - log << log3 << "Thumb: created a thumbnail: " << tempa << logend; - db->EditHasThumbById(true, item_work.item_id); - Unlock(); + Ezc::WideToUTF8(src_path, tempa); + EscapePath(tempa); + + stream_tmp_path << config->upload_dir << L"/tmp/thumb_" << std::time(0); + Ezc::WideToUTF8(stream_tmp_path.Str(), string_tmp_patha); + EscapePath(string_tmp_patha); + + res = true; + } + else + { + log << log1 << "Thumb: cannot create a source path" << logend; + res = false; + } + + Unlock(); + +return res; +} + + + +// second thread (objects are not locked) +void Thumb::SaveTmpThumbnail() +{ +bool moved = false; + + Lock(); + + // the file could have been changed especially when creating thumbnail lasted too long + iq.SetAll(false, false); + iq.sel_parent_id = true; + iq.sel_file = true; + iq.sel_url = true; + iq.sel_type = true; + iq.WhereId(item_work.file.id); + + if( db->GetItem(item_work.file, iq) == WINIX_ERR_OK ) + { + if( system->MakeFilePath(item_work.file, dst_path, true, true, config->upload_dirs_chmod) ) + { + if( RenameFile(stream_tmp_path.Str(), dst_path) ) + { + log << log3 << "Thumb: created a thumbnail: " << dst_path << logend; + db->EditHasThumbById(true, item_work.file.id); + moved = true; + } + else + { + log << log1 << "Thumb: cannot move a temporary file: " << stream_tmp_path.Str() << ", to: " << dst_path << logend; + } + } + else + { + log << log1 << "Thumb: cannot create a destination path" << logend; + } + } + + if( !moved ) + ::RemoveFile(stream_tmp_path.Str()); + + Unlock(); +} + + + +// second thread (objects are not locked) +void Thumb::CreateThumbnail() +{ + if( !CreateCommand() ) + return; + + int res = std::system(command.CStr()); + + if( res == 0 ) + { + SaveTmpThumbnail(); } else { Lock(); - log << log3 << "Thumb: some problems with creating a thumbnail: " << tempa << logend; + log << log3 << "Thumb: some problems with creating a thumbnail " << tempa + << ", 'convert' process returned: " << res << logend; Unlock(); } } diff --git a/core/thumb.h b/core/thumb.h index 6cefcf1..b7014d8 100755 --- a/core/thumb.h +++ b/core/thumb.h @@ -10,11 +10,16 @@ #ifndef headerfilecmslucorethumb #define headerfilecmslucorethumb -#include "basethread.h" #include #include +#include "basethread.h" #include "textstream.h" #include "db/db.h" +#include "core/item.h" +#include "core/config.h" + + +class System; @@ -46,21 +51,21 @@ class Thumb : public BaseThread { public: - void CreateThumb(long item_id, const std::wstring & source, const std::wstring & dst, - size_t cx, size_t cy, int aspect_mode = WINIX_THUMB_MODE_2); + void CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode); - void SetConvertCmd(const std::wstring & cmd); void SetDb(Db * pdb); + void SetConfig(Config * pconfig); + void SetSystem(System * psystem); private: Db * db; + Config * config; + System * system; struct ThumbItem { - long item_id; - std::wstring source; - std::wstring dst; + Item file; size_t cx; size_t cy; int aspect_mode; @@ -71,16 +76,18 @@ private: ThumbTab thumb_tab; ThumbItem item_temp; - // this is set before the second thread starts - std::wstring convert_cmd; - // only for second thread ThumbItem item_work; - std::string tempa; + std::wstring src_path, dst_path; + std::string tempa, string_tmp_patha; TextStream command; + TextStream stream_tmp_path; + DbItemQuery iq; virtual bool SignalReceived(); virtual void Do(); + bool CreateCommand(); + void SaveTmpThumbnail(); void CreateThumbnail(); void SelectAspect(); void EscapePath(const std::string & path); diff --git a/core/ugcontainer.h b/core/ugcontainer.h index a001dfd..2d8be1a 100755 --- a/core/ugcontainer.h +++ b/core/ugcontainer.h @@ -185,7 +185,7 @@ void UGContainer::AddIndexes(UGContainer::SizeType pos) table_id.insert( std::make_pair(table[pos].id, pos) ); table_name.insert( std::make_pair(table[pos].name, pos) ); - log << log2 << "UGCont: added indexes to: id: " << table[pos].id << ", name: " << table[pos].name << logend; + log << log4 << "UGCont: added indexes to: id: " << table[pos].id << ", name: " << table[pos].name << logend; } @@ -193,7 +193,7 @@ void UGContainer::AddIndexes(UGContainer::SizeType pos) template void UGContainer::RebuildIndexes() { - log << log2 << "UGCont: rebuilding indexes" << logend; + log << log4 << "UGCont: rebuilding indexes" << logend; table_id.clear(); table_name.clear(); @@ -204,7 +204,7 @@ void UGContainer::RebuildIndexes() for(i=0 ; i!=len ; ++i) AddIndexes( i ); - log << log2 << "UGCont: indexes rebuilt, table.size: " << table.size() << ", table_id.size: " + log << log4 << "UGCont: indexes rebuilt, table.size: " << table.size() << ", table_id.size: " << table_id.size() << ", table_name.size: " << table_name.size() << logend; } diff --git a/core/version.h b/core/version.h index c812aed..bbd33ad 100755 --- a/core/version.h +++ b/core/version.h @@ -13,7 +13,7 @@ #define WINIX_VER_MAJOR 0 #define WINIX_VER_MINOR 4 -#define WINIX_VER_REVISION 0 +#define WINIX_VER_REVISION 5 #endif diff --git a/db/db.cpp b/db/db.cpp index e3e0efa..e5bc2d3 100755 --- a/db/db.cpp +++ b/db/db.cpp @@ -110,6 +110,10 @@ wchar_t appendix[20]; size_t appendix_len = sizeof(appendix) / sizeof(wchar_t); appendix[0] = 0; + // only root dir may not have url + if( item.parent_id != -1 && item.url.empty() ) + item.url = L"empty"; + try { do @@ -157,75 +161,6 @@ return !is_that_url; -// for testing consistency -// !! obecnie nie potrzebne? skasowac? -void Db::CheckAllUrlSubjectModifyItem(Item & item) -{ - PGresult * r = 0; - - try - { - query.Clear(); - query << R("update core.item set url="); - - // url - if( AddItemCreateUrlSubject(item) ) - query << item.url; - else - { - query << item.id; - item.url.clear(); - } - - query << R(" where id=") << item.id << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_COMMAND_OK); - } - catch(const Error &) - { - } - - ClearResult(r); -} - - - -// for checking consistency -// !! skasowac? nie potrzebne? -void Db::CheckAllUrlSubject() -{ - PGresult * r = 0; - Item item; - - try - { - // !! subject zostal wrzucony do tabeli item - query << R("select item.id, subject from core.item left join core.content" - " on item.content_id = content.id where url is null or url=''"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - int rows = Rows(r); - int cid = AssertColumn(r, "id"); - int csubject = AssertColumn(r, "subject"); - - for(int i = 0 ; i(item.type) << item.parent_id << item.content_id - << item.file_path - << item.file_fs - << item.file_type - << static_cast(item.has_thumb) - << item.default_item + << item.link_to + << item.link_redirect << item.subject << item.guest_name << item.html_template; @@ -287,17 +219,26 @@ return result; } + Error Db::AddItemIntoContent(Item & item) { PGresult * r = 0; Error result = WINIX_ERR_OK; - + int first_ref = 1; + try { query.Clear(); - query << R("insert into core.content (content, content_type) values (") + query << R("insert into core.content (content, content_type, file_path, file_fs, " + "file_type, has_thumb, ref, modify_index) values (") << item.content << static_cast(item.content_type) + << item.file_path + << item.file_fs + << item.file_type + << static_cast(item.has_thumb) + << first_ref + << item.modify_index << R(");"); r = AssertQuery(query); @@ -320,8 +261,9 @@ return result; Error Db::AddItem(Item & item) { + BeginTrans(); Error result = WINIX_ERR_OK; - + if( item.type == Item::file ) result = AddItemIntoContent(item); else @@ -330,12 +272,50 @@ Error Db::AddItem(Item & item) if( result == WINIX_ERR_OK ) result = AddItemIntoItem(item); -return result; +return EndTrans(result); } +Error Db::IncrementContentRef(long content_id) +{ + query.Clear(); + query << R("update core.content set (ref) = (ref + 1) where id = ") + << content_id + << R(";"); + +return DoCommand(query); +} + + +Error Db::DecrementContentRef(long content_id) +{ + query.Clear(); + query << R("update core.content set (ref) = (ref - 1) where id = ") + << content_id + << R(";"); + +return DoCommand(query); +} + + +// item.id must be set (it's used by GetContentId) +Error Db::AddHardLink(Item & item) +{ + if( item.type != Item::file || item.content_id == -1 ) + return WINIX_ERR_FILE_EXPECTED; + + BeginTrans(); + Error result = IncrementContentRef(item.content_id); + + if( result == WINIX_ERR_OK ) + result = AddItemIntoItem(item); + +return EndTrans(result); +} + + Error Db::EditItemInItem(Item & item, bool with_url) { @@ -347,8 +327,8 @@ Error Db::EditItemInItem(Item & item, bool with_url) { query.Clear(); query << R("update core.item set (user_id, modification_user_id, group_id, privileges, " - "date_creation, date_modification, type, default_item, parent_id, subject, " - "guest_name, file_path, file_fs, file_type, has_thumb, template"); + "date_creation, date_modification, type, link_to, link_redirect, parent_id, subject, " + "guest_name, template"); if( with_url ) query << R(", url"); @@ -361,14 +341,11 @@ Error Db::EditItemInItem(Item & item, bool with_url) << item.date_creation << item.date_modification << static_cast(item.type) - << item.default_item + << item.link_to + << item.link_redirect << item.parent_id << item.subject << item.guest_name - << item.file_path - << item.file_fs - << item.file_type - << static_cast(item.has_thumb) << item.html_template; if( with_url ) @@ -408,10 +385,17 @@ Error Db::EditItemInContent(Item & item) try { + // we don't change 'ref' here query.Clear(); - query << R("update core.content set (content, content_type) = (") + query << R("update core.content set (content, content_type, file_path, file_fs, " + "file_type, has_thumb, modify_index) = (") << item.content << static_cast(item.content_type) + << item.file_path + << item.file_fs + << item.file_type + << static_cast(item.has_thumb) + << item.modify_index << R(") where id=") << item.content_id << R(";"); @@ -430,63 +414,24 @@ return result; } -Error Db::EditItemGetId(Item & item) + +long Db::GetContentId(long item_id) { PGresult * r = 0; - Error result = WINIX_ERR_OK; + long result = -1; try { query.Clear(); - query << R("select item.id, content.id from core.item left join core.content" - " on item.content_id = content.id where item.parent_id=") - << item.parent_id - << R(" and item.url=") - << item.url + query << R("select content_id from core.item where item.id=") + << item_id << R(";"); r = AssertQuery(query); AssertResult(r, PGRES_TUPLES_OK); - if( Rows(r) != 1 || Cols(r) != 2 ) - throw Error(WINIX_ERR_NO_ITEM); - - // we cannot use AssertColumn() with a name because both columns are called 'id' - item.id = AssertValueLong(r, 0, 0); - item.content_id = AssertValueLong(r, 0, 1); - } - catch(const Error & e) - { - result = e; - } - - ClearResult(r); - -return result; -} - - -Error Db::EditItemGetContentId(Item & item) -{ - PGresult * r = 0; - Error result = WINIX_ERR_OK; - - try - { - query.Clear(); - // !! tutaj chyba nie ma potrzeby robic left join z core.content (nie uzywamy nic z tamtej tabeli) - query << R("select content_id from core.item left join core.content" - " on item.content_id = content.id where item.id=") - << item.id - << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - if( Rows(r) != 1 || Cols(r) != 1 ) - throw Error(WINIX_ERR_NO_ITEM); - - item.content_id = AssertValueLong(r, 0, 0); + if( Rows(r) == 1 && Cols(r) == 1 ) + result = AssertValueLong(r, 0, 0); } catch(const Error & e) { @@ -503,47 +448,25 @@ return result; // !! moze nazwa poprostu EditItem (nie trzeba tego ById) ? (sprawdzic czy nie koliduje z inna nazwa) Error Db::EditItemById(Item & item, bool with_url) { + BeginTrans(); Error result = WINIX_ERR_OK; - // !! dla katalogow nie testowane jeszcze - if( item.type == Item::file ) - result = EditItemGetContentId(item); - - if( result == WINIX_ERR_OK ) { - if( item.type == Item::file ) - result = EditItemInContent(item); - - if( result == WINIX_ERR_OK ) - result = EditItemInItem(item, with_url); - } - -return result; -} - - - -// item.url and item.parent_id must be set -// doesn't work with directiories -Error Db::EditItemByUrl(Item & item, bool with_url) -{ - Error result = EditItemGetId(item); - - if( result == WINIX_ERR_OK ) - { + item.content_id = GetContentId(item.id); result = EditItemInContent(item); - - if( result == WINIX_ERR_OK ) - result = EditItemInItem(item, with_url); } + + if( result == WINIX_ERR_OK ) + result = EditItemInItem(item, with_url); -return result; +return EndTrans(result); } -Error Db::EditDefaultItem(long id, long new_default_item) + +Error Db::EditItemGetIdsByUrl(Item & item) { PGresult * r = 0; Error result = WINIX_ERR_OK; @@ -551,8 +474,65 @@ Error Db::EditDefaultItem(long id, long new_default_item) try { query.Clear(); - query << R("update core.item set (default_item) = (") - << new_default_item + query << R("select id, content_id from core.item where parent_id=") + << item.parent_id + << R(" and item.url=") + << item.url + << R(";"); + + r = AssertQuery(query); + AssertResult(r, PGRES_TUPLES_OK); + + if( Rows(r) != 1 ) + throw Error(WINIX_ERR_NO_ITEM); + + int cid = AssertColumn(r, "id"); + int cc_id = AssertColumn(r, "content_id"); + item.id = AssertValueLong(r, 0, cid); + item.content_id = AssertValueLong(r, 0, cc_id); + } + catch(const Error & e) + { + result = e; + } + + ClearResult(r); + +return result; +} + + +// item.url and item.parent_id must be set +Error Db::EditItemByUrl(Item & item, bool with_url) +{ + BeginTrans(); + Error result = EditItemGetIdsByUrl(item); + + if( result == WINIX_ERR_OK ) + { + if( item.type == Item::file ) + result = EditItemInContent(item); + + if( result == WINIX_ERR_OK ) + result = EditItemInItem(item, with_url); + } + +return EndTrans(result); +} + + + +Error Db::EditLinkItem(long id, const std::wstring & link_to, int link_redirect) +{ + PGresult * r = 0; + Error result = WINIX_ERR_OK; + + try + { + query.Clear(); + query << R("update core.item set (link_to, link_redirect) = (") + << link_to + << link_redirect << R(") where id=") << id << R(";"); @@ -563,7 +543,7 @@ Error Db::EditDefaultItem(long id, long new_default_item) if( AffectedRows(r) == 0 ) { result = WINIX_ERR_NO_ITEM; - log << log1 << "Db: EditDefaultItem: no such an item, id: " << id << logend; + log << log1 << "Db: EditLinkItem: no such an item, id: " << id << logend; } } catch(const Error & e) @@ -615,28 +595,28 @@ return result; PGresult * Db::GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel) { query.Clear(); - query << R("select item.id"); + query << R("select item.id, content_id"); if( !skip_other_sel ) { - if( iq.sel_parent_id ) query << R(" ,parent_id"); - if( iq.sel_user_id ) query << R(" ,user_id, modification_user_id"); - if( iq.sel_group_id ) query << R(" ,group_id"); - if( iq.sel_guest_name) query << R(" ,guest_name"); - if( iq.sel_privileges ) query << R(" ,privileges"); - if( iq.sel_date ) query << R(" ,date_creation, date_modification"); - if( iq.sel_subject ) query << R(" ,subject"); - if( iq.sel_content ) query << R(" ,content, content_type, content_id"); - if( iq.sel_url ) query << R(" ,url"); - if( iq.sel_type ) query << R(" ,type"); - if( iq.sel_default_item ) query << R(" ,default_item"); - if( iq.sel_file ) query << R(" ,file_path, file_fs, file_type, has_thumb"); - if( iq.sel_html_template ) query << R(" ,template"); + if( iq.sel_parent_id ) query << R(", parent_id"); + if( iq.sel_user_id ) query << R(", user_id, modification_user_id"); + if( iq.sel_group_id ) query << R(", group_id"); + if( iq.sel_guest_name) query << R(", guest_name"); + if( iq.sel_privileges ) query << R(", privileges"); + if( iq.sel_date ) query << R(", date_creation, date_modification"); + if( iq.sel_subject ) query << R(", subject"); + if( iq.sel_content ) query << R(", content, content_type, ref, modify_index"); + if( iq.sel_url ) query << R(", url"); + if( iq.sel_type ) query << R(", type"); + if( iq.sel_link ) query << R(", link_to, link_redirect"); + if( iq.sel_file ) query << R(", file_path, file_fs, file_type, has_thumb"); + if( iq.sel_html_template ) query << R(", template"); } query << R(" from core.item"); - if( iq.sel_content ) + if( iq.sel_content || iq.sel_file || iq.where_file_type ) query << R(" left join core.content on item.content_id = content.id"); if( iq.where_id || iq.where_parent_id || iq.where_type || iq.where_file_type ) @@ -645,9 +625,22 @@ PGresult * Db::GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel) const char * add_and = " and "; const char * if_and = ""; - if( iq.where_id ) { query << R(if_and) << R("id=") << iq.id ; if_and = add_and; } + if( iq.where_id ) { query << R(if_and) << R("item.id=") << iq.id ; if_and = add_and; } if( iq.where_parent_id ){ query << R(if_and) << R("parent_id=") << iq.parent_id ; if_and = add_and; } - if( iq.where_type ) { query << R(if_and) << R("type=") << int(iq.type) ; if_and = add_and; } + + if( iq.where_type ) + { + query << R(if_and) << R("type"); + + if( iq.type_equal ) + query << R("="); + else + query << R("!="); + + query << int(iq.type); + if_and = add_and; + } + if( iq.where_file_type ) { @@ -741,6 +734,49 @@ void Db::GetItems(std::vector & item_tab, const DbItemQuery & item_query) } + +Error Db::GetItem(Item & item, const DbItemQuery & item_query) +{ + item.Clear(); + PGresult * r = 0; + Error result = WINIX_ERR_OK; + + try + { + r = GetItemsQuery(item_query); + AssertResult(r, PGRES_TUPLES_OK); + + int rows = Rows(r); + + if( rows == 1 ) + { + DbItemColumns col; + col.SetColumns(r); + col.SetItem(r, 0, item); + } + else + if( rows == 0 ) + { + result = WINIX_ERR_NO_ITEM; + } + else + { + result = WINIX_ERR_NO_ITEM; + log << log1 << "Db: more than one item matches the query (" << rows << ")"; + } + } + catch(const Error & e) + { + result = e; + } + + ClearResult(r); + +return result; +} + + + // how many items there are in a 'parent_id' directory long Db::Size(long parent_id, Item::Type type) { @@ -772,44 +808,6 @@ return res; } -// !! zamienic nazwe na GetFile? -// !! cos tu pomyslec innego, ta metoda nie musi pobierac tablicy za argument -// i tak istnieje tylko jedna pozycja o okreslonym id -// mozna zwracac bool i pobierac referencje na item -void Db::GetItem(std::vector & item_tab, long id) -{ - PGresult * r = 0; - - try - { - query.Clear(); - query << R("select * from core.item left join core.content on item.content_id = content.id" - " where type=1 and item.id=") << id << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - Item item; - int rows = Rows(r); - - if( rows > 1 ) - log << log1 << "Db: we have more than one item with id: " << id << logend; - - DbItemColumns col; - col.SetColumns(r); - - for(int i = 0 ; i(item.has_thumb) - << R(") where id=") << id << R(";"); + << R(") where id=") << content_id << R(";"); r = AssertQuery(query); AssertResult(r, PGRES_COMMAND_OK); @@ -1067,7 +1072,7 @@ Error Db::EditFileById(const Item & item, long id) ClearResult(r); -return result; +return EndTrans(result); } @@ -1076,13 +1081,20 @@ Error Db::EditHasThumbById(bool has_thumb, long id) { PGresult * r = 0; Error result = WINIX_ERR_OK; - + + BeginTrans(); + try { + long content_id = GetContentId(id); + + if( content_id == -1 ) + throw Error(WINIX_ERR_NO_ITEM); + query.Clear(); - query << R("update core.item set (has_thumb) = (") + query << R("update core.content set (has_thumb) = (") << static_cast(has_thumb) - << R(") where id=") << id << R(";"); + << R(") where id=") << content_id << R(";"); r = AssertQuery(query); AssertResult(r, PGRES_COMMAND_OK); @@ -1094,53 +1106,12 @@ Error Db::EditHasThumbById(bool has_thumb, long id) ClearResult(r); -return result; +return EndTrans(result); } -Error Db::DelDirById(long id) -{ - Error result = WINIX_ERR_OK; - PGresult * r = 0; - - try - { - query.Clear(); - // !! trzeba poprawic to usuwanie gdy beda hard linki - query << R("delete from core.content where content.id in (select content_id from core.item where parent_id=") - << id - << R(");"); - - r = AssertQuery(query); - AssertResult(r, PGRES_COMMAND_OK); - log << log2 << "Db: deleted " << AffectedRows(r) << " rows from core.content" << logend; - - // !! ClearResult(r) tutaj? - - query.Clear(); - query << R("delete from core.item where id=") - << id - << R(" or parent_id=") - << id - << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_COMMAND_OK); - log << log1 << "Db: deleted dir: " << id << " (deleted: " << AffectedRows(r) << " rows)" << logend; - } - catch(const Error & e) - { - result = e; - } - - ClearResult(r); - - -return result; -} - Error Db::EditSubjectById(Item & item, long id) @@ -1172,10 +1143,63 @@ return result; -bool Db::DelItemDelItem(const Item & item) +Error Db::DelDirById(long id) +{ + Error result = WINIX_ERR_OK; + PGresult * r = 0; + + BeginTrans(); + + try + { + // decrementing ref in core.content + query.Clear(); + query << R("update core.content set (ref) = (ref - 1) where content.id in " + "(select content_id from core.item where type=1 and parent_id=") + << id + << R(");"); + + r = AssertQuery(query); + AssertResult(r, PGRES_COMMAND_OK); + ClearResult(r); + + // deleting in core.content where ref is zero + query.Clear(); + query << R("delete from core.content where ref=0;"); + r = AssertQuery(query); + AssertResult(r, PGRES_COMMAND_OK); + log << log2 << "Db: deleted " << AffectedRows(r) << " rows from core.content" << logend; + ClearResult(r); + + // deleting from core.item + query.Clear(); + query << R("delete from core.item where id=") + << id + << R(" or parent_id=") + << id + << R(";"); + + r = AssertQuery(query); + AssertResult(r, PGRES_COMMAND_OK); + log << log2 << "Db: deleted dir: " << id << " (deleted: " << AffectedRows(r) << " rows from core.item)" << logend; + } + catch(const Error & e) + { + result = e; + } + + ClearResult(r); + +return EndTrans(result); +} + + + + +Error Db::DelItemDelItem(const Item & item) { - long affected = 0; PGresult * r = 0; + Error result = WINIX_ERR_OK; try { @@ -1187,75 +1211,7 @@ bool Db::DelItemDelItem(const Item & item) r = AssertQuery(query); AssertResult(r, PGRES_COMMAND_OK); - affected = AffectedRows(r); - - if( affected > 1 ) - log << log1 << "Db: more than one item were deleted" << logend; - else - if( affected == 0 ) - log << log1 << "Db: no item has been deleted" << logend; - } - catch(const Error &) - { - } - - ClearResult(r); - -return affected != 0; -} - - - - -void Db::DelItemDelContent(const Item & item) -{ - PGresult * r = 0; - - try - { - query.Clear(); - query << R("delete from core.content where id=") - << item.content_id - << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_COMMAND_OK); - - long rows = AffectedRows(r); - - if( rows > 1 ) - log << log1 << "Db: more than one content were deleted" << logend; - else - if( rows == 0 ) - log << log1 << "Db: no content has been deleted" << logend; - - } - catch(const Error &) - { - } - - ClearResult(r); -} - - - - -Error Db::DelItemCountContents(const Item & item, long & contents) -{ - Error result = WINIX_ERR_OK; - PGresult * r = 0; - - try - { - query.Clear(); - query << R("select count('id') from core.item where content_id=") - << item.content_id - << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - contents = AssertValueLong(r, 0, 0); + log << log2 << "Db: deleted " << AffectedRows(r) << " from core.item" << logend; } catch(const Error & e) { @@ -1269,16 +1225,70 @@ return result; -bool Db::DelItem(const Item & item) + +Error Db::DelItemDelContent(const Item & item) { -long contents; + PGresult * r = 0; + Error result = WINIX_ERR_OK; - Error result = DelItemCountContents(item, contents); + try + { + result = DecrementContentRef(item.content_id); - if( result == WINIX_ERR_OK && contents == 1 ) - DelItemDelContent(item); - -return DelItemDelItem(item); + if( result == WINIX_ERR_OK ) + { + query.Clear(); + query << R("delete from core.content where ref=0 and id=") + << item.content_id + << R(";"); + + r = AssertQuery(query); + AssertResult(r, PGRES_COMMAND_OK); + + log << log2 << "Db: deleted " << AffectedRows(r) << " rows from core.content" << logend; + } + } + catch(const Error & e) + { + result = e; + } + + ClearResult(r); + +return result; +} + + + + + + +Error Db::DelItem(const Item & item) +{ +Error result = WINIX_ERR_NO_ITEM; + + if( item.type == Item::file ) + { + BeginTrans(); + result = DelItemDelContent(item); + + if( result == WINIX_ERR_OK ) + result = DelItemDelItem(item); + + result = EndTrans(result); + } + else + if( item.type == Item::symlink ) + { + result = DelItemDelItem(item); + } + else + if( item.type == Item::dir ) + { + result = DelDirById(item.id); + } + +return result; } @@ -1298,7 +1308,7 @@ void Db::GetDirs(DirContainer & dir_tab) r = AssertQuery(query); AssertResult(r, PGRES_TUPLES_OK); - Item item; // !! wrzucic jako skladowa klasy? a tutaj tylko dac item.clear()? + dir_temp.Clear(); int rows = Rows(r); DbItemColumns col; @@ -1306,8 +1316,8 @@ void Db::GetDirs(DirContainer & dir_tab) for(int i = 0 ; i & user_tab) u.email = AssertValueWide(r, i, cemail); u.notify = AssertValueInt(r, i, cnotify); - log << log1 << "Db: get user: id:" << u.id << ", name:" << u.name << ", super_user:" << u.super_user << logend; + log << log2 << "Db: user: id:" << u.id << ", name:" << u.name << ", super_user:" << u.super_user << logend; iter = user_tab.PushBack( u ); @@ -1438,262 +1448,3 @@ void Db::GetGroups(UGContainer & group_tab) } - - -/* - threads -*/ - - -Error Db::GetThreadByDirId(long dir_id, Thread & thread) -{ - PGresult * r = 0; - Error status = WINIX_ERR_OK; - - try - { - query.Clear(); - query << R("select thread.id, thread.parent_id, thread.dir_id, thread.closed, thread.items, " - "thread.last_item, item.date_modification, item.user_id " - "from core.thread left join core.item on thread.last_item = item.id " - "where thread.dir_id = ") << dir_id << R(";"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - int rows = Rows(r); - - if( rows > 1 ) - log << log1 << "Db: there is more than one thread with dir_id: " << dir_id << logend; - else - if( rows == 0 ) - throw Error(WINIX_ERR_NO_THREAD); - - int cid = AssertColumn(r, "id"); - int cparent_id = AssertColumn(r, "parent_id"); - int cdir_id = AssertColumn(r, "dir_id"); - int cclosed = AssertColumn(r, "closed"); - int citems = AssertColumn(r, "items"); - int clast_item = AssertColumn(r, "last_item"); - - int cdate_modification = PQfnumber(r, "date_modification"); // !! tych kolumn może nie być? czemu PQfnumber a nie AssertColumn? - int cuser_id = PQfnumber(r, "user_id"); - - thread.id = AssertValueLong(r, 0, cid); - thread.parent_id = AssertValueLong(r, 0, cparent_id); - thread.dir_id = AssertValueLong(r, 0, cdir_id); - thread.closed = AssertValueLong(r, 0, cclosed) == 0 ? false : true; - thread.items = AssertValueLong(r, 0, citems); - thread.last_item.id = AssertValueLong(r, 0, clast_item); - thread.last_item.date_modification = AssertValueTm(r, 0, cdate_modification); - thread.last_item.user_id = AssertValueLong(r, 0, cuser_id); - } - catch(const Error & e) - { - status = e; - } - - ClearResult(r); - -return status; -} - - - -Error Db::GetThreads(long parent_id, std::vector & thread_tab) -{ - PGresult * r = 0; - Error status = WINIX_ERR_OK; - - try - { - query.Clear(); - query << R("select thread.id, thread.parent_id, thread.dir_id, thread.closed, " - "thread.items, thread.last_item, item.date_modification, item.user_id, item.guest_name " - "from core.thread left join core.item on thread.last_item = item.id " - "where thread.parent_id = ") << parent_id << R(" order by date_modification asc;"); - - r = AssertQuery(query); - AssertResult(r, PGRES_TUPLES_OK); - - int rows = Rows(r); - Thread thread; - - int cid = AssertColumn(r, "id"); - int cparent_id = AssertColumn(r, "parent_id"); - int cdir_id = AssertColumn(r, "dir_id"); - int cclosed = AssertColumn(r, "closed"); - int citems = AssertColumn(r, "items"); - int clast_item = AssertColumn(r, "last_item"); - int cdate_modification = PQfnumber(r, "date_modification"); // !! czemu tutaj jest pqfnumber zamiast assertcolumn? - int cuser_id = PQfnumber(r, "user_id"); - int cguest_name = PQfnumber(r, "guest_name"); - - - for(int i=0 ; i 0 ) - log << log2 << "Db: deleted " << rows << " rows from core.thread" << logend; - } - catch(const Error & e) - { - status = e; - } - - ClearResult(r); - -return status; -} - - - - diff --git a/db/db.h b/db/db.h index 6d4bae0..4b1cf19 100755 --- a/db/db.h +++ b/db/db.h @@ -48,17 +48,13 @@ public: Error AddItem(Item & item); Error EditItemById(Item & item, bool with_url = true); Error EditItemByUrl(Item & item, bool with_url = true); - void CheckAllUrlSubject(); + // !! nie zwracac zadnych kodow bledow? void GetItems(std::vector & item_tab, const DbItemQuery & item_query); void GetItems(std::vector & item_tab, const DbItemQuery & item_query); - - - // !! pobiera tylko jeden item (cos wymyslec innego z nazwa albo argumentem) - void GetItem(std::vector & item_tab, long id); - + Error GetItem(Item & item, const DbItemQuery & item_query); bool GetPriv(Item & item, long id); Error EditPrivById(Item & item, long id); @@ -70,7 +66,7 @@ public: Error EditSubjectById(Item & item, long id); - bool DelItem(const Item & item); + Error DelItem(const Item & item); void GetDirs(DirContainer & dir_tab); void GetUsers(UGContainer & user_tab); void GetGroups(UGContainer & group_tab); @@ -80,21 +76,15 @@ public: Error GetItemById(long item_id, Item & item); Error GetItem(long parent_id, const std::wstring & url, Item & item); - Error EditDefaultItem(long id, long new_default_item); + Error EditLinkItem(long id, const std::wstring & link_to, int link_redirect); Error EditTemplateItemById(long id, const std::wstring & new_html_template); long GetItemId(long parent_id, const std::wstring & url, Item::Type type); long GetFileId(long parent_id, const std::wstring & url); long GetDirId(long parent_id, const std::wstring & url); + Error AddHardLink(Item & item); - - Error AddThread(Thread & thread); - Error GetThreadByDirId(long dir_id, Thread & thread); - Error GetThreads(long parent_id, std::vector & thread_tab); - Error EditThreadAddItem(long dir_id, long item_id); - Error EditThreadRemoveItem(long dir_id); - Error RemoveThread(long dir_id); @@ -102,6 +92,7 @@ protected: DbTextStream query, query_create_url; std::wstring temp_url; + Item dir_temp; bool AddItemCreateUrlSubject(Item & item); @@ -110,18 +101,16 @@ protected: Error EditItemInItem(Item & item, bool with_url); Error EditItemInContent(Item & item); - Error EditItemGetId(Item & item); - Error EditItemGetContentId(Item & item); - - void CheckAllUrlSubjectModifyItem(Item & item); + Error EditItemGetIdsByUrl(Item & item); + long GetContentId(long item_id); PGresult * GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel = false); - bool DelItemDelItem(const Item & item); - void DelItemDelContent(const Item & item); - Error DelItemCountContents(const Item & item, long & contents); - + Error DelItemDelItem(const Item & item); + Error DelItemDelContent(const Item & item); + Error IncrementContentRef(long content_id); + Error DecrementContentRef(long content_id); }; diff --git a/db/dbbase.cpp b/db/dbbase.cpp index 372af4e..0e7399a 100755 --- a/db/dbbase.cpp +++ b/db/dbbase.cpp @@ -346,6 +346,29 @@ size_t buffer_len = sizeof(buffer) / sizeof(wchar_t); + +Error DbBase::DoCommand(const DbTextStream & command) +{ + PGresult * r = 0; + Error status = WINIX_ERR_OK; + + try + { + r = AssertQuery(command); + AssertResult(r, PGRES_COMMAND_OK); + } + catch(const Error & e) + { + status = e; + } + + ClearResult(r); + +return status; +} + + + Error DbBase::DoCommand(const char * command) { PGresult * r = 0; @@ -353,9 +376,7 @@ Error DbBase::DoCommand(const char * command) try { - bquery.Clear(); - bquery << R(command); - r = AssertQuery(bquery); + r = AssertQuery(command); AssertResult(r, PGRES_COMMAND_OK); } catch(const Error & e) @@ -391,4 +412,18 @@ Error DbBase::CommitTrans() +Error DbBase::EndTrans(Error err) +{ + if( err == WINIX_ERR_OK ) + { + err = CommitTrans(); + } + else + { + // we returned the old err code + RollbackTrans(); + } + +return err; +} diff --git a/db/dbbase.h b/db/dbbase.h index e40f759..a8af380 100755 --- a/db/dbbase.h +++ b/db/dbbase.h @@ -58,10 +58,12 @@ public: static const char * ConvertTime(const tm & t); // warning: it uses its own static buffer void CreateIdList(const std::vector & id_tab, std::wstring & list, bool add_parentheses = true); + Error DoCommand(const DbTextStream & command); Error DoCommand(const char * command); Error BeginTrans(); Error RollbackTrans(); Error CommitTrans(); + Error EndTrans(Error err); protected: diff --git a/db/dbitemcolumns.cpp b/db/dbitemcolumns.cpp index f40e733..94af9b6 100755 --- a/db/dbitemcolumns.cpp +++ b/db/dbitemcolumns.cpp @@ -25,7 +25,8 @@ void DbItemColumns::SetColumns(PGresult * r) type = PQfnumber(r, "type"); parent_id = PQfnumber(r, "parent_id"); content_id = PQfnumber(r, "content_id"); - default_item = PQfnumber(r, "default_item"); + link_to = PQfnumber(r, "link_to"); + link_redirect = PQfnumber(r, "link_redirect"); subject = PQfnumber(r, "subject"); content = PQfnumber(r, "content"); content_type = PQfnumber(r, "content_type"); @@ -36,6 +37,8 @@ void DbItemColumns::SetColumns(PGresult * r) file_fs = PQfnumber(r, "file_fs"); file_type = PQfnumber(r, "file_type"); has_thumb = PQfnumber(r, "has_thumb"); + ref = PQfnumber(r, "ref"); + modify_index = PQfnumber(r, "modify_index"); } @@ -48,21 +51,25 @@ void DbItemColumns::SetItem(PGresult * r, long row, Item & item) if( privileges != -1 ) item.privileges = DbBase::AssertValueInt(r, row, privileges); if( date_creation != -1 ) item.date_creation = DbBase::AssertValueTm(r, row, date_creation); if( date_modification != -1 ) item.date_modification = DbBase::AssertValueTm(r, row, date_modification); - if( url != -1 ) item.url = DbBase::AssertValueWide(r, row, url); if( type != -1 ) item.type = static_cast( DbBase::AssertValueInt(r, row, type) ); if( parent_id != -1 ) item.parent_id = DbBase::AssertValueLong(r, row, parent_id); if( content_id != -1 ) item.content_id = DbBase::AssertValueLong(r, row, content_id); - if( default_item != -1 ) item.default_item = DbBase::AssertValueLong(r, row, default_item); - if( subject != -1 ) item.subject = DbBase::AssertValueWide(r, row, subject); - if( content != -1 ) item.content = DbBase::AssertValueWide(r, row, content); + if( link_redirect != -1 ) item.link_redirect = DbBase::AssertValueInt(r, row, link_redirect); if( content_type != -1 ) item.content_type = static_cast( DbBase::AssertValueInt(r, row, content_type) ); - if( guest_name != -1 ) item.guest_name = DbBase::AssertValueWide(r, row, guest_name); - if( html_template != -1 ) item.html_template = DbBase::AssertValueWide(r, row, html_template); if( modification_user_id != -1 ) item.modification_user_id = DbBase::AssertValueLong(r, row, modification_user_id); - if( file_path != -1 ) item.file_path = DbBase::AssertValueWide(r, row, file_path); if( file_fs != -1 ) item.file_fs = DbBase::AssertValueInt(r, row, file_fs); if( file_type != -1 ) item.file_type = DbBase::AssertValueInt(r, row, file_type); if( has_thumb != -1 ) item.has_thumb = DbBase::AssertValueBool(r, row, has_thumb); + if( ref != -1 ) item.ref = DbBase::AssertValueInt(r, row, ref); + if( modify_index != -1 ) item.modify_index = DbBase::AssertValueInt(r, row, modify_index); + + if( url != -1 ) DbBase::AssertValueWide(r, row, url, item.url); + if( content != -1 ) DbBase::AssertValueWide(r, row, content, item.content); + if( subject != -1 ) DbBase::AssertValueWide(r, row, subject, item.subject); + if( file_path != -1 ) DbBase::AssertValueWide(r, row, file_path, item.file_path); + if( link_to != -1 ) DbBase::AssertValueWide(r, row, link_to, item.link_to); + if( guest_name != -1 ) DbBase::AssertValueWide(r, row, guest_name, item.guest_name); + if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template); } diff --git a/db/dbitemcolumns.h b/db/dbitemcolumns.h index 36c4d32..4486ad2 100755 --- a/db/dbitemcolumns.h +++ b/db/dbitemcolumns.h @@ -29,7 +29,8 @@ struct DbItemColumns int type; int parent_id; int content_id; - int default_item; + int link_to; + int link_redirect; int subject; int content; int content_type; @@ -40,6 +41,8 @@ struct DbItemColumns int file_fs; int file_type; int has_thumb; + int ref; + int modify_index; void SetColumns(PGresult * r); void SetItem(PGresult * r, long row, Item & item); diff --git a/db/dbitemquery.cpp b/db/dbitemquery.cpp index ab6ead9..4ba16a0 100755 --- a/db/dbitemquery.cpp +++ b/db/dbitemquery.cpp @@ -12,10 +12,10 @@ + DbItemQuery::DbItemQuery() { sort_asc = true; - file_type_equal = true; SetAll(true, false); @@ -24,6 +24,9 @@ DbItemQuery::DbItemQuery() type = Item::none; file_type = WINIX_ITEM_FILETYPE_NONE; + type_equal = true; + file_type_equal = true; + limit = 0; // limit and offset not used by default offset = 0; } @@ -42,7 +45,7 @@ void DbItemQuery::SetAllSel(bool sel) sel_content = sel; sel_url = sel; sel_type = sel; - sel_default_item = sel; + sel_link = sel; sel_file = sel; sel_html_template = sel; } @@ -83,10 +86,11 @@ void DbItemQuery::WhereParentId(long parent_id_) -void DbItemQuery::WhereType(Item::Type type_) +void DbItemQuery::WhereType(Item::Type type_, bool equal) { where_type = true; type = type_; + type_equal = equal; } diff --git a/db/dbitemquery.h b/db/dbitemquery.h index bbe9c78..09563a1 100755 --- a/db/dbitemquery.h +++ b/db/dbitemquery.h @@ -18,7 +18,7 @@ struct DbItemQuery { - // id is selected always + // id and content_id is selected always bool sel_parent_id; // parent_id bool sel_user_id; // user_id, modification_user_id bool sel_group_id; // group_id @@ -26,10 +26,10 @@ struct DbItemQuery bool sel_privileges; // privileges bool sel_date; // date_creation, date_modification bool sel_subject; // subject - bool sel_content; // content, content_type, (content_id) + bool sel_content; // content, content_type, ref, modify_index bool sel_url; // url bool sel_type; // type (dir, file, none) - bool sel_default_item; // default_item + bool sel_link; // link_to, link_redirect bool sel_file; // file_path, file_fs, file_type, has_thumb bool sel_html_template; // template @@ -41,6 +41,7 @@ struct DbItemQuery long id; // if where_id is true long parent_id; // if where_parent_id is true Item::Type type; + bool type_equal; int file_type; bool file_type_equal; // if true means file_type should be equal bool sort_asc; @@ -56,7 +57,7 @@ struct DbItemQuery void WhereId(long id_); void WhereParentId(long parent_id_); - void WhereType(Item::Type type_); + void WhereType(Item::Type type_, bool equal = true); void WhereFileType(int file_t, bool equal = true); void Limit(long l); // setting 0 turns off diff --git a/functions/Makefile.dep b/functions/Makefile.dep index c919d12..1863c92 100755 --- a/functions/Makefile.dep +++ b/functions/Makefile.dep @@ -16,18 +16,18 @@ adduser.o: ../core/confparser.h ../templates/misc.h adduser.o: ../templates/localefilter.h ../templates/locale.h adduser.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h adduser.o: ../../ezc/src/pattern.h functions.h functionparser.h cat.h chmod.h -adduser.o: privchanger.h chown.h ckeditor.h cp.h createthread.h default.h -adduser.o: download.h emacs.h last.h login.h logout.h ls.h mkdir.h mv.h -adduser.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -adduser.o: subject.h funthread.h template.h tinymce.h uname.h upload.h -adduser.o: uptime.h who.h vim.h ../core/htmlfilter.h -adduser.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -adduser.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -adduser.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -adduser.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -adduser.o: ../core/mountparser.h ../core/users.h ../core/groups.h -adduser.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -adduser.o: ../core/basethread.h ../core/synchro.h +adduser.o: privchanger.h chown.h ckeditor.h cp.h createthread.h +adduser.o: ../functions/functionbase.h default.h download.h emacs.h last.h +adduser.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h +adduser.o: rm.h run.h specialdefault.h stat.h subject.h funthread.h +adduser.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +adduser.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +adduser.o: ../templates/htmltextstream.h ../notify/notifythread.h +adduser.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +adduser.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +adduser.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +adduser.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +adduser.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h cat.o: cat.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h cat.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h cat.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -43,17 +43,17 @@ cat.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h cat.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h cat.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h cat.o: functions.h functionparser.h adduser.h chmod.h privchanger.h chown.h -cat.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -cat.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -cat.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -cat.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -cat.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -cat.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -cat.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -cat.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -cat.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -cat.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -cat.o: ../core/synchro.h +cat.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +cat.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +cat.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +cat.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +cat.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +cat.o: ../templates/htmltextstream.h ../notify/notifythread.h +cat.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +cat.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +cat.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +cat.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +cat.o: ../core/basethread.h ../core/synchro.h chmod.o: chmod.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h chmod.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h chmod.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -70,17 +70,17 @@ chmod.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h chmod.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h chmod.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h chmod.o: functionparser.h adduser.h cat.h chown.h privchanger.h ckeditor.h -chmod.o: cp.h createthread.h default.h download.h emacs.h last.h login.h -chmod.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -chmod.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -chmod.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -chmod.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -chmod.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -chmod.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -chmod.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -chmod.o: ../core/mountparser.h ../core/users.h ../core/groups.h -chmod.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -chmod.o: ../core/basethread.h ../core/synchro.h +chmod.o: cp.h createthread.h ../functions/functionbase.h default.h download.h +chmod.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h +chmod.o: reload.h rm.h run.h specialdefault.h stat.h subject.h funthread.h +chmod.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +chmod.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +chmod.o: ../templates/htmltextstream.h ../notify/notifythread.h +chmod.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +chmod.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +chmod.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +chmod.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +chmod.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h chown.o: chown.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h chown.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h chown.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -97,17 +97,17 @@ chown.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h chown.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h chown.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h chown.o: functionparser.h adduser.h cat.h chmod.h privchanger.h ckeditor.h -chown.o: cp.h createthread.h default.h download.h emacs.h last.h login.h -chown.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -chown.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -chown.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -chown.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -chown.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -chown.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -chown.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -chown.o: ../core/mountparser.h ../core/users.h ../core/groups.h -chown.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -chown.o: ../core/basethread.h ../core/synchro.h +chown.o: cp.h createthread.h ../functions/functionbase.h default.h download.h +chown.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h +chown.o: reload.h rm.h run.h specialdefault.h stat.h subject.h funthread.h +chown.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +chown.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +chown.o: ../templates/htmltextstream.h ../notify/notifythread.h +chown.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +chown.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +chown.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +chown.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +chown.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h ckeditor.o: ckeditor.h functionbase.h ../core/item.h ../db/db.h ckeditor.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ckeditor.o: ../core/textstream.h ../core/misc.h ../core/item.h @@ -126,13 +126,13 @@ ckeditor.o: ../templates/localefilter.h ../templates/locale.h ckeditor.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ckeditor.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h ckeditor.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -ckeditor.o: cp.h createthread.h default.h download.h emacs.h last.h login.h -ckeditor.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -ckeditor.o: specialdefault.h stat.h subject.h funthread.h template.h -ckeditor.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -ckeditor.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -ckeditor.o: ../templates/htmltextstream.h ../notify/notifythread.h -ckeditor.o: ../core/basethread.h ../core/synchro.h +ckeditor.o: cp.h createthread.h ../functions/functionbase.h default.h +ckeditor.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +ckeditor.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h +ckeditor.o: subject.h funthread.h template.h tinymce.h uname.h upload.h +ckeditor.o: uptime.h who.h vim.h ../core/htmlfilter.h +ckeditor.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +ckeditor.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h ckeditor.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h ckeditor.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h ckeditor.o: ../core/mountparser.h ../core/users.h ../core/groups.h @@ -153,49 +153,48 @@ cp.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h cp.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h cp.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h cp.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -cp.o: chown.h ckeditor.h createthread.h default.h download.h emacs.h last.h -cp.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -cp.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -cp.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -cp.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -cp.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -cp.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -cp.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -cp.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -cp.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -cp.o: ../core/synchro.h ../core/misc.h -createthread.o: createthread.h functionbase.h ../core/item.h ../db/db.h -createthread.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h -createthread.o: ../core/textstream.h ../core/misc.h ../core/item.h -createthread.o: ../core/error.h ../core/log.h ../core/textstream.h -createthread.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h -createthread.o: ../core/group.h ../core/thread.h ../core/dircontainer.h -createthread.o: ../core/ugcontainer.h ../core/request.h -createthread.o: ../core/requesttypes.h ../core/session.h ../core/error.h -createthread.o: ../core/user.h ../core/plugindata.h ../core/rebus.h -createthread.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h -createthread.o: ../templates/htmltextstream.h ../core/config.h -createthread.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h -createthread.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h -createthread.o: ../templates/locale.h ../core/confparser.h -createthread.o: ../templates/misc.h ../templates/localefilter.h -createthread.o: ../templates/locale.h ../../ezc/src/ezc.h -createthread.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h -createthread.o: ../../ezc/src/pattern.h functions.h functionparser.h -createthread.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h -createthread.o: default.h download.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 -createthread.o: specialdefault.h stat.h subject.h funthread.h template.h -createthread.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -createthread.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -createthread.o: ../templates/htmltextstream.h ../notify/notifythread.h -createthread.o: ../core/basethread.h ../core/synchro.h -createthread.o: ../notify/templatesnotify.h ../core/users.h +cp.o: chown.h ckeditor.h createthread.h ../functions/functionbase.h default.h +cp.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +cp.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +cp.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +cp.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +cp.o: ../templates/htmltextstream.h ../notify/notifythread.h +cp.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +cp.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +cp.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +cp.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +cp.o: ../core/basethread.h ../core/synchro.h ../core/misc.h +createthread.o: createthread.h ../functions/functionbase.h functions.h +createthread.o: functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h +createthread.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h +createthread.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h +createthread.o: ../core/textstream.h ../db/dbitemquery.h +createthread.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h +createthread.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h +createthread.o: ../core/request.h ../core/requesttypes.h ../core/session.h +createthread.o: ../core/error.h ../core/user.h ../core/plugindata.h +createthread.o: ../core/rebus.h ../core/config.h ../core/confparser.h +createthread.o: ../core/htmlfilter.h ../templates/htmltextstream.h +createthread.o: ../core/config.h ../core/system.h ../core/dirs.h +createthread.o: ../core/dircontainer.h ../core/request.h ../notify/notify.h +createthread.o: ../notify/notifypool.h ../templates/locale.h +createthread.o: ../core/confparser.h ../templates/misc.h +createthread.o: ../templates/localefilter.h ../templates/locale.h +createthread.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h +createthread.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h +createthread.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +createthread.o: ../notify/notifythread.h ../core/basethread.h +createthread.o: ../core/synchro.h ../notify/templatesnotify.h ../core/users.h createthread.o: ../core/ugcontainer.h ../core/lastcontainer.h createthread.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h createthread.o: ../core/users.h ../core/groups.h ../core/group.h createthread.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -createthread.o: ../core/synchro.h +createthread.o: ../core/synchro.h functionparser.h adduser.h cat.h chmod.h +createthread.o: privchanger.h chown.h ckeditor.h cp.h default.h download.h +createthread.o: emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h +createthread.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +createthread.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h +createthread.o: who.h vim.h ../core/htmlfilter.h default.o: default.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h default.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h default.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -213,10 +212,10 @@ default.o: ../templates/localefilter.h ../templates/locale.h default.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h default.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h default.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -default.o: download.h emacs.h last.h login.h logout.h ls.h mkdir.h mv.h -default.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -default.o: subject.h funthread.h template.h tinymce.h uname.h upload.h -default.o: uptime.h who.h vim.h ../core/htmlfilter.h +default.o: ../functions/functionbase.h download.h emacs.h last.h login.h +default.o: logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h +default.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h +default.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h default.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h default.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h default.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h @@ -242,13 +241,13 @@ download.o: ../templates/localefilter.h ../templates/locale.h download.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h download.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h download.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -download.o: ckeditor.h cp.h createthread.h default.h emacs.h last.h login.h -download.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -download.o: specialdefault.h stat.h subject.h funthread.h template.h -download.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -download.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -download.o: ../templates/htmltextstream.h ../notify/notifythread.h -download.o: ../core/basethread.h ../core/synchro.h +download.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h +download.o: default.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +download.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h +download.o: subject.h funthread.h template.h tinymce.h uname.h upload.h +download.o: uptime.h who.h vim.h ../core/htmlfilter.h +download.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +download.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h download.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h download.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h download.o: ../core/mountparser.h ../core/users.h ../core/groups.h @@ -270,20 +269,20 @@ emacs.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h emacs.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h emacs.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h emacs.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -emacs.o: ckeditor.h cp.h createthread.h default.h download.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: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -emacs.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -emacs.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -emacs.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -emacs.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -emacs.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -emacs.o: ../core/mountparser.h ../core/users.h ../core/groups.h -emacs.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -emacs.o: ../core/basethread.h ../core/synchro.h ../templates/templates.h -emacs.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h -emacs.o: ../core/httpsimpleparser.h ../core/log.h -emacs.o: ../templates/indexpatterns.h ../core/sessionmanager.h +emacs.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +emacs.o: download.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h +emacs.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +emacs.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +emacs.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +emacs.o: ../templates/htmltextstream.h ../notify/notifythread.h +emacs.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +emacs.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +emacs.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +emacs.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +emacs.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h +emacs.o: ../templates/templates.h ../templates/patterncacher.h +emacs.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +emacs.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h emacs.o: ../core/sessioncontainer.h ../core/system.h functionbase.o: functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h functionbase.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h @@ -303,9 +302,10 @@ functionbase.o: ../templates/localefilter.h ../templates/locale.h functionbase.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h functionbase.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h functionbase.o: functionparser.h adduser.h cat.h chmod.h privchanger.h -functionbase.o: chown.h ckeditor.h cp.h createthread.h default.h download.h -functionbase.o: emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h -functionbase.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +functionbase.o: chown.h ckeditor.h cp.h createthread.h +functionbase.o: ../functions/functionbase.h default.h download.h emacs.h +functionbase.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h +functionbase.o: reload.h rm.h run.h specialdefault.h stat.h subject.h functionbase.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h functionbase.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h functionbase.o: ../templates/htmltextstream.h ../notify/notifythread.h @@ -335,8 +335,9 @@ functionparser.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h functionparser.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functionparser.o: functions.h functionbase.h ../core/config.h functionparser.o: ../core/synchro.h adduser.h cat.h chmod.h privchanger.h -functionparser.o: chown.h ckeditor.h cp.h createthread.h default.h download.h -functionparser.o: emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h +functionparser.o: chown.h ckeditor.h cp.h createthread.h +functionparser.o: ../functions/functionbase.h default.h download.h emacs.h +functionparser.o: last.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h functionparser.o: priv.h reload.h rm.h run.h specialdefault.h stat.h functionparser.o: subject.h funthread.h template.h tinymce.h uname.h upload.h functionparser.o: uptime.h who.h vim.h ../core/htmlfilter.h @@ -373,47 +374,20 @@ functions.o: ../core/mount.h ../core/mountparser.h ../core/users.h functions.o: ../core/groups.h ../core/group.h ../core/loadavg.h functions.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h functions.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -functions.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h -functions.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h -functions.o: rm.h run.h specialdefault.h stat.h subject.h funthread.h -functions.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h -functions.o: ../core/htmlfilter.h ../core/log.h ../core/misc.h -functions.o: ../core/plugin.h ../core/pluginmsg.h ../core/system.h -functions.o: ../core/sessionmanager.h ../core/sessioncontainer.h -functions.o: ../functions/functions.h ../templates/templates.h -functions.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h -functions.o: ../core/httpsimpleparser.h ../core/log.h -functions.o: ../templates/indexpatterns.h ../core/sessionmanager.h -funthread.o: ../core/misc.h funthread.h functionbase.h ../core/item.h -funthread.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h -funthread.o: ../core/textstream.h ../core/misc.h ../core/item.h -funthread.o: ../core/error.h ../core/log.h ../core/textstream.h -funthread.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h -funthread.o: ../core/group.h ../core/thread.h ../core/dircontainer.h -funthread.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h -funthread.o: ../core/session.h ../core/error.h ../core/user.h -funthread.o: ../core/plugindata.h ../core/rebus.h ../core/config.h -funthread.o: ../core/confparser.h ../core/htmlfilter.h -funthread.o: ../templates/htmltextstream.h ../core/config.h ../core/system.h -funthread.o: ../core/dirs.h ../core/dircontainer.h ../core/request.h -funthread.o: ../notify/notify.h ../notify/notifypool.h ../templates/locale.h -funthread.o: ../core/confparser.h ../templates/misc.h -funthread.o: ../templates/localefilter.h ../templates/locale.h -funthread.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h -funthread.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h -funthread.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -funthread.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h -funthread.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h -funthread.o: rm.h run.h specialdefault.h stat.h subject.h template.h -funthread.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -funthread.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -funthread.o: ../templates/htmltextstream.h ../notify/notifythread.h -funthread.o: ../core/basethread.h ../core/synchro.h -funthread.o: ../notify/templatesnotify.h ../core/users.h -funthread.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/mounts.h -funthread.o: ../core/mount.h ../core/mountparser.h ../core/users.h -funthread.o: ../core/groups.h ../core/group.h ../core/loadavg.h -funthread.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h +functions.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h +functions.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h +functions.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h +functions.o: stat.h subject.h funthread.h template.h tinymce.h uname.h +functions.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h ../core/log.h +functions.o: ../core/misc.h ../core/plugin.h ../core/pluginmsg.h +functions.o: ../core/system.h ../core/sessionmanager.h +functions.o: ../core/sessioncontainer.h ../functions/functions.h +functions.o: ../templates/templates.h ../templates/patterncacher.h +functions.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +functions.o: ../core/log.h ../templates/indexpatterns.h +functions.o: ../core/sessionmanager.h +funthread.o: ../core/misc.h funthread.h ../functions/functionbase.h +funthread.o: ../core/thread.h last.o: last.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h last.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h last.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -430,17 +404,44 @@ last.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h last.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h last.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h last.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -last.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h login.h -last.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -last.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -last.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -last.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -last.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -last.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -last.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -last.o: ../core/mountparser.h ../core/users.h ../core/groups.h -last.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -last.o: ../core/basethread.h ../core/synchro.h +last.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +last.o: download.h emacs.h login.h logout.h ln.h ls.h mkdir.h mv.h node.h +last.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +last.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +last.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +last.o: ../templates/htmltextstream.h ../notify/notifythread.h +last.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +last.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +last.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +last.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +last.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h +ln.o: ln.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h +ln.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h +ln.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h +ln.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h +ln.o: ../core/group.h ../core/thread.h ../core/dircontainer.h +ln.o: ../core/ugcontainer.h ../core/request.h ../core/requesttypes.h +ln.o: ../core/session.h ../core/error.h ../core/user.h ../core/plugindata.h +ln.o: ../core/rebus.h ../core/config.h ../core/confparser.h +ln.o: ../core/htmlfilter.h ../templates/htmltextstream.h ../core/config.h +ln.o: ../core/system.h ../core/dirs.h ../core/dircontainer.h +ln.o: ../core/request.h ../notify/notify.h ../notify/notifypool.h +ln.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h +ln.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h +ln.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h +ln.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h +ln.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +ln.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h mv.h +ln.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +ln.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +ln.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +ln.o: ../templates/htmltextstream.h ../notify/notifythread.h +ln.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +ln.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +ln.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +ln.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +ln.o: ../core/basethread.h ../core/synchro.h ../core/misc.h +ln.o: ../functions/functions.h login.o: login.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h login.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h login.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -457,17 +458,17 @@ login.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h login.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h login.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h login.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -login.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -login.o: logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -login.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -login.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -login.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -login.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -login.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -login.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -login.o: ../core/mountparser.h ../core/users.h ../core/groups.h -login.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -login.o: ../core/basethread.h ../core/synchro.h +login.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +login.o: download.h emacs.h last.h logout.h ln.h ls.h mkdir.h mv.h node.h +login.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +login.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +login.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +login.o: ../templates/htmltextstream.h ../notify/notifythread.h +login.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +login.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +login.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +login.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +login.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h logout.o: logout.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h logout.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h logout.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -485,16 +486,17 @@ logout.o: ../templates/localefilter.h ../templates/locale.h logout.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h logout.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h logout.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -logout.o: default.h download.h emacs.h last.h login.h ls.h mkdir.h mv.h -logout.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h -logout.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h -logout.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h -logout.o: ../templates/htmltextstream.h ../notify/notifythread.h -logout.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h -logout.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h -logout.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h -logout.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h -logout.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h +logout.o: ../functions/functionbase.h default.h download.h emacs.h last.h +logout.o: login.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h +logout.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h +logout.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h +logout.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +logout.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h +logout.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h +logout.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h +logout.o: ../core/mountparser.h ../core/users.h ../core/groups.h +logout.o: ../core/group.h ../core/loadavg.h ../core/thumb.h +logout.o: ../core/basethread.h ../core/synchro.h ls.o: ls.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h ls.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h ls.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h @@ -510,17 +512,17 @@ ls.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h ls.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h ls.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h ls.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -ls.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -ls.o: last.h login.h logout.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -ls.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -ls.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -ls.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -ls.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -ls.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -ls.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -ls.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -ls.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -ls.o: ../core/synchro.h +ls.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +ls.o: default.h download.h emacs.h last.h login.h logout.h ln.h mkdir.h mv.h +ls.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +ls.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +ls.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +ls.o: ../templates/htmltextstream.h ../notify/notifythread.h +ls.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +ls.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +ls.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +ls.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +ls.o: ../core/basethread.h ../core/synchro.h mkdir.o: mkdir.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h mkdir.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h mkdir.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -537,17 +539,17 @@ mkdir.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h mkdir.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h mkdir.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h mkdir.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -mkdir.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -mkdir.o: login.h logout.h ls.h mv.h node.h priv.h reload.h rm.h run.h -mkdir.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -mkdir.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -mkdir.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -mkdir.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -mkdir.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -mkdir.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -mkdir.o: ../core/mountparser.h ../core/users.h ../core/groups.h -mkdir.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -mkdir.o: ../core/basethread.h ../core/synchro.h +mkdir.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +mkdir.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mv.h node.h +mkdir.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +mkdir.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +mkdir.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +mkdir.o: ../templates/htmltextstream.h ../notify/notifythread.h +mkdir.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +mkdir.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +mkdir.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +mkdir.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +mkdir.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h mv.o: mv.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h mv.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h mv.o: ../core/item.h ../core/error.h ../core/log.h ../core/textstream.h @@ -563,17 +565,17 @@ mv.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h mv.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h mv.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h mv.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -mv.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -mv.o: last.h login.h logout.h ls.h mkdir.h node.h priv.h reload.h rm.h run.h -mv.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -mv.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -mv.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -mv.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -mv.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -mv.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -mv.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -mv.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -mv.o: ../core/synchro.h +mv.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +mv.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +mv.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +mv.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +mv.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +mv.o: ../templates/htmltextstream.h ../notify/notifythread.h +mv.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +mv.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +mv.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +mv.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +mv.o: ../core/basethread.h ../core/synchro.h node.o: node.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h node.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h node.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -590,17 +592,17 @@ node.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h node.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h node.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h node.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -node.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -node.o: login.h logout.h ls.h mkdir.h mv.h priv.h reload.h rm.h run.h -node.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -node.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -node.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -node.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -node.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -node.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -node.o: ../core/mountparser.h ../core/users.h ../core/groups.h -node.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -node.o: ../core/basethread.h ../core/synchro.h +node.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +node.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +node.o: priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +node.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +node.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +node.o: ../templates/htmltextstream.h ../notify/notifythread.h +node.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +node.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +node.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +node.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +node.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h priv.o: priv.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h priv.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h priv.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -617,17 +619,17 @@ priv.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h priv.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h priv.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h priv.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -priv.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -priv.o: login.h logout.h ls.h mkdir.h mv.h node.h reload.h rm.h run.h -priv.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -priv.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -priv.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -priv.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -priv.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -priv.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -priv.o: ../core/mountparser.h ../core/users.h ../core/groups.h -priv.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -priv.o: ../core/basethread.h ../core/synchro.h +priv.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +priv.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +priv.o: node.h reload.h rm.h run.h specialdefault.h stat.h subject.h +priv.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +priv.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +priv.o: ../templates/htmltextstream.h ../notify/notifythread.h +priv.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +priv.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +priv.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +priv.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +priv.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h privchanger.o: privchanger.h ../core/request.h ../core/requesttypes.h privchanger.o: ../core/session.h ../core/item.h ../core/error.h privchanger.o: ../core/user.h ../core/plugindata.h ../core/rebus.h @@ -647,14 +649,14 @@ privchanger.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h privchanger.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h privchanger.o: functionbase.h ../core/config.h ../core/synchro.h privchanger.o: functionparser.h adduser.h cat.h chmod.h chown.h ckeditor.h -privchanger.o: cp.h createthread.h default.h download.h emacs.h last.h -privchanger.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h -privchanger.o: run.h specialdefault.h stat.h subject.h funthread.h template.h -privchanger.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -privchanger.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -privchanger.o: ../templates/htmltextstream.h ../notify/notifythread.h -privchanger.o: ../core/basethread.h ../core/synchro.h -privchanger.o: ../notify/templatesnotify.h ../core/users.h +privchanger.o: cp.h createthread.h ../functions/functionbase.h default.h +privchanger.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +privchanger.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h +privchanger.o: subject.h funthread.h template.h tinymce.h uname.h upload.h +privchanger.o: uptime.h who.h vim.h ../core/htmlfilter.h +privchanger.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +privchanger.o: ../notify/notifythread.h ../core/basethread.h +privchanger.o: ../core/synchro.h ../notify/templatesnotify.h ../core/users.h privchanger.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/mounts.h privchanger.o: ../core/mount.h ../core/mountparser.h ../core/users.h privchanger.o: ../core/groups.h ../core/group.h ../core/loadavg.h @@ -676,19 +678,20 @@ reload.o: ../templates/localefilter.h ../templates/locale.h reload.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h reload.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h reload.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -reload.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h -reload.o: mv.h node.h priv.h rm.h run.h specialdefault.h stat.h subject.h -reload.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h -reload.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h -reload.o: ../templates/htmltextstream.h ../notify/notifythread.h -reload.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h -reload.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h -reload.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h -reload.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h -reload.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h -reload.o: ../templates/templates.h ../templates/patterncacher.h -reload.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h -reload.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h +reload.o: ../functions/functionbase.h default.h download.h emacs.h last.h +reload.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h rm.h run.h +reload.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h +reload.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h +reload.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +reload.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h +reload.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h +reload.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h +reload.o: ../core/mountparser.h ../core/users.h ../core/groups.h +reload.o: ../core/group.h ../core/loadavg.h ../core/thumb.h +reload.o: ../core/basethread.h ../core/synchro.h ../templates/templates.h +reload.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h +reload.o: ../core/httpsimpleparser.h ../core/log.h +reload.o: ../templates/indexpatterns.h ../core/sessionmanager.h reload.o: ../core/sessioncontainer.h ../core/system.h rm.o: rm.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h rm.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h ../core/misc.h @@ -705,22 +708,23 @@ rm.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h rm.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h rm.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h rm.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -rm.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -rm.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h run.h -rm.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -rm.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -rm.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -rm.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -rm.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -rm.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -rm.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -rm.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -rm.o: ../core/synchro.h ../core/plugin.h ../core/pluginmsg.h ../core/system.h -rm.o: ../core/sessionmanager.h ../core/sessioncontainer.h -rm.o: ../functions/functions.h ../templates/templates.h -rm.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h -rm.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h -rm.o: ../core/sessionmanager.h ../core/misc.h +rm.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +rm.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +rm.o: mv.h node.h priv.h reload.h run.h specialdefault.h stat.h subject.h +rm.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +rm.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +rm.o: ../templates/htmltextstream.h ../notify/notifythread.h +rm.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +rm.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +rm.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +rm.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +rm.o: ../core/basethread.h ../core/synchro.h ../core/plugin.h +rm.o: ../core/pluginmsg.h ../core/system.h ../core/sessionmanager.h +rm.o: ../core/sessioncontainer.h ../functions/functions.h +rm.o: ../templates/templates.h ../templates/patterncacher.h +rm.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +rm.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h +rm.o: ../core/misc.h run.o: run.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h run.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h run.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -736,17 +740,17 @@ run.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h run.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h run.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h run.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -run.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -run.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h -run.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -run.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h -run.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -run.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -run.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -run.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -run.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -run.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -run.o: ../core/synchro.h +run.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +run.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +run.o: mv.h node.h priv.h reload.h rm.h specialdefault.h stat.h subject.h +run.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h vim.h +run.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +run.o: ../templates/htmltextstream.h ../notify/notifythread.h +run.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +run.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +run.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +run.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +run.o: ../core/basethread.h ../core/synchro.h specialdefault.o: specialdefault.h functionbase.h ../core/item.h ../db/db.h specialdefault.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h specialdefault.o: ../core/textstream.h ../core/misc.h ../core/item.h @@ -766,19 +770,19 @@ specialdefault.o: ../templates/locale.h ../../ezc/src/ezc.h specialdefault.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h specialdefault.o: ../../ezc/src/pattern.h functions.h functionparser.h specialdefault.o: adduser.h cat.h chmod.h privchanger.h chown.h ckeditor.h -specialdefault.o: cp.h createthread.h default.h download.h emacs.h last.h -specialdefault.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h -specialdefault.o: rm.h run.h stat.h subject.h funthread.h template.h -specialdefault.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -specialdefault.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h -specialdefault.o: ../templates/htmltextstream.h ../notify/notifythread.h +specialdefault.o: cp.h createthread.h ../functions/functionbase.h default.h +specialdefault.o: download.h emacs.h last.h login.h logout.h ln.h ls.h +specialdefault.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h stat.h +specialdefault.o: subject.h funthread.h template.h tinymce.h uname.h upload.h +specialdefault.o: uptime.h who.h vim.h ../core/htmlfilter.h +specialdefault.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +specialdefault.o: ../notify/notifythread.h ../core/basethread.h +specialdefault.o: ../core/synchro.h ../notify/templatesnotify.h +specialdefault.o: ../core/users.h ../core/ugcontainer.h +specialdefault.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h +specialdefault.o: ../core/mountparser.h ../core/users.h ../core/groups.h +specialdefault.o: ../core/group.h ../core/loadavg.h ../core/thumb.h specialdefault.o: ../core/basethread.h ../core/synchro.h -specialdefault.o: ../notify/templatesnotify.h ../core/users.h -specialdefault.o: ../core/ugcontainer.h ../core/lastcontainer.h -specialdefault.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h -specialdefault.o: ../core/users.h ../core/groups.h ../core/group.h -specialdefault.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -specialdefault.o: ../core/synchro.h stat.o: stat.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h stat.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h stat.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -795,17 +799,17 @@ stat.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h stat.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h stat.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h stat.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -stat.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -stat.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -stat.o: specialdefault.h subject.h funthread.h template.h tinymce.h uname.h -stat.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h -stat.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -stat.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -stat.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -stat.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -stat.o: ../core/mountparser.h ../core/users.h ../core/groups.h -stat.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -stat.o: ../core/basethread.h ../core/synchro.h +stat.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +stat.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +stat.o: node.h priv.h reload.h rm.h run.h specialdefault.h subject.h +stat.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h +stat.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +stat.o: ../templates/htmltextstream.h ../notify/notifythread.h +stat.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +stat.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +stat.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +stat.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +stat.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h subject.o: subject.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h subject.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h subject.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -823,10 +827,11 @@ subject.o: ../templates/localefilter.h ../templates/locale.h subject.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h subject.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h subject.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -subject.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h -subject.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -subject.o: funthread.h template.h tinymce.h uname.h upload.h uptime.h who.h -subject.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +subject.o: ../functions/functionbase.h default.h download.h emacs.h last.h +subject.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h +subject.o: rm.h run.h specialdefault.h stat.h funthread.h template.h +subject.o: tinymce.h uname.h upload.h uptime.h who.h vim.h +subject.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h subject.o: ../templates/htmltextstream.h ../notify/notifythread.h subject.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h subject.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h @@ -851,11 +856,11 @@ template.o: ../templates/localefilter.h ../templates/locale.h template.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h template.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h template.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -template.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h -template.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h -template.o: rm.h run.h specialdefault.h stat.h subject.h funthread.h -template.o: tinymce.h uname.h upload.h uptime.h who.h vim.h -template.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +template.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h +template.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h +template.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h specialdefault.h +template.o: stat.h subject.h funthread.h tinymce.h uname.h upload.h uptime.h +template.o: who.h vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h template.o: ../templates/htmltextstream.h ../notify/notifythread.h template.o: ../core/basethread.h ../core/synchro.h template.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h @@ -880,10 +885,11 @@ tinymce.o: ../templates/localefilter.h ../templates/locale.h tinymce.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h tinymce.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h tinymce.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -tinymce.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h -tinymce.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -tinymce.o: subject.h funthread.h template.h uname.h upload.h uptime.h who.h -tinymce.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +tinymce.o: ../functions/functionbase.h default.h download.h emacs.h last.h +tinymce.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h +tinymce.o: rm.h run.h specialdefault.h stat.h subject.h funthread.h +tinymce.o: template.h uname.h upload.h uptime.h who.h vim.h +tinymce.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h tinymce.o: ../templates/htmltextstream.h ../notify/notifythread.h tinymce.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h tinymce.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h @@ -906,17 +912,17 @@ uname.o: ../core/confparser.h ../templates/misc.h ../templates/localefilter.h uname.o: ../templates/locale.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h uname.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h functions.h uname.o: functionparser.h adduser.h cat.h chmod.h privchanger.h chown.h -uname.o: ckeditor.h cp.h createthread.h default.h download.h emacs.h last.h -uname.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h run.h -uname.o: specialdefault.h stat.h subject.h funthread.h template.h tinymce.h -uname.o: upload.h uptime.h who.h vim.h ../core/htmlfilter.h -uname.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -uname.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -uname.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -uname.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -uname.o: ../core/mountparser.h ../core/users.h ../core/groups.h -uname.o: ../core/group.h ../core/loadavg.h ../core/thumb.h -uname.o: ../core/basethread.h ../core/synchro.h +uname.o: ckeditor.h cp.h createthread.h ../functions/functionbase.h default.h +uname.o: download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h mv.h +uname.o: node.h priv.h reload.h rm.h run.h specialdefault.h stat.h subject.h +uname.o: funthread.h template.h tinymce.h upload.h uptime.h who.h vim.h +uname.o: ../core/htmlfilter.h ../../ezc/src/stringconv.h +uname.o: ../templates/htmltextstream.h ../notify/notifythread.h +uname.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +uname.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +uname.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h +uname.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h +uname.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h upload.o: upload.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h upload.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h upload.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -934,17 +940,18 @@ upload.o: ../templates/localefilter.h ../templates/locale.h upload.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h upload.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h upload.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -upload.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h -upload.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -upload.o: subject.h funthread.h template.h tinymce.h uname.h uptime.h who.h -upload.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h -upload.o: ../templates/htmltextstream.h ../notify/notifythread.h -upload.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h -upload.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h -upload.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h -upload.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h -upload.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h -upload.o: ../core/misc.h ../functions/functions.h +upload.o: ../functions/functionbase.h default.h download.h emacs.h last.h +upload.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h +upload.o: run.h specialdefault.h stat.h subject.h funthread.h template.h +upload.o: tinymce.h uname.h uptime.h who.h vim.h ../core/htmlfilter.h +upload.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +upload.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h +upload.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h +upload.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h +upload.o: ../core/mountparser.h ../core/users.h ../core/groups.h +upload.o: ../core/group.h ../core/loadavg.h ../core/thumb.h +upload.o: ../core/basethread.h ../core/synchro.h ../core/misc.h +upload.o: ../functions/functions.h uptime.o: uptime.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h uptime.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h uptime.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -962,16 +969,17 @@ uptime.o: ../templates/localefilter.h ../templates/locale.h uptime.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h uptime.o: ../../ezc/src/pattern.h functions.h functionparser.h adduser.h uptime.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h -uptime.o: default.h download.h emacs.h last.h login.h logout.h ls.h mkdir.h -uptime.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h -uptime.o: subject.h funthread.h template.h tinymce.h uname.h upload.h who.h -uptime.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h -uptime.o: ../templates/htmltextstream.h ../notify/notifythread.h -uptime.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h -uptime.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h -uptime.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h -uptime.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h -uptime.o: ../core/thumb.h ../core/basethread.h ../core/synchro.h +uptime.o: ../functions/functionbase.h default.h download.h emacs.h last.h +uptime.o: login.h logout.h ln.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h +uptime.o: run.h specialdefault.h stat.h subject.h funthread.h template.h +uptime.o: tinymce.h uname.h upload.h who.h vim.h ../core/htmlfilter.h +uptime.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h +uptime.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h +uptime.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h +uptime.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h +uptime.o: ../core/mountparser.h ../core/users.h ../core/groups.h +uptime.o: ../core/group.h ../core/loadavg.h ../core/thumb.h +uptime.o: ../core/basethread.h ../core/synchro.h vim.o: vim.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h vim.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h vim.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -987,17 +995,17 @@ vim.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h vim.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h vim.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h vim.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -vim.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -vim.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h -vim.o: run.h specialdefault.h stat.h subject.h funthread.h template.h -vim.o: tinymce.h uname.h upload.h uptime.h who.h ../core/htmlfilter.h -vim.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -vim.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -vim.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -vim.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -vim.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -vim.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -vim.o: ../core/synchro.h +vim.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +vim.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +vim.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h +vim.o: subject.h funthread.h template.h tinymce.h uname.h upload.h uptime.h +vim.o: who.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +vim.o: ../templates/htmltextstream.h ../notify/notifythread.h +vim.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +vim.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +vim.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +vim.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +vim.o: ../core/basethread.h ../core/synchro.h who.o: who.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h who.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h who.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h @@ -1013,14 +1021,14 @@ who.o: ../templates/locale.h ../core/confparser.h ../templates/misc.h who.o: ../templates/localefilter.h ../templates/locale.h ../../ezc/src/ezc.h who.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h who.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h -who.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h -who.o: last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h rm.h -who.o: run.h specialdefault.h stat.h subject.h funthread.h template.h -who.o: tinymce.h uname.h upload.h uptime.h vim.h ../core/htmlfilter.h -who.o: ../../ezc/src/stringconv.h ../templates/htmltextstream.h -who.o: ../notify/notifythread.h ../core/basethread.h ../core/synchro.h -who.o: ../notify/templatesnotify.h ../core/users.h ../core/ugcontainer.h -who.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h -who.o: ../core/mountparser.h ../core/users.h ../core/groups.h ../core/group.h -who.o: ../core/loadavg.h ../core/thumb.h ../core/basethread.h -who.o: ../core/synchro.h +who.o: chown.h ckeditor.h cp.h createthread.h ../functions/functionbase.h +who.o: default.h download.h emacs.h last.h login.h logout.h ln.h ls.h mkdir.h +who.o: mv.h node.h priv.h reload.h rm.h run.h specialdefault.h stat.h +who.o: subject.h funthread.h template.h tinymce.h uname.h upload.h uptime.h +who.o: vim.h ../core/htmlfilter.h ../../ezc/src/stringconv.h +who.o: ../templates/htmltextstream.h ../notify/notifythread.h +who.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h +who.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h +who.o: ../core/mounts.h ../core/mount.h ../core/mountparser.h ../core/users.h +who.o: ../core/groups.h ../core/group.h ../core/loadavg.h ../core/thumb.h +who.o: ../core/basethread.h ../core/synchro.h diff --git a/functions/Makefile.o.dep b/functions/Makefile.o.dep index 026c55f..c7e4d86 100755 --- a/functions/Makefile.o.dep +++ b/functions/Makefile.o.dep @@ -1 +1 @@ -o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o createthread.o default.o download.o emacs.o functionbase.o functionparser.o functions.o funthread.o last.o login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o reload.o rm.o run.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o +o = adduser.o cat.o chmod.o chown.o ckeditor.o cp.o createthread.o default.o download.o emacs.o functionbase.o functionparser.o functions.o funthread.o last.o ln.o login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o reload.o rm.o run.o specialdefault.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o diff --git a/functions/cp.cpp b/functions/cp.cpp index 407eb4c..73c0c58 100755 --- a/functions/cp.cpp +++ b/functions/cp.cpp @@ -7,7 +7,6 @@ * */ -#include #include "cp.h" #include "core/misc.h" #include "functions.h" @@ -22,11 +21,17 @@ Cp::Cp() } -bool Cp::CpCheckAccessFrom() +bool Cp::HasAccess() +{ + return CheckAccessFrom(); +} + + +bool Cp::CheckAccessFrom() { if( request->is_item ) { - if( !system->HasReadAccess(request->item) ) + if( !system->HasReadAccess(request->item) || request->item.type == Item::symlink ) { request->status = WINIX_ERR_PERMISSION_DENIED; return false; @@ -39,22 +44,15 @@ bool Cp::CpCheckAccessFrom() request->status = WINIX_ERR_PERMISSION_DENIED; } - return true; } -bool Cp::CheckAccessTo(long dir_id) +bool Cp::CheckAccessTo() { - 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) ) + if( dir_tab.empty() || + !system->HasReadExecAccessToPath(dir_tab) || + !system->HasWriteAccess(*dir_tab.back()) ) { request->status = WINIX_ERR_PERMISSION_DENIED; return false; @@ -65,157 +63,230 @@ return true; -bool Cp::ParseDir(long & dir_id, std::wstring & dir, std::wstring & file) +bool Cp::ParseDir() { - int res = system->dirs.AnalyzePath(request->PostVar(L"to"), dir_id, dir, file); + const std::wstring & new_dir = request->PostVar(L"to"); + int res = system->dirs.FollowLink(request->dir_tab, new_dir, dir_tab, file); - if( res == 1 ) + if( res == 3 ) request->status = WINIX_ERR_NO_ROOT_DIR; else - if( res != 0 ) + if( res != 0 && res != 1 ) request->status = WINIX_ERR_INCORRECT_DIR; -return res == 0; +return res == 0 || res == 1; } -void Cp::CpStaticFile(Item & item) +bool Cp::CopyStaticFile(const std::wstring & from, const std::wstring & to) { - bool res1 = system->MakeFilePath(item, old_path); - bool res2 = system->CreateNewFile(item); - bool res3 = system->MakeFilePath(item, mv_new_path, false, true, config->upload_dirs_chmod); + if( from == to ) + { + log << log3 << "Cp: the same path to a static file: " << to << logend; + return true; + } - if( !res1 || !res2 || !res3 ) + if( ::CopyFile(from, to) ) + { + log << log2 << "Cp: copied a static file from: " << from << ", to: " << to << logend; + return true; + } + else + { + log << log1 << "Cp: can't copy a file from: " << from << ", to: " << to << logend; + request->status = WINIX_ERR_PERMISSION_DENIED; + return false; + } +} + + + +void Cp::CopyStaticFile(Item & item) +{ +bool res1, res2, res3, res4, res5; + + res1 = system->MakeFilePath(item, old_path, false); + res2 = !item.has_thumb || system->MakeFilePath(item, old_path_thumb, true); + res3 = system->CreateNewFile(item); + res4 = system->MakeFilePath(item, new_path, false, true, config->upload_dirs_chmod); + res5 = !item.has_thumb || system->MakeFilePath(item, new_path_thumb, true, true, config->upload_dirs_chmod); + + if( !res1 || !res2 || !res3 || !res4 || !res5 ) { request->status = WINIX_ERR_PERMISSION_DENIED; return; } - if( CopyFile(old_path, mv_new_path) ) - { - log << log1 << "Cp: copied static file from: " << old_path << ", to: " << mv_new_path << logend; - request->status = db->EditFileById(item, item.id); - } - else + if( CopyStaticFile(old_path, new_path) ) { - log << log1 << "Cp: can't copy a file from: " << old_path << ", to: " << mv_new_path << logend; - request->status = WINIX_ERR_PERMISSION_DENIED; + request->status = db->EditFileById(item, item.id); + + if( item.has_thumb ) + CopyStaticFile(old_path_thumb, new_path_thumb); } } -void Cp::CpSetNewAttributes(Item & item) + +void Cp::SetNewAttributes(Item & item) { - item.user_id = cp_new_user; - item.group_id = cp_new_group; + item.user_id = new_user; + item.group_id = new_group; item.SetDateModifyToNow(); } -void Cp::CpItem(Item & item, long dst_dir_id) +void Cp::CopyFile(Item & item, long dst_dir_id) { - if( !system->HasReadAccess(item) ) - return; // !! w przyszlosci bedziemy dodawac komunikaty do specjalnej tablicy (narazie nie zaimplementowane) + if( !preserve_attr ) + SetNewAttributes(item); - item.parent_id = dst_dir_id; - - if( !cp_preserve_attr ) - CpSetNewAttributes(item); - - request->status = system->AddFile(item); + item.parent_id = dst_dir_id; + request->status = db->AddItem(item); if( request->status == WINIX_ERR_OK ) { if( item.file_type != WINIX_ITEM_FILETYPE_NONE ) - CpStaticFile(item); + CopyStaticFile(item); + } +} + + +void Cp::CopyFileOrSymlink(Item & item, long dst_dir_id) +{ + if( !system->HasReadAccess(item) ) + return; // !! w przyszlosci bedziemy dodawac komunikaty do specjalnej tablicy (narazie nie zaimplementowane) + + if( item.type == Item::symlink && follow_symlinks ) + { + if( system->dirs.CreateDirTab(item.parent_id, symlink_dir_tab) ) + { + int res = system->FollowAllLinks(symlink_dir_tab, item.link_to, symlink_dir_tab, item); + + if( res == 0 ) + CopyDirTree(*symlink_dir_tab.back(), dst_dir_id); + else + if( res == 1 ) + CopyFile(item, dst_dir_id); + } + } + else + { + CopyFile(item, dst_dir_id); } } -void Cp::CpPrepare() +void Cp::Prepare() { - cp_iq.SetAll(true, false); - cp_iq.WhereType(Item::file); + iq.SetAll(true, false); + iq.WhereType(Item::dir, false); - cp_new_user = -1; - cp_new_group = -1; + new_user = -1; + new_group = dir_tab.back()->group_id; if( request->session->puser ) - cp_new_user = request->session->puser->id; + new_user = request->session->puser->id; - Item * pdir = system->dirs.GetDir(mv_dir_id); - - if( pdir ) - cp_new_group = pdir->group_id; + loop_checker.clear(); } -void Cp::CpFilesInDir(const Item & dir, long dst_dir_id) -{ - cp_iq.WhereParentId(dir.id); - db->GetItems(request->item_tab, cp_iq); - for(size_t i=0 ; iitem_tab.size() ; ++i) - CpItem(request->item_tab[i], dst_dir_id); +void Cp::CopyFilesInDir(const Item & dir, long dst_dir_id) +{ + iq.WhereParentId(dir.id); + db->GetItems(item_tab, iq); + + for(size_t i=0 ; idirs.FindFirstParent(item.id); + DirContainer::ParentIterator i = system->dirs.FindFirstChild(dir.id); // go through all directories - for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextParent(i) ) - CpDir(*(i->second), dst_dir_id); + for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) ) + CopyDirTree(*(i->second), dst_dir_id); - CpFilesInDir(item, dst_dir_id); + CopyFilesInDir(dir, dst_dir_id); +} + + +bool Cp::WasThisDir(const Item & dir) +{ + for(size_t i=0 ; iPrepareUrl(cp_temp); + log << log1 << "Cp: a loop between directories found (created by a symlink), " + << "dir_id: " << dir.id << ", dir_url: " << dir.url << logend; + + return -1; } - if( !cp_preserve_attr ) - CpSetNewAttributes(cp_temp); + loop_checker.push_back(dir.id); + temp = dir; + temp.parent_id = dst_dir_id; - if( cp_remove_defaults ) - cp_temp.default_item = -1; + if( !file.empty() ) + { + temp.url = file; + functions->PrepareUrl(temp); + file.clear(); + } - request->status = system->dirs.AddDirectory(cp_temp); - long new_dir_id = cp_temp.id; // remember the new dir_id + if( !preserve_attr ) + SetNewAttributes(temp); - if( system->HasReadExecAccess(item) ) - CpContentOfDir(item, cp_temp.id); + if( remove_defaults ) + { + temp.link_to.clear(); + temp.link_redirect = 0; + } + + request->status = system->dirs.AddDirectory(temp); + loop_checker.push_back(temp.id); + + // remember the new dir_id because temp can be changed + // this method is called in recurrences + long new_dir_id = temp.id; + + if( system->HasReadExecAccess(dir) ) + CopyDirContentTree(dir, temp.id); return new_dir_id; // and return it } + + bool Cp::IsTheSameFile(const Item & item) { - if( mv_file.empty() ) + if( file.empty() ) { - if( item.parent_id == mv_dir_id ) + if( item.parent_id == dir_tab.back()->id ) return true; // nothing to do } else { - if( item.parent_id == mv_dir_id && item.url == mv_file ) + if( item.parent_id == dir_tab.back()->id && item.url == file ) return true; // nothing to do } @@ -226,101 +297,94 @@ return false; // here 'item' can be changed in place -void Cp::CpItemCheck(Item & item, bool redirect) +void Cp::PostCopyFile(Item & item, bool redirect) { if( IsTheSameFile(item) ) return; - if( !mv_file.empty() ) + if( !file.empty() ) { - item.url = mv_file; + item.url = file; functions->PrepareUrl(item); + file.clear(); } - CpItem(item, mv_dir_id); + CopyFileOrSymlink(item, dir_tab.back()->id); - if( request->status==WINIX_ERR_OK && redirect ) + if( request->status == WINIX_ERR_OK && redirect ) system->RedirectTo(item); } -void Cp::CpContentOfDirCheck(const Item & item, bool redirect) + + +void Cp::PostCopyDirContent(const Item & dir, bool redirect) { - if( !mv_file.empty() ) + if( !file.empty() ) { request->status = WINIX_ERR_INCORRECT_DIR; return; } - if( mv_dir_id == item.id ) + if( dir_tab.back()->id == dir.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; - } + CopyDirContentTree(dir, dir_tab.back()->id); - CpContentOfDir(item, mv_dir_id); - - if( request->status==WINIX_ERR_OK && redirect ) - system->RedirectTo(mv_dir_id); + if( request->status == WINIX_ERR_OK && redirect ) + system->RedirectTo(dir_tab.back()->id); } -void Cp::CpDirCheck(const Item & item, bool redirect) +void Cp::PostCopyDir(const Item & dir, bool redirect) { - if( mv_file.empty() && mv_dir_id == item.id ) + long dir_id = dir_tab.back()->id; + + if( file.empty() && dir_id == dir.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 = CopyDirTree(dir, dir_id); - long new_dir_id = CpDir(item, mv_dir_id); - - if( request->status==WINIX_ERR_OK && redirect ) + if( new_dir_id != -1 && request->status == WINIX_ERR_OK && redirect ) system->RedirectTo(new_dir_id); } - -void Cp::MakePost() +void Cp::Clear() { - if( CpCheckAccessFrom() && - ParseDir(mv_dir_id, mv_dir, mv_file) && - CheckAccessTo(mv_dir_id) ) - { - CpPrepare(); - cp_preserve_attr = request->IsPostVar(L"preserveattr"); - - if( request->is_item ) - { - CpItemCheck(request->item); - } - else - { - cp_remove_defaults = request->IsPostVar(L"removedefaults"); - - if( request->IsPostVar(L"onlycontent") ) - CpContentOfDirCheck(*request->dir_tab.back()); - else - CpDirCheck(*request->dir_tab.back()); - } - } + loop_checker.clear(); + dir_tab.clear(); + item_tab.clear(); + symlink_dir_tab.clear(); } - -void Cp::MakeGet() +void Cp::MakePost() { - CpCheckAccessFrom(); + if( ParseDir() && CheckAccessTo() ) + { + Prepare(); + + preserve_attr = request->IsPostVar(L"preserveattr"); + remove_defaults = request->IsPostVar(L"removedefaults"); + follow_symlinks = request->IsPostVar(L"followsymlinks"); + + if( request->is_item ) + { + PostCopyFile(request->item); + } + else + { + if( request->IsPostVar(L"onlycontent") ) + PostCopyDirContent(*request->dir_tab.back()); + else + PostCopyDir(*request->dir_tab.back()); + } + + Clear(); + } } diff --git a/functions/cp.h b/functions/cp.h index 96a105b..2f7bcb9 100755 --- a/functions/cp.h +++ b/functions/cp.h @@ -18,45 +18,58 @@ namespace Fun { + class Cp : public FunctionBase { public: Cp(); + bool HasAccess(); + void MakePost(); private: - // !! wywalic przedrostki cp_ Cp + Item temp; + DbItemQuery iq; + bool remove_defaults; + bool preserve_attr; + bool follow_symlinks; + long new_user; + long new_group; - Item cp_temp; - DbItemQuery cp_iq; - bool cp_remove_defaults; - bool cp_preserve_attr; - long cp_new_user; - long cp_new_group; + // destination dir (will not be empty) + std::vector dir_tab, symlink_dir_tab; - std::wstring mv_dir; - std::wstring mv_file; - std::wstring mv_new_path; - std::wstring old_path; - long mv_dir_id; + // for testing loops in directories (between symlinks) + std::vector loop_checker; - bool CpCheckAccessFrom(); - bool CheckAccessTo(long dir_id); - bool ParseDir(long & dir_id, std::wstring & dir, std::wstring & file); - void CpStaticFile(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); + // destination file (if exists) + std::wstring file; + + // for copying static files + std::wstring new_path, new_path_thumb; + std::wstring old_path, old_path_thumb; + + std::vector item_tab; + + bool WasThisDir(const Item & dir); + bool CheckAccessFrom(); + bool CheckAccessTo(); + bool ParseDir(); + bool CopyStaticFile(const std::wstring & from, const std::wstring & to); + void CopyStaticFile(Item & item); + void SetNewAttributes(Item & item); + void CopyFile(Item & item, long dst_dir_id); + void CopyFileOrSymlink(Item & item, long dst_dir_id); + void Prepare(); + void CopyFilesInDir(const Item & dir, long dst_dir_id); + void CopyDirContentTree(const Item & item, long dst_dir_id); + long CopyDirTree(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(); + void Clear(); + void PostCopyFile(Item & item, bool redirect = true); + void PostCopyDirContent(const Item & dir, bool redirect = true); + void PostCopyDir(const Item & dir, bool redirect = true); }; diff --git a/functions/createthread.cpp b/functions/createthread.cpp index c6488bb..418e939 100755 --- a/functions/createthread.cpp +++ b/functions/createthread.cpp @@ -11,7 +11,7 @@ #include "functions.h" -namespace Fun +namespace Thread { CreateThread::CreateThread() diff --git a/functions/createthread.h b/functions/createthread.h index 064087e..8e3fa8b 100755 --- a/functions/createthread.h +++ b/functions/createthread.h @@ -7,14 +7,14 @@ * */ -#ifndef headerfilecmslucontentcreatethread -#define headerfilecmslucontentcreatethread +#ifndef headerfile_winix_plugins_thread_createthread +#define headerfile_winix_plugins_thread_createthread -#include "functionbase.h" +#include "functions/functionbase.h" -namespace Fun +namespace Thread { diff --git a/functions/default.cpp b/functions/default.cpp index a5fcb3c..a15d7b9 100755 --- a/functions/default.cpp +++ b/functions/default.cpp @@ -20,103 +20,33 @@ Default::Default() } -long Default::PostFunDefaultParsePath() +bool Default::HasAccess() { -Item * pdir, * pdir2; -long defaultid = -1; - - const std::wstring & path = request->PostVar(L"defaultitem"); - - - if( !path.empty() ) - { - std::wstring 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; + return !request->is_item && system->HasWriteAccess(*request->dir_tab.back()); } - void Default::MakePost() { - if( !system->HasWriteAccess(*request->dir_tab.back()) ) - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - + Item & dir = *request->dir_tab.back(); - try - { - long defaultid = PostFunDefaultParsePath(); + dir.link_to = request->PostVar(L"linkto"); + dir.link_redirect = request->IsPostVar(L"makeredirect") ? 1 : 0; + TrimWhite(dir.link_to); - if( defaultid != request->dir_tab.back()->id ) - { - request->status = db->EditDefaultItem(request->dir_tab.back()->id, defaultid); - - if( request->status == WINIX_ERR_OK ) - request->dir_tab.back()->default_item = defaultid; - } - else - { - log << "Default: skipping the same directory" << logend; - } - } - catch(const Error & e) - { - request->status = e; - } + // !! dodac sprawdzenie czy link_to jest pusty teraz + request->status = db->EditLinkItem(dir.id, dir.link_to, dir.link_redirect); if( request->status == WINIX_ERR_OK ) - system->RedirectTo(*request->dir_tab.back()); - else - log << log1 << "Content: PostFunDefaultItem: Error: " << request->status << logend; -} - - - - -void Default::MakeGet() -{ - if( !system->HasWriteAccess(*request->dir_tab.back()) ) { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; + log << log2 << "Default: changed link_to: " << dir.link_to << ", for dir_id: " << dir.id << logend; + system->RedirectToLastDir(); } - } + + } // namespace diff --git a/functions/default.h b/functions/default.h index fb361d7..cd90bec 100755 --- a/functions/default.h +++ b/functions/default.h @@ -23,12 +23,8 @@ class Default : public FunctionBase public: Default(); + bool HasAccess(); void MakePost(); - void MakeGet(); - -private: - - long PostFunDefaultParsePath(); }; diff --git a/functions/emacs.cpp b/functions/emacs.cpp index 09a02d9..6154d76 100755 --- a/functions/emacs.cpp +++ b/functions/emacs.cpp @@ -127,7 +127,6 @@ void Emacs::MakePost() if( !PostEmacsCheckAbuse(adding) ) return; - if( adding ) { request->is_item = true; // !! moze lepiej nie ustawiac is_item? (bo jak wystapi blad np dodania do bazy danych @@ -140,7 +139,6 @@ void Emacs::MakePost() request->status = system->EditFile(request->item, request->item.url != old_url, NotifyCodeEdit()); } - if( request->status == WINIX_ERR_OK ) { PostFunEmacsModifyMountPoint(adding); @@ -148,8 +146,7 @@ void Emacs::MakePost() } else { - log << log1 << "Emacs: error: " - << request->status << logend; + log << log1 << "Emacs: error: " << request->status << logend; } } diff --git a/functions/functionbase.cpp b/functions/functionbase.cpp index 64d67d1..5e9079c 100755 --- a/functions/functionbase.cpp +++ b/functions/functionbase.cpp @@ -15,6 +15,7 @@ FunctionBase::FunctionBase() { id = -1; + follow_symlinks = true; fun.user_id = -1; fun.group_id = -1; @@ -82,12 +83,6 @@ bool FunctionBase::HasAccess() } -void FunctionBase::Clear() -{ - // this method is called at the end of a request - // you can clear your variables -} - void FunctionBase::MakePost() { diff --git a/functions/functionbase.h b/functions/functionbase.h index d66fe63..dcb30f0 100755 --- a/functions/functionbase.h +++ b/functions/functionbase.h @@ -27,6 +27,7 @@ class Templates; + class FunctionBase { public: @@ -41,9 +42,11 @@ public: // user, group, permissions, url (function name) Item fun; + // auto follow sym links, default: true + bool follow_symlinks; + virtual void Init(); virtual bool HasAccess(); - virtual void Clear(); virtual void MakePost(); virtual void MakeGet(); diff --git a/functions/functionparser.cpp b/functions/functionparser.cpp index a61cb9b..f92cf1f 100755 --- a/functions/functionparser.cpp +++ b/functions/functionparser.cpp @@ -72,7 +72,7 @@ void FunctionParser::ParseItem() return; // request->dir_tab has at least one element - long parent_id = request->dir_tab.back()->id; + long parent_id = request->dir_tab.back()->id; const std::wstring & url = request->get_tab[get_index]; request->status = db->GetItem(parent_id, url, request->item); @@ -171,7 +171,6 @@ void FunctionParser::ParseParams() - void FunctionParser::Parse(Request * prequest, Db * pdb, Functions * pfunctions, System * psystem) { request = prequest; @@ -198,7 +197,7 @@ void FunctionParser::Parse(Request * prequest, Db * pdb, Functions * pfunctions, if( request->status != WINIX_ERR_OK ) return; - + ParseFunction(); if( !request->function && get_index != get_tab_len ) diff --git a/functions/functions.cpp b/functions/functions.cpp index 601b661..39854fe 100755 --- a/functions/functions.cpp +++ b/functions/functions.cpp @@ -123,7 +123,7 @@ Error Functions::CheckSpecialFile(const Item & item) Error status = system->mounts.ReadMounts(item.content); templates->ReadNewIndexTemplates(); - + return status; } @@ -183,6 +183,7 @@ void Functions::CreateFunctions() Add(fun_last); Add(fun_login); Add(fun_logout); + Add(fun_ln); Add(fun_ls); Add(fun_mkdir); Add(fun_mv); @@ -248,33 +249,26 @@ void Functions::SetDefaultFunctionForFile() void Functions::SetDefaultFunctionForDir() { - long default_item = request->dir_tab.back()->default_item; - - if( default_item != -1 ) - { - log << log3 << "Functions: Default item: id: " << default_item << logend; - system->RedirectTo(default_item); - } + if( system->mounts.pmount->type == system->mounts.MountTypeThread() ) + request->function = &fun_thread; else - { - if( system->mounts.pmount->type == system->mounts.MountTypeThread() ) - request->function = &fun_thread; - else - request->function = &fun_ls; + request->function = &fun_ls; - log << log3 << "Functions: default function: " << request->function->fun.url << logend; - } + log << log3 << "Functions: default function: " << request->function->fun.url << logend; } void Functions::SetDefaultFunction() { request->function = 0; + plugin.Call(WINIX_SELECT_DEFAULT_FUNCTION); if( request->function ) { - log << log3 << "Functions: default function: " << request->function->fun.url << logend; + log << log3 << "Functions: default function: " << request->function->fun.url + << " (set by a plugin)" << logend; + return; } @@ -287,75 +281,120 @@ void Functions::SetDefaultFunction() -void Functions::MakeGet() + +void Functions::CheckFunctionFollowDir(bool was_default_function) { - if( request->role == Request::authorizer ) + // directory with 'default' flag + + if( was_default_function ) { - // in authorizer mode only cat function is available - // (and must be default) - - if( request->function ) + if( request->dir_tab.back()->link_redirect == 1 ) { - request->status = WINIX_ERR_NO_ITEM; - log << log1 << "Functions: in authorizer mode only 'cat' funtion is available and must " - "be default (not in the url)" << logend; - return; + system->RedirectTo(request->dir_tab.back()->link_to); + } + else + { + if( system->FollowAllLinks(request->dir_tab.back()->link_to, true, true) ) + SetDefaultFunction(); } - - request->function = &fun_cat; } +} + +void Functions::CheckFunctionFollowSymlink(bool was_default_function) +{ + if( request->item.link_redirect == 1 ) + { + if( was_default_function ) + system->RedirectTo(request->item.link_to); + else + system->RedirectWithFunctionAndParamsTo(request->item.link_to); + } + else + if( system->FollowAllLinks(request->item.link_to, true, true) ) + { + if( was_default_function ) + SetDefaultFunction(); + + if( request->status == WINIX_ERR_OK && !request->redirect_to.empty() && !was_default_function && request->function ) + { + // !! nie jestem pewny dodania tej nowej funkcji do redirecta... (sprawdzic to) + request->redirect_to += '/'; + request->redirect_to += request->function->fun.url; + system->AddParams(request->param_tab, request->redirect_to, false); + } + } +} + + +// making a proper redirection from a directory with 'default' flag +// or from a symlink (or just loading it if there is no redirection flag set) +void Functions::CheckFunctionAndSymlink() +{ +bool was_default_function = false; + if( !request->function || request->function == &fun_special_default ) + { + was_default_function = true; SetDefaultFunction(); + } - if( !request->redirect_to.empty() ) + if( request->status != WINIX_ERR_OK || !request->redirect_to.empty() ) return; - if( !request->function ) + if( !request->is_item && !request->dir_tab.back()->link_to.empty() ) + CheckFunctionFollowDir(was_default_function); + else + if( request->is_item && request->item.type == Item::symlink && request->function && request->function->follow_symlinks ) + CheckFunctionFollowSymlink(was_default_function); +} + + + +void Functions::MakeFunction() +{ + if( !request->function ) { request->status = WINIX_ERR_NO_FUNCTION; log << log1 << "Functions: no function (neither cat nor ls)" << logend; return; } - if( !system->HasReadExecAccess(request->function->fun) || !request->function->HasAccess() ) + if( !system->DirsHaveReadExecPerm() || + !system->HasReadExecAccess(request->function->fun) || + !request->function->HasAccess() ) { request->status = WINIX_ERR_PERMISSION_DENIED; return; } - request->function->MakeGet(); + if( request->method == Request::get ) + { + if( request->redirect_to.empty() ) + request->function->MakeGet(); + } + else + if( request->method == Request::post ) + { + // we don't use post with redirecting (the post variables would be lost) + + if( request->redirect_to.empty() ) + request->function->MakePost(); + else + request->status = WINIX_ERR_PERMISSION_DENIED; + } + else + if( request->method == Request::head ) + { + // do nothing + } + else + log << log1 << "Functions: unknown request method (skipping)" << logend; } -void Functions::MakePost() -{ - if( request->role == Request::authorizer ) - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - - if( !request->function || request->function == &fun_special_default ) - SetDefaultFunction(); - - if( !request->function ) - { - request->status = WINIX_ERR_NO_FUNCTION; - log << log1 << "Functions: MakePost: no function" << logend; - return; - } - - if( !system->HasReadExecAccess(request->function->fun) || !request->function->HasAccess() ) - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - - request->function->MakePost(); -} void Functions::CheckGetPostTimes(time_t difference) @@ -505,6 +544,7 @@ void Functions::ReadItemContentWithType(Item & item) // 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 +// !! zmienic nazwe na ReadUrlSubjectContent void Functions::ReadItem(Item & item, Item::Type item_type) { if( item_type == Item::none ) diff --git a/functions/functions.h b/functions/functions.h index 2234933..29a27a5 100755 --- a/functions/functions.h +++ b/functions/functions.h @@ -26,6 +26,7 @@ #include "last.h" #include "login.h" #include "logout.h" +#include "ln.h" #include "ls.h" #include "mkdir.h" #include "mv.h" @@ -69,6 +70,7 @@ public: Fun::Last fun_last; Fun::Login fun_login; Fun::Logout fun_logout; + Fun::Ln fun_ln; Fun::Ls fun_ls; Fun::Mkdir fun_mkdir; Fun::Mv fun_mv; @@ -99,8 +101,9 @@ public: Iterator Begin(); Iterator End(); - void MakeGet(); - void MakePost(); + void CheckFunctionAndSymlink(); + void MakeFunction(); + void SetConfig(Config * pconfig); void SetRequest(Request * prequest); @@ -145,6 +148,7 @@ private: std::wstring temp; HTMLFilter html_filter; + std::wstring link_to_temp; void CreateFunctions(); void InitFunctions(); @@ -158,6 +162,11 @@ private: Table table; FunctionParser function_parser; + + void CheckFunctionFollowDir(bool was_default_function); + void CheckFunctionFollowSymlink(bool was_default_function); + }; + #endif diff --git a/functions/funthread.cpp b/functions/funthread.cpp index 680debf..26bc650 100755 --- a/functions/funthread.cpp +++ b/functions/funthread.cpp @@ -12,7 +12,7 @@ #include "funthread.h" -namespace Fun +namespace Thread { FunThread::FunThread() @@ -31,7 +31,6 @@ bool FunThread::HasAccess() void FunThread::Clear() { - is_thread = false; thread.Clear(); thread_tab.clear(); } @@ -80,6 +79,8 @@ void FunThread::MakeGet() CreateSortIndexByDate(); std::sort(thread_tab.begin(), thread_tab.end(), FunThreadSort); + + Clear(); } diff --git a/functions/funthread.h b/functions/funthread.h index 5699e2d..1d594d8 100755 --- a/functions/funthread.h +++ b/functions/funthread.h @@ -7,14 +7,14 @@ * */ -#ifndef headerfilecmslucontentthread -#define headerfilecmslucontentthread +#ifndef headerfile_winix_plugins_thread_funthread +#define headerfile_winix_plugins_thread_funthread -#include "functionbase.h" +#include "functions/functionbase.h" #include "core/thread.h" -namespace Fun +namespace Thread { @@ -24,7 +24,6 @@ public: FunThread(); bool HasAccess(); - void Clear(); void MakeGet(); // current thread (if exists) @@ -36,6 +35,7 @@ private: static bool FunThreadSort(const Thread & t1, const Thread & t2); void CreateSortIndexByDate(); + void Clear(); }; diff --git a/functions/ln.cpp b/functions/ln.cpp new file mode 100755 index 0000000..a7760e1 --- /dev/null +++ b/functions/ln.cpp @@ -0,0 +1,111 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "ln.h" +#include "core/misc.h" +#include "functions/functions.h" + + + +namespace Fun +{ + +Ln::Ln() +{ + fun.url = L"ln"; +} + + + +bool Ln::HasAccess() +{ + return system->HasWriteAccess(*request->dir_tab.back()); +} + + +void Ln::CreateSymbolicLink(const std::wstring & link_to) +{ + item.Clear(); // setting the date to now + item.type = Item::symlink; + item.parent_id = request->dir_tab.back()->id; + item.url = request->PostVar(L"url"); + item.link_to = link_to; + item.link_redirect = request->IsPostVar(L"makeredirect") ? 1 : 0; + item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask + functions->SetUser(item); + functions->PrepareUrl(item); + + request->status = db->AddItem(item); + + if( request->status == WINIX_ERR_OK ) + log << log3 << "Ln: created a symbolic link to: " << link_to << logend; +} + + +void Ln::CreateHardLink(const std::wstring & link_to) +{ + int res = system->FollowAllLinks(request->dir_tab, link_to, dir_tab, item, false, false); + + if( res == 0 ) + { + log << log2 << "Ln: " << link_to << " is a directory (can't create a hard link)" << logend; + request->status = WINIX_ERR_PERMISSION_DENIED; + } + else + if( res == 1 ) + { + item.SetDateToNow(); + item.type = Item::file; + item.parent_id = request->dir_tab.back()->id; + item.url = request->PostVar(L"url"); + item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask + functions->SetUser(item); + functions->PrepareUrl(item); + request->status = db->AddHardLink(item); + + if( request->status == WINIX_ERR_OK ) + log << log3 << "Ln: created a hard link to: " << link_to << logend; + } + else + if( res == 5 || res == 6 ) + { + request->status = WINIX_ERR_PERMISSION_DENIED; + } + else + { + request->status = WINIX_ERR_NO_ITEM; + } +} + + + +// we do not use notifications for links +void Ln::MakePost() +{ + link_to = request->PostVar(L"linkto"); + TrimWhite(link_to); + + if( link_to.empty() ) + return; + + int type = Toi(request->PostVar(L"linktype")); + + if( type == 0 ) + CreateHardLink(link_to); + else + CreateSymbolicLink(link_to); + + if( request->status == WINIX_ERR_OK ) + system->RedirectTo(item); +} + + + +} // namespace + diff --git a/functions/ln.h b/functions/ln.h new file mode 100755 index 0000000..ef88bdc --- /dev/null +++ b/functions/ln.h @@ -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 headerfilecmslucontentln +#define headerfilecmslucontentln + +#include "functionbase.h" + + + +namespace Fun +{ + + +class Ln : public FunctionBase +{ +public: + + Ln(); + bool HasAccess(); + void CreateSymbolicLink(const std::wstring & link_to); + void CreateHardLink(const std::wstring & link_to); + void MakePost(); + +private: + + Item item; + std::wstring link_to; + std::vector dir_tab; + +}; + + +} // namespace + +#endif diff --git a/functions/ls.cpp b/functions/ls.cpp index 84b2c1d..02277fd 100755 --- a/functions/ls.cpp +++ b/functions/ls.cpp @@ -30,7 +30,7 @@ void Ls::MakeGet() iq.sel_content = false; iq.WhereParentId(request->dir_tab.back()->id); - iq.WhereType(Item::file); + iq.WhereType(Item::dir, false); if( request->IsParam(L"ckeditor_browse") ) { diff --git a/functions/mv.cpp b/functions/mv.cpp index 341efac..c3c6521 100755 --- a/functions/mv.cpp +++ b/functions/mv.cpp @@ -18,25 +18,38 @@ namespace Fun Mv::Mv() { fun.url = L"mv"; + follow_symlinks = false; } -bool Mv::MoveCheckAccessFromToDir() +bool Mv::HasAccess() +{ + return CheckAccessFrom(); +} + + + +bool Mv::CheckAccessFromToDir() { Item * last; Item * last_but_one = 0; +size_t dir_tab_size; - last = request->dir_tab[request->dir_tab.size()-1]; + last = request->dir_tab.back(); + dir_tab_size = request->dir_tab.size(); - if( request->dir_tab.size() >= 2 ) - last_but_one = request->dir_tab[request->dir_tab.size()-2]; + if( dir_tab_size <= 1 ) + return false; // you cannot move the root directory + + last_but_one = request->dir_tab[dir_tab_size - 2]; if( request->method != Request::post ) { // used in GET or HEAD + // we don't now whether we move the last directory or the last but one + // it depends on the 'onlycontent' parameter - if( !system->HasWriteAccess(*last) && - (!last_but_one || !system->HasWriteAccess(*last_but_one)) ) + if( !system->HasWriteAccess(*last) && !system->HasWriteAccess(*last_but_one) ) return false; } else @@ -46,10 +59,7 @@ Item * last_but_one = 0; if( request->IsPostVar(L"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; @@ -57,7 +67,8 @@ return true; -bool Mv::MoveCheckAccessFrom() + +bool Mv::CheckAccessFrom() { if( request->is_item ) { @@ -71,7 +82,7 @@ bool Mv::MoveCheckAccessFrom() } else { - if( !MoveCheckAccessFromToDir() ) + if( !CheckAccessFromToDir() ) { request->status = WINIX_ERR_PERMISSION_DENIED; return false; @@ -82,17 +93,11 @@ return true; } -bool Mv::MoveCheckAccessTo(long dir_id) +bool Mv::CheckAccessTo() { - 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) ) + if( dir_tab.empty() || + !system->HasReadExecAccessToPath(dir_tab) || + !system->HasWriteAccess(*dir_tab.back()) ) { request->status = WINIX_ERR_PERMISSION_DENIED; return false; @@ -103,85 +108,222 @@ return true; -bool Mv::MoveCheckMountPoints(long dir_id) + + +bool Mv::ParseDir() { - /* - Mount * new_mount = system->mounts.CalcMount(dir_id); - - if( !new_mount ) - { - if( system->mounts.pmount->type != system->mounts.MountTypeCms() ) - { - request->status = WINIX_DIFFERENT_MOUNT_POINTS; - return false; - } + const std::wstring & new_dir = request->PostVar(L"to"); + int res = system->dirs.FollowLink(request->dir_tab, new_dir, dir_tab, file); - return true; - } + if( res == 3 ) + request->status = WINIX_ERR_NO_ROOT_DIR; + else + if( res != 0 && res != 1 ) + request->status = WINIX_ERR_INCORRECT_DIR; - if( new_mount->type != system->mounts.pmount->type ) - { - request->status = WINIX_DIFFERENT_MOUNT_POINTS; - return false; - } - */ - -return true; +return res == 0 || res == 1; } -bool Mv::MoveParseDir(long & dir_id, std::wstring & dir, std::wstring & file) +bool Mv::MoveStaticFile(const std::wstring & from, const std::wstring & to) { - int res = system->dirs.AnalyzePath(request->PostVar(L"to"), dir_id, dir, file); + if( from == to ) + { + log << log3 << "Mv: the same path to a static file: " << to << " (skipped)" << logend; + return true; + } - if( res == 1 ) - request->status = WINIX_ERR_NO_ROOT_DIR; + if( RenameFile(from, to) ) + { + log << log2 << "Mv: moved static file from: " << from << ", to: " << to << logend; + return true; + } else - if( res != 0 ) - request->status = WINIX_ERR_INCORRECT_DIR; - -return res == 0; + { + log << log1 << "Mv: can't move a file from: " << from << ", to: " << to << logend; + request->status = WINIX_ERR_PERMISSION_DENIED; + return false; + } } void Mv::MoveStaticFile(Item & item) { - bool res1 = system->MakeFilePath(item, old_path); - bool res2 = system->CreateNewFile(item); - bool res3 = system->MakeFilePath(item, mv_new_path, false, true, config->upload_dirs_chmod); +bool res1, res2, res3, res4, res5; + + res1 = system->MakeFilePath(item, old_path, false); + res2 = !item.has_thumb || system->MakeFilePath(item, old_path_thumb, true); + res3 = system->CreateNewFile(item); + res4 = system->MakeFilePath(item, new_path, false, true, config->upload_dirs_chmod); + res5 = !item.has_thumb || system->MakeFilePath(item, new_path_thumb, true, true, config->upload_dirs_chmod); - if( !res1 || !res2 || !res3 ) + if( !res1 || !res2 || !res3 || !res4 || !res5 ) { request->status = WINIX_ERR_PERMISSION_DENIED; return; } - if( RenameFile(old_path, mv_new_path) ) - { - log << log1 << "Mv: moved static file from: " << old_path << ", to: " << mv_new_path << logend; - request->status = db->EditFileById(item, item.id); - } - else + if( MoveStaticFile(old_path, new_path) ) { - log << log1 << "Mv: can't move a file from: " << old_path << ", to: " << mv_new_path << logend; - request->status = WINIX_ERR_PERMISSION_DENIED; + request->status = db->EditFileById(item, item.id); + + if( item.has_thumb ) + MoveStaticFile(old_path_thumb, new_path_thumb); } } -bool Mv::MoveIsTheSameFile(const Item & item) + +void Mv::MoveFileOrSymlink(Item & item) { - if( mv_file.empty() ) + old_url = item.url; + + if( !file.empty() ) { - if( item.parent_id == mv_dir_id ) + item.url = file; + functions->PrepareUrl(item); + file.clear(); + } + + item.parent_id = dir_tab.back()->id; + request->status = db->EditParentUrlById(item, item.id); + + if( request->status == WINIX_ERR_OK ) + { + if( item.type == Item::file ) + log << log3 << "Mv: file: "; + else + log << log3 << "Mv: symlink: "; + + log << old_url << " was moved to: "; + system->dirs.LogDir(dir_tab); + log << item.url << logend; + + if( item.file_type != WINIX_ITEM_FILETYPE_NONE ) + MoveStaticFile(item); + } +} + + + + +void Mv::MoveDirContent(const Item & dir) +{ + content_dir_iq.WhereParentId(dir.id); + db->GetItems(item_tab, content_dir_iq); + + for(size_t i=0 ; idirs.FindFirstChild(dir.id); + + // go through all directories + for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) ) + MoveStaticFilesTree(*(i->second)); + + static_iq.WhereParentId(dir.id); + db->GetItems(static_item_tab, static_iq); + + for(size_t i=0 ; iid; + old_url = dir.url; + + if( dst_dir_id == dir.id || system->dirs.HasParent(dst_dir_id, dir.id) ) + { + log << log1 << "Mv: cannot move directory to inside it" << logend; + request->status = WINIX_ERR_INCORRECT_DIR; + return; + } + + if( !system->dirs.ChangeParent(dir.id, dst_dir_id) ) + { + request->status = WINIX_ERR_INCORRECT_DIR; + return; + } + + dir.parent_id = dst_dir_id; + + if( !file.empty() ) + { + dir.url = file; + functions->PrepareUrl(dir); + file.clear(); + } + + request->status = db->EditParentUrlById(dir, dir.id); + + if( request->status == WINIX_ERR_OK ) + { + log << log3 << "Mv: directory: " << old_url << " was moved to: "; + system->dirs.LogDir(dir_tab); + log << dir.url << logend; + + MoveStaticFilesTree(dir); + } +} + + + + +bool Mv::IsTheSameFile(const Item & item) +{ + if( file.empty() ) + { + if( item.parent_id == dir_tab.back()->id ) return true; // nothing to do } else { - if( item.parent_id == mv_dir_id && item.url == mv_file ) + if( item.parent_id == dir_tab.back()->id && item.url == file ) return true; // nothing to do } @@ -190,131 +332,48 @@ return false; -void Mv::MoveFile(Item & item, bool redirect) +void Mv::PostMoveFile() { - if( MoveIsTheSameFile(item) ) + if( IsTheSameFile(request->item) ) return; - if( !mv_file.empty() ) - { - item.url = mv_file; - functions->PrepareUrl(item); - } - - item.parent_id = mv_dir_id; - request->status = db->EditParentUrlById(item, item.id); + MoveFileOrSymlink(request->item); if( request->status == WINIX_ERR_OK ) - { - log << log2 << "Mv: the file was moved to: " << mv_dir << item.url << logend; - - if( item.file_type != WINIX_ITEM_FILETYPE_NONE ) - MoveStaticFile(item); - - if( redirect ) - system->RedirectTo(item); - } + system->RedirectTo(request->item); } -void Mv::MoveContentOfDir() +void Mv::PostMoveDirContent() { -DbItemQuery iq; - - iq.sel_parent_id = true; - iq.sel_type = true; - iq.sel_url = true; - iq.sel_file = true; - iq.WhereParentId(request->dir_tab.back()->id); - - db->GetItems(request->item_tab, iq); - - for(size_t i=0 ; iitem_tab.size() ; ++i) + if( !file.empty() ) { - if( request->item_tab[i].type == Item::dir ) - MoveDir(request->item_tab[i], false); - else - MoveFile(request->item_tab[i], false); + request->status = WINIX_ERR_INCORRECT_DIR; + return; } + if( request->dir_tab.back()->id == dir_tab.back()->id ) + return; // nothing to do + + MoveDirContent(*request->dir_tab.back()); system->RedirectToLastDir(); } -void Mv::MoveAuthPrepareQuery() +void Mv::PostMoveDir() { - mv_auth_iq.SetAll(false, false); + Item & last_dir = *request->dir_tab.back(); + Item & new_dir = *dir_tab.back(); - mv_auth_iq.sel_parent_id = true; - mv_auth_iq.sel_type = true; - mv_auth_iq.sel_url = true; - mv_auth_iq.sel_file = true; - - mv_auth_iq.WhereType(Item::file); - mv_auth_iq.WhereFileType(WINIX_ITEM_FILETYPE_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 ; idirs.HasParent(mv_dir_id, item.id) ) - { - log << log1 << "Mv: 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; - functions->PrepareUrl(item); - } - - request->status = db->EditParentUrlById(item, item.id); + MoveDir(last_dir); if( request->status == WINIX_ERR_OK ) - { - log << log2 << "Mv: the directory was moved to: " << mv_dir << item.url << logend; - MoveAuthContentOfDir(item); - - if( redirect ) - system->RedirectToLastDir(); - } + system->RedirectToLastDir(); } @@ -322,41 +381,29 @@ void Mv::MoveDir(Item & item, bool redirect) void Mv::MakePost() { - if( MoveCheckAccessFrom() && - MoveParseDir(mv_dir_id, mv_dir, mv_file) && - MoveCheckAccessTo(mv_dir_id) && - MoveCheckMountPoints(mv_dir_id) ) + if( CheckAccessFrom() && + ParseDir() && + CheckAccessTo() ) { + Prepare(); + if( request->is_item ) { - MoveFile(request->item); + PostMoveFile(); } else { - MoveAuthPrepareQuery(); - if( request->IsPostVar(L"onlycontent") ) - { - if( mv_file.empty() ) - MoveContentOfDir(); - else - request->status = WINIX_ERR_INCORRECT_DIR; - } + PostMoveDirContent(); else - { - MoveDir(*request->dir_tab.back()); - } + PostMoveDir(); } + + Clear(); } } -void Mv::MakeGet() -{ - MoveCheckAccessFrom(); -} - - } // namespace diff --git a/functions/mv.h b/functions/mv.h index 87734ba..935c378 100755 --- a/functions/mv.h +++ b/functions/mv.h @@ -14,40 +14,59 @@ + namespace Fun { + class Mv : public FunctionBase { public: Mv(); + bool HasAccess(); void MakePost(); - void MakeGet(); private: - std::wstring mv_dir; - std::wstring mv_file; - std::wstring mv_new_path; - std::wstring old_path; - long mv_dir_id; - std::vector mv_auth; - DbItemQuery mv_auth_iq; + // destination dir + std::vector dir_tab; - bool MoveCheckAccessFromToDir(); - bool MoveCheckAccessFrom(); - bool MoveCheckAccessTo(long dir_id); - bool MoveCheckMountPoints(long dir_id); - bool MoveParseDir(long & dir_id, std::wstring & dir, std::wstring & file); + // destination file (if exists) + std::wstring file; + + // for copying static files + std::wstring new_path, new_path_thumb; + std::wstring old_path, old_path_thumb; + + // for static files + std::vector static_item_tab; + DbItemQuery static_iq; + + // for moving content of a directory + DbItemQuery content_dir_iq; + std::vector item_tab; + + // for logging + std::wstring old_url; + + bool CheckAccessFromToDir(); + bool CheckAccessFrom(); + bool CheckAccessTo(); + bool ParseDir(); + bool MoveStaticFile(const std::wstring & from, const std::wstring & to); void MoveStaticFile(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); + void MoveFileOrSymlink(Item & item); + void MoveDirContent(const Item & dir); + void Prepare(); + void Clear(); + void MoveStaticFilesTree(const Item & dir); + void MoveDir(Item & dir); + bool IsTheSameFile(const Item & item); + void PostMoveFile(); + void PostMoveDirContent(); + void PostMoveDir(); }; diff --git a/functions/privchanger.cpp b/functions/privchanger.cpp index fdf635d..99fe8ca 100755 --- a/functions/privchanger.cpp +++ b/functions/privchanger.cpp @@ -172,7 +172,7 @@ void PrivChanger::PrivFilesInDir(long parent_id) iq.sel_user_id = iq.sel_group_id = iq.sel_guest_name = iq.sel_privileges = true; iq.WhereParentId(parent_id); - iq.WhereType(Item::file); + iq.WhereType(Item::dir, false); db->GetItems(request->item_tab, iq); @@ -194,9 +194,9 @@ void PrivChanger::PrivDir(long parent_id) PrivFilesInDir(parent_id); - DirContainer::ParentIterator i = system->dirs.FindFirstParent(parent_id); + DirContainer::ParentIterator i = system->dirs.FindFirstChild(parent_id); - for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextParent(i) ) + for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) ) { PrivLog(L"changed dir: ", -1, i->second->url); ChangePriv(*(i->second), user_id_dir, group_id_dir, priv_dir); diff --git a/functions/rm.cpp b/functions/rm.cpp index c299c25..9682af7 100755 --- a/functions/rm.cpp +++ b/functions/rm.cpp @@ -22,6 +22,7 @@ namespace Fun Rm::Rm() { fun.url = L"rm"; + follow_symlinks = false; } @@ -35,9 +36,10 @@ bool Rm::HasAccess(const Item & item) 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 ) + // we can only remove the content of the root directory + // and here we check only access the the root dir + // "onlycontent" parameter should be check in post method + if( !system->HasWriteAccess(item) ) return false; } else @@ -72,39 +74,110 @@ return true; -void Rm::RemoveAuthPrepareQuery() +void Rm::Prepare() { - rm_auth_iq.SetAll(true, false); + content_dir_iq.SetAll(false, false); + content_dir_iq.sel_parent_id = true; + content_dir_iq.sel_type = true; + content_dir_iq.sel_url = true; + content_dir_iq.sel_file = true; - rm_auth_iq.sel_parent_id = true; - rm_auth_iq.sel_type = true; - rm_auth_iq.sel_file = true; + static_iq.SetAll(false, false); + static_iq.sel_parent_id = true; + static_iq.sel_type = true; + static_iq.sel_url = true; + static_iq.sel_file = true; - rm_auth_iq.WhereType(Item::file); - rm_auth_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false); + static_iq.WhereType(Item::file); + static_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false); +} + + +bool Rm::RemoveStaticFile(const std::wstring & path) +{ + if( ::RemoveFile(path) ) + { + log << log2 << "Rm: removed static file: " << path << logend; + return true; + } + else + { + log << log1 << "Rm: can't remove a file: " << path << logend; + request->status = WINIX_ERR_PERMISSION_DENIED; + return false; + } +} + + +void Rm::RemoveStaticFile(Item & item) +{ + if( system->MakeFilePath(item, path, false) ) + { + if( RemoveStaticFile(path) ) + { + if( item.has_thumb && system->MakeFilePath(item, path, true) ) + { + RemoveStaticFile(path); + item.has_thumb = false; + } + + // we don't store it to db (it will be removed or is removed already) + item.file_path.clear(); + item.file_type = WINIX_ITEM_FILETYPE_NONE; + } + } + else + { + request->status = WINIX_ERR_PERMISSION_DENIED; + } } -void Rm::RemoveAllDirs(long dir_id) +void Rm::RemoveFileOrSymlink(Item & item) { - DirContainer::ParentIterator pnext, p = system->dirs.FindFirstParent(dir_id); + if( db->DelItem(item) == WINIX_ERR_OK ) + { + if( item.type == Item::file ) + log << log2 << "Rm: deleted file "; + else + log << log2 << "Rm: deleted symlink "; + + log << item.url << logend; + + TemplatesFunctions::pattern_cacher.DeletePattern(item); + plugin.Call(WINIX_FILE_REMOVED, item.id); + db->EditThreadRemoveItem(item.parent_id); + + if( item.file_type != WINIX_ITEM_FILETYPE_NONE ) + RemoveStaticFile(item); + } + else + { + // request->status = WINIX_ERR_NO_ITEM; + } +} + + +void Rm::RemoveDirTree(long dir_id) +{ + DirContainer::ParentIterator pnext, p = system->dirs.FindFirstChild(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); + pnext = system->dirs.NextChild(p); + RemoveDirTree(p->second->id); } plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, dir_id); - rm_auth_iq.WhereParentId(dir_id); - db->GetItems(request->item_tab, rm_auth_iq); + static_iq.WhereParentId(dir_id); + db->GetItems(static_item_tab, static_iq); - for(size_t i=0 ; iitem_tab.size() ; ++i) - RemoveStaticFile(request->item_tab[i]); + for(size_t i=0 ; iDelDirById(dir_id) == WINIX_ERR_OK ) { @@ -117,115 +190,96 @@ void Rm::RemoveAllDirs(long dir_id) -void Rm::RemoveAllDirs() +void Rm::RemoveDir(const Item & dir) { - RemoveAuthPrepareQuery(); + old_url = dir.url; + RemoveDirTree(dir.id); - // this method deletes recursively all directories - RemoveAllDirs(request->dir_tab.back()->id); - request->dir_tab.erase(--request->dir_tab.end()); - - if( request->dir_tab.empty() ) - { - // we have deleted the root directory - system->dirs.CheckRootDir(); // adding a new root dir - Item * proot = system->dirs.GetRootDir(); - - if( proot ) - request->dir_tab.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_tab is empty and returns - return; - } - - system->RedirectToLastDir(); -} - - -void Rm::RemoveDir() -{ - if( request->param_tab.empty() ) - request->status = WINIX_ERR_PERMISSION_DENIED; // use parameter "r" for removing a directory - else - if( request->IsParam(L"r") ) - RemoveAllDirs(); - else - request->status = WINIX_ERR_UNKNOWN_PARAM; -} - - - -void Rm::RemoveStaticFile(Item & item) -{ - if( item.file_path.empty() ) - { - log << log1 << "Rm: can't remove a static file: file_path is empty" << logend; - return; - } - - if( !system->MakeFilePath(item, path) ) - return; - - if( ::RemoveFile(path) ) - { - log << log1 << "Rm: removed static file: " << path << logend; - item.file_path.clear(); - item.file_type = WINIX_ITEM_FILETYPE_NONE; - // we don't store it to db (will be removed or is removed already) - } - else - { - log << log1 << "Rm: can't remove a file: " << path << logend; - request->status = WINIX_ERR_PERMISSION_DENIED; - } + if( request->status == WINIX_ERR_OK ) + log << log3 << "Rm: removed directory " << old_url << logend; } void Rm::RemoveFile() { - // for safety we check if param_tab is empty - // a user can use "confirm" but can make a mistake when typing - if( !request->param_tab.empty() ) - { - request->status = WINIX_ERR_UNKNOWN_PARAM; - return; - } + RemoveFileOrSymlink(request->item); - if( db->DelItem( request->item ) ) - { - log << log2 << "Rm: 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 == system->mounts.MountTypeThread() ) - db->EditThreadRemoveItem(request->item.parent_id); - - if( request->item.file_type != WINIX_ITEM_FILETYPE_NONE ) - RemoveStaticFile(request->item); - } - else - { - request->status = WINIX_ERR_NO_ITEM; - } - - system->RedirectToLastDir(); + if( request->status == WINIX_ERR_OK ) + system->RedirectToLastDir(); } -void Rm::MakeGet() +void Rm::RemoveDirContent() { - if( request->IsParam(L"confirm") ) - return; // show confirmation dialog + if( !request->IsParam(L"r") ) + { + request->status = WINIX_ERR_PERMISSION_DENIED; + return; + } + + content_dir_iq.WhereParentId(request->dir_tab.back()->id); + db->GetItems(item_tab, content_dir_iq); + + for(size_t i=0 ; istatus == WINIX_ERR_OK ) + system->RedirectToLastDir(); +} + + + +void Rm::RemoveDir() +{ + if( !request->IsParam(L"r") || request->dir_tab.size() <= 1 ) + { + // we cannot remove the root directory (dir_tab.size()==1) + request->status = WINIX_ERR_PERMISSION_DENIED; + return; + } + + RemoveDir(*request->dir_tab.back()); + request->dir_tab.erase(--request->dir_tab.end()); + + if( request->status == WINIX_ERR_OK ) + system->RedirectToLastDir(); +} + + + + +void Rm::Clear() +{ + static_item_tab.clear(); + item_tab.clear(); +} + + + +void Rm::MakePost() +{ + Prepare(); if( request->is_item ) + { RemoveFile(); + } else - RemoveDir(); + { + if( request->IsPostVar(L"onlycontent") ) + RemoveDirContent(); + else + RemoveDir(); + } + + Clear(); } diff --git a/functions/rm.h b/functions/rm.h index d5ed609..8b655b9 100755 --- a/functions/rm.h +++ b/functions/rm.h @@ -24,19 +24,32 @@ public: Rm(); bool HasAccess(); - void MakeGet(); + void MakePost(); private: - DbItemQuery rm_auth_iq; + // for static files + DbItemQuery static_iq; + std::vector static_item_tab; std::wstring path; + // for directory content + DbItemQuery content_dir_iq; + std::vector item_tab; + + // for logging + std::wstring old_url; + bool HasAccess(const Item & item); - void RemoveAuthPrepareQuery(); - void RemoveAllDirs(long dir_id); - void RemoveAllDirs(); - void RemoveDir(); + void Prepare(); + void Clear(); + void RemoveFileOrSymlink(Item & item); + void RemoveDir(const Item & dir); + bool RemoveStaticFile(const std::wstring & path); void RemoveStaticFile(Item & item); + void RemoveDirTree(long dir_id); + void RemoveDirContent(); + void RemoveDir(); void RemoveFile(); }; diff --git a/functions/upload.cpp b/functions/upload.cpp index 4ed9a26..1f05b1d 100755 --- a/functions/upload.cpp +++ b/functions/upload.cpp @@ -66,15 +66,6 @@ return true; -void Upload::CreateThumbnail(const Item & item) -{ - if( !system->MakeFilePath(item, path) || - !system->MakeFilePath(item, path_thumb, true, true, config->upload_dirs_chmod) ) - return; - - system->thumb.CreateThumb(item.id, path, path_thumb, config->thumb_cx, config->thumb_cy, config->thumb_mode); -} - bool Upload::UploadSaveStaticFile(const Item & item, const std::wstring & tmp_filename) { @@ -112,7 +103,7 @@ void Upload::UploadFile(Item & item, const std::wstring & tmp_filename) request->status = db->EditFileById(item, item.id); if( item.file_type == WINIX_ITEM_FILETYPE_IMAGE && config->create_thumb ) - CreateThumbnail(item); + system->thumb.CreateThumb(item, config->thumb_cx, config->thumb_cy, config->thumb_mode); } else { diff --git a/functions/upload.h b/functions/upload.h index 90b24e2..30e52e3 100755 --- a/functions/upload.h +++ b/functions/upload.h @@ -25,17 +25,16 @@ public: Upload(); bool HasAccess(); void MakePost(); + void UploadFile(Item & item, const std::wstring & tmp_filename); private: - std::wstring path, path_thumb; + std::wstring path; std::string patha, path_thumba; bool HasAccess(const Item & item); - void CreateThumbnail(const Item & item); bool UploadSaveStaticFile(const Item & item, const std::wstring & tmp_filename); bool FunUploadCheckAbuse(); - void UploadFile(Item & item, const std::wstring & tmp_filename); void UploadMulti(); void UploadSingle(); }; diff --git a/html/fun_cp.html b/html/fun_cp.html index 8921994..537df8f 100755 --- a/html/fun_cp.html +++ b/html/fun_cp.html @@ -20,6 +20,7 @@ [if-no item_is] + [end]

diff --git a/html/fun_createticket.html b/html/fun_createticket.html index 0ff457d..b783b16 100755 --- a/html/fun_createticket.html +++ b/html/fun_createticket.html @@ -1,23 +1,23 @@ [# this template is used in fun_editticket.html as well] -[if-one ticket_is]

{edit_ticket_header}

[else]

{create_ticket_header}

[end] +[if item_is]

{edit_ticket_header}

[else]

{create_ticket_header}

[end] [include "error.html"] -
+
-[if-one ticket_is] +[if item_is] {form_edit_ticket_legend} [else] {form_create_ticket_legend} [end]

{title}:

- + [if ticket_tab] @@ -39,10 +39,36 @@ [end] - [if ticket_tab_is_integer] + [if-one ticket_tab_is_integer ticket_tab_is_progress ticket_tab_is_string] [end] + + [if ticket_tab_is_multistring] + + [end] + + + [if ticket_tab_is_images] + [for ticket_tab_files_tab] + [ticket_tab_value] + [end] + + + + [end] + + + [if ticket_tab_is_files] + [for ticket_tab_files_tab] + [ticket_tab_value] + [end] + + + + [end] + + @@ -55,17 +81,17 @@ [# !! change names form_emacs_content_thread and form_emacs_content_ticket]

{form_emacs_content_ticket}

- +

{form_emacs_content_type}

@@ -80,6 +106,6 @@ [end] - +
diff --git a/html/fun_default.html b/html/fun_default.html index 59bdf5d..33104da 100755 --- a/html/fun_default.html +++ b/html/fun_default.html @@ -6,7 +6,12 @@
{form_default_legend} {url}:
- + + +

+ +

+
diff --git a/html/fun_ln.html b/html/fun_ln.html new file mode 100755 index 0000000..71a5a41 --- /dev/null +++ b/html/fun_ln.html @@ -0,0 +1,31 @@ +

{ln_header}

+ +[include "error.html"] + +
+
+ {form_ln_legend} + +

{ln_info}: [dir]

+ +

{suggested_url}

+ + +

{ln_to}

+ + +

+ + +

+ +

+ +

+ + +
+
+ + + diff --git a/html/fun_ls.html b/html/fun_ls.html index e883082..a41eb84 100755 --- a/html/fun_ls.html +++ b/html/fun_ls.html @@ -47,11 +47,11 @@ [for item_tab] - - + [if item_tab_type_is_symlink]l[else][if item_tab_has_static_file]s[else]-[end][end] [item_tab_privileges] [item_tab_user] [item_tab_group] - [item_tab_url] + [item_tab_url][if item_tab_type_is_symlink] -> [item_tab_link_to][end] [end] diff --git a/html/fun_rm.html b/html/fun_rm.html index 7a3977b..a9db355 100755 --- a/html/fun_rm.html +++ b/html/fun_rm.html @@ -1,30 +1,39 @@ -[if-one item_is] +

{rm_header}

+[include "error.html"] -

{rm_file_header}

+
+
+ {rm_form_legend}

- {url}: [doc_base_url][dir][item_url]
- {title}: [item_subject] + [if item_is] + + [if item_type_is_symlink] + {rm_symlink}: [dir][item_url] + [else] + {rm_file}: [dir][item_url] + [end] + + [else] + + [if dir_is_root] + {rm_root} + [else] + {rm_dir}: [dir_without_slash] + [end] + + [end]

- - -[else] - -

{rm_dir_header}

+ [if-no item_is]

- {url}: [doc_base_url][dir] +

+ [end] - - -[end] - + + +
+
diff --git a/html/fun_showtickets.html b/html/fun_showtickets.html new file mode 100755 index 0000000..6c4bf39 --- /dev/null +++ b/html/fun_showtickets.html @@ -0,0 +1,40 @@ +[if mount_page_arg_is "subject"][dir_last_subject][end] +[if mount_page_arg_is "info"][include "dir_last_info.html"][end] + + +[if-one ticket_can_create] + +[end] + + +[if tickets_tab] + + + + + [for ticket_tab] + + [end] + + + [for tickets_tab] + + + [for tickets_tab_conf_tab] + [if tickets_tab_conf_tab_is_progress] + + [else] + + [end] + [end] + + [end] + +
{tickets_header_name}[ticket_tab_param]
[if-no tickets_tab_subject_empty][tickets_tab_subject][else]<[tickets_tab_url]>[end]progress [tickets_tab_conf_tab_value]%[tickets_tab_conf_tab_value]
+[end] + + + + diff --git a/html/fun_ticket.html b/html/fun_ticket.html index 0164097..88b5836 100755 --- a/html/fun_ticket.html +++ b/html/fun_ticket.html @@ -1,66 +1,52 @@ -[if mount_page_arg_is "subject"][dir_last_subject][end] -[if mount_page_arg_is "info"][include "dir_last_info.html"][end] +[if mount_page_arg_is "subject"][item_subject][end] +[if mount_page_arg_is "info"][include "item_info.html"][end] -[if-one ticket_can_create] + +
+ [if ticket_can_edit]

\[{edit}\]

[end] + + [for ticket_tab] + + + + + + [end] +
[ticket_tab_param]: + + [if ticket_tab_is_images] + [for ticket_tab_files_tab] + [ticket_tab_value] + [end] + [end] + + [if ticket_tab_is_files] + [for ticket_tab_files_tab] + [ticket_tab_value] + [end] + [end] + + [if-any-no ticket_tab_is_images ticket_tab_is_files] + [ticket_tab_value] + [end] + +
+ [item_print_content] +
+ +[if-one dir_can_use_emacs] [end] - -[if tickets_tab] - - - - - [for ticket_tab] - - [end] - - - [for tickets_tab] - - - [for tickets_tab_conf_tab] - - [if tickets_tab_conf_tab_is_progress] - - [else] - - [end] - [end] - - [end] - -
{tickets_header_name}[ticket_tab_param]
[if-no tickets_tab_subject_empty][tickets_tab_subject][else]<[tickets_tab_url]>[end]progress [tickets_tab_conf_tab_value]%[tickets_tab_conf_tab_value]
-[end] - - -[if-one ticket_is] -
- [if-one ticket_can_edit]

\[{edit}\]

[end] - - [for ticket_tab] - - [end] -
[ticket_tab_param]:[ticket_tab_value]
- [ticket_item_print_content] +[for item_tab] +
+ [if mount_thread_arg_is "subject"][item_tab_subject][end] + [if mount_thread_arg_is "info"][include "item_tab_info.html"][end] + [item_tab_print_content]
- - [if-one dir_can_use_emacs] - - [end] - - [for item_tab] -
- [if mount_thread_arg_is "subject"][item_tab_subject][end] - [if mount_thread_arg_is "info"][include "item_tab_info.html"][end] - [item_tab_print_content] -
- [end] [end] diff --git a/html/item_options.html b/html/item_options.html index 13d4ef5..3240799 100755 --- a/html/item_options.html +++ b/html/item_options.html @@ -25,7 +25,7 @@
  • {admin_ls}
  • [if-one dir_can_write]
  • {admin_mkdir}
  • [end] [if-one dir_can_write]
  • {admin_upload}
  • [end] - [if-any item_is item_can_remove]
  • {admin_rm}
  • [end] + [if-any item_is item_can_remove]
  • {admin_rm}
  • [end]
    [end] diff --git a/locale/en b/locale/en index 5eb5836..fa133d7 100755 --- a/locale/en +++ b/locale/en @@ -50,6 +50,7 @@ change = Change edit = Edit add = Add move = Move +copy = Copy user = User group = Group permissions = Permissions @@ -79,9 +80,19 @@ form_ticket_create_submit = Create a new ticket form_ticket_edit_submit = Edit a ticket default_header = Default item in a directory - +default_make_redirect = Make redirect form_default_legend = Default item form +ln_header = Link +ln_info = Create a link in directory +ln_to = Link pointing to +ln_hardlink = hardlink +ln_symlink = symbolic link +ln_make_redirect = Make redirect (only for symbolic links) +form_ln_legend = Link form + + + form_emacs_legend = Edit form form_emacs_content_cms = Content @@ -124,8 +135,14 @@ reload_templates = html templates reload_tickets = tickets config files -rm_file_header = Are you sure you want to delete the file? -rm_dir_header = Are you sure you want to delete the directory? +rm_header = Remove +rm_form_legend = Remove form +rm_file = Do you really want to remove file +rm_symlink = Do you really want to remove symlink +rm_dir = Do you really want to remove directory +rm_only_content = Remove only the content of the directory +rm_root = You cannot remove the root directory, you are only allowed to delete the content of the directory +rm_submit = Remove thread_create_new = Create a new thread thread_tab_title = Thread title @@ -216,6 +233,9 @@ cp_dir = Copy directory cp_only_content = Copy only content of the directory cp_remove_defaults = Remove 'default' attribute from copied directories cp_preserve_attr = Preserve attributes: user, group, times +cp_follow_symlinks = Follow symlinks + + stat_header = Stat stat_item_type = type diff --git a/locale/pl b/locale/pl index 7900107..85f89d5 100755 --- a/locale/pl +++ b/locale/pl @@ -80,9 +80,18 @@ form_ticket_create_submit = Załóż zgĹ‚oszenie form_ticket_edit_submit = Edytuj zgĹ‚oszenie default_header = DomyĹ›lna pozycja w katalogu - +default_make_redirect = Wykonaj przekierowanie form_default_legend = Formularz zmiany pozycji domyĹ›lnej +ln_header = Link +ln_info = StwĂłrz link w katalogu +ln_to = Link wskazujÄ…cy na +ln_hardlink = hard link +ln_symlink = link symboliczny +ln_make_redirect = Wykonaj przekierowanie (jedynie dla linkĂłw symbolicznych) +form_ln_legend = Formularz zmiany linku + + form_emacs_legend = Formularz edycji. form_emacs_content_cms = Zawartość: @@ -126,8 +135,14 @@ reload_templates = szablony html reload_tickets = pliki konfiguracyjne ticketĂłw -rm_file_header = Czy napewno chcesz usunąć podanÄ… pozycjÄ™? -rm_dir_header = Czy napewno chcesz usunąć podany katalog? +rm_header = UsuĹ„ +rm_form_legend = Formularz usuwania +rm_file = Czy napewno usunąć plik +rm_symlink = Czy napewno usunąć symlink +rm_dir = Czy napewno usunąć katalog +rm_only_content = UsuĹ„ jedynie zawartość katalogu +rm_root = Nie moĹĽesz skasować katalogu gĹ‚Ăłwnego, moĹĽesz jedynie usunąć jego zawartość +rm_submit = UsuĹ„ thread_create_new = Załóż nowy wÄ…tek thread_tab_title = TytuĹ‚ wÄ…tku @@ -220,6 +235,8 @@ cp_dir = Kopiuj katalog cp_only_content = Kopiuj tylko zawartość katalogu cp_remove_defaults = UsuĹ„ atrybut 'default' z kopiowanych katalogĂłw cp_preserve_attr = Zachowaj atrybuty: uĹĽytkownik, grupa, czas +cp_follow_symlinks = PodÄ…ĹĽaj za linkami symbolicznymi + stat_header = Stat diff --git a/main/Makefile.dep b/main/Makefile.dep index b322329..99a5935 100755 --- a/main/Makefile.dep +++ b/main/Makefile.dep @@ -29,8 +29,9 @@ main.o: ../core/synchro.h ../functions/functionparser.h main.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h main.o: ../functions/privchanger.h ../functions/chown.h main.o: ../functions/ckeditor.h ../functions/cp.h ../functions/createthread.h -main.o: ../functions/default.h ../functions/download.h ../functions/emacs.h -main.o: ../functions/last.h ../functions/login.h ../functions/logout.h +main.o: ../functions/functionbase.h ../functions/default.h +main.o: ../functions/download.h ../functions/emacs.h ../functions/last.h +main.o: ../functions/login.h ../functions/logout.h ../functions/ln.h main.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h main.o: ../functions/node.h ../functions/priv.h ../functions/reload.h main.o: ../functions/rm.h ../functions/run.h ../functions/specialdefault.h diff --git a/main/main.cpp b/main/main.cpp index 599a63f..a523e13 100755 --- a/main/main.cpp +++ b/main/main.cpp @@ -69,13 +69,15 @@ int main(int argv, char ** argc) app.stdout_is_closed = true; } - log.Init(app.config.log_level, app.config.log_file, app.config.log_stdout, app.config.log_request); - nlog.Init(app.config.log_level, app.config.log_notify_file, false, 1); + log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file, + app.config.log_stdout, app.config.log_request); - log << log3 << "-- preparing to start winix --" << logend << logsavenow; + nlog.Init(app.config.log_level, true, app.config.log_notify_file, false, 1); + + log << log3 << "-- preparing to start winix --" << logend; if( !app.InitFCGI() ) - return false; // !! dodac logsave do logow + return false; if( !app.DropPrivileges() ) return 3; @@ -98,13 +100,7 @@ int main(int argv, char ** argc) return 1; log.PutDate(log1); - log << "winix started" << logend << logsavenow; - - // !! wywalic to sprawdzanie - //log << log2 << "checking for table consistency:" << logend; - // !! zrobic wyjatek dla root - //app.db.CheckAllUrlSubject(); - + log << "winix started" << logend << logsave; app.StartThreads(); // now we have more threads, we should use Lock() and Unlock() @@ -121,7 +117,7 @@ int main(int argv, char ** argc) // now all others threads are terminated log.PutDate(log1); - log << "winix stopped" << logend << logsavenow; + log << "winix stopped" << logend << logsave; return 0; } diff --git a/notify/Makefile.dep b/notify/Makefile.dep index 355c6a8..5745f5e 100755 --- a/notify/Makefile.dep +++ b/notify/Makefile.dep @@ -33,13 +33,14 @@ notify.o: ../functions/functionbase.h ../functions/functionparser.h notify.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h notify.o: ../functions/privchanger.h ../functions/chown.h notify.o: ../functions/ckeditor.h ../functions/cp.h -notify.o: ../functions/createthread.h ../functions/default.h -notify.o: ../functions/download.h ../functions/emacs.h ../functions/last.h -notify.o: ../functions/login.h ../functions/logout.h ../functions/ls.h -notify.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -notify.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h -notify.o: ../functions/run.h ../functions/specialdefault.h -notify.o: ../functions/stat.h ../functions/subject.h ../functions/funthread.h +notify.o: ../functions/createthread.h ../functions/functionbase.h +notify.o: ../functions/default.h ../functions/download.h ../functions/emacs.h +notify.o: ../functions/last.h ../functions/login.h ../functions/logout.h +notify.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +notify.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +notify.o: ../functions/reload.h ../functions/rm.h ../functions/run.h +notify.o: ../functions/specialdefault.h ../functions/stat.h +notify.o: ../functions/subject.h ../functions/funthread.h notify.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h notify.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h notify.o: ../functions/vim.h ../core/htmlfilter.h @@ -92,13 +93,13 @@ templatesnotify.o: ../functions/functionparser.h ../functions/adduser.h templatesnotify.o: ../functions/cat.h ../functions/chmod.h templatesnotify.o: ../functions/privchanger.h ../functions/chown.h templatesnotify.o: ../functions/ckeditor.h ../functions/cp.h -templatesnotify.o: ../functions/createthread.h ../functions/default.h -templatesnotify.o: ../functions/download.h ../functions/emacs.h -templatesnotify.o: ../functions/last.h ../functions/login.h -templatesnotify.o: ../functions/logout.h ../functions/ls.h -templatesnotify.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h -templatesnotify.o: ../functions/priv.h ../functions/reload.h -templatesnotify.o: ../functions/rm.h ../functions/run.h +templatesnotify.o: ../functions/createthread.h ../functions/functionbase.h +templatesnotify.o: ../functions/default.h ../functions/download.h +templatesnotify.o: ../functions/emacs.h ../functions/last.h +templatesnotify.o: ../functions/login.h ../functions/logout.h +templatesnotify.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h +templatesnotify.o: ../functions/mv.h ../functions/node.h ../functions/priv.h +templatesnotify.o: ../functions/reload.h ../functions/rm.h ../functions/run.h templatesnotify.o: ../functions/specialdefault.h ../functions/stat.h templatesnotify.o: ../functions/subject.h ../functions/funthread.h templatesnotify.o: ../functions/template.h ../functions/tinymce.h diff --git a/notify/notifythread.cpp b/notify/notifythread.cpp index 748531a..81bc990 100755 --- a/notify/notifythread.cpp +++ b/notify/notifythread.cpp @@ -211,8 +211,7 @@ void NotifyThread::SendMail(const std::wstring & email, const std::wstring & mes SendMail(sendmail, message); pclose(sendmail); - nlog << log1 << "NotifyThread: email to: " << email << " has been sent" << logend; - nlog << logsave; + nlog << log1 << "NotifyThread: email to: " << email << " has been sent" << logend << logsave; } diff --git a/plugins/stats/Makefile.dep b/plugins/stats/Makefile.dep index b5cb1b3..9945150 100755 --- a/plugins/stats/Makefile.dep +++ b/plugins/stats/Makefile.dep @@ -35,11 +35,12 @@ init.o: ../../functions/functionparser.h ../../functions/adduser.h init.o: ../../functions/cat.h ../../functions/chmod.h init.o: ../../functions/privchanger.h ../../functions/chown.h init.o: ../../functions/ckeditor.h ../../functions/cp.h -init.o: ../../functions/createthread.h ../../functions/default.h -init.o: ../../functions/download.h ../../functions/emacs.h -init.o: ../../functions/last.h ../../functions/login.h -init.o: ../../functions/logout.h ../../functions/ls.h ../../functions/mkdir.h -init.o: ../../functions/mv.h ../../functions/node.h ../../functions/priv.h +init.o: ../../functions/createthread.h ../../functions/functionbase.h +init.o: ../../functions/default.h ../../functions/download.h +init.o: ../../functions/emacs.h ../../functions/last.h +init.o: ../../functions/login.h ../../functions/logout.h ../../functions/ln.h +init.o: ../../functions/ls.h ../../functions/mkdir.h ../../functions/mv.h +init.o: ../../functions/node.h ../../functions/priv.h init.o: ../../functions/reload.h ../../functions/rm.h ../../functions/run.h init.o: ../../functions/specialdefault.h ../../functions/stat.h init.o: ../../functions/subject.h ../../functions/funthread.h @@ -89,10 +90,11 @@ templates.o: ../../functions/functionparser.h ../../functions/adduser.h templates.o: ../../functions/cat.h ../../functions/chmod.h templates.o: ../../functions/privchanger.h ../../functions/chown.h templates.o: ../../functions/ckeditor.h ../../functions/cp.h -templates.o: ../../functions/createthread.h ../../functions/default.h -templates.o: ../../functions/download.h ../../functions/emacs.h -templates.o: ../../functions/last.h ../../functions/login.h -templates.o: ../../functions/logout.h ../../functions/ls.h +templates.o: ../../functions/createthread.h ../../functions/functionbase.h +templates.o: ../../functions/default.h ../../functions/download.h +templates.o: ../../functions/emacs.h ../../functions/last.h +templates.o: ../../functions/login.h ../../functions/logout.h +templates.o: ../../functions/ln.h ../../functions/ls.h templates.o: ../../functions/mkdir.h ../../functions/mv.h templates.o: ../../functions/node.h ../../functions/priv.h templates.o: ../../functions/reload.h ../../functions/rm.h diff --git a/plugins/thread/Makefile b/plugins/thread/Makefile new file mode 100755 index 0000000..31cd118 --- /dev/null +++ b/plugins/thread/Makefile @@ -0,0 +1,27 @@ +include Makefile.o.dep + +name = thread.so + + +all: $(o) + $(CXX) -shared -Wl,-soname,$(name).so -o $(name) $(CXXFLAGS) *.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 + rm -f $(name) + +include Makefile.dep diff --git a/plugins/thread/Makefile.dep b/plugins/thread/Makefile.dep new file mode 100755 index 0000000..4b9b5bc --- /dev/null +++ b/plugins/thread/Makefile.dep @@ -0,0 +1,374 @@ +# DO NOT DELETE + +createticket.o: createticket.h tdb.h ticket.h ../../db/dbbase.h +createticket.o: ../../db/dbconn.h ../../db/dbtextstream.h +createticket.o: ../../core/textstream.h ../../core/misc.h ../../core/item.h +createticket.o: ../../core/error.h ../../core/log.h ../../core/textstream.h +createticket.o: ../../functions/functionbase.h ../../core/item.h +createticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h +createticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +createticket.o: ../../core/thread.h ../../core/dircontainer.h +createticket.o: ../../core/ugcontainer.h ../../core/request.h +createticket.o: ../../core/requesttypes.h ../../core/session.h +createticket.o: ../../core/error.h ../../core/user.h ../../core/plugindata.h +createticket.o: ../../core/rebus.h ../../core/config.h +createticket.o: ../../core/confparser.h ../../core/htmlfilter.h +createticket.o: ../../templates/htmltextstream.h ../../core/config.h +createticket.o: ../../core/system.h ../../core/dirs.h +createticket.o: ../../core/dircontainer.h ../../core/request.h +createticket.o: ../../notify/notify.h ../../notify/notifypool.h +createticket.o: ../../templates/locale.h ../../core/confparser.h +createticket.o: ../../templates/misc.h ../../templates/localefilter.h +createticket.o: ../../templates/locale.h ../../../ezc/src/ezc.h +createticket.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h +createticket.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h +createticket.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h +createticket.o: ../../templates/htmltextstream.h ../../notify/notifythread.h +createticket.o: ../../core/basethread.h ../../core/synchro.h +createticket.o: ../../notify/templatesnotify.h ../../core/users.h +createticket.o: ../../core/ugcontainer.h ../../core/lastcontainer.h +createticket.o: ../../core/mounts.h ../../core/mount.h +createticket.o: ../../core/mountparser.h ../../core/users.h +createticket.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h +createticket.o: ../../core/thumb.h ../../core/basethread.h +createticket.o: ../../core/synchro.h ticketinfo.h ticketparser.h ticketconf.h +createticket.o: ../../functions/functions.h ../../functions/functionbase.h +createticket.o: ../../functions/functionparser.h ../../functions/adduser.h +createticket.o: ../../functions/cat.h ../../functions/chmod.h +createticket.o: ../../functions/privchanger.h ../../functions/chown.h +createticket.o: ../../functions/ckeditor.h ../../functions/cp.h +createticket.o: ../../functions/createthread.h ../../functions/default.h +createticket.o: ../../functions/download.h ../../functions/emacs.h +createticket.o: ../../functions/last.h ../../functions/login.h +createticket.o: ../../functions/logout.h ../../functions/ln.h +createticket.o: ../../functions/ls.h ../../functions/mkdir.h +createticket.o: ../../functions/mv.h ../../functions/node.h +createticket.o: ../../functions/priv.h ../../functions/reload.h +createticket.o: ../../functions/rm.h ../../functions/run.h +createticket.o: ../../functions/specialdefault.h ../../functions/stat.h +createticket.o: ../../functions/subject.h ../../functions/funthread.h +createticket.o: ../../functions/template.h ../../functions/tinymce.h +createticket.o: ../../functions/uname.h ../../functions/upload.h +createticket.o: ../../functions/uptime.h ../../functions/who.h +createticket.o: ../../functions/vim.h ../../core/htmlfilter.h sessiondata.h +createticket.o: ../../core/plugindata.h +editticket.o: editticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h +editticket.o: ../../db/dbtextstream.h ../../core/textstream.h +editticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h +editticket.o: ../../core/log.h ../../core/textstream.h ticketinfo.h +editticket.o: ticketparser.h ticketconf.h ../../core/item.h +editticket.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h +editticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h +editticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +editticket.o: ../../core/thread.h ../../core/dircontainer.h +editticket.o: ../../core/ugcontainer.h ../../core/request.h +editticket.o: ../../notify/notify.h ../../notify/notifypool.h +editticket.o: ../../templates/locale.h ../../core/confparser.h +editticket.o: ../../templates/misc.h ../../templates/localefilter.h +editticket.o: ../../templates/locale.h ../../../ezc/src/ezc.h +editticket.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h +editticket.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h +editticket.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h +editticket.o: ../../templates/htmltextstream.h ../../notify/notifythread.h +editticket.o: ../../core/basethread.h ../../core/synchro.h +editticket.o: ../../notify/templatesnotify.h ../../core/config.h +editticket.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h +editticket.o: ../../core/lastcontainer.h ../../core/mounts.h +editticket.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h +editticket.o: ../../core/config.h ../../core/confparser.h +editticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h +editticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h +editticket.o: ../../core/thumb.h ../../core/basethread.h +editticket.o: ../../functions/functions.h ../../functions/functionbase.h +editticket.o: ../../functions/functionparser.h ../../core/request.h +editticket.o: ../../core/requesttypes.h ../../core/session.h +editticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h +editticket.o: ../../functions/adduser.h ../../functions/cat.h +editticket.o: ../../functions/chmod.h ../../functions/privchanger.h +editticket.o: ../../functions/chown.h ../../functions/ckeditor.h +editticket.o: ../../functions/cp.h ../../functions/createthread.h +editticket.o: ../../functions/default.h ../../functions/download.h +editticket.o: ../../functions/emacs.h ../../functions/last.h +editticket.o: ../../functions/login.h ../../functions/logout.h +editticket.o: ../../functions/ln.h ../../functions/ls.h +editticket.o: ../../functions/mkdir.h ../../functions/mv.h +editticket.o: ../../functions/node.h ../../functions/priv.h +editticket.o: ../../functions/reload.h ../../functions/rm.h +editticket.o: ../../functions/run.h ../../functions/specialdefault.h +editticket.o: ../../functions/stat.h ../../functions/subject.h +editticket.o: ../../functions/funthread.h ../../functions/template.h +editticket.o: ../../functions/tinymce.h ../../functions/uname.h +editticket.o: ../../functions/upload.h ../../functions/uptime.h +editticket.o: ../../functions/who.h ../../functions/vim.h +editticket.o: ../../core/htmlfilter.h ../../functions/functionbase.h +editticket.o: ../../core/synchro.h sessiondata.h ../../core/plugindata.h +funticket.o: funticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h +funticket.o: ../../db/dbtextstream.h ../../core/textstream.h +funticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h +funticket.o: ../../core/log.h ../../core/textstream.h ticketinfo.h +funticket.o: ticketparser.h ticketconf.h ../../core/item.h +funticket.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h +funticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h +funticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +funticket.o: ../../core/thread.h ../../core/dircontainer.h +funticket.o: ../../core/ugcontainer.h ../../core/request.h +funticket.o: ../../notify/notify.h ../../notify/notifypool.h +funticket.o: ../../templates/locale.h ../../core/confparser.h +funticket.o: ../../templates/misc.h ../../templates/localefilter.h +funticket.o: ../../templates/locale.h ../../../ezc/src/ezc.h +funticket.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h +funticket.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h +funticket.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h +funticket.o: ../../templates/htmltextstream.h ../../notify/notifythread.h +funticket.o: ../../core/basethread.h ../../core/synchro.h +funticket.o: ../../notify/templatesnotify.h ../../core/config.h +funticket.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h +funticket.o: ../../core/lastcontainer.h ../../core/mounts.h +funticket.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h +funticket.o: ../../core/config.h ../../core/confparser.h +funticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h +funticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h +funticket.o: ../../core/thumb.h ../../core/basethread.h +funticket.o: ../../functions/functions.h ../../functions/functionbase.h +funticket.o: ../../functions/functionparser.h ../../core/request.h +funticket.o: ../../core/requesttypes.h ../../core/session.h +funticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h +funticket.o: ../../functions/adduser.h ../../functions/cat.h +funticket.o: ../../functions/chmod.h ../../functions/privchanger.h +funticket.o: ../../functions/chown.h ../../functions/ckeditor.h +funticket.o: ../../functions/cp.h ../../functions/createthread.h +funticket.o: ../../functions/default.h ../../functions/download.h +funticket.o: ../../functions/emacs.h ../../functions/last.h +funticket.o: ../../functions/login.h ../../functions/logout.h +funticket.o: ../../functions/ln.h ../../functions/ls.h +funticket.o: ../../functions/mkdir.h ../../functions/mv.h +funticket.o: ../../functions/node.h ../../functions/priv.h +funticket.o: ../../functions/reload.h ../../functions/rm.h +funticket.o: ../../functions/run.h ../../functions/specialdefault.h +funticket.o: ../../functions/stat.h ../../functions/subject.h +funticket.o: ../../functions/funthread.h ../../functions/template.h +funticket.o: ../../functions/tinymce.h ../../functions/uname.h +funticket.o: ../../functions/upload.h ../../functions/uptime.h +funticket.o: ../../functions/who.h ../../functions/vim.h +funticket.o: ../../core/htmlfilter.h ../../functions/functionbase.h +funticket.o: ../../core/synchro.h +init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h +init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h +init.o: ../../core/item.h ../../core/error.h ../../core/log.h +init.o: ../../core/textstream.h funticket.h ticketinfo.h ticketparser.h +init.o: ticketconf.h ../../core/item.h ../../core/system.h ../../core/dirs.h +init.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h +init.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h ../../core/user.h +init.o: ../../core/group.h ../../core/thread.h ../../core/dircontainer.h +init.o: ../../core/ugcontainer.h ../../core/request.h ../../notify/notify.h +init.o: ../../notify/notifypool.h ../../templates/locale.h +init.o: ../../core/confparser.h ../../templates/misc.h +init.o: ../../templates/localefilter.h ../../templates/locale.h +init.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h +init.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h +init.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h +init.o: ../../../ezc/src/stringconv.h ../../templates/htmltextstream.h +init.o: ../../notify/notifythread.h ../../core/basethread.h +init.o: ../../core/synchro.h ../../notify/templatesnotify.h +init.o: ../../core/config.h ../../core/users.h ../../core/user.h +init.o: ../../core/ugcontainer.h ../../core/lastcontainer.h +init.o: ../../core/mounts.h ../../core/mount.h ../../core/error.h +init.o: ../../core/mountparser.h ../../core/config.h ../../core/confparser.h +init.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h +init.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h +init.o: ../../core/thumb.h ../../core/basethread.h +init.o: ../../functions/functions.h ../../functions/functionbase.h +init.o: ../../functions/functionparser.h ../../core/request.h +init.o: ../../core/requesttypes.h ../../core/session.h +init.o: ../../core/plugindata.h ../../templates/htmltextstream.h +init.o: ../../functions/adduser.h ../../functions/cat.h +init.o: ../../functions/chmod.h ../../functions/privchanger.h +init.o: ../../functions/chown.h ../../functions/ckeditor.h +init.o: ../../functions/cp.h ../../functions/createthread.h +init.o: ../../functions/default.h ../../functions/download.h +init.o: ../../functions/emacs.h ../../functions/last.h +init.o: ../../functions/login.h ../../functions/logout.h ../../functions/ln.h +init.o: ../../functions/ls.h ../../functions/mkdir.h ../../functions/mv.h +init.o: ../../functions/node.h ../../functions/priv.h +init.o: ../../functions/reload.h ../../functions/rm.h ../../functions/run.h +init.o: ../../functions/specialdefault.h ../../functions/stat.h +init.o: ../../functions/subject.h ../../functions/funthread.h +init.o: ../../functions/template.h ../../functions/tinymce.h +init.o: ../../functions/uname.h ../../functions/upload.h +init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h +init.o: ../../core/htmlfilter.h ../../functions/functionbase.h +init.o: ../../core/synchro.h editticket.h createticket.h showtickets.h +init.o: ../../core/log.h ../../core/plugin.h ../../core/pluginmsg.h +init.o: ../../core/system.h ../../core/sessionmanager.h +init.o: ../../core/sessioncontainer.h ../../templates/templates.h +init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h +init.o: ../../core/httpsimpleparser.h ../../core/log.h +init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h +init.o: sessiondata.h ../../core/plugindata.h +sessiondata.o: sessiondata.h ../../core/plugindata.h ticket.h +showtickets.o: showtickets.h tdb.h ticket.h ../../db/dbbase.h +showtickets.o: ../../db/dbconn.h ../../db/dbtextstream.h +showtickets.o: ../../core/textstream.h ../../core/misc.h ../../core/item.h +showtickets.o: ../../core/error.h ../../core/log.h ../../core/textstream.h +showtickets.o: ticketinfo.h ticketparser.h ticketconf.h ../../core/item.h +showtickets.o: ../../core/system.h ../../core/dirs.h +showtickets.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h +showtickets.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h +showtickets.o: ../../core/user.h ../../core/group.h ../../core/thread.h +showtickets.o: ../../core/dircontainer.h ../../core/ugcontainer.h +showtickets.o: ../../core/request.h ../../notify/notify.h +showtickets.o: ../../notify/notifypool.h ../../templates/locale.h +showtickets.o: ../../core/confparser.h ../../templates/misc.h +showtickets.o: ../../templates/localefilter.h ../../templates/locale.h +showtickets.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h +showtickets.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h +showtickets.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h +showtickets.o: ../../../ezc/src/stringconv.h ../../templates/htmltextstream.h +showtickets.o: ../../notify/notifythread.h ../../core/basethread.h +showtickets.o: ../../core/synchro.h ../../notify/templatesnotify.h +showtickets.o: ../../core/config.h ../../core/users.h ../../core/user.h +showtickets.o: ../../core/ugcontainer.h ../../core/lastcontainer.h +showtickets.o: ../../core/mounts.h ../../core/mount.h ../../core/error.h +showtickets.o: ../../core/mountparser.h ../../core/config.h +showtickets.o: ../../core/confparser.h ../../core/htmlfilter.h +showtickets.o: ../../core/users.h ../../core/groups.h ../../core/group.h +showtickets.o: ../../core/rebus.h ../../core/loadavg.h ../../core/thumb.h +showtickets.o: ../../core/basethread.h ../../functions/functions.h +showtickets.o: ../../functions/functionbase.h +showtickets.o: ../../functions/functionparser.h ../../core/request.h +showtickets.o: ../../core/requesttypes.h ../../core/session.h +showtickets.o: ../../core/plugindata.h ../../templates/htmltextstream.h +showtickets.o: ../../functions/adduser.h ../../functions/cat.h +showtickets.o: ../../functions/chmod.h ../../functions/privchanger.h +showtickets.o: ../../functions/chown.h ../../functions/ckeditor.h +showtickets.o: ../../functions/cp.h ../../functions/createthread.h +showtickets.o: ../../functions/default.h ../../functions/download.h +showtickets.o: ../../functions/emacs.h ../../functions/last.h +showtickets.o: ../../functions/login.h ../../functions/logout.h +showtickets.o: ../../functions/ln.h ../../functions/ls.h +showtickets.o: ../../functions/mkdir.h ../../functions/mv.h +showtickets.o: ../../functions/node.h ../../functions/priv.h +showtickets.o: ../../functions/reload.h ../../functions/rm.h +showtickets.o: ../../functions/run.h ../../functions/specialdefault.h +showtickets.o: ../../functions/stat.h ../../functions/subject.h +showtickets.o: ../../functions/funthread.h ../../functions/template.h +showtickets.o: ../../functions/tinymce.h ../../functions/uname.h +showtickets.o: ../../functions/upload.h ../../functions/uptime.h +showtickets.o: ../../functions/who.h ../../functions/vim.h +showtickets.o: ../../core/htmlfilter.h ../../functions/functionbase.h +showtickets.o: ../../core/synchro.h +tdb.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h +tdb.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h +tdb.o: ../../core/item.h ../../core/error.h ../../core/log.h +tdb.o: ../../core/textstream.h ../../core/log.h +templates.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h +templates.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h +templates.o: ../../core/item.h ../../../ezc/src/functions.h +templates.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h +templates.o: ticketinfo.h ticket.h ticketparser.h ticketconf.h +templates.o: ../../core/item.h ../../core/system.h ../../core/dirs.h +templates.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h +templates.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h +templates.o: ../../core/user.h ../../core/group.h ../../core/thread.h +templates.o: ../../core/dircontainer.h ../../core/ugcontainer.h +templates.o: ../../core/log.h ../../core/textstream.h ../../core/request.h +templates.o: ../../notify/notify.h ../../notify/notifypool.h +templates.o: ../../templates/locale.h ../../core/confparser.h +templates.o: ../../templates/misc.h ../../templates/localefilter.h +templates.o: ../../templates/locale.h ../../templates/htmltextstream.h +templates.o: ../../notify/notifythread.h ../../core/basethread.h +templates.o: ../../core/synchro.h ../../notify/templatesnotify.h +templates.o: ../../core/textstream.h ../../core/misc.h ../../core/config.h +templates.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h +templates.o: ../../core/lastcontainer.h ../../core/mounts.h +templates.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h +templates.o: ../../core/config.h ../../core/confparser.h +templates.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h +templates.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h +templates.o: ../../core/thumb.h ../../core/basethread.h +templates.o: ../../functions/functions.h ../../functions/functionbase.h +templates.o: ../../functions/functionparser.h ../../core/request.h +templates.o: ../../core/requesttypes.h ../../core/session.h +templates.o: ../../core/plugindata.h ../../templates/htmltextstream.h +templates.o: ../../functions/adduser.h ../../functions/cat.h +templates.o: ../../functions/chmod.h ../../functions/privchanger.h +templates.o: ../../functions/chown.h ../../functions/ckeditor.h +templates.o: ../../functions/cp.h ../../functions/createthread.h +templates.o: ../../functions/default.h ../../functions/download.h +templates.o: ../../functions/emacs.h ../../functions/last.h +templates.o: ../../functions/login.h ../../functions/logout.h +templates.o: ../../functions/ln.h ../../functions/ls.h +templates.o: ../../functions/mkdir.h ../../functions/mv.h +templates.o: ../../functions/node.h ../../functions/priv.h +templates.o: ../../functions/reload.h ../../functions/rm.h +templates.o: ../../functions/run.h ../../functions/specialdefault.h +templates.o: ../../functions/stat.h ../../functions/subject.h +templates.o: ../../functions/funthread.h ../../functions/template.h +templates.o: ../../functions/tinymce.h ../../functions/uname.h +templates.o: ../../functions/upload.h ../../functions/uptime.h +templates.o: ../../functions/who.h ../../functions/vim.h +templates.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h +templates.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h +templates.o: editticket.h ../../functions/functionbase.h ../../core/synchro.h +templates.o: createticket.h ../../core/misc.h ../../core/plugin.h +templates.o: ../../core/pluginmsg.h ../../core/system.h +templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h +templates.o: ../../templates/templates.h ../../templates/patterncacher.h +templates.o: ../../templates/ckeditorgetparser.h +templates.o: ../../core/httpsimpleparser.h ../../core/log.h +templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h +templates.o: sessiondata.h ../../core/plugindata.h +ticketconf.o: ticketconf.h +ticketinfo.o: ticketinfo.h ticket.h ticketparser.h ticketconf.h +ticketinfo.o: ../../core/item.h ../../core/system.h ../../core/dirs.h +ticketinfo.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h +ticketinfo.o: ../../db/dbbase.h ../../db/dbitemquery.h +ticketinfo.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +ticketinfo.o: ../../core/thread.h ../../core/dircontainer.h +ticketinfo.o: ../../core/ugcontainer.h ../../core/log.h +ticketinfo.o: ../../core/textstream.h ../../core/request.h +ticketinfo.o: ../../notify/notify.h ../../notify/notifypool.h +ticketinfo.o: ../../templates/locale.h ../../core/confparser.h +ticketinfo.o: ../../templates/misc.h ../../templates/localefilter.h +ticketinfo.o: ../../templates/locale.h ../../../ezc/src/ezc.h +ticketinfo.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h +ticketinfo.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h +ticketinfo.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h +ticketinfo.o: ../../templates/htmltextstream.h ../../notify/notifythread.h +ticketinfo.o: ../../core/basethread.h ../../core/synchro.h +ticketinfo.o: ../../notify/templatesnotify.h ../../core/textstream.h +ticketinfo.o: ../../core/misc.h ../../core/config.h ../../core/users.h +ticketinfo.o: ../../core/user.h ../../core/ugcontainer.h +ticketinfo.o: ../../core/lastcontainer.h ../../core/mounts.h +ticketinfo.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h +ticketinfo.o: ../../core/config.h ../../core/confparser.h +ticketinfo.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h +ticketinfo.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h +ticketinfo.o: ../../core/thumb.h ../../core/basethread.h +ticketinfo.o: ../../functions/functions.h ../../functions/functionbase.h +ticketinfo.o: ../../functions/functionparser.h ../../core/request.h +ticketinfo.o: ../../core/requesttypes.h ../../core/session.h +ticketinfo.o: ../../core/plugindata.h ../../templates/htmltextstream.h +ticketinfo.o: ../../functions/adduser.h ../../functions/cat.h +ticketinfo.o: ../../functions/chmod.h ../../functions/privchanger.h +ticketinfo.o: ../../functions/chown.h ../../functions/ckeditor.h +ticketinfo.o: ../../functions/cp.h ../../functions/createthread.h +ticketinfo.o: ../../functions/default.h ../../functions/download.h +ticketinfo.o: ../../functions/emacs.h ../../functions/last.h +ticketinfo.o: ../../functions/login.h ../../functions/logout.h +ticketinfo.o: ../../functions/ln.h ../../functions/ls.h +ticketinfo.o: ../../functions/mkdir.h ../../functions/mv.h +ticketinfo.o: ../../functions/node.h ../../functions/priv.h +ticketinfo.o: ../../functions/reload.h ../../functions/rm.h +ticketinfo.o: ../../functions/run.h ../../functions/specialdefault.h +ticketinfo.o: ../../functions/stat.h ../../functions/subject.h +ticketinfo.o: ../../functions/funthread.h ../../functions/template.h +ticketinfo.o: ../../functions/tinymce.h ../../functions/uname.h +ticketinfo.o: ../../functions/upload.h ../../functions/uptime.h +ticketinfo.o: ../../functions/who.h ../../functions/vim.h +ticketinfo.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h +ticketinfo.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h +ticketinfo.o: ../../core/log.h ../../core/misc.h sessiondata.h +ticketinfo.o: ../../core/plugindata.h +ticketparser.o: ticketparser.h ticketconf.h ../../core/log.h +ticketparser.o: ../../core/misc.h diff --git a/plugins/thread/Makefile.o.dep b/plugins/thread/Makefile.o.dep new file mode 100755 index 0000000..6a40f3d --- /dev/null +++ b/plugins/thread/Makefile.o.dep @@ -0,0 +1 @@ +o = createticket.o editticket.o funticket.o init.o sessiondata.o showtickets.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o diff --git a/plugins/thread/init.cpp b/plugins/thread/init.cpp new file mode 100755 index 0000000..4960d1b --- /dev/null +++ b/plugins/thread/init.cpp @@ -0,0 +1,141 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "tdb.h" +#include "funthread.h" +#include "createthread.h" +#include "showthreads.h" +#include "core/log.h" +#include "core/plugin.h" + + +extern "C" void Init(PluginInfo &); + + +namespace Thread +{ +const wchar_t plugin_name[] = L"thread"; + +TDb tdb; +ThreadInfo thread_info; + +FunThread fun_thread; +CreateThread fun_create_thread; +ShowThreads fun_show_threads; + + +void AddFunctions(PluginInfo & info) +{ + info.functions->Add(fun_thread); + info.functions->Add(fun_create_thread); +} + + +void SelectDefaultFunction(PluginInfo & info) +{ + if( info.system->mounts.pmount->type == thread_info.mount_type_thread ) + { + if( info.request->is_item ) + info.request->function = &fun_thread; + else + info.request->function = &fun_show_threads; + } +} + + +void AddMounts(PluginInfo & info) +{ + Mounts & m = info.system->mounts; + + ticket_info.mount_type_thread = m.AddMountType(L"thread"); + ticket_info.mount_par_thread_enable = m.AddMountPar(L"thread_enable"); +} + + + + + + +void ProcessRequest(PluginInfo & info) +{ + if( info.request->function == &info.functions->fun_reload ) + { + if( info.request->IsParam(L"tickets") ) + ticket_info.ReadTicketConf(); + } +} + + + +void RemoveThread(PluginInfo & i) +{ + +} + + +void InitTicket(PluginInfo & info) +{ +} + + +void AddNotifyTemplate(PluginInfo & info) +{ + ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_thread.txt"); +} + + + + +void AddEzcFunctions(PluginInfo & info); + +} // namespace Thread + + + +void Init(PluginInfo & info) +{ +using namespace Ticket; + + plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions); + plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction); + plugin.Assign(WINIX_ADD_MOUNTS, AddMounts); + plugin.Assign(WINIX_FILE_REMOVED, RemoveThread); + plugin.Assign(WINIX_PLUGIN_INIT, InitTicket); + plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate); + + plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions); + plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest); + + tdb.SetConn(info.db->GetConn()); + tdb.LogQueries(info.config->log_db_query); + + ticket_info.SetDb(info.db); + ticket_info.SetTDb(&tdb); + ticket_info.SetConfig(info.config); + ticket_info.SetSystem(info.system); + ticket_info.SetRequest(info.request); + ticket_info.SetFunctions(info.functions); + ticket_info.plugin_id = info.plugin_id; + + fun_ticket.SetTDb(&tdb); + fun_ticket.SetTicketInfo(&ticket_info); + + fun_edit_ticket.SetTDb(&tdb); + fun_edit_ticket.SetTicketInfo(&ticket_info); + + fun_create_ticket.SetTDb(&tdb); + fun_create_ticket.SetTicketInfo(&ticket_info); + + fun_show_tickets.SetTDb(&tdb); + fun_show_tickets.SetTicketInfo(&ticket_info); + + info.p1 = (void*)(plugin_name); +} + + diff --git a/plugins/thread/showthreads.cpp b/plugins/thread/showthreads.cpp new file mode 100755 index 0000000..b5fca63 --- /dev/null +++ b/plugins/thread/showthreads.cpp @@ -0,0 +1,23 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "showthreads.h" +#include "functions.h" + + +namespace Thread +{ + + + + + + + +} // namespace diff --git a/plugins/thread/showthreads.h b/plugins/thread/showthreads.h new file mode 100755 index 0000000..8e7aab6 --- /dev/null +++ b/plugins/thread/showthreads.h @@ -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 headerfile_winix_plugins_thread_showthreads +#define headerfile_winix_plugins_thread_showthreads + +#include "functions/functionbase.h" + + + +namespace Thread +{ + + +class ShowThreads : public FunctionBase +{ +public: + + bool HasAccess(); + void MakePost(); + +private: + +}; + + +} // namespace + +#endif diff --git a/plugins/thread/tdb.cpp b/plugins/thread/tdb.cpp new file mode 100755 index 0000000..f46c226 --- /dev/null +++ b/plugins/thread/tdb.cpp @@ -0,0 +1,277 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "tdb.h" +#include "core/log.h" + + + +namespace Thread +{ + + + +Error Db::GetThreadByDirId(long dir_id, Thread & thread) +{ + PGresult * r = 0; + Error status = WINIX_ERR_OK; + + try + { + query.Clear(); + query << R("select thread.id, thread.parent_id, thread.dir_id, thread.closed, thread.items, " + "thread.last_item, item.date_modification, item.user_id " + "from core.thread left join core.item on thread.last_item = item.id " + "where thread.dir_id = ") << dir_id << R(";"); + + r = AssertQuery(query); + AssertResult(r, PGRES_TUPLES_OK); + + int rows = Rows(r); + + if( rows > 1 ) + log << log1 << "Db: there is more than one thread with dir_id: " << dir_id << logend; + else + if( rows == 0 ) + throw Error(WINIX_ERR_NO_THREAD); + + int cid = AssertColumn(r, "id"); + int cparent_id = AssertColumn(r, "parent_id"); + int cdir_id = AssertColumn(r, "dir_id"); + int cclosed = AssertColumn(r, "closed"); + int citems = AssertColumn(r, "items"); + int clast_item = AssertColumn(r, "last_item"); + + int cdate_modification = PQfnumber(r, "date_modification"); // !! tych kolumn może nie być? czemu PQfnumber a nie AssertColumn? + int cuser_id = PQfnumber(r, "user_id"); + + thread.id = AssertValueLong(r, 0, cid); + thread.parent_id = AssertValueLong(r, 0, cparent_id); + thread.dir_id = AssertValueLong(r, 0, cdir_id); + thread.closed = AssertValueLong(r, 0, cclosed) == 0 ? false : true; + thread.items = AssertValueLong(r, 0, citems); + thread.last_item.id = AssertValueLong(r, 0, clast_item); + thread.last_item.date_modification = AssertValueTm(r, 0, cdate_modification); + thread.last_item.user_id = AssertValueLong(r, 0, cuser_id); + } + catch(const Error & e) + { + status = e; + } + + ClearResult(r); + +return status; +} + + + +Error Db::GetThreads(long parent_id, std::vector & thread_tab) +{ + PGresult * r = 0; + Error status = WINIX_ERR_OK; + + try + { + query.Clear(); + query << R("select thread.id, thread.parent_id, thread.dir_id, thread.closed, " + "thread.items, thread.last_item, item.date_modification, item.user_id, item.guest_name " + "from core.thread left join core.item on thread.last_item = item.id " + "where thread.parent_id = ") << parent_id << R(" order by date_modification asc;"); + + r = AssertQuery(query); + AssertResult(r, PGRES_TUPLES_OK); + + int rows = Rows(r); + Thread thread; + + int cid = AssertColumn(r, "id"); + int cparent_id = AssertColumn(r, "parent_id"); + int cdir_id = AssertColumn(r, "dir_id"); + int cclosed = AssertColumn(r, "closed"); + int citems = AssertColumn(r, "items"); + int clast_item = AssertColumn(r, "last_item"); + int cdate_modification = PQfnumber(r, "date_modification"); // !! czemu tutaj jest pqfnumber zamiast assertcolumn? + int cuser_id = PQfnumber(r, "user_id"); + int cguest_name = PQfnumber(r, "guest_name"); + + + for(int i=0 ; i 0 ) + log << log2 << "Db: deleted " << rows << " rows from core.thread" << logend; + } + catch(const Error & e) + { + status = e; + } + + ClearResult(r); + +return status; +} + + + + + + + + +} // namespace + diff --git a/plugins/thread/tdb.h b/plugins/thread/tdb.h new file mode 100755 index 0000000..d2e67d2 --- /dev/null +++ b/plugins/thread/tdb.h @@ -0,0 +1,47 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#ifndef headerfile_winix_plugins_thread_tdb +#define headerfile_winix_plugins_thread_tdb + + +#include +#include "ticket.h" +#include "db/dbbase.h" +#include "core/error.h" + + +namespace Thread +{ + + +class TDb : public DbBase +{ +public: + + Error AddThread(Thread & thread); + Error GetThreadByDirId(long dir_id, Thread & thread); + Error GetThreads(long parent_id, std::vector & thread_tab); + Error EditThreadAddItem(long dir_id, long item_id); + Error EditThreadRemoveItem(long dir_id); + Error RemoveThread(long dir_id); + + +private: + + DbTextStream query; + +}; + + +} // namespace + + +#endif + diff --git a/plugins/thread/threadinfo.h b/plugins/thread/threadinfo.h new file mode 100755 index 0000000..158330e --- /dev/null +++ b/plugins/thread/threadinfo.h @@ -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 headerfile_winix_plugins_thread_threadinfo +#define headerfile_winix_plugins_thread_threadinfo + + +namespace Thread +{ + + + +// id of a mount type +int mount_type_thread; + +// enable a thread in a specific directory +int mount_par_thread_enable; + + + + + + + + +} // namespace + +#endif + + diff --git a/plugins/ticket/Makefile.dep b/plugins/ticket/Makefile.dep index e92dcd6..70706fb 100755 --- a/plugins/ticket/Makefile.dep +++ b/plugins/ticket/Makefile.dep @@ -40,17 +40,18 @@ createticket.o: ../../functions/ckeditor.h ../../functions/cp.h createticket.o: ../../functions/createthread.h ../../functions/default.h createticket.o: ../../functions/download.h ../../functions/emacs.h createticket.o: ../../functions/last.h ../../functions/login.h -createticket.o: ../../functions/logout.h ../../functions/ls.h -createticket.o: ../../functions/mkdir.h ../../functions/mv.h -createticket.o: ../../functions/node.h ../../functions/priv.h -createticket.o: ../../functions/reload.h ../../functions/rm.h -createticket.o: ../../functions/run.h ../../functions/specialdefault.h -createticket.o: ../../functions/stat.h ../../functions/subject.h -createticket.o: ../../functions/funthread.h ../../functions/template.h -createticket.o: ../../functions/tinymce.h ../../functions/uname.h -createticket.o: ../../functions/upload.h ../../functions/uptime.h -createticket.o: ../../functions/who.h ../../functions/vim.h -createticket.o: ../../core/htmlfilter.h +createticket.o: ../../functions/logout.h ../../functions/ln.h +createticket.o: ../../functions/ls.h ../../functions/mkdir.h +createticket.o: ../../functions/mv.h ../../functions/node.h +createticket.o: ../../functions/priv.h ../../functions/reload.h +createticket.o: ../../functions/rm.h ../../functions/run.h +createticket.o: ../../functions/specialdefault.h ../../functions/stat.h +createticket.o: ../../functions/subject.h ../../functions/funthread.h +createticket.o: ../../functions/template.h ../../functions/tinymce.h +createticket.o: ../../functions/uname.h ../../functions/upload.h +createticket.o: ../../functions/uptime.h ../../functions/who.h +createticket.o: ../../functions/vim.h ../../core/htmlfilter.h sessiondata.h +createticket.o: ../../core/plugindata.h editticket.o: editticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h editticket.o: ../../db/dbtextstream.h ../../core/textstream.h editticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h @@ -78,28 +79,29 @@ editticket.o: ../../core/config.h ../../core/confparser.h editticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h editticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h editticket.o: ../../core/thumb.h ../../core/basethread.h -editticket.o: ../../functions/functionbase.h ../../core/request.h +editticket.o: ../../functions/functions.h ../../functions/functionbase.h +editticket.o: ../../functions/functionparser.h ../../core/request.h editticket.o: ../../core/requesttypes.h ../../core/session.h editticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h -editticket.o: ../../core/synchro.h ../../functions/functions.h -editticket.o: ../../functions/functionbase.h ../../functions/functionparser.h editticket.o: ../../functions/adduser.h ../../functions/cat.h editticket.o: ../../functions/chmod.h ../../functions/privchanger.h editticket.o: ../../functions/chown.h ../../functions/ckeditor.h editticket.o: ../../functions/cp.h ../../functions/createthread.h +editticket.o: ../../functions/functionbase.h ../../core/synchro.h editticket.o: ../../functions/default.h ../../functions/download.h editticket.o: ../../functions/emacs.h ../../functions/last.h editticket.o: ../../functions/login.h ../../functions/logout.h -editticket.o: ../../functions/ls.h ../../functions/mkdir.h -editticket.o: ../../functions/mv.h ../../functions/node.h -editticket.o: ../../functions/priv.h ../../functions/reload.h -editticket.o: ../../functions/rm.h ../../functions/run.h -editticket.o: ../../functions/specialdefault.h ../../functions/stat.h -editticket.o: ../../functions/subject.h ../../functions/funthread.h -editticket.o: ../../functions/template.h ../../functions/tinymce.h -editticket.o: ../../functions/uname.h ../../functions/upload.h -editticket.o: ../../functions/uptime.h ../../functions/who.h -editticket.o: ../../functions/vim.h ../../core/htmlfilter.h +editticket.o: ../../functions/ln.h ../../functions/ls.h +editticket.o: ../../functions/mkdir.h ../../functions/mv.h +editticket.o: ../../functions/node.h ../../functions/priv.h +editticket.o: ../../functions/reload.h ../../functions/rm.h +editticket.o: ../../functions/run.h ../../functions/specialdefault.h +editticket.o: ../../functions/stat.h ../../functions/subject.h +editticket.o: ../../functions/funthread.h ../../functions/template.h +editticket.o: ../../functions/tinymce.h ../../functions/uname.h +editticket.o: ../../functions/upload.h ../../functions/uptime.h +editticket.o: ../../functions/who.h ../../functions/vim.h +editticket.o: ../../core/htmlfilter.h sessiondata.h ../../core/plugindata.h funticket.o: funticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h funticket.o: ../../db/dbtextstream.h ../../core/textstream.h funticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h @@ -127,10 +129,29 @@ funticket.o: ../../core/config.h ../../core/confparser.h funticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h funticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h funticket.o: ../../core/thumb.h ../../core/basethread.h -funticket.o: ../../functions/functionbase.h ../../core/request.h +funticket.o: ../../functions/functions.h ../../functions/functionbase.h +funticket.o: ../../functions/functionparser.h ../../core/request.h funticket.o: ../../core/requesttypes.h ../../core/session.h funticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h -funticket.o: ../../core/synchro.h ../../core/misc.h +funticket.o: ../../functions/adduser.h ../../functions/cat.h +funticket.o: ../../functions/chmod.h ../../functions/privchanger.h +funticket.o: ../../functions/chown.h ../../functions/ckeditor.h +funticket.o: ../../functions/cp.h ../../functions/createthread.h +funticket.o: ../../functions/functionbase.h ../../core/synchro.h +funticket.o: ../../functions/default.h ../../functions/download.h +funticket.o: ../../functions/emacs.h ../../functions/last.h +funticket.o: ../../functions/login.h ../../functions/logout.h +funticket.o: ../../functions/ln.h ../../functions/ls.h +funticket.o: ../../functions/mkdir.h ../../functions/mv.h +funticket.o: ../../functions/node.h ../../functions/priv.h +funticket.o: ../../functions/reload.h ../../functions/rm.h +funticket.o: ../../functions/run.h ../../functions/specialdefault.h +funticket.o: ../../functions/stat.h ../../functions/subject.h +funticket.o: ../../functions/funthread.h ../../functions/template.h +funticket.o: ../../functions/tinymce.h ../../functions/uname.h +funticket.o: ../../functions/upload.h ../../functions/uptime.h +funticket.o: ../../functions/who.h ../../functions/vim.h +funticket.o: ../../core/htmlfilter.h init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h init.o: ../../core/item.h ../../core/error.h ../../core/log.h @@ -156,32 +177,86 @@ init.o: ../../core/mountparser.h ../../core/config.h ../../core/confparser.h init.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h init.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h init.o: ../../core/thumb.h ../../core/basethread.h -init.o: ../../functions/functionbase.h ../../core/request.h +init.o: ../../functions/functions.h ../../functions/functionbase.h +init.o: ../../functions/functionparser.h ../../core/request.h init.o: ../../core/requesttypes.h ../../core/session.h init.o: ../../core/plugindata.h ../../templates/htmltextstream.h -init.o: ../../core/synchro.h editticket.h createticket.h ../../core/log.h -init.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h -init.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h -init.o: ../../functions/functions.h ../../functions/functionbase.h -init.o: ../../functions/functionparser.h ../../functions/adduser.h -init.o: ../../functions/cat.h ../../functions/chmod.h -init.o: ../../functions/privchanger.h ../../functions/chown.h -init.o: ../../functions/ckeditor.h ../../functions/cp.h -init.o: ../../functions/createthread.h ../../functions/default.h -init.o: ../../functions/download.h ../../functions/emacs.h -init.o: ../../functions/last.h ../../functions/login.h -init.o: ../../functions/logout.h ../../functions/ls.h ../../functions/mkdir.h -init.o: ../../functions/mv.h ../../functions/node.h ../../functions/priv.h +init.o: ../../functions/adduser.h ../../functions/cat.h +init.o: ../../functions/chmod.h ../../functions/privchanger.h +init.o: ../../functions/chown.h ../../functions/ckeditor.h +init.o: ../../functions/cp.h ../../functions/createthread.h +init.o: ../../functions/functionbase.h ../../core/synchro.h +init.o: ../../functions/default.h ../../functions/download.h +init.o: ../../functions/emacs.h ../../functions/last.h +init.o: ../../functions/login.h ../../functions/logout.h ../../functions/ln.h +init.o: ../../functions/ls.h ../../functions/mkdir.h ../../functions/mv.h +init.o: ../../functions/node.h ../../functions/priv.h init.o: ../../functions/reload.h ../../functions/rm.h ../../functions/run.h init.o: ../../functions/specialdefault.h ../../functions/stat.h init.o: ../../functions/subject.h ../../functions/funthread.h init.o: ../../functions/template.h ../../functions/tinymce.h init.o: ../../functions/uname.h ../../functions/upload.h init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h -init.o: ../../core/htmlfilter.h ../../templates/templates.h +init.o: ../../core/htmlfilter.h editticket.h createticket.h showtickets.h +init.o: ../../core/log.h ../../core/plugin.h ../../core/pluginmsg.h +init.o: ../../core/system.h ../../core/sessionmanager.h +init.o: ../../core/sessioncontainer.h ../../templates/templates.h init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h init.o: ../../core/httpsimpleparser.h ../../core/log.h init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h +init.o: sessiondata.h ../../core/plugindata.h +sessiondata.o: sessiondata.h ../../core/plugindata.h ticket.h +showtickets.o: showtickets.h tdb.h ticket.h ../../db/dbbase.h +showtickets.o: ../../db/dbconn.h ../../db/dbtextstream.h +showtickets.o: ../../core/textstream.h ../../core/misc.h ../../core/item.h +showtickets.o: ../../core/error.h ../../core/log.h ../../core/textstream.h +showtickets.o: ticketinfo.h ticketparser.h ticketconf.h ../../core/item.h +showtickets.o: ../../core/system.h ../../core/dirs.h +showtickets.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h +showtickets.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h +showtickets.o: ../../core/user.h ../../core/group.h ../../core/thread.h +showtickets.o: ../../core/dircontainer.h ../../core/ugcontainer.h +showtickets.o: ../../core/request.h ../../notify/notify.h +showtickets.o: ../../notify/notifypool.h ../../templates/locale.h +showtickets.o: ../../core/confparser.h ../../templates/misc.h +showtickets.o: ../../templates/localefilter.h ../../templates/locale.h +showtickets.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h +showtickets.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h +showtickets.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h +showtickets.o: ../../../ezc/src/stringconv.h ../../templates/htmltextstream.h +showtickets.o: ../../notify/notifythread.h ../../core/basethread.h +showtickets.o: ../../core/synchro.h ../../notify/templatesnotify.h +showtickets.o: ../../core/config.h ../../core/users.h ../../core/user.h +showtickets.o: ../../core/ugcontainer.h ../../core/lastcontainer.h +showtickets.o: ../../core/mounts.h ../../core/mount.h ../../core/error.h +showtickets.o: ../../core/mountparser.h ../../core/config.h +showtickets.o: ../../core/confparser.h ../../core/htmlfilter.h +showtickets.o: ../../core/users.h ../../core/groups.h ../../core/group.h +showtickets.o: ../../core/rebus.h ../../core/loadavg.h ../../core/thumb.h +showtickets.o: ../../core/basethread.h ../../functions/functions.h +showtickets.o: ../../functions/functionbase.h +showtickets.o: ../../functions/functionparser.h ../../core/request.h +showtickets.o: ../../core/requesttypes.h ../../core/session.h +showtickets.o: ../../core/plugindata.h ../../templates/htmltextstream.h +showtickets.o: ../../functions/adduser.h ../../functions/cat.h +showtickets.o: ../../functions/chmod.h ../../functions/privchanger.h +showtickets.o: ../../functions/chown.h ../../functions/ckeditor.h +showtickets.o: ../../functions/cp.h ../../functions/createthread.h +showtickets.o: ../../functions/functionbase.h ../../core/synchro.h +showtickets.o: ../../functions/default.h ../../functions/download.h +showtickets.o: ../../functions/emacs.h ../../functions/last.h +showtickets.o: ../../functions/login.h ../../functions/logout.h +showtickets.o: ../../functions/ln.h ../../functions/ls.h +showtickets.o: ../../functions/mkdir.h ../../functions/mv.h +showtickets.o: ../../functions/node.h ../../functions/priv.h +showtickets.o: ../../functions/reload.h ../../functions/rm.h +showtickets.o: ../../functions/run.h ../../functions/specialdefault.h +showtickets.o: ../../functions/stat.h ../../functions/subject.h +showtickets.o: ../../functions/funthread.h ../../functions/template.h +showtickets.o: ../../functions/tinymce.h ../../functions/uname.h +showtickets.o: ../../functions/upload.h ../../functions/uptime.h +showtickets.o: ../../functions/who.h ../../functions/vim.h +showtickets.o: ../../core/htmlfilter.h tdb.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h tdb.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h tdb.o: ../../core/item.h ../../core/error.h ../../core/log.h @@ -210,24 +285,20 @@ templates.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h templates.o: ../../core/config.h ../../core/confparser.h templates.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h templates.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h -templates.o: ../../core/thumb.h ../../core/basethread.h tdb.h -templates.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h -templates.o: ../../core/error.h editticket.h ../../functions/functionbase.h -templates.o: ../../core/request.h ../../core/requesttypes.h -templates.o: ../../core/session.h ../../core/plugindata.h -templates.o: ../../templates/htmltextstream.h ../../core/synchro.h -templates.o: createticket.h ../../core/misc.h ../../core/plugin.h -templates.o: ../../core/pluginmsg.h ../../core/system.h -templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h +templates.o: ../../core/thumb.h ../../core/basethread.h templates.o: ../../functions/functions.h ../../functions/functionbase.h -templates.o: ../../functions/functionparser.h ../../functions/adduser.h -templates.o: ../../functions/cat.h ../../functions/chmod.h -templates.o: ../../functions/privchanger.h ../../functions/chown.h -templates.o: ../../functions/ckeditor.h ../../functions/cp.h -templates.o: ../../functions/createthread.h ../../functions/default.h -templates.o: ../../functions/download.h ../../functions/emacs.h -templates.o: ../../functions/last.h ../../functions/login.h -templates.o: ../../functions/logout.h ../../functions/ls.h +templates.o: ../../functions/functionparser.h ../../core/request.h +templates.o: ../../core/requesttypes.h ../../core/session.h +templates.o: ../../core/plugindata.h ../../templates/htmltextstream.h +templates.o: ../../functions/adduser.h ../../functions/cat.h +templates.o: ../../functions/chmod.h ../../functions/privchanger.h +templates.o: ../../functions/chown.h ../../functions/ckeditor.h +templates.o: ../../functions/cp.h ../../functions/createthread.h +templates.o: ../../functions/functionbase.h ../../core/synchro.h +templates.o: ../../functions/default.h ../../functions/download.h +templates.o: ../../functions/emacs.h ../../functions/last.h +templates.o: ../../functions/login.h ../../functions/logout.h +templates.o: ../../functions/ln.h ../../functions/ls.h templates.o: ../../functions/mkdir.h ../../functions/mv.h templates.o: ../../functions/node.h ../../functions/priv.h templates.o: ../../functions/reload.h ../../functions/rm.h @@ -237,11 +308,16 @@ templates.o: ../../functions/funthread.h ../../functions/template.h templates.o: ../../functions/tinymce.h ../../functions/uname.h templates.o: ../../functions/upload.h ../../functions/uptime.h templates.o: ../../functions/who.h ../../functions/vim.h -templates.o: ../../core/htmlfilter.h ../../templates/templates.h -templates.o: ../../templates/patterncacher.h +templates.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h +templates.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h +templates.o: editticket.h createticket.h ../../core/misc.h +templates.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h +templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h +templates.o: ../../templates/templates.h ../../templates/patterncacher.h templates.o: ../../templates/ckeditorgetparser.h templates.o: ../../core/httpsimpleparser.h ../../core/log.h templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h +templates.o: sessiondata.h ../../core/plugindata.h ticketconf.o: ticketconf.h ticketinfo.o: ticketinfo.h ticket.h ticketparser.h ticketconf.h ticketinfo.o: ../../core/item.h ../../core/system.h ../../core/dirs.h @@ -268,7 +344,32 @@ ticketinfo.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h ticketinfo.o: ../../core/config.h ../../core/confparser.h ticketinfo.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h ticketinfo.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h -ticketinfo.o: ../../core/thumb.h ../../core/basethread.h tdb.h -ticketinfo.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h -ticketinfo.o: ../../core/error.h ../../core/log.h ../../core/misc.h +ticketinfo.o: ../../core/thumb.h ../../core/basethread.h +ticketinfo.o: ../../functions/functions.h ../../functions/functionbase.h +ticketinfo.o: ../../functions/functionparser.h ../../core/request.h +ticketinfo.o: ../../core/requesttypes.h ../../core/session.h +ticketinfo.o: ../../core/plugindata.h ../../templates/htmltextstream.h +ticketinfo.o: ../../functions/adduser.h ../../functions/cat.h +ticketinfo.o: ../../functions/chmod.h ../../functions/privchanger.h +ticketinfo.o: ../../functions/chown.h ../../functions/ckeditor.h +ticketinfo.o: ../../functions/cp.h ../../functions/createthread.h +ticketinfo.o: ../../functions/functionbase.h ../../core/synchro.h +ticketinfo.o: ../../functions/default.h ../../functions/download.h +ticketinfo.o: ../../functions/emacs.h ../../functions/last.h +ticketinfo.o: ../../functions/login.h ../../functions/logout.h +ticketinfo.o: ../../functions/ln.h ../../functions/ls.h +ticketinfo.o: ../../functions/mkdir.h ../../functions/mv.h +ticketinfo.o: ../../functions/node.h ../../functions/priv.h +ticketinfo.o: ../../functions/reload.h ../../functions/rm.h +ticketinfo.o: ../../functions/run.h ../../functions/specialdefault.h +ticketinfo.o: ../../functions/stat.h ../../functions/subject.h +ticketinfo.o: ../../functions/funthread.h ../../functions/template.h +ticketinfo.o: ../../functions/tinymce.h ../../functions/uname.h +ticketinfo.o: ../../functions/upload.h ../../functions/uptime.h +ticketinfo.o: ../../functions/who.h ../../functions/vim.h +ticketinfo.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h +ticketinfo.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h +ticketinfo.o: ../../core/log.h ../../core/misc.h sessiondata.h +ticketinfo.o: ../../core/plugindata.h ticketparser.o: ticketparser.h ticketconf.h ../../core/log.h +ticketparser.o: ../../core/misc.h diff --git a/plugins/ticket/Makefile.o.dep b/plugins/ticket/Makefile.o.dep index 58621a7..6a40f3d 100755 --- a/plugins/ticket/Makefile.o.dep +++ b/plugins/ticket/Makefile.o.dep @@ -1 +1 @@ -o = createticket.o editticket.o funticket.o init.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o +o = createticket.o editticket.o funticket.o init.o sessiondata.o showtickets.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o diff --git a/plugins/ticket/createticket.cpp b/plugins/ticket/createticket.cpp index 87b3b3c..ff039f6 100755 --- a/plugins/ticket/createticket.cpp +++ b/plugins/ticket/createticket.cpp @@ -9,6 +9,8 @@ #include "createticket.h" #include "functions/functions.h" +#include "sessiondata.h" + namespace Ticket @@ -36,76 +38,61 @@ void CreateTicket::SetTicketInfo(TicketInfo * pinfo) -void CreateTicket::Clear() +bool CreateTicket::HasAccess() { - ticket_info->Clear(); -} - - -// returning true if we can create a ticket in the current directory -bool CreateTicket::HasAccess(bool check_root) -{ - if( request->dir_tab.empty() ) - return false; - - if( request->is_item ) - return false; - - if( !system->HasWriteAccess(*request->dir_tab.back()) ) + if( request->is_item || !system->HasWriteAccess(*request->dir_tab.back()) ) return false; if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket ) return false; + +return true; +} + + + +void CreateTicket::AddTicket(Ticket & ticket, Item & item) +{ + ticket.file_id = item.id; + request->status = tdb->AddTicket(ticket); + + if( request->status == WINIX_ERR_OK ) + { + // sending notification + notify_msg.code = WINIX_NOTIFY_CODE_USER1; + notify_msg.template_index = ticket_info->template_index; + notify_msg.dir_link = config->base_url; + system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); + notify_msg.item_link = notify_msg.dir_link; + notify_msg.item_link += item.url; + + system->notify.ItemChanged(notify_msg); + } +} + + + + +void CreateTicket::Submit(Ticket & ticket, Item & item) +{ + if( functions->CheckAbuse() ) + return; + + functions->SetUser(item); + item.privileges = 0644; // !! tymczasowo + item.parent_id = request->dir_tab.back()->id; + + // adding without notificating + request->status = system->AddFile(item, false); + + if( request->status == WINIX_ERR_OK ) + AddTicket(ticket, item); - - // checking for par_createticket_on mount option - - if( !check_root && 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(ticket_info->mount_par_createticket_on) ) - return true; - - if( system->mounts.pmount->IsArg(ticket_info->mount_par_createticket_on, request->dir_tab.size()) ) - return true; - -return false; -} - - -bool CreateTicket::HasAccess() -{ - return HasAccess(false); -} - - - -void CreateTicket::AddTicket() -{ - // a new directory created by system->AddDir() - ticket_info->ticket.dir_id = request->dir_tab.back()->id; - request->status = tdb->AddTicket(ticket_info->ticket); - - // sending notification - notify_msg.code = WINIX_NOTIFY_CODE_USER1; - notify_msg.template_index = ticket_info->template_index; - - system->dirs.MakePath(ticket_info->item.parent_id, tmp_path); - notify_msg.item_link = config->base_url; - notify_msg.item_link += tmp_path; - notify_msg.dir_link = notify_msg.item_link; - - system->notify.ItemChanged(notify_msg); -} - - -void CreateTicket::LogAndRedirect() -{ if( request->status == WINIX_ERR_OK ) { log << log2 << "CreateTicket: added a new ticket" << logend; - system->RedirectToLastDir(); + RemoveTicket(); + system->RedirectTo(item); } else { @@ -116,41 +103,55 @@ void CreateTicket::LogAndRedirect() +void CreateTicket::RemoveTicket() +{ + SessionData * session_data = reinterpret_cast( + request->session->plugin_data.Get(ticket_info->plugin_id) ); + + long dir_id = request->dir_tab.back()->id; + session_data->create_ticket_map.erase(dir_id); +} + + + +Ticket & CreateTicket::PrepareTicket() +{ + SessionData * session_data = reinterpret_cast( + request->session->plugin_data.Get(ticket_info->plugin_id) ); + + long dir_id = request->dir_tab.back()->id; + Ticket & ticket = session_data->GetTicket(dir_id, session_data->create_ticket_map); + +return ticket; +} + + + void CreateTicket::MakePost() { + ticket_info->Clear(); ticket_info->FindCurrentConf(); - functions->ReadItem(ticket_info->item, Item::file); - functions->SetUser(ticket_info->item); - ticket_info->item.privileges = request->dir_tab.back()->privileges; // !! tymczasowo takie same jak z katalogu nadrzednego - ticket_info->ReadTicketParams(); + Ticket & ticket = PrepareTicket(); + Item & item = request->item; + ticket_info->ticket = &ticket; - if( functions->CheckAbuse() ) - return; + ticket_info->ReadTicketParams(ticket, false); + functions->ReadItem(item, Item::file); - ticket_info->item.type = Item::dir; - request->status = system->dirs.AddDirectory(ticket_info->item, true); - - if( request->status == WINIX_ERR_OK ) - { - ticket_info->item.type = Item::file; - ticket_info->item.privileges = 0644; // !! tymczasowo - ticket_info->item.parent_id = request->dir_tab.back()->id; - - // adding without notificating - request->status = system->AddFile(ticket_info->item, false); - - if( request->status == WINIX_ERR_OK ) - AddTicket(); - } - - LogAndRedirect(); + if( !request->IsPostVar(L"fileuploadsubmit") ) + Submit(ticket, item); } + void CreateTicket::MakeGet() { + ticket_info->Clear(); ticket_info->FindCurrentConf(); + + Ticket & ticket = PrepareTicket(); + ticket_info->ticket = &ticket; } diff --git a/plugins/ticket/createticket.h b/plugins/ticket/createticket.h index 156d949..07fd084 100755 --- a/plugins/ticket/createticket.h +++ b/plugins/ticket/createticket.h @@ -28,21 +28,20 @@ public: void SetTDb(TDb * ptdb); void SetTicketInfo(TicketInfo * pinfo); - void Clear(); - bool HasAccess(bool check_root); bool HasAccess(); void MakePost(); void MakeGet(); private: - void AddTicket(); - void LogAndRedirect(); + void AddTicket(Ticket & ticket, Item & item); + void Submit(Ticket & ticket, Item & item); + void RemoveTicket(); + Ticket & PrepareTicket(); TDb * tdb; TicketInfo * ticket_info; NotifyMsg notify_msg; - std::wstring tmp_path; }; diff --git a/plugins/ticket/editticket.cpp b/plugins/ticket/editticket.cpp index c16eb2b..6429465 100755 --- a/plugins/ticket/editticket.cpp +++ b/plugins/ticket/editticket.cpp @@ -9,13 +9,15 @@ #include "editticket.h" #include "functions/functions.h" - +#include "sessiondata.h" namespace Ticket { + + EditTicket::EditTicket() { fun.url = L"editticket"; @@ -34,27 +36,15 @@ void EditTicket::SetTicketInfo(TicketInfo * pinfo) } -void EditTicket::Clear() -{ - ticket_info->Clear(); -} - bool EditTicket::HasAccess() { // not logged users cannot edit tickets + // !! we are waiting for the sticky bit if( !request->session->puser ) return false; - if( request->dir_tab.empty() ) - return false; - - ticket_info->ReadTicket(request->dir_tab.back()->id); - - if( request->is_item || !ticket_info->is_ticket ) - return false; - - if( !system->HasWriteAccess(*request->dir_tab.back()) ) + if( !request->is_item || !system->HasWriteAccess(request->item) ) return false; if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket ) @@ -66,89 +56,43 @@ return true; - -void EditTicket::GetFirstItem(Item & item) +void EditTicket::ChangeTicket(Ticket & ticket, Item & item) { - if( request->status != WINIX_ERR_OK ) - return; + request->status = tdb->RemoveAddTicket(ticket); - DbItemQuery iq; - iq.Limit(1); - iq.WhereParentId(request->dir_tab.back()->id); - db->GetItems(item_tab, iq); // !! chwilowo GetItems() nie zwraca zadnych kodow bledow - - if( request->status != WINIX_ERR_OK ) - return; - - if( item_tab.empty() ) - { - // creating a new item (the item was deleted by a user) - - item.parent_id = request->dir_tab.back()->id; - item.subject = request->dir_tab.back()->subject; - item.type = Item::file; - item.privileges = 0644; // !! tymczasowo - functions->SetUser(item); - functions->PrepareUrl(item); - - request->status = system->AddFile(item); - - if( request->status == WINIX_ERR_OK ) - log << log2 << "EditTicket: added the first item with content for the ticket, item.id: " - << item.id << logend; - } - else - { - item = item_tab[0]; - } -} - - - -void EditTicket::ModifyTicket() -{ - if( request->status != WINIX_ERR_OK ) - return; - - ticket_info->ReadTicketParams(); - request->status = tdb->RemoveAddTicket(ticket_info->ticket); -} - - - -void EditTicket::ModifyLastDir() -{ - if( request->status != WINIX_ERR_OK ) - return; - - // we don't modify the url - Item & dir = *request->dir_tab.back(); - - if( dir.subject != ticket_info->item.subject ) - { - dir.subject = ticket_info->item.subject; - request->status = db->EditItemById(dir, false); - } -} - - -void EditTicket::ModifyFirstItem() -{ - if( request->status != WINIX_ERR_OK ) - return; - - // we don't modify the url and don't use notifications - system->EditFile(ticket_info->item, false, false); -} - - - -void EditTicket::LogAndRedirect() -{ if( request->status == WINIX_ERR_OK ) { - log << log2 << "EditTicket: edited a ticket" << logend; - system->RedirectToLastDir(); + // sending notification + /* + notify_msg.code = WINIX_NOTIFY_CODE_USER1; + notify_msg.template_index = ticket_info->template_index; + notify_msg.dir_link = config->base_url; + system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false); + notify_msg.item_link = notify_msg.dir_link; + notify_msg.item_link += item.url; + + system->notify.ItemChanged(notify_msg); + */ + } +} + + +void EditTicket::Submit(Ticket & ticket, Item & item) +{ + if( functions->CheckAbuse() ) + return; + + // adding without notificating + request->status = system->EditFile(item, old_url != item.url); + + if( request->status == WINIX_ERR_OK ) + ChangeTicket(ticket, item); + + if( request->status == WINIX_ERR_OK ) + { + log << log2 << "EditTicket: ticket modified" << logend; + RemoveTicket(); + system->RedirectTo(item); } else { @@ -159,29 +103,65 @@ void EditTicket::LogAndRedirect() + +void EditTicket::RemoveTicket() +{ + SessionData * session_data = reinterpret_cast( + request->session->plugin_data.Get(ticket_info->plugin_id) ); + + long file_id = request->item.id; + session_data->create_ticket_map.erase(file_id); + session_data->new_file_map.erase(file_id); +} + + + +Ticket & EditTicket::PrepareTicket() +{ + SessionData * session_data = reinterpret_cast( + request->session->plugin_data.Get(ticket_info->plugin_id) ); + + bool is_new; + long file_id = request->item.id; + Ticket & ticket = session_data->GetTicket(file_id, session_data->edit_ticket_map, &is_new); + + if( is_new ) + tdb->GetTicket(file_id, ticket); + else + ticket.file_id = file_id; + +return ticket; +} + + + +std::vector & EditTicket::PrepareFileMap() +{ + SessionData * session_data = reinterpret_cast( + request->session->plugin_data.Get(ticket_info->plugin_id) ); + + long file_id = request->item.id; + std::vector & file_map = session_data->GetFileTab(file_id, session_data->new_file_map); + +return file_map; +} + + void EditTicket::MakePost() { ticket_info->FindCurrentConf(); - // reading the first item from the db or creating it if not exists - GetFirstItem(ticket_info->item); + Ticket & ticket = PrepareTicket(); + Item & item = request->item; + old_url = item.url; + std::vector & file_map = PrepareFileMap(); + ticket_info->ticket = &ticket; - // reading information from POST - functions->ReadItem(ticket_info->item, Item::file); + ticket_info->ReadTicketParams(ticket, false, &file_map); + functions->ReadItem(item, Item::file); - if( functions->CheckAbuse() ) - return; - - if( tdb->GetTicket(request->dir_tab.back()->id, ticket_info->ticket) != WINIX_ERR_OK ) - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - - ModifyTicket(); - ModifyLastDir(); - ModifyFirstItem(); - LogAndRedirect(); + if( !request->IsPostVar(L"fileuploadsubmit") ) + Submit(ticket, item); } @@ -190,19 +170,8 @@ void EditTicket::MakeGet() { ticket_info->FindCurrentConf(); - DbItemQuery iq; - iq.Limit(1); - iq.WhereParentId(request->dir_tab.back()->id); - db->GetItems(item_tab, iq); // !! chwilowo GetItems() nie zwraca kodow bledow - - if( request->status != WINIX_ERR_OK ) - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - - if( !item_tab.empty() ) - ticket_info->item = item_tab[0]; + Ticket & ticket = PrepareTicket(); + ticket_info->ticket = &ticket; } diff --git a/plugins/ticket/editticket.h b/plugins/ticket/editticket.h index f617cf3..567a56a 100755 --- a/plugins/ticket/editticket.h +++ b/plugins/ticket/editticket.h @@ -28,22 +28,22 @@ public: void SetTDb(TDb * ptdb); void SetTicketInfo(TicketInfo * pinfo); - void Clear(); bool HasAccess(); void MakePost(); void MakeGet(); private: - void GetFirstItem(Item & item); - void ModifyTicket(); - void ModifyLastDir(); - void ModifyFirstItem(); - void LogAndRedirect(); + void RemoveTicket(); + Ticket & PrepareTicket(); + std::vector & PrepareFileMap(); + std::wstring old_url; + + void ChangeTicket(Ticket & ticket, Item & item); + void Submit(Ticket & ticket, Item & item); TDb * tdb; TicketInfo * ticket_info; - std::vector item_tab; }; diff --git a/plugins/ticket/funticket.cpp b/plugins/ticket/funticket.cpp index b2e5624..97f976a 100755 --- a/plugins/ticket/funticket.cpp +++ b/plugins/ticket/funticket.cpp @@ -7,10 +7,7 @@ * */ -#include -#include #include "funticket.h" -#include "core/misc.h" @@ -37,102 +34,21 @@ void FunTicket::SetTicketInfo(TicketInfo * pinfo) } -void FunTicket::Clear() -{ - ticket_info->Clear(); -} - - bool FunTicket::HasAccess() { - return !request->is_item; + return request->is_item && system->HasReadAccess(request->item); } - - - void FunTicket::MakeGet() { + ticket_info->Clear(); ticket_info->FindCurrentConf(); - ticket_info->ReadTicket(request->dir_tab.back()->id); + ticket_info->ticket = &ticket; - DbItemQuery iq; - iq.WhereParentId(request->dir_tab.back()->id); - iq.WhereType(Item::file); - iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE); - db->GetItems(request->item_tab, iq); - - if( !request->item_tab.empty() ) - { - if( system->HasReadAccess(request->item_tab[0]) ) - { - ticket_info->item = request->item_tab[0]; - request->item_tab.erase(request->item_tab.begin()); - } - else - { - request->status = WINIX_ERR_PERMISSION_DENIED; - return; - } - } - - system->CheckAccessToItems(request->item_tab); - SelectTickets(); + tdb->GetTicket(request->item.id, ticket); } -void FunTicket::SelectTickets() -{ - child_tab.clear(); - system->dirs.GetDirChilds(request->dir_tab.back()->id, child_tab); - - SortDirs(); - PageDirs(); - CreateIdTab(); - tdb->GetTickets(id_tab, ticket_info->ticket_tab); - ticket_info->SortTickets(); -} - - - -bool FunTicket::SortByDate::operator()(const Item * item1, const Item * item2) -{ - tm tm1 = item1->date_creation; - tm tm2 = item2->date_creation; - - time_t time1 = Time(tm1); - time_t time2 = Time(tm2); - -return time1 < time2; -} - - - -void FunTicket::SortDirs() -{ - // temporarily sorting by date - SortByDate sort(this); - std::sort(child_tab.begin(), child_tab.end(), sort); -} - - - -void FunTicket::PageDirs() -{ - // temporarily show every tickets -} - - - -void FunTicket::CreateIdTab() -{ - id_tab.clear(); - - for(size_t i=0 ; iid); -} - - } // namespace diff --git a/plugins/ticket/funticket.h b/plugins/ticket/funticket.h index 7f148e5..c94d164 100755 --- a/plugins/ticket/funticket.h +++ b/plugins/ticket/funticket.h @@ -12,7 +12,6 @@ #include "tdb.h" #include "ticketinfo.h" -#include "core/item.h" #include "functions/functionbase.h" @@ -28,7 +27,6 @@ public: void SetTDb(TDb * ptdb); void SetTicketInfo(TicketInfo * pinfo); - void Clear(); bool HasAccess(); void MakeGet(); @@ -36,20 +34,7 @@ private: TDb * tdb; TicketInfo * ticket_info; - std::vector child_tab; - std::vector id_tab; - - struct SortByDate - { - FunTicket * fun_ticket; - SortByDate(FunTicket * f) : fun_ticket(f) {} - bool operator()(const Item * item1, const Item * item2); - }; - - void SelectTickets(); - void SortDirs(); - void PageDirs(); - void CreateIdTab(); + Ticket ticket; }; diff --git a/plugins/ticket/init.cpp b/plugins/ticket/init.cpp index 4d85d34..457bb46 100755 --- a/plugins/ticket/init.cpp +++ b/plugins/ticket/init.cpp @@ -11,8 +11,10 @@ #include "funticket.h" #include "editticket.h" #include "createticket.h" +#include "showtickets.h" #include "core/log.h" #include "core/plugin.h" +#include "sessiondata.h" extern "C" void Init(PluginInfo &); @@ -28,7 +30,7 @@ TicketInfo ticket_info; FunTicket fun_ticket; CreateTicket fun_create_ticket; EditTicket fun_edit_ticket; - +ShowTickets fun_show_tickets; void AddFunctions(PluginInfo & info) @@ -36,16 +38,19 @@ void AddFunctions(PluginInfo & info) info.functions->Add(fun_ticket); info.functions->Add(fun_create_ticket); info.functions->Add(fun_edit_ticket); + info.functions->Add(fun_show_tickets); } void SelectDefaultFunction(PluginInfo & info) { - if( info.request->is_item ) - return; - if( info.system->mounts.pmount->type == ticket_info.mount_type_ticket ) - info.request->function = &fun_ticket; + { + if( info.request->is_item ) + info.request->function = &fun_ticket; + else + info.request->function = &fun_show_tickets; + } } @@ -53,22 +58,8 @@ void AddMounts(PluginInfo & info) { Mounts & m = info.system->mounts; - ticket_info.mount_type_ticket = m.AddMountType(L"ticket"); - ticket_info.mount_par_ticket = m.AddMountPar(L"ticket"); - ticket_info.mount_par_ticket_conf = m.AddMountPar(L"ticket_conf"); - - // !! bedzie do usuniecia - ticket_info.mount_par_ticket_type = m.AddMountPar(L"ticket_type"); - ticket_info.mount_par_ticket_type_default = m.AddMountPar(L"ticket_type_default"); - ticket_info.mount_par_ticket_status = m.AddMountPar(L"ticket_status"); - ticket_info.mount_par_ticket_status_default = m.AddMountPar(L"ticket_status_default"); - ticket_info.mount_par_ticket_priority = m.AddMountPar(L"ticket_priority"); - ticket_info.mount_par_ticket_priority_default = m.AddMountPar(L"ticket_priority_default"); - ticket_info.mount_par_ticket_category = m.AddMountPar(L"ticket_category"); - ticket_info.mount_par_ticket_category_default = m.AddMountPar(L"ticket_category_default"); - ticket_info.mount_par_ticket_expected = m.AddMountPar(L"ticket_expected"); - ticket_info.mount_par_ticket_expected_default = m.AddMountPar(L"ticket_expected_default"); - ticket_info.mount_par_createticket_on = m.AddMountPar(L"createticket_on"); + ticket_info.mount_type_ticket = m.AddMountType(L"ticket"); + ticket_info.mount_par_ticket_conf = m.AddMountPar(L"ticket_conf"); } @@ -90,6 +81,8 @@ void ProcessRequest(PluginInfo & info) } + + void RemoveTicket(PluginInfo & i) { tdb.RemoveTicket(i.l1); @@ -104,7 +97,22 @@ void InitTicket(PluginInfo & info) void AddNotifyTemplate(PluginInfo & info) { - ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt"); + ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt"); +} + + +void CreateSession(PluginInfo & info) +{ + SessionData * p = new SessionData(); + info.request->session->plugin_data.Assign(p); + log << log4 << "Ticket: created ticket plugin data: " << (void*)p << logend; +} + + +void RemoveSession(PluginInfo & info) +{ + delete info.plugin_data_base; + log << log4 << "Ticket: removed ticket plugin date: " << (void*)info.plugin_data_base << logend; } @@ -125,16 +133,21 @@ using namespace Ticket; plugin.Assign(WINIX_ADD_MOUNTS, AddMounts); plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged); plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest); - plugin.Assign(WINIX_DIR_REMOVED, RemoveTicket); + plugin.Assign(WINIX_FILE_REMOVED, RemoveTicket); plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate); + plugin.Assign(WINIX_SESSION_CREATED, CreateSession); + plugin.Assign(WINIX_SESSION_REMOVE, RemoveSession); tdb.SetConn(info.db->GetConn()); tdb.LogQueries(info.config->log_db_query); ticket_info.SetDb(info.db); ticket_info.SetTDb(&tdb); + ticket_info.SetConfig(info.config); ticket_info.SetSystem(info.system); ticket_info.SetRequest(info.request); + ticket_info.SetFunctions(info.functions); + ticket_info.plugin_id = info.plugin_id; fun_ticket.SetTDb(&tdb); fun_ticket.SetTicketInfo(&ticket_info); @@ -145,6 +158,9 @@ using namespace Ticket; fun_create_ticket.SetTDb(&tdb); fun_create_ticket.SetTicketInfo(&ticket_info); + fun_show_tickets.SetTDb(&tdb); + fun_show_tickets.SetTicketInfo(&ticket_info); + info.p1 = (void*)(plugin_name); } diff --git a/plugins/ticket/sessiondata.cpp b/plugins/ticket/sessiondata.cpp new file mode 100755 index 0000000..dc1d93d --- /dev/null +++ b/plugins/ticket/sessiondata.cpp @@ -0,0 +1,42 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "sessiondata.h" + + +namespace Ticket +{ + + + +Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new) +{ + std::pair res = ticket_map.insert( std::make_pair(id, Ticket()) ); + + if( is_new ) + *is_new = res.second; + +return res.first->second; +} + + + +std::vector & SessionData::GetFileTab(long id, FileMap & file_map) +{ + std::pair res = file_map.insert( std::make_pair(id, std::vector()) ); + +return res.first->second; +} + + + +} // namespace + + + diff --git a/plugins/ticket/sessiondata.h b/plugins/ticket/sessiondata.h new file mode 100755 index 0000000..7341e36 --- /dev/null +++ b/plugins/ticket/sessiondata.h @@ -0,0 +1,53 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#ifndef headerfile_winix_plugins_ticket_sessiondata +#define headerfile_winix_plugins_ticket_sessiondata + +#include +#include +#include +#include "core/plugindata.h" +#include "ticket.h" + + +namespace Ticket +{ + + +struct SessionData : public PluginDataBase +{ + typedef std::map TicketMap; + typedef std::map > FileMap; + + // temporary tickets for 'createticket' function + // + TicketMap create_ticket_map; + + // temporary tickets for 'editticket' function + // + TicketMap edit_ticket_map; + + // temporary files for 'editticket' function + // these files should be deleted if a user will not click on the submit button + FileMap new_file_map; + + + // inserting and returning a new ticket or just returning the ticket if it exists + Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0); + + std::vector & GetFileTab(long id, FileMap & file_map); + +}; + + +} // namespace + + +#endif diff --git a/plugins/ticket/showtickets.cpp b/plugins/ticket/showtickets.cpp new file mode 100755 index 0000000..bf480c0 --- /dev/null +++ b/plugins/ticket/showtickets.cpp @@ -0,0 +1,138 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include +#include +#include "showtickets.h" + + + +namespace Ticket +{ + + + +ShowTickets::ShowTickets() +{ + fun.url = L"showtickets"; +} + + +void ShowTickets::SetTDb(TDb * ptdb) +{ + tdb = ptdb; +} + + +void ShowTickets::SetTicketInfo(TicketInfo * pinfo) +{ + ticket_info = pinfo; +} + + + +bool ShowTickets::HasAccess() +{ + return !request->is_item; +} + + + +bool ShowTickets::Sort::operator()(const Item * item1, const Item * item2) +{ + if( sort_type == 0 ) + { + // sorting by url + return item1->url < item2->url; + } + else + { + // sorting by date + tm tm1 = item1->date_creation; + tm tm2 = item2->date_creation; + + time_t time1 = Time(tm1); + time_t time2 = Time(tm2); + + return time1 < time2; + } +} + + + + +void ShowTickets::ReadFiles() +{ + // reading files + DbItemQuery iq; + iq.SetAll(false, false); + iq.sel_url = true; + iq.sel_subject = true; + iq.sel_date = true; + iq.WhereParentId(request->dir_tab.back()->id); + iq.WhereType(Item::file); + iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE); + + db->GetItems(ticket_info->item_tab, iq); + system->CheckAccessToItems(ticket_info->item_tab); +} + + +void ShowTickets::ReadTickets() +{ + // reading tickets for the files + file_id_tab.resize(ticket_info->item_tab.size()); + + for(size_t i=0 ; iitem_tab.size() ; ++i) + file_id_tab[i] = ticket_info->item_tab[i].id; + + tdb->GetTickets(file_id_tab, ticket_info->ticket_tab); +} + + +void ShowTickets::CreatePointers() +{ + // creating a pointers table + ticket_info->item_sort_tab.resize(ticket_info->item_tab.size()); + + for(size_t i=0 ; iitem_tab.size() ; ++i) + ticket_info->item_sort_tab[i] = &ticket_info->item_tab[i]; +} + + + +void ShowTickets::SortPointers() +{ + int sort_type = 1; + + if( request->PostVar(L"sort") == L"url" ) + sort_type = 0; + + std::vector & table = ticket_info->item_sort_tab; + std::sort(table.begin(), table.end(), Sort(this, sort_type)); +} + + + +void ShowTickets::MakeGet() +{ + ticket_info->Clear(); + ticket_info->FindCurrentConf(); + + ReadFiles(); + ReadTickets(); + CreatePointers(); + SortPointers(); +} + + + + + +} // namespace diff --git a/plugins/ticket/showtickets.h b/plugins/ticket/showtickets.h new file mode 100755 index 0000000..45b14d2 --- /dev/null +++ b/plugins/ticket/showtickets.h @@ -0,0 +1,58 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#ifndef headerfile_winix_plugins_ticket_showtickets +#define headerfile_winix_plugins_ticket_showtickets + +#include "tdb.h" +#include "ticketinfo.h" +#include "core/item.h" +#include "functions/functionbase.h" + + +namespace Ticket +{ + + +class ShowTickets : public FunctionBase +{ +public: + + ShowTickets(); + void SetTDb(TDb * ptdb); + void SetTicketInfo(TicketInfo * pinfo); + + bool HasAccess(); + void MakeGet(); + +private: + + TDb * tdb; + TicketInfo * ticket_info; + std::vector file_id_tab; + + void ReadFiles(); + void ReadTickets(); + void CreatePointers(); + void SortPointers(); + + struct Sort + { + ShowTickets * show_tickets; + int sort_type; + Sort(ShowTickets * show, int type) : show_tickets(show), sort_type(type) {} + bool operator()(const Item * item1, const Item * item2); + }; + +}; + + +} // namespace + +#endif diff --git a/plugins/ticket/tdb.cpp b/plugins/ticket/tdb.cpp index d8c9cc2..35a82bf 100755 --- a/plugins/ticket/tdb.cpp +++ b/plugins/ticket/tdb.cpp @@ -16,8 +16,34 @@ namespace Ticket { +bool TDb::IsTicket(long file_id) +{ + PGresult * r = 0; + bool is = false; + + try + { + query.Clear(); + query << R("select count(*) from plugins.ticket " + "where ticket.file_id=") << file_id << R(";"); + + r = AssertQuery(query); + AssertResult(r, PGRES_TUPLES_OK); -Error TDb::GetTicket(long dir_id, Ticket & ticket) + if( Rows(r)==1 && Cols(r)==1 ) + is = AssertValueInt(r, 0, 0) != 0; + } + catch(const Error &) + { + } + + ClearResult(r); + +return is; +} + + +Error TDb::GetTicket(long file_id, Ticket & ticket) { PGresult * r = 0; Error status = WINIX_ERR_OK; @@ -26,8 +52,8 @@ Error TDb::GetTicket(long dir_id, Ticket & ticket) try { query.Clear(); - query << R("select dir_id, param, value from plugins.ticket " - "where ticket.dir_id=") << dir_id << R(";"); + query << R("select file_id, param, int_value, str_value from plugins.ticket " + "where ticket.file_id=") << file_id << R(";"); r = AssertQuery(query); AssertResult(r, PGRES_TUPLES_OK); @@ -38,15 +64,18 @@ Error TDb::GetTicket(long dir_id, Ticket & ticket) throw Error(WINIX_ERR_NO_TICKET); Ticket::TicketParam par; - ticket.dir_id = dir_id; + ticket.file_id = file_id; - int cparam = AssertColumn(r, "param"); - int cvalue = AssertColumn(r, "value"); + int cparam = AssertColumn(r, "param"); + int cintvalue = AssertColumn(r, "int_value"); + int cstrvalue = AssertColumn(r, "str_value"); for(int i=0 ; i & dir_id_tab, std::vector & ticket_tab) +Error TDb::GetTickets(const std::vector & file_id_tab, std::vector & ticket_tab) { PGresult * r = 0; Error status = WINIX_ERR_OK; ticket_tab.clear(); - if( dir_id_tab.empty() ) + if( file_id_tab.empty() ) return status; try { query.Clear(); - CreateIdList(dir_id_tab, dir_list); - query << R("select dir_id, param, value from plugins.ticket " - "where ticket.dir_id in ") << R(dir_list) << R(" order by dir_id;"); + CreateIdList(file_id_tab, file_list); + query << R("select file_id, param, int_value, str_value from plugins.ticket " + "where ticket.file_id in ") << R(file_list) << R(" order by file_id;"); // !! moze dodac operator <<(std::vector(long)) do query? @@ -89,24 +118,27 @@ Error TDb::GetTickets(const std::vector & dir_id_tab, std::vector int rows = Rows(r); Ticket::TicketParam par; - int cdir_id = AssertColumn(r, "dir_id"); - int cparam = AssertColumn(r, "param"); - int cvalue = AssertColumn(r, "value"); - long last_dir_id = -1; + int cfile_id = AssertColumn(r, "file_id"); + int cparam = AssertColumn(r, "param"); + int cintvalue = AssertColumn(r, "int_value"); + int cstrvalue = AssertColumn(r, "str_value"); + long last_file_id = -1; for(int i=0 ; i & dir_id_tab, std::vector } ClearResult(r); - dir_list.clear(); + file_list.clear(); return status; } @@ -134,10 +166,11 @@ Error TDb::AddTicket(const Ticket & ticket) for(size_t i=0 ; i & dir_id_tab, std::vector & ticket_tab); + bool IsTicket(long file_id); + Error GetTicket(long file_id, Ticket & ticket); + Error GetTickets(const std::vector & file_id_tab, std::vector & ticket_tab); Error AddTicket(const Ticket & ticket); Error RemoveAddTicket(const Ticket & ticket); // first removing and then adding a ticket - Error RemoveTicket(long dir_id); + Error RemoveTicket(long file_id); private: DbTextStream query; - std::wstring dir_list; + std::wstring file_list; }; diff --git a/plugins/ticket/templates.cpp b/plugins/ticket/templates.cpp index c06af38..47930ce 100755 --- a/plugins/ticket/templates.cpp +++ b/plugins/ticket/templates.cpp @@ -16,6 +16,8 @@ #include "core/plugin.h" #include "functions/functions.h" #include "templates/templates.h" +#include "sessiondata.h" + namespace Ticket @@ -45,38 +47,49 @@ return percent; -void find_ticket_value(const TicketConf::TicketItem & conf_item, const Ticket & ticket, bool * has_value, int * value) +bool find_ticket_value(const TicketConf::TicketItem & conf_item, const Ticket & ticket, size_t * ticket_par_index) { - *has_value = false; - *value = 0; - for(size_t a=0 ; a < ticket.par_tab.size() ; a++) { - int par = ticket.par_tab[a].param; - int val = ticket.par_tab[a].value; - - if( par == conf_item.id ) + if( ticket.par_tab[a].param == conf_item.id ) { - *has_value = true; - *value = val; + *ticket_par_index = a; + return true; } } + +return false; } -void ticket_print_value(Info & i, size_t conf_index, int value) +void ticket_print_value(Info & i, size_t conf_index, const Ticket::TicketParam & ticket_param) { if( conf_index < ticket_info.cur_conf->tab.size() ) { const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; - if( conf_item.type == TicketConf::TicketItem::TypeInteger ) - i.out << value; + if( conf_item.type == TicketConf::TicketItem::TypeInteger || + conf_item.type == TicketConf::TicketItem::TypeProgress ) + { + i.out << ticket_param.int_value; + } else if( conf_item.type == TicketConf::TicketItem::TypeSelect ) { - if( value < (int)conf_item.select.size() ) - i.out << conf_item.select[value].name; + if( ticket_param.int_value < (int)conf_item.select.size() ) + i.out << conf_item.select[ticket_param.int_value].name; + } + else + if( conf_item.type == TicketConf::TicketItem::TypeString || + conf_item.type == TicketConf::TicketItem::TypeMultistring ) + { + i.out << ticket_param.str_value; + } + else + if( conf_item.type == TicketConf::TicketItem::TypeImages || + conf_item.type == TicketConf::TicketItem::TypeFiles ) + { + i.out << ticket_param.str_value; } } } @@ -84,41 +97,9 @@ void ticket_print_value(Info & i, size_t conf_index, int value) -void ticket_is(Info & i) -{ - i.res = ticket_info.is_ticket; -} - - -void ticket_item_subject(Info & i) -{ - i.out << ticket_info.item.subject; -} - - -void ticket_item_content(Info & i) -{ - i.out << ticket_info.item.content; -} - - -void ticket_item_content_type_is(Info & i) -{ - item_content_type_is(ticket_info.item, i); -} - - -void ticket_item_print_content(Info & i) -{ - item_print_content(i.out, ticket_info.item.content, ticket_info.item.content_type); -} - - - - void ticket_can_create(Info & i) { - i.res = fun_create_ticket.HasAccess(true); + i.res = fun_create_ticket.HasAccess(); } @@ -133,65 +114,63 @@ void ticket_can_edit(Info & i) namespace ns_tickets_tab { -static size_t tickets_tab_index; -static size_t conf_tab_index; +static size_t item_sort_index; // index for: ticket_info.item_sort_tab +static size_t ticket_index; // index for: ticket_info.ticket_tab +static size_t par_index; // index for: ticket_info.ticket_tab[ticket_index].par_tab +static size_t conf_tab_index; // index for: ticket_info.cur_conf->tab +static bool has_ticket; static bool has_value; -static int value; + void tickets_tab(Info & i) { - tickets_tab_index = i.iter; - i.res = tickets_tab_index < ticket_info.ticket_tab.size(); -} + has_ticket = false; + item_sort_index = i.iter; + i.res = item_sort_index < ticket_info.item_sort_tab.size(); - - -Item * tickets_tab_find_index_dir() -{ -Item * dir = 0; - - if( tickets_tab_index < ticket_info.ticket_tab.size() ) + if( i.res ) { - long dir_id = ticket_info.ticket_tab[tickets_tab_index].dir_id; - dir = system->dirs.GetDir(dir_id); + for(size_t a=0 ; aid ) + { + has_ticket = true; + ticket_index = a; + } + } } - -return dir; } - void tickets_tab_url(Info & i) { - Item * dir = tickets_tab_find_index_dir(); - - if( dir ) - i.out << dir->url; + if( item_sort_index < ticket_info.item_sort_tab.size() ) + i.out << ticket_info.item_sort_tab[item_sort_index]->url; } void tickets_tab_subject_empty(Info & i) { - Item * dir = tickets_tab_find_index_dir(); - - if( dir ) - i.res = dir->subject.empty(); + if( item_sort_index < ticket_info.item_sort_tab.size() ) + i.res = ticket_info.item_sort_tab[item_sort_index]->subject.empty(); } void tickets_tab_subject(Info & i) { - Item * dir = tickets_tab_find_index_dir(); - - if( dir ) - i.out << dir->subject; + if( item_sort_index < ticket_info.item_sort_tab.size() ) + i.out << ticket_info.item_sort_tab[item_sort_index]->subject; } void tickets_tab_conf_tab(Info & i) { - if( tickets_tab_index < ticket_info.ticket_tab.size() ) + has_value = false; + + if( has_ticket && + item_sort_index < ticket_info.item_sort_tab.size() && + ticket_index < ticket_info.ticket_tab.size() ) { conf_tab_index = i.iter; i.res = conf_tab_index < ticket_info.cur_conf->tab.size(); @@ -199,37 +178,105 @@ void tickets_tab_conf_tab(Info & i) if( i.res ) { const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; - const Ticket & ticket = ticket_info.ticket_tab[tickets_tab_index]; - find_ticket_value(conf_item, ticket, &has_value, &value); + const Ticket & ticket = ticket_info.ticket_tab[ticket_index]; + has_value = find_ticket_value(conf_item, ticket, &par_index); } } } void tickets_tab_conf_tab_value(Info & i) -{ - if( has_value ) - ticket_print_value(i, conf_tab_index, value); -} - - - -void tickets_tab_conf_tab_is_progress(Info & i) { if( has_value && - conf_tab_index < ticket_info.cur_conf->tab.size() ) + item_sort_index < ticket_info.item_sort_tab.size() && + ticket_index < ticket_info.ticket_tab.size() && + par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() ) { - const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; - i.res = IsSubString(ticket_info.progress_prefix, conf_item.name); + ticket_print_value(i, conf_tab_index, ticket_info.ticket_tab[ticket_index].par_tab[par_index]); } } +void tickets_tab_conf_tab_is_integer(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeInteger; + } +} + + +void tickets_tab_conf_tab_is_progress(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeProgress; + } +} + + +void tickets_tab_conf_tab_is_select(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeSelect; + } +} + + +void tickets_tab_conf_tab_is_string(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeString; + } +} + + +void tickets_tab_conf_tab_is_multistring(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeMultistring; + } +} + + +void tickets_tab_conf_tab_is_images(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeImages; + } +} + + +void tickets_tab_conf_tab_is_files(Info & i) +{ + if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() ) + { + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + i.res = conf_item.type == TicketConf::TicketItem::TypeFiles; + } +} + + void tickets_tab_conf_tab_progress_image_number(Info & i) { - if( has_value ) - i.out << ticket_calc_progress_image_number(value); + if( has_value && + ticket_index < ticket_info.ticket_tab.size() && + par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() ) + { + int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].int_value; + i.out << ticket_calc_progress_image_number(progress); + } } @@ -237,12 +284,17 @@ void tickets_tab_conf_tab_progress_image_number(Info & i) + + + namespace ns_ticket_tab { -static size_t conf_index; -static size_t select_index; +static size_t conf_index; // index for: ticket_info.cur_conf->tab +static size_t select_index; // index for: ticket_info.cur_conf->tab[conf_index].select +static size_t par_index; // index for: ticket_info.ticket->par_tab +static size_t files_number; static bool has_value; -static int value; + void ticket_tab(Info & i) @@ -253,11 +305,12 @@ void ticket_tab(Info & i) if( i.res ) { const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; - find_ticket_value(conf_item, ticket_info.ticket, &has_value, &value); + has_value = find_ticket_value(conf_item, *ticket_info.ticket, &par_index); } } + void ticket_tab_param(Info & i) { if( conf_index < ticket_info.cur_conf->tab.size() ) @@ -267,8 +320,8 @@ void ticket_tab_param(Info & i) void ticket_tab_value(Info & i) { - if( has_value ) - ticket_print_value(i, conf_index, value); + if( has_value && par_index < ticket_info.ticket->par_tab.size() ) + ticket_print_value(i, conf_index, ticket_info.ticket->par_tab[par_index]); } @@ -280,13 +333,33 @@ void ticket_tab_param_index(Info & i) } -void ticket_tab_value_index(Info & i) +void ticket_tab_int_value_index(Info & i) { - if( has_value ) - i.out << value; + if( has_value && par_index < ticket_info.ticket->par_tab.size() ) + i.out << ticket_info.ticket->par_tab[par_index].int_value; } +void ticket_tab_str_value_index(Info & i) +{ + if( has_value && par_index < ticket_info.ticket->par_tab.size() ) + i.out << ticket_info.ticket->par_tab[par_index].str_value; +} + + +void ticket_tab_is_integer(Info & i) +{ + if( conf_index < ticket_info.cur_conf->tab.size() ) + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeInteger; +} + + +void ticket_tab_is_progress(Info & i) +{ + if( conf_index < ticket_info.cur_conf->tab.size() ) + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeProgress; +} + void ticket_tab_is_select(Info & i) { if( conf_index < ticket_info.cur_conf->tab.size() ) @@ -294,10 +367,31 @@ void ticket_tab_is_select(Info & i) } -void ticket_tab_is_integer(Info & i) +void ticket_tab_is_string(Info & i) { if( conf_index < ticket_info.cur_conf->tab.size() ) - i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeInteger; + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeString; +} + + +void ticket_tab_is_multistring(Info & i) +{ + if( conf_index < ticket_info.cur_conf->tab.size() ) + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeMultistring; +} + + +void ticket_tab_is_images(Info & i) +{ + if( conf_index < ticket_info.cur_conf->tab.size() ) + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeImages; +} + + +void ticket_tab_is_files(Info & i) +{ + if( conf_index < ticket_info.cur_conf->tab.size() ) + i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeFiles; } @@ -311,15 +405,17 @@ void ticket_tab_select_tab(Info & i) } +// !! zmienic nazwe na cos w stylu should_be_selected +// bo to nie tylko odczytuje nazwe z konfiga void ticket_tab_select_tab_is_default(Info & i) { - if( has_value ) + if( has_value && par_index < ticket_info.ticket->par_tab.size() ) { - i.res = select_index == (size_t)value; + i.res = select_index == (size_t)ticket_info.ticket->par_tab[par_index].int_value; } else { - if( conf_index < ticket_info.cur_conf->tab.size() && + if( conf_index < ticket_info.cur_conf->tab.size() && select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) { i.res = select_index == ticket_info.cur_conf->tab[conf_index].select_default; @@ -330,7 +426,7 @@ void ticket_tab_select_tab_is_default(Info & i) void ticket_tab_select_tab_name(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() && + if( conf_index < ticket_info.cur_conf->tab.size() && select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) { i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].name; @@ -340,7 +436,7 @@ void ticket_tab_select_tab_name(Info & i) void ticket_tab_select_tab_id(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() && + if( conf_index < ticket_info.cur_conf->tab.size() && select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) { i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].id; @@ -348,6 +444,49 @@ void ticket_tab_select_tab_id(Info & i) } + + +void ticket_tab_files_tab(Info & i) +{ + files_number = i.iter; + + if( has_value && conf_index < ticket_info.cur_conf->tab.size() ) + { + if( i.iter == 0 ) + { + // first iteration, we are using the par_index found by previous call to ticket_tab + i.res = true; + return; + } + else + { + // next iteration, we are looking for the next par_index + const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; + + for(++par_index ; par_index < ticket_info.ticket->par_tab.size() ; ++par_index) + { + if( ticket_info.ticket->par_tab[par_index].param == conf_item.id ) + { + i.res = true; + return; + } + } + + // there are no more such items + has_value = false; + i.res = false; + } + } +} + + +void ticket_tab_files_tab_index(Info & i) +{ + i.out << files_number; +} + + + } // namespace ns_ticket_tab @@ -362,94 +501,52 @@ using namespace ns_ticket_tab; using TemplatesFunctions::EzcFun; EzcFun * fun = reinterpret_cast(info.p1); - fun->Insert("ticket_is", ticket_is); - fun->Insert("ticket_item_subject", ticket_item_subject); - fun->Insert("ticket_item_content", ticket_item_content); - fun->Insert("ticket_item_content_type_is", ticket_item_content_type_is); - fun->Insert("ticket_item_print_content", ticket_item_print_content); - fun->Insert("ticket_can_create", ticket_can_create); - fun->Insert("ticket_can_edit", ticket_can_edit); - - fun->Insert("tickets_tab", tickets_tab); - fun->Insert("tickets_tab_url", tickets_tab_url); - fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty); - fun->Insert("tickets_tab_subject", tickets_tab_subject); - fun->Insert("tickets_tab_url", tickets_tab_url); + fun->Insert("ticket_can_create", ticket_can_create); + fun->Insert("ticket_can_edit", ticket_can_edit); + fun->Insert("tickets_tab", tickets_tab); + fun->Insert("tickets_tab_url", tickets_tab_url); + fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty); + fun->Insert("tickets_tab_subject", tickets_tab_subject); + fun->Insert("tickets_tab_url", tickets_tab_url); - fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab); + fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab); fun->Insert("tickets_tab_conf_tab_value", tickets_tab_conf_tab_value); - fun->Insert("tickets_tab_conf_tab_is_progress", tickets_tab_conf_tab_is_progress); - fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number); + + fun->Insert("tickets_tab_conf_tab_is_integer", tickets_tab_conf_tab_is_integer); + fun->Insert("tickets_tab_conf_tab_is_progress", tickets_tab_conf_tab_is_progress); + fun->Insert("tickets_tab_conf_tab_is_select", tickets_tab_conf_tab_is_select); + fun->Insert("tickets_tab_conf_tab_is_string", tickets_tab_conf_tab_is_string); + fun->Insert("tickets_tab_conf_tab_is_multistring", tickets_tab_conf_tab_is_multistring); + fun->Insert("tickets_tab_conf_tab_is_images", tickets_tab_conf_tab_is_images); + fun->Insert("tickets_tab_conf_tab_is_files", tickets_tab_conf_tab_is_files); + fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number); - fun->Insert("ticket_tab", ticket_tab); - fun->Insert("ticket_tab_param", ticket_tab_param); - fun->Insert("ticket_tab_value", ticket_tab_value); - fun->Insert("ticket_tab_param_index", ticket_tab_param_index); - fun->Insert("ticket_tab_value_index", ticket_tab_value_index); - fun->Insert("ticket_tab_is_select", ticket_tab_is_select); - fun->Insert("ticket_tab_is_integer", ticket_tab_is_integer); + fun->Insert("ticket_tab", ticket_tab); - fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab); + fun->Insert("ticket_tab_param", ticket_tab_param); + fun->Insert("ticket_tab_value", ticket_tab_value); + fun->Insert("ticket_tab_param_index", ticket_tab_param_index); + fun->Insert("ticket_tab_int_value_index", ticket_tab_int_value_index); + fun->Insert("ticket_tab_str_value_index", ticket_tab_str_value_index); + + fun->Insert("ticket_tab_is_integer", ticket_tab_is_integer); + fun->Insert("ticket_tab_is_progress", ticket_tab_is_progress); + fun->Insert("ticket_tab_is_select", ticket_tab_is_select); + fun->Insert("ticket_tab_is_string", ticket_tab_is_string); + fun->Insert("ticket_tab_is_multistring", ticket_tab_is_multistring); + fun->Insert("ticket_tab_is_images", ticket_tab_is_images); + fun->Insert("ticket_tab_is_files", ticket_tab_is_files); + + fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab); fun->Insert("ticket_tab_select_tab_is_default", ticket_tab_select_tab_is_default); - fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id); - fun->Insert("ticket_tab_select_tab_name", ticket_tab_select_tab_name); + fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id); + fun->Insert("ticket_tab_select_tab_name", ticket_tab_select_tab_name); - - /* - fun->Insert("ticket_type", ticket_type); - fun->Insert("ticket_status", ticket_status); - fun->Insert("ticket_priority", ticket_priority); - fun->Insert("ticket_category", ticket_category); - fun->Insert("ticket_expected", ticket_expected); - fun->Insert("ticket_progress", ticket_progress); - fun->Insert("ticket_progress_image_number", ticket_progress_image_number); - - fun->Insert("ticket_tab", ticket_tab); - fun->Insert("ticket_tab_url", ticket_tab_url); - fun->Insert("ticket_tab_subject", ticket_tab_subject); - fun->Insert("ticket_tab_subject_empty", ticket_tab_subject_empty); - fun->Insert("ticket_tab_author", ticket_tab_author); - fun->Insert("ticket_tab_type", ticket_tab_type); - fun->Insert("ticket_tab_status", ticket_tab_status); - fun->Insert("ticket_tab_priority", ticket_tab_priority); - fun->Insert("ticket_tab_category", ticket_tab_category); - fun->Insert("ticket_tab_expected", ticket_tab_expected); - fun->Insert("ticket_tab_progress", ticket_tab_progress); - fun->Insert("ticket_tab_progress_image_number",ticket_tab_progress_image_number); - - fun->Insert("ticket_type_tab", ticket_type_tab); - fun->Insert("ticket_type_tab_defined", ticket_type_tab_defined); - fun->Insert("ticket_type_tab_isdefault", ticket_type_tab_isdefault); - fun->Insert("ticket_type_tab_index", ticket_type_tab_index); - fun->Insert("ticket_type_tab_name", ticket_type_tab_name); - - fun->Insert("ticket_status_tab", ticket_status_tab); - fun->Insert("ticket_status_tab_defined", ticket_status_tab_defined); - fun->Insert("ticket_status_tab_isdefault", ticket_status_tab_isdefault); - fun->Insert("ticket_status_tab_index", ticket_status_tab_index); - fun->Insert("ticket_status_tab_name", ticket_status_tab_name); - - fun->Insert("ticket_priority_tab", ticket_priority_tab); - fun->Insert("ticket_priority_tab_defined", ticket_priority_tab_defined); - fun->Insert("ticket_priority_tab_isdefault", ticket_priority_tab_isdefault); - fun->Insert("ticket_priority_tab_index", ticket_priority_tab_index); - fun->Insert("ticket_priority_tab_name", ticket_priority_tab_name); - - fun->Insert("ticket_category_tab", ticket_category_tab); - fun->Insert("ticket_category_tab_defined", ticket_category_tab_defined); - fun->Insert("ticket_category_tab_isdefault", ticket_category_tab_isdefault); - fun->Insert("ticket_category_tab_index", ticket_category_tab_index); - fun->Insert("ticket_category_tab_name", ticket_category_tab_name); - - fun->Insert("ticket_expected_tab", ticket_expected_tab); - fun->Insert("ticket_expected_tab_defined", ticket_expected_tab_defined); - fun->Insert("ticket_expected_tab_isdefault", ticket_expected_tab_isdefault); - fun->Insert("ticket_expected_tab_index", ticket_expected_tab_index); - fun->Insert("ticket_expected_tab_name", ticket_expected_tab_name); - */ + fun->Insert("ticket_tab_files_tab", ticket_tab_files_tab); + fun->Insert("ticket_tab_files_tab_index", ticket_tab_files_tab_index); } diff --git a/plugins/ticket/ticket.h b/plugins/ticket/ticket.h index 809e7a0..394c449 100755 --- a/plugins/ticket/ticket.h +++ b/plugins/ticket/ticket.h @@ -11,7 +11,7 @@ #define headerfile_winix_plugins_ticket_ticket #include - +#include namespace Ticket @@ -21,16 +21,25 @@ struct Ticket { struct TicketParam { - int param; - int value; + long file_id; + int param; + long int_value; // changed to long (from int) + std::wstring str_value; + + void Clear() + { + // !! what about file_id? + param = 0; + int_value = 0; + str_value.clear(); + } TicketParam() { - param = value = 0; + Clear(); } }; - long dir_id; std::vector par_tab; // auxiliary object used during sorting @@ -38,7 +47,7 @@ struct Ticket void Clear() { - dir_id = -1; + file_id = -1; par_tab.clear(); sort_id = 0; } diff --git a/plugins/ticket/ticketconf.cpp b/plugins/ticket/ticketconf.cpp index 98af9c5..976c1b5 100755 --- a/plugins/ticket/ticketconf.cpp +++ b/plugins/ticket/ticketconf.cpp @@ -13,8 +13,10 @@ void TicketConf::TicketItem::Clear() id = 0; name.clear(); type = TypeInteger; - integer_min = std::numeric_limits::min(); - integer_max = std::numeric_limits::max(); + integer_min = std::numeric_limits::min(); + integer_max = std::numeric_limits::max(); + max_files = 0; + upload_dir.clear(); select.clear(); select_default = 0; } diff --git a/plugins/ticket/ticketconf.h b/plugins/ticket/ticketconf.h index 077d7e6..156a77d 100755 --- a/plugins/ticket/ticketconf.h +++ b/plugins/ticket/ticketconf.h @@ -17,23 +17,27 @@ struct TicketConf int id; }; - TicketItem(); void Clear(); - enum Type { TypeInteger, TypeSelect }; + enum Type { TypeInteger, TypeProgress, TypeSelect, TypeString, TypeMultistring, TypeImages, TypeFiles }; int id; std::wstring name; Type type; - // used when type is TypeInteger + // used when type is TypeInteger or TypeProgress int integer_min, integer_max; // used when type is TypeSelect std::vector