added function: uname
added function: subject - for changing a subject git-svn-id: svn://ttmath.org/publicrep/winix/trunk@600 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -92,6 +92,15 @@ class Content
|
||||
void FunCKEditor();
|
||||
|
||||
|
||||
void FunUname();
|
||||
|
||||
bool SubjectCheckAccess();
|
||||
void EditDirSubject();
|
||||
void EditFileSubject();
|
||||
void PostFunSubject();
|
||||
void FunSubject();
|
||||
|
||||
|
||||
/*
|
||||
rm
|
||||
*/
|
||||
|
||||
81
content/subject.cpp
Executable file
81
content/subject.cpp
Executable file
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
18
content/uname.cpp
Executable file
18
content/uname.cpp
Executable file
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user