diff --git a/content/Makefile.dep b/content/Makefile.dep
index c6496f8..d91a6eb 100755
--- a/content/Makefile.dep
+++ b/content/Makefile.dep
@@ -337,6 +337,19 @@ run.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
run.o: ../core/compress.h ../core/acceptencodingparser.h
run.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
run.o: ../core/postmultiparser.h ../core/error.h
+subject.o: content.h ../core/item.h ../templates/templates.h
+subject.o: ../templates/patterncacher.h ../templates/misc.h
+subject.o: ../templates/localefilter.h ../core/locale.h
+subject.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
+subject.o: ../core/httpsimpleparser.h ../core/log.h ../core/thread.h
+subject.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
+subject.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
+subject.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
+subject.o: ../core/request.h ../core/requesttypes.h ../core/session.h
+subject.o: ../core/rebus.h ../core/plugindata.h ../core/function.h
+subject.o: ../core/compress.h ../core/acceptencodingparser.h
+subject.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
+subject.o: ../core/postmultiparser.h
thread.o: content.h ../core/item.h ../templates/templates.h
thread.o: ../templates/patterncacher.h ../templates/misc.h
thread.o: ../templates/localefilter.h ../core/locale.h
@@ -369,6 +382,14 @@ ticket.o: ../core/postmultiparser.h ../core/data.h ../core/dirs.h
ticket.o: ../core/users.h ../core/groups.h ../core/functions.h
ticket.o: ../core/lastcontainer.h ../core/mounts.h ../core/mount.h
ticket.o: ../core/loadavg.h ../core/mount.h
+uname.o: content.h ../core/item.h ../templates/templates.h
+uname.o: ../templates/patterncacher.h ../templates/misc.h
+uname.o: ../templates/localefilter.h ../core/locale.h
+uname.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
+uname.o: ../core/httpsimpleparser.h ../core/log.h ../core/thread.h
+uname.o: ../core/ticket.h ../core/db.h ../core/item.h ../core/user.h
+uname.o: ../core/group.h ../core/thread.h ../core/error.h ../core/log.h
+uname.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/ticket.h
upload.o: content.h ../core/item.h ../templates/templates.h
upload.o: ../templates/patterncacher.h ../templates/misc.h
upload.o: ../templates/localefilter.h ../core/locale.h
diff --git a/content/Makefile.o.dep b/content/Makefile.o.dep
index eff91b6..e418960 100755
--- a/content/Makefile.o.dep
+++ b/content/Makefile.o.dep
@@ -1 +1 @@
-o = adduser.o cat.o content.o createthread.o createticket.o default.o download.o editticket.o emacs.o last.o login.o logout.o ls.o misc_item.o misc_specialfile.o mkdir.o mv.o node.o priv.o reload.o rm.o run.o thread.o ticket.o upload.o who.o
+o = adduser.o cat.o content.o createthread.o createticket.o default.o download.o editticket.o emacs.o last.o login.o logout.o ls.o misc_item.o misc_specialfile.o mkdir.o mv.o node.o priv.o reload.o rm.o run.o subject.o thread.o ticket.o uname.o upload.o who.o
diff --git a/content/content.cpp b/content/content.cpp
index 4d85955..cdbf79b 100755
--- a/content/content.cpp
+++ b/content/content.cpp
@@ -214,10 +214,9 @@ void Content::MakeStandardFunction()
else
if( request.pfunction->code == FUN_MV )
FunMv();
-/* else
+ else
if( request.pfunction->code == FUN_UNAME )
FunUname();
-*/
else
if( request.pfunction->code == FUN_CHMOD )
FunPriv();
@@ -230,6 +229,9 @@ void Content::MakeStandardFunction()
else
if( request.pfunction->code == FUN_ADDUSER )
FunAddUser();
+ else
+ if( request.pfunction->code == FUN_SUBJECT )
+ FunSubject();
else
request.status = WINIX_ERR_PERMISSION_DENIED;
@@ -313,6 +315,10 @@ void Content::MakePost()
PostFunMv();
break;
+ case FUN_SUBJECT:
+ PostFunSubject();
+ break;
+
default:
log << log1 << "Content: unknown post function" << logend;
break;
diff --git a/content/content.h b/content/content.h
index f910134..a65002d 100755
--- a/content/content.h
+++ b/content/content.h
@@ -92,6 +92,15 @@ class Content
void FunCKEditor();
+ void FunUname();
+
+ bool SubjectCheckAccess();
+ void EditDirSubject();
+ void EditFileSubject();
+ void PostFunSubject();
+ void FunSubject();
+
+
/*
rm
*/
diff --git a/content/subject.cpp b/content/subject.cpp
new file mode 100755
index 0000000..e6c118f
--- /dev/null
+++ b/content/subject.cpp
@@ -0,0 +1,81 @@
+/*
+ * This file is a part of Winix
+ * and is not publicly distributed
+ *
+ * Copyright (c) 2008-2010, Tomasz Sowa
+ * All rights reserved.
+ *
+ */
+
+#include "content.h"
+#include "../core/request.h"
+#include "../core/db.h"
+#include "../core/log.h"
+
+
+
+bool Content::SubjectCheckAccess()
+{
+ // super user can always
+ if( request.session->puser && request.session->puser->super_user )
+ return true;
+
+ bool access;
+
+ if( request.is_item )
+ access = request.HasWriteAccess(request.item);
+ else
+ access = request.HasWriteAccess(*request.dir_table.back());
+
+ if( !access )
+ request.status = WINIX_ERR_PERMISSION_DENIED;
+
+return access;
+}
+
+
+
+void Content::EditDirSubject()
+{
+ Item & dir = *request.dir_table.back();
+
+ request.PostVar("subject", dir.subject);
+ db.EditSubjectById(dir, dir.id);
+
+ RedirectToLastDir();
+}
+
+
+
+void Content::EditFileSubject()
+{
+ request.PostVar("subject", request.item.subject);
+ db.EditSubjectById(request.item, request.item.id);
+
+ RedirectTo(request.item);
+}
+
+
+
+
+void Content::PostFunSubject()
+{
+ if( !SubjectCheckAccess() )
+ return;
+
+ if( request.is_item )
+ EditFileSubject();
+ else
+ EditDirSubject();
+}
+
+
+
+void Content::FunSubject()
+{
+ SubjectCheckAccess();
+}
+
+
+
+
diff --git a/content/uname.cpp b/content/uname.cpp
new file mode 100755
index 0000000..884b8ec
--- /dev/null
+++ b/content/uname.cpp
@@ -0,0 +1,18 @@
+/*
+ * This file is a part of Winix
+ * and is not publicly distributed
+ *
+ * Copyright (c) 2008-2010, Tomasz Sowa
+ * All rights reserved.
+ *
+ */
+
+#include "content.h"
+
+
+
+void Content::FunUname()
+{
+}
+
+
diff --git a/core/db.cpp b/core/db.cpp
index a77910c..b6489a8 100755
--- a/core/db.cpp
+++ b/core/db.cpp
@@ -1259,6 +1259,33 @@ return result;
+Error Db::EditSubjectById(Item & item, long id)
+{
+ PGresult * r = 0;
+ Error result = WINIX_ERR_OK;
+
+ try
+ {
+ AssertConnection();
+ std::ostringstream query;
+ query << "update core.item set (subject) = (";
+ query << '\'' << Escape(item.subject) << "') ";
+ query << " where id='" << id << "';";
+
+ r = AssertQuery(query.str());
+ AssertResultStatus(r, PGRES_COMMAND_OK);
+ }
+ catch(const Error & e)
+ {
+ result = e;
+ }
+
+ ClearResult(r);
+
+return result;
+}
+
+
bool Db::DelItemDelItem(const Item & item)
{
diff --git a/core/db.h b/core/db.h
index c70b581..e0615ab 100755
--- a/core/db.h
+++ b/core/db.h
@@ -138,7 +138,10 @@ public:
Error EditParentUrlById(Item & item, long id);
Error EditAuthById(Item & item, long id);
Error DelDirById(long id);
-
+
+ Error EditSubjectById(Item & item, long id);
+
+
bool DelItem(const Item & item);
void GetDirs(DirContainer & dir_table);
void GetUsers(UGContainer
{suggested_url}
diff --git a/html/fun_subject.html b/html/fun_subject.html new file mode 100755 index 0000000..79b0ba6 --- /dev/null +++ b/html/fun_subject.html @@ -0,0 +1,17 @@ +Winix [sys_ver_major].[sys_ver_minor].[sys_ver_revision]
diff --git a/locale/en b/locale/en index 94f0236..104b060 100755 --- a/locale/en +++ b/locale/en @@ -195,6 +195,14 @@ mv_dir = Move directory mv_only_content = Move only content of the directory +subject_header = Edit subject +subject_form_legend = Edit subject form + + +uname_header = Uname + + + # notifications notify_new = News notify_change = Changes diff --git a/locale/pl b/locale/pl index 5bebb06..1b3156f 100755 --- a/locale/pl +++ b/locale/pl @@ -196,6 +196,13 @@ mv_dir = Przenie mv_only_content = Przenieś tylko zawartość katalogu +subject_header = Zmień tytuł +subject_form_legend = Formularz zmiany tytułu + +uname_header = Nazwa systemu + + + # notifications notify_new = Coś nowego notify_change = Zmiany diff --git a/templates/Makefile.dep b/templates/Makefile.dep index 03aad2d..1420c2f 100755 --- a/templates/Makefile.dep +++ b/templates/Makefile.dep @@ -127,7 +127,7 @@ sys.o: ../core/loadavg.h ../core/request.h ../core/requesttypes.h sys.o: ../core/session.h ../core/plugindata.h ../core/thread.h sys.o: ../core/compress.h ../core/acceptencodingparser.h sys.o: ../core/acceptbaseparser.h ../core/htmlfilter.h -sys.o: ../core/postmultiparser.h ../core/ticket.h ../core/misc.h +sys.o: ../core/postmultiparser.h ../core/ticket.h ../core/version.h templates.o: templates.h patterncacher.h ../core/item.h misc.h localefilter.h templates.o: ../core/locale.h ../confparser/confparser.h ckeditorgetparser.h templates.o: ../core/httpsimpleparser.h ../core/log.h ../core/data.h diff --git a/templates/sys.cpp b/templates/sys.cpp index d442f31..2549027 100755 --- a/templates/sys.cpp +++ b/templates/sys.cpp @@ -10,7 +10,7 @@ #include "templates.h" #include "../core/data.h" #include "../core/request.h" -#include "../core/misc.h" +#include "../core/version.h" @@ -21,20 +21,20 @@ namespace TemplatesFunctions void sys_ver_major(Info & i) { - i.out << MAJOR_VER; + i.out << WINIX_VER_MAJOR; } void sys_ver_minor(Info & i) { - i.out << MINOR_VER; + i.out << WINIX_VER_MINOR; } void sys_ver_revision(Info & i) { - i.out << REVISION_VER; + i.out << WINIX_VER_REVISION; } diff --git a/templates/templates.cpp b/templates/templates.cpp index 5952466..50667ba 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -65,8 +65,9 @@ Ezc::Pattern * p = 0; {FUN_UPTIME, pat_fun_uptime}, {FUN_LOGIN, pat_fun_login}, {FUN_MV, pat_fun_mv}, -/* {FUN_UNAME, pat_fun_uname},*/ + {FUN_UNAME, pat_fun_uname}, {FUN_CKEDITOR, pat_fun_ckeditor}, + {FUN_SUBJECT, pat_fun_subject}, {FUN_ADDUSER, pat_fun_adduser} }; @@ -515,9 +516,10 @@ using namespace TemplatesFunctions; ReadFile(pat_fun_uptime, "fun_uptime.html"); ReadFile(pat_fun_login, "fun_login.html"); ReadFile(pat_fun_mv, "fun_mv.html"); - /*ReadFile(pat_fun_uname, "fun_uname.html");*/ + ReadFile(pat_fun_uname, "fun_uname.html"); ReadFile(pat_fun_ckeditor, "fun_ckeditor.html"); ReadFile(pat_fun_adduser, "fun_adduser.html"); + ReadFile(pat_fun_subject, "fun_subject.html"); } diff --git a/templates/templates.h b/templates/templates.h index b5b4805..fe66c1d 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -52,6 +52,7 @@ namespace TemplatesFunctions pat_item_info, pat_item_tab_info, pat_dir_last_info, + pat_fun_subject, pat_last // should be last };