added: function cp (only for files)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@605 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -112,6 +112,61 @@ void Content::SetDefaultFunction()
|
||||
}
|
||||
|
||||
|
||||
void Content::FunNothing()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
|
||||
void Content::CallFunction()
|
||||
{
|
||||
static FunItem tab[] = {
|
||||
{FUN_LOGOUT, &Content::FunLogout},
|
||||
{FUN_CAT, &Content::FunCat},
|
||||
{FUN_LS, &Content::FunLs},
|
||||
{FUN_EMACS, &Content::FunEmacs},
|
||||
{FUN_MKDIR, &Content::FunMkdir},
|
||||
{FUN_DEFAULT, &Content::FunDefault},
|
||||
{FUN_PRIV, &Content::FunPriv},
|
||||
{FUN_RM, &Content::FunRm},
|
||||
{FUN_RUN, &Content::FunRun},
|
||||
{FUN_NODE, &Content::FunNode},
|
||||
{FUN_WHO, &Content::FunWho},
|
||||
{FUN_LAST, &Content::FunLast},
|
||||
{FUN_THREAD, &Content::FunThread},
|
||||
{FUN_RELOAD, &Content::FunReload},
|
||||
{FUN_UPLOAD, &Content::FunUpload},
|
||||
{FUN_TICKET, &Content::FunTicket},
|
||||
{FUN_CKEDITOR, &Content::FunEmacs},
|
||||
{FUN_LOGIN, &Content::FunLogin},
|
||||
{FUN_MV, &Content::FunMv},
|
||||
{FUN_UNAME, &Content::FunUname},
|
||||
{FUN_CHMOD, &Content::FunPriv},
|
||||
{FUN_CHOWN, &Content::FunPriv},
|
||||
{FUN_DOWNLOAD, &Content::FunDownload},
|
||||
{FUN_ADDUSER, &Content::FunAddUser},
|
||||
{FUN_SUBJECT, &Content::FunSubject},
|
||||
{FUN_CP, &Content::FunCp},
|
||||
{FUN_UPTIME, &Content::FunNothing},
|
||||
{FUN_EDITTICKET,&Content::FunEditTicket},
|
||||
{FUN_CREATETHREAD, &Content::FunCreateThread},
|
||||
{FUN_CREATETICKET, &Content::FunCreateTicket}
|
||||
};
|
||||
|
||||
size_t len = sizeof(tab) / sizeof(FunItem);
|
||||
size_t i;
|
||||
|
||||
for(i=0 ; i<len ; ++i)
|
||||
{
|
||||
if( tab[i].code == request.pfunction->code )
|
||||
{
|
||||
(this->*tab[i].fun)();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
void Content::MakeStandardFunction()
|
||||
@@ -145,102 +200,51 @@ void Content::MakeStandardFunction()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( request.pfunction->code == FUN_LOGOUT )
|
||||
FunLogout();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CAT )
|
||||
FunCat();
|
||||
else
|
||||
if( request.pfunction->code == FUN_LS )
|
||||
FunLs();
|
||||
else
|
||||
if( request.pfunction->code == FUN_EMACS )
|
||||
FunEmacs();
|
||||
else
|
||||
if( request.pfunction->code == FUN_MKDIR )
|
||||
FunMkdir();
|
||||
else
|
||||
if( request.pfunction->code == FUN_DEFAULT )
|
||||
FunDefault();
|
||||
else
|
||||
if( request.pfunction->code == FUN_PRIV )
|
||||
FunPriv();
|
||||
else
|
||||
if( request.pfunction->code == FUN_RM )
|
||||
FunRm();
|
||||
else
|
||||
if( request.pfunction->code == FUN_RUN )
|
||||
FunRun();
|
||||
else
|
||||
if( request.pfunction->code == FUN_NODE )
|
||||
FunNode();
|
||||
else
|
||||
if( request.pfunction->code == FUN_WHO )
|
||||
FunWho();
|
||||
else
|
||||
if( request.pfunction->code == FUN_LAST )
|
||||
FunLast();
|
||||
else
|
||||
if( request.pfunction->code == FUN_THREAD )
|
||||
FunThread();
|
||||
else
|
||||
if( request.pfunction->code == FUN_RELOAD )
|
||||
FunReload();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CREATETHREAD )
|
||||
FunCreateThread();
|
||||
else
|
||||
if( request.pfunction->code == FUN_UPLOAD )
|
||||
FunUpload();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CREATETICKET )
|
||||
FunCreateTicket();
|
||||
else
|
||||
if( request.pfunction->code == FUN_EDITTICKET )
|
||||
FunEditTicket();
|
||||
else
|
||||
if( request.pfunction->code == FUN_TICKET )
|
||||
FunTicket();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CKEDITOR )
|
||||
FunEmacs();
|
||||
else
|
||||
if( request.pfunction->code == FUN_LOGIN )
|
||||
FunLogin();
|
||||
else
|
||||
if( request.pfunction->code == FUN_UPTIME )
|
||||
{ /* do nothing */ }
|
||||
else
|
||||
if( request.pfunction->code == FUN_MV )
|
||||
FunMv();
|
||||
else
|
||||
if( request.pfunction->code == FUN_UNAME )
|
||||
FunUname();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CHMOD )
|
||||
FunPriv();
|
||||
else
|
||||
if( request.pfunction->code == FUN_CHOWN )
|
||||
FunPriv();
|
||||
else
|
||||
if( request.pfunction->code == FUN_DOWNLOAD )
|
||||
FunDownload();
|
||||
else
|
||||
if( request.pfunction->code == FUN_ADDUSER )
|
||||
FunAddUser();
|
||||
else
|
||||
if( request.pfunction->code == FUN_SUBJECT )
|
||||
FunSubject();
|
||||
else
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
|
||||
|
||||
CallFunction();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::CallPostFunction()
|
||||
{
|
||||
static FunItem tab[] = {
|
||||
{FUN_RUN, &Content::PostFunRun},
|
||||
{FUN_EMACS, &Content::PostFunEmacs},
|
||||
{FUN_MKDIR, &Content::PostFunMkdir},
|
||||
{FUN_DEFAULT, &Content::PostFunDefault},
|
||||
{FUN_PRIV, &Content::PostFunPriv},
|
||||
{FUN_CHMOD, &Content::PostFunPriv},
|
||||
{FUN_CHOWN, &Content::PostFunPriv},
|
||||
{FUN_LOGIN, &Content::PostFunLogin},
|
||||
{FUN_UPLOAD, &Content::PostFunUpload},
|
||||
{FUN_EDITTICKET,&Content::PostFunEditTicket},
|
||||
{FUN_CKEDITOR, &Content::PostFunEmacs},
|
||||
{FUN_ADDUSER, &Content::PostFunAddUser},
|
||||
{FUN_MV, &Content::PostFunMv},
|
||||
{FUN_SUBJECT, &Content::PostFunSubject},
|
||||
{FUN_CP, &Content::PostFunCp},
|
||||
{FUN_CREATETHREAD, &Content::PostFunCreateThread},
|
||||
{FUN_CREATETICKET, &Content::PostFunCreateTicket}
|
||||
};
|
||||
|
||||
size_t len = sizeof(tab) / sizeof(FunItem);
|
||||
size_t i;
|
||||
|
||||
for(i=0 ; i<len ; ++i)
|
||||
{
|
||||
if( tab[i].code == request.pfunction->code )
|
||||
{
|
||||
(this->*tab[i].fun)();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log << log1 << "Content: unknown post function" << logend;
|
||||
request.status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
void Content::MakePost()
|
||||
{
|
||||
if( request.role == Request::authorizer )
|
||||
@@ -259,70 +263,7 @@ void Content::MakePost()
|
||||
return;
|
||||
}
|
||||
|
||||
switch( request.pfunction->code )
|
||||
{
|
||||
case FUN_RUN:
|
||||
PostFunRun();
|
||||
break;
|
||||
|
||||
case FUN_EMACS:
|
||||
PostFunEmacs();
|
||||
break;
|
||||
|
||||
case FUN_MKDIR:
|
||||
PostFunMkdir();
|
||||
break;
|
||||
|
||||
case FUN_DEFAULT:
|
||||
PostFunDefault();
|
||||
break;
|
||||
|
||||
case FUN_PRIV:
|
||||
case FUN_CHMOD:
|
||||
case FUN_CHOWN:
|
||||
PostFunPriv();
|
||||
break;
|
||||
|
||||
case FUN_LOGIN:
|
||||
PostFunLogin();
|
||||
break;
|
||||
|
||||
case FUN_CREATETHREAD:
|
||||
PostFunCreateThread();
|
||||
break;
|
||||
|
||||
case FUN_UPLOAD:
|
||||
PostFunUpload();
|
||||
break;
|
||||
|
||||
case FUN_CREATETICKET:
|
||||
PostFunCreateTicket();
|
||||
break;
|
||||
|
||||
case FUN_EDITTICKET:
|
||||
PostFunEditTicket();
|
||||
break;
|
||||
|
||||
case FUN_CKEDITOR:
|
||||
PostFunEmacs();
|
||||
break;
|
||||
|
||||
case FUN_ADDUSER:
|
||||
PostFunAddUser();
|
||||
break;
|
||||
|
||||
case FUN_MV:
|
||||
PostFunMv();
|
||||
break;
|
||||
|
||||
case FUN_SUBJECT:
|
||||
PostFunSubject();
|
||||
break;
|
||||
|
||||
default:
|
||||
log << log1 << "Content: unknown post function" << logend;
|
||||
break;
|
||||
}
|
||||
CallPostFunction();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user