diff --git a/core/Makefile.dep b/core/Makefile.dep index bf54945..f68d139 100755 --- a/core/Makefile.dep +++ b/core/Makefile.dep @@ -25,13 +25,14 @@ app.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h app.o: ../functions/run.h ../functions/stat.h ../functions/subject.h app.o: ../functions/funthread.h ../functions/template.h app.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -app.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -app.o: ../templates/templates.h misc.h ../templates/patterncacher.h -app.o: ../core/item.h ../templates/ckeditorgetparser.h -app.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h -app.o: ../core/sessionmanager.h compress.h getparser.h httpsimpleparser.h -app.o: postparser.h cookieparser.h postmultiparser.h acceptencodingparser.h -app.o: acceptbaseparser.h plugin.h pluginmsg.h +app.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +app.o: ../core/htmlfilter.h ../templates/templates.h misc.h +app.o: ../templates/patterncacher.h ../core/item.h +app.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +app.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h +app.o: compress.h getparser.h httpsimpleparser.h postparser.h cookieparser.h +app.o: postmultiparser.h acceptencodingparser.h acceptbaseparser.h plugin.h +app.o: pluginmsg.h bbcodeparser.o: bbcodeparser.h htmlfilter.h compress.o: compress.h log.h config.o: config.h confparser.h htmlfilter.h log.h plugin.h pluginmsg.h @@ -57,12 +58,13 @@ config.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h config.o: ../functions/run.h ../functions/stat.h ../functions/subject.h config.o: ../functions/funthread.h ../functions/template.h config.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -config.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -config.o: ../templates/templates.h misc.h ../templates/patterncacher.h -config.o: ../core/item.h ../templates/ckeditorgetparser.h -config.o: ../core/httpsimpleparser.h ../core/log.h -config.o: ../templates/indexpatterns.h ../templates/localefilter.h -config.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h +config.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +config.o: ../core/htmlfilter.h ../templates/templates.h misc.h +config.o: ../templates/patterncacher.h ../core/item.h +config.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +config.o: ../core/log.h ../templates/indexpatterns.h +config.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h +config.o: ../core/sessionmanager.h confparser.o: confparser.h misc.h item.h dircontainer.o: dircontainer.h item.h log.h dirs.o: dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h @@ -121,12 +123,13 @@ mounts.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h mounts.o: ../functions/run.h ../functions/stat.h ../functions/subject.h mounts.o: ../functions/funthread.h ../functions/template.h mounts.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -mounts.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -mounts.o: ../templates/templates.h misc.h ../templates/patterncacher.h -mounts.o: ../core/item.h ../templates/ckeditorgetparser.h -mounts.o: ../core/httpsimpleparser.h ../core/log.h -mounts.o: ../templates/indexpatterns.h ../templates/localefilter.h -mounts.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h +mounts.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +mounts.o: ../core/htmlfilter.h ../templates/templates.h misc.h +mounts.o: ../templates/patterncacher.h ../core/item.h +mounts.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +mounts.o: ../core/log.h ../templates/indexpatterns.h +mounts.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h +mounts.o: ../core/sessionmanager.h notify.o: log.h notify.h ../templatesnotify/templatesnotify.h notify.o: ../../ezc/src/ezc.h ../core/mount.h ../core/locale.h confparser.h notify.o: ../core/config.h ../templates/misc.h ../templates/localefilter.h @@ -162,12 +165,13 @@ plugin.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h plugin.o: ../functions/run.h ../functions/stat.h ../functions/subject.h plugin.o: ../functions/funthread.h ../functions/template.h plugin.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -plugin.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -plugin.o: ../templates/templates.h misc.h ../templates/patterncacher.h -plugin.o: ../core/item.h ../templates/ckeditorgetparser.h -plugin.o: ../core/httpsimpleparser.h ../core/log.h -plugin.o: ../templates/indexpatterns.h ../templates/localefilter.h -plugin.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h +plugin.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +plugin.o: ../core/htmlfilter.h ../templates/templates.h misc.h +plugin.o: ../templates/patterncacher.h ../core/item.h +plugin.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +plugin.o: ../core/log.h ../templates/indexpatterns.h +plugin.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h +plugin.o: ../core/sessionmanager.h plugindata.o: plugindata.h plugin.h pluginmsg.h log.h config.h confparser.h plugindata.o: htmlfilter.h request.h requesttypes.h session.h item.h error.h plugindata.o: user.h rebus.h system.h dirs.h dircontainer.h ../db/db.h @@ -193,12 +197,13 @@ plugindata.o: ../functions/rm.h ../functions/run.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 ../core/htmlfilter.h -plugindata.o: ../templates/templates.h misc.h ../templates/patterncacher.h -plugindata.o: ../core/item.h ../templates/ckeditorgetparser.h -plugindata.o: ../core/httpsimpleparser.h ../core/log.h -plugindata.o: ../templates/indexpatterns.h ../templates/localefilter.h -plugindata.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h +plugindata.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +plugindata.o: ../core/htmlfilter.h ../templates/templates.h misc.h +plugindata.o: ../templates/patterncacher.h ../core/item.h +plugindata.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +plugindata.o: ../core/log.h ../templates/indexpatterns.h +plugindata.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h +plugindata.o: ../core/sessionmanager.h postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h postmultiparser.o: confparser.h htmlfilter.h log.h rebus.o: log.h rebus.h misc.h item.h request.h requesttypes.h session.h @@ -226,12 +231,13 @@ request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h request.o: ../functions/run.h ../functions/stat.h ../functions/subject.h request.o: ../functions/funthread.h ../functions/template.h request.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -request.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -request.o: ../templates/templates.h misc.h ../templates/patterncacher.h -request.o: ../core/item.h ../templates/ckeditorgetparser.h -request.o: ../core/httpsimpleparser.h ../core/log.h -request.o: ../templates/indexpatterns.h ../templates/localefilter.h -request.o: ../core/locale.h ../core/locale.h ../core/sessionmanager.h +request.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +request.o: ../core/htmlfilter.h ../templates/templates.h misc.h +request.o: ../templates/patterncacher.h ../core/item.h +request.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h +request.o: ../core/log.h ../templates/indexpatterns.h +request.o: ../templates/localefilter.h ../core/locale.h ../core/locale.h +request.o: ../core/sessionmanager.h session.o: session.h item.h error.h user.h plugindata.h rebus.h misc.h sessioncontainer.o: sessioncontainer.h session.h item.h error.h user.h sessioncontainer.o: plugindata.h rebus.h lastcontainer.h log.h misc.h @@ -263,7 +269,7 @@ sessionmanager.o: ../functions/run.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 +sessionmanager.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h sessionmanager.o: ../core/htmlfilter.h ../templates/templates.h misc.h sessionmanager.o: ../templates/patterncacher.h ../core/item.h sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h diff --git a/core/app.cpp b/core/app.cpp index 5e5a9cf..23d4cef 100755 --- a/core/app.cpp +++ b/core/app.cpp @@ -148,7 +148,7 @@ bool App::Init() request.Clear(); compress.Init(); system.Init(); - functions.Create(); + functions.Init(); // !! teraz mamy dwa katalogi z templetami // !! o co chodzilo? diff --git a/core/dircontainer.cpp b/core/dircontainer.cpp index f6f3cc1..925af78 100755 --- a/core/dircontainer.cpp +++ b/core/dircontainer.cpp @@ -12,12 +12,14 @@ std::string DirContainer::dir_etc = "etc"; +std::string DirContainer::dir_var = "var"; DirContainer::DirContainer() { is_root = false; is_etc = false; + is_var = false; } @@ -40,6 +42,15 @@ return etc_iter; } +DirContainer::Iterator DirContainer::GetVar() +{ + if( !is_var ) + return table.end(); + +return var_iter; +} + + DirContainer::Iterator DirContainer::Begin() { return table.begin(); @@ -69,6 +80,7 @@ bool DirContainer::Empty() void DirContainer::FindSpecialFolders() { is_etc = false; + is_var = false; if( !is_root ) return; @@ -81,7 +93,12 @@ void DirContainer::FindSpecialFolders() { is_etc = true; etc_iter = i->second; - break; + } + else + if( i->second->url == dir_var ) + { + is_var = true; + var_iter = i->second; } } } @@ -105,6 +122,14 @@ void DirContainer::CheckSpecialFolder(const Item & item, Iterator iter) etc_iter = iter; log << log1 << "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; + } + } diff --git a/core/dircontainer.h b/core/dircontainer.h index 3f5a6f7..3e0f2dd 100755 --- a/core/dircontainer.h +++ b/core/dircontainer.h @@ -34,6 +34,7 @@ public: Iterator GetRoot(); Iterator GetEtc(); + Iterator GetVar(); Iterator Begin(); Iterator End(); @@ -75,12 +76,18 @@ private: // etc Iterator etc_iter; + // true if there is a var dir in the table + bool is_var; + + // var + Iterator var_iter; + // indexes TableId table_id; TableParent table_parent; // names of folders - static std::string dir_etc; + static std::string dir_etc, dir_var; }; diff --git a/core/dirs.cpp b/core/dirs.cpp index dc00175..92d6f59 100755 --- a/core/dirs.cpp +++ b/core/dirs.cpp @@ -237,6 +237,17 @@ return &(*etc); } +Item * Dirs::GetVarDir() +{ + DirContainer::Iterator etc = dir_tab.GetVar(); + + if( etc == dir_tab.End() ) + return 0; + +return &(*etc); +} + + Item * Dirs::GetDir(const std::string & name, long parent) { DirContainer::ParentIterator i = dir_tab.FindFirstParent(parent); @@ -411,8 +422,11 @@ bool Dirs::DelDir(long dir_id) } -Error Dirs::AddDirectory(Item & item, bool add_to_dir_tab) +Error Dirs::AddDirectory(Item & item, bool add_to_dir_tab, Item ** pdir) { + if( pdir ) + *pdir = 0; + if( item.type != Item::dir ) return WINIX_ERR_DIR_EXPECTED; @@ -421,10 +435,13 @@ Error Dirs::AddDirectory(Item & item, bool add_to_dir_tab) if( status == WINIX_ERR_OK ) { request->notify_code |= WINIX_NOTIFY_DIR_ADD; - Item * pdir = AddDir(item); + Item * d = AddDir(item); - if( add_to_dir_tab && request->dir_tab.back()->id == item.parent_id ) - request->dir_tab.push_back(pdir); + if( add_to_dir_tab && !request->dir_tab.empty() && request->dir_tab.back()->id == item.parent_id ) + request->dir_tab.push_back(d); + + if( pdir ) + *pdir = d; } return status; @@ -432,5 +449,32 @@ return status; +Item * Dirs::CreateVarDir() +{ + Item * var = GetVarDir(); + + if( var ) + return var; + + Item v; + Item * root = GetRootDir(); + + if( root ) + { + v.parent_id = root->id; + v.user_id = -1; + v.group_id = -1; + v.privileges = 0755; + v.subject = "var"; + v.url = "var"; + v.type = Item::dir; + + AddDirectory(v, false, &var); + } + +return var; +} + + diff --git a/core/dirs.h b/core/dirs.h index b9adc33..c6ac532 100755 --- a/core/dirs.h +++ b/core/dirs.h @@ -54,6 +54,7 @@ public: // !! zmienic nazwy wskazujace ze operujemy tylko na lokalnej tablicy Item * GetRootDir(); Item * GetEtcDir(); + Item * GetVarDir(); Item * GetDir(const std::string & name, long parent); Item * GetDir(const std::string & path); Item * GetDir(long id); @@ -61,9 +62,10 @@ public: void CheckRootDir(); + Item * CreateVarDir(); - // !! jak juz wczesniejsze nazwy beda zmienione to tutaj damy AddDir() - Error AddDirectory(Item & item, bool add_to_dir_tab = false); + // !! jak juz wczesniejsze nazwy beda zmienione to tutaj damy AddDir() /AddDir() juz istnieje przeciez?/ + Error AddDirectory(Item & item, bool add_to_dir_tab = false, Item ** pdir = 0); private: diff --git a/functions/Makefile.dep b/functions/Makefile.dep index 1de05fc..b12c086 100755 --- a/functions/Makefile.dep +++ b/functions/Makefile.dep @@ -90,7 +90,8 @@ ckeditor.o: functions.h functionparser.h adduser.h cat.h chmod.h ckeditor.o: privchanger.h chown.h cp.h createthread.h default.h download.h ckeditor.o: emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h ckeditor.o: reload.h rm.h run.h stat.h subject.h funthread.h template.h -ckeditor.o: tinymce.h uname.h upload.h uptime.h who.h ../core/htmlfilter.h +ckeditor.o: tinymce.h uname.h upload.h uptime.h who.h vim.h +ckeditor.o: ../core/htmlfilter.h cp.o: cp.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h cp.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h cp.o: ../core/error.h ../core/log.h ../db/dbitemquery.h ../db/dbitemcolumns.h @@ -110,7 +111,7 @@ cp.o: ../core/system.h ../core/misc.h functions.h functionparser.h adduser.h cp.o: cat.h chmod.h privchanger.h chown.h ckeditor.h createthread.h default.h cp.o: download.h emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h cp.o: priv.h reload.h rm.h run.h stat.h subject.h funthread.h template.h -cp.o: tinymce.h uname.h upload.h uptime.h who.h ../core/htmlfilter.h +cp.o: tinymce.h uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.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/error.h ../core/log.h @@ -133,7 +134,7 @@ createthread.o: functionparser.h adduser.h cat.h chmod.h privchanger.h createthread.o: chown.h ckeditor.h cp.h default.h download.h emacs.h last.h createthread.o: login.h logout.h ls.h mkdir.h mv.h node.h priv.h reload.h createthread.o: rm.h run.h stat.h subject.h funthread.h template.h tinymce.h -createthread.o: uname.h upload.h uptime.h who.h ../core/htmlfilter.h +createthread.o: uname.h upload.h uptime.h 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/error.h ../core/log.h ../db/dbitemquery.h @@ -193,7 +194,7 @@ emacs.o: ../core/sessioncontainer.h functions.h functionparser.h adduser.h emacs.o: cat.h chmod.h privchanger.h chown.h ckeditor.h cp.h createthread.h emacs.o: default.h download.h last.h login.h logout.h ls.h mkdir.h mv.h emacs.o: node.h priv.h reload.h rm.h run.h stat.h subject.h funthread.h -emacs.o: template.h tinymce.h uname.h upload.h uptime.h who.h +emacs.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h emacs.o: ../core/htmlfilter.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 @@ -217,7 +218,7 @@ 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 stat.h subject.h funthread.h -functionbase.o: template.h tinymce.h uname.h upload.h uptime.h who.h +functionbase.o: template.h tinymce.h uname.h upload.h uptime.h who.h vim.h functionbase.o: ../core/htmlfilter.h functionparser.o: functionparser.h ../core/request.h ../core/requesttypes.h functionparser.o: ../core/session.h ../core/item.h ../core/error.h @@ -242,7 +243,7 @@ functionparser.o: privchanger.h chown.h ckeditor.h cp.h createthread.h functionparser.o: default.h download.h emacs.h last.h login.h logout.h ls.h functionparser.o: mkdir.h mv.h node.h priv.h reload.h rm.h run.h stat.h functionparser.o: subject.h funthread.h template.h tinymce.h uname.h upload.h -functionparser.o: uptime.h who.h ../core/htmlfilter.h +functionparser.o: uptime.h who.h vim.h ../core/htmlfilter.h functions.o: functions.h functionbase.h ../core/item.h ../db/db.h functions.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h functions.o: ../core/textstream.h ../core/error.h ../core/log.h @@ -264,7 +265,7 @@ 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 stat.h subject.h funthread.h template.h tinymce.h -functions.o: uname.h upload.h uptime.h who.h ../core/htmlfilter.h +functions.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h functions.o: ../core/log.h ../core/misc.h ../core/plugin.h functions.o: ../core/pluginmsg.h ../core/sessionmanager.h functions.o: ../core/sessioncontainer.h ../functions/functions.h @@ -377,7 +378,7 @@ mkdir.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h mkdir.o: chown.h ckeditor.h cp.h createthread.h default.h download.h emacs.h mkdir.o: last.h login.h logout.h ls.h mv.h node.h priv.h reload.h rm.h run.h mkdir.o: stat.h subject.h funthread.h template.h tinymce.h uname.h upload.h -mkdir.o: uptime.h who.h ../core/htmlfilter.h +mkdir.o: uptime.h who.h vim.h ../core/htmlfilter.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 mv.o: ../core/error.h ../core/log.h ../db/dbitemquery.h ../db/dbitemcolumns.h @@ -397,7 +398,7 @@ mv.o: ../core/system.h functions.h functionparser.h adduser.h cat.h chmod.h mv.o: privchanger.h chown.h ckeditor.h cp.h createthread.h default.h mv.o: download.h emacs.h last.h login.h logout.h ls.h mkdir.h node.h priv.h mv.o: reload.h rm.h run.h stat.h subject.h funthread.h template.h tinymce.h -mv.o: uname.h upload.h uptime.h who.h ../core/htmlfilter.h +mv.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.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/error.h ../core/log.h ../db/dbitemquery.h @@ -575,7 +576,7 @@ tinymce.o: functions.h functionparser.h adduser.h cat.h chmod.h privchanger.h tinymce.o: chown.h ckeditor.h cp.h createthread.h default.h download.h tinymce.o: emacs.h last.h login.h logout.h ls.h mkdir.h mv.h node.h priv.h tinymce.o: reload.h rm.h run.h stat.h subject.h funthread.h template.h -tinymce.o: uname.h upload.h uptime.h who.h ../core/htmlfilter.h +tinymce.o: uname.h upload.h uptime.h who.h vim.h ../core/htmlfilter.h uname.o: uname.h functionbase.h ../core/item.h ../db/db.h ../db/dbbase.h uname.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h uname.o: ../core/error.h ../core/log.h ../db/dbitemquery.h @@ -628,6 +629,27 @@ uptime.o: ../core/loadavg.h ../core/notify.h uptime.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h uptime.o: ../core/mount.h ../core/locale.h ../templates/misc.h uptime.o: ../templates/localefilter.h ../core/locale.h ../core/system.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/error.h ../core/log.h ../db/dbitemquery.h +vim.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h ../core/thread.h +vim.o: ../core/dircontainer.h ../core/item.h ../core/ugcontainer.h +vim.o: ../core/request.h ../core/requesttypes.h ../core/session.h +vim.o: ../core/error.h ../core/user.h ../core/plugindata.h ../core/rebus.h +vim.o: ../core/config.h ../core/confparser.h ../core/htmlfilter.h +vim.o: ../core/config.h ../core/system.h ../core/dirs.h +vim.o: ../core/dircontainer.h ../core/request.h ../core/mounts.h +vim.o: ../core/mount.h ../core/mountparser.h ../core/users.h +vim.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/groups.h +vim.o: ../core/group.h ../core/loadavg.h ../core/notify.h +vim.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h +vim.o: ../core/mount.h ../core/locale.h ../templates/misc.h +vim.o: ../templates/localefilter.h ../core/locale.h ../core/system.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 stat.h subject.h funthread.h template.h tinymce.h uname.h +vim.o: upload.h uptime.h who.h ../core/htmlfilter.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/error.h ../core/log.h ../db/dbitemquery.h diff --git a/functions/Makefile.o.dep b/functions/Makefile.o.dep index 52e9c75..6537b04 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 stat.o subject.o template.o tinymce.o uname.o upload.o uptime.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 login.o logout.o ls.o mkdir.o mv.o node.o priv.o privchanger.o reload.o rm.o run.o stat.o subject.o template.o tinymce.o uname.o upload.o uptime.o vim.o who.o diff --git a/functions/functionbase.cpp b/functions/functionbase.cpp index 26c5565..c88bb4d 100755 --- a/functions/functionbase.cpp +++ b/functions/functionbase.cpp @@ -67,6 +67,13 @@ void FunctionBase::SetNotify(Notify * pnotify) } +void FunctionBase::Init() +{ + // this method is called only once at the beginning + // when winix starts +} + + bool FunctionBase::HasAccess() { // true by default diff --git a/functions/functionbase.h b/functions/functionbase.h index d0fdad7..0db03e6 100755 --- a/functions/functionbase.h +++ b/functions/functionbase.h @@ -40,6 +40,7 @@ public: // user, group, permissions, url (function name) Item fun; + virtual void Init(); virtual bool HasAccess(); virtual void Clear(); virtual void MakePost(); diff --git a/functions/functions.cpp b/functions/functions.cpp index 180a1e8..9acadac 100755 --- a/functions/functions.cpp +++ b/functions/functions.cpp @@ -166,7 +166,7 @@ void Functions::Add(FunctionBase & fun) -void Functions::Create() +void Functions::CreateFunctions() { Add(fun_adduser); Add(fun_cat); @@ -198,11 +198,28 @@ void Functions::Create() Add(fun_upload); Add(fun_uptime); Add(fun_who); + Add(fun_vim); plugin.Call(WINIX_CREATE_FUNCTIONS); } +void Functions::InitFunctions() +{ + Table::iterator i = table.begin(); + + for( ; i!=table.end() ; ++i) + i->second->Init(); +} + + +void Functions::Init() +{ + CreateFunctions(); + InitFunctions(); +} + + void Functions::Parse() { function_parser.Parse(request, db, this, system); diff --git a/functions/functions.h b/functions/functions.h index f29b3b1..07c9d1a 100755 --- a/functions/functions.h +++ b/functions/functions.h @@ -43,6 +43,7 @@ #include "upload.h" #include "uptime.h" #include "who.h" +#include "vim.h" #include "core/htmlfilter.h" @@ -84,11 +85,12 @@ public: Fun::Upload fun_upload; Fun::Uptime fun_uptime; Fun::Who fun_who; + Fun::Vim fun_vim; typedef std::map Table; typedef Table::iterator Iterator; - void Create(); + void Init(); void Parse(); size_t FunctionsSize(); @@ -142,6 +144,9 @@ private: std::string temp; HTMLFilter html_filter; + void CreateFunctions(); + void InitFunctions(); + void SetObjects(FunctionBase * fun); void SetDefaultFunctionForFile(); void SetDefaultFunctionForDir(); diff --git a/functions/vim.cpp b/functions/vim.cpp new file mode 100755 index 0000000..fa54ec0 --- /dev/null +++ b/functions/vim.cpp @@ -0,0 +1,101 @@ +/* + * This file is a part of Winix + * and is not publicly distributed + * + * Copyright (c) 2010, Tomasz Sowa + * All rights reserved. + * + */ + +#include "vim.h" +#include "functions.h" + + + +namespace Fun +{ + +// WYMeditor doesn't work on different domains by default, +// solution: http://forum.wymeditor.org/forum/viewtopic.php?f=2&t=731&p=2507#p2504 +// we add one file to winix: /var/wymiframe.html +// in the future this will be removed + + +static const char vim_wymiframe[] = +"\n" +"\n" +"\n" +"\n" +"WYMeditor iframe\n" +"\n" +"\n" +"\n" +"\n" +"\n"; + + +Vim::Vim() +{ + fun.url = "vim"; +} + + +void Vim::Init() +{ + Item * var = system->dirs.CreateVarDir(); + + if( var ) + { + Item temp; + + if( db->GetItem(var->id, "wymiframe.html", temp) == WINIX_ERR_NO_ITEM ) + { + Item v; + + v.parent_id = var->id; + v.user_id = -1; + v.group_id = -1; + v.privileges = 0755; + v.subject = "wymiframe.html"; + v.url = "wymiframe.html"; + v.type = Item::file; + v.content = vim_wymiframe; + v.content_type = Item::ct_raw; + + system->AddFile(v, false); + } + } +} + + +bool Vim::HasAccess() +{ + return functions->fun_emacs.HasAccess(); +} + + +void Vim::MakePost() +{ + functions->fun_emacs.MakePost(); +} + + + + +} // namespace diff --git a/functions/vim.h b/functions/vim.h new file mode 100755 index 0000000..0b22fd8 --- /dev/null +++ b/functions/vim.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 headerfilecmslucontentvim +#define headerfilecmslucontentvim + +#include "functionbase.h" + + + +namespace Fun +{ + + +class Vim : public FunctionBase +{ +public: + + Vim(); + void Init(); + bool HasAccess(); + void MakePost(); + +}; + + +} // namespace + +#endif diff --git a/html/fun_vim.html b/html/fun_vim.html new file mode 100755 index 0000000..f8f40a2 --- /dev/null +++ b/html/fun_vim.html @@ -0,0 +1,49 @@ +[if item_is]

{edit}

[else]

{add}

[end] + +[include "error.html"] + +
+
+ {form_emacs_legend} + + [if mount_type_is "cms"] +

{title}:

+ + +

{suggested_url}:

+ + [end] + + [if-any mount_type_is "thread" mount_thread_arg_is "subject"] +

{title}:

+ + +

{suggested_url}:

+ + [end] + + [if mount_type_is "cms"]

{form_emacs_content_cms}

[end] + [if mount_type_is "thread"]

{form_emacs_content_thread}

[end] + [if mount_type_is "ticket"]

{form_emacs_content_ticket}

[end] + + + + + + [if winix_function_param_is "full"] + [else] + [end] + + [if-no user_logged] +

{nick}:

+ + +

{rebus_how_is_it} [rebus_question]?

+ + [end] + + +
+
+ + diff --git a/html/index_head.html b/html/index_head.html index 29214b0..f2d543a 100755 --- a/html/index_head.html +++ b/html/index_head.html @@ -7,14 +7,5 @@ - [if winix_function_is "ckeditor"] - - [end] - - [# in the future tinymce will be placed in doc_base_url_common] - [if winix_function_is "tinymce"] - - - [end] - + [include "index_head_functions_add.html"] diff --git a/html/index_head_functions_add.html b/html/index_head_functions_add.html new file mode 100755 index 0000000..57c0047 --- /dev/null +++ b/html/index_head_functions_add.html @@ -0,0 +1,33 @@ +[# other stuff needed by a specific function] + +[if winix_function_is "ckeditor"] + +[end] + + +[# in the future tinymce will be placed in doc_base_url_common] +[if winix_function_is "tinymce"] + + +[end] + + +[if winix_function_is "vim"] +[# this editor doesn't work on different domains by default, solution: http://forum.wymeditor.org/forum/viewtopic.php?f=2&t=731&p=2507#p2504 ] +[# you should add one file to winix: wymiframe.html ] + + + + + + + + +[end] + + +[if winix_has_plugin "stats"] + [include "stats_info.html"] +[end] + + diff --git a/locale/en b/locale/en index 2f4914a..0e05181 100755 --- a/locale/en +++ b/locale/en @@ -239,6 +239,8 @@ uname_header = Uname + + # notifications notify_new = News notify_change = Changes diff --git a/locale/pl b/locale/pl index 279b14b..871c6c7 100755 --- a/locale/pl +++ b/locale/pl @@ -243,6 +243,9 @@ uname_header = Nazwa systemu + + + # notifications notify_new = Coś nowego notify_change = Zmiany diff --git a/main/Makefile.dep b/main/Makefile.dep index 7abc327..be2141d 100755 --- a/main/Makefile.dep +++ b/main/Makefile.dep @@ -28,8 +28,8 @@ main.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h main.o: ../functions/run.h ../functions/stat.h ../functions/subject.h main.o: ../functions/funthread.h ../functions/template.h main.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -main.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -main.o: ../templates/templates.h ../templates/misc.h +main.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +main.o: ../core/htmlfilter.h ../templates/templates.h ../templates/misc.h main.o: ../templates/patterncacher.h ../core/item.h main.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h main.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h diff --git a/plugins/stats/Makefile.dep b/plugins/stats/Makefile.dep index 3edc1fc..671edef 100755 --- a/plugins/stats/Makefile.dep +++ b/plugins/stats/Makefile.dep @@ -36,7 +36,7 @@ init.o: ../../functions/run.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 +init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h init.o: ../../core/htmlfilter.h ../../templates/templates.h init.o: ../../templates/misc.h ../../templates/patterncacher.h init.o: ../../core/item.h ../../templates/ckeditorgetparser.h @@ -83,9 +83,10 @@ templates.o: ../../functions/subject.h ../../functions/funthread.h templates.o: ../../functions/template.h ../../functions/tinymce.h templates.o: ../../functions/uname.h ../../functions/upload.h templates.o: ../../functions/uptime.h ../../functions/who.h -templates.o: ../../core/htmlfilter.h ../../templates/templates.h -templates.o: ../../templates/misc.h ../../templates/patterncacher.h -templates.o: ../../core/item.h ../../templates/ckeditorgetparser.h +templates.o: ../../functions/vim.h ../../core/htmlfilter.h +templates.o: ../../templates/templates.h ../../templates/misc.h +templates.o: ../../templates/patterncacher.h ../../core/item.h +templates.o: ../../templates/ckeditorgetparser.h templates.o: ../../core/httpsimpleparser.h ../../core/log.h templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h templates.o: ../../core/misc.h stats.h diff --git a/plugins/ticket/Makefile.dep b/plugins/ticket/Makefile.dep index 7a21be8..1552279 100755 --- a/plugins/ticket/Makefile.dep +++ b/plugins/ticket/Makefile.dep @@ -41,7 +41,7 @@ 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: ../../core/htmlfilter.h +createticket.o: ../../functions/vim.h ../../core/htmlfilter.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/error.h ../../core/log.h ticketinfo.h ticketparser.h @@ -80,7 +80,8 @@ 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 ../../core/htmlfilter.h +editticket.o: ../../functions/who.h ../../functions/vim.h +editticket.o: ../../core/htmlfilter.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/error.h ../../core/log.h ticketinfo.h ticketparser.h @@ -140,7 +141,7 @@ init.o: ../../functions/stat.h ../../functions/subject.h init.o: ../../functions/funthread.h ../../functions/template.h init.o: ../../functions/tinymce.h ../../functions/uname.h init.o: ../../functions/upload.h ../../functions/uptime.h -init.o: ../../functions/who.h ../../core/htmlfilter.h +init.o: ../../functions/who.h ../../functions/vim.h ../../core/htmlfilter.h init.o: ../../templates/templates.h ../../templates/misc.h init.o: ../../templates/patterncacher.h ../../core/item.h init.o: ../../templates/ckeditorgetparser.h ../../core/httpsimpleparser.h @@ -190,9 +191,10 @@ templates.o: ../../functions/subject.h ../../functions/funthread.h templates.o: ../../functions/template.h ../../functions/tinymce.h templates.o: ../../functions/uname.h ../../functions/upload.h templates.o: ../../functions/uptime.h ../../functions/who.h -templates.o: ../../core/htmlfilter.h ../../templates/templates.h -templates.o: ../../templates/misc.h ../../templates/patterncacher.h -templates.o: ../../core/item.h ../../templates/ckeditorgetparser.h +templates.o: ../../functions/vim.h ../../core/htmlfilter.h +templates.o: ../../templates/templates.h ../../templates/misc.h +templates.o: ../../templates/patterncacher.h ../../core/item.h +templates.o: ../../templates/ckeditorgetparser.h templates.o: ../../core/httpsimpleparser.h ../../core/log.h templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h ticketconf.o: ticketconf.h diff --git a/templates/Makefile.dep b/templates/Makefile.dep index e389aed..2c4ba46 100755 --- a/templates/Makefile.dep +++ b/templates/Makefile.dep @@ -48,7 +48,7 @@ dir.o: ../functions/rm.h ../functions/run.h ../functions/stat.h dir.o: ../functions/subject.h ../functions/funthread.h dir.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h dir.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h -dir.o: ../core/htmlfilter.h +dir.o: ../functions/vim.h ../core/htmlfilter.h doc.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h ../core/locale.h doc.o: ../core/confparser.h ../core/user.h patterncacher.h ../core/item.h doc.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h @@ -190,7 +190,7 @@ priv.o: ../functions/rm.h ../functions/run.h ../functions/stat.h priv.o: ../functions/subject.h ../functions/funthread.h priv.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h priv.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h -priv.o: ../core/htmlfilter.h +priv.o: ../functions/vim.h ../core/htmlfilter.h rebus.o: ../core/request.h templates.h ../../ezc/src/ezc.h misc.h rebus.o: localefilter.h ../core/locale.h ../core/confparser.h ../core/user.h rebus.o: patterncacher.h ../core/item.h ckeditorgetparser.h @@ -296,7 +296,7 @@ templates.o: ../functions/run.h ../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 ../functions/who.h -templates.o: ../core/htmlfilter.h ../templates/templates.h +templates.o: ../functions/vim.h ../core/htmlfilter.h ../templates/templates.h thread.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h thread.o: ../core/locale.h ../core/confparser.h ../core/user.h thread.o: patterncacher.h ../core/item.h ckeditorgetparser.h @@ -329,7 +329,8 @@ thread.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h thread.o: ../functions/run.h ../functions/stat.h ../functions/subject.h thread.o: ../functions/funthread.h ../functions/template.h thread.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -thread.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h +thread.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +thread.o: ../core/htmlfilter.h upload.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h upload.o: ../core/locale.h ../core/confparser.h ../core/user.h upload.o: patterncacher.h ../core/item.h ckeditorgetparser.h @@ -432,5 +433,5 @@ winix.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h winix.o: ../functions/run.h ../functions/stat.h ../functions/subject.h winix.o: ../functions/funthread.h ../functions/template.h winix.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h -winix.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h -winix.o: ../templates/templates.h ../core/misc.h +winix.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h +winix.o: ../core/htmlfilter.h ../templates/templates.h ../core/misc.h