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:
2010-05-20 18:28:19 +00:00
parent 2ad666d221
commit 612f260938
22 changed files with 291 additions and 145 deletions

View File

@@ -22,139 +22,62 @@ void Functions::Clear()
void Functions::AddFun(int code, const char * url)
{
fun.code = code;
fun.item.url = url;
table.insert( std::make_pair(fun.item.url, fun) );
}
// in the future we will read these functions from the database
void Functions::ReadFunctions()
{
Clear();
Function f;
f.item.user_id = -1;
f.item.group_id = -1;
f.item.privileges = 0755;
f.item.parent_id = -1; // !! temporarily doesn't matter
f.item.id = -1;
f.item.type = Item::file;
// in the future we will read these functions from the database
f.code = FUN_LS;
f.item.url = "ls";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_CAT;
f.item.url = "cat";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_NODE;
f.item.url = "node";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_EMACS;
f.item.url = "emacs";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_MKDIR;
f.item.url = "mkdir";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_DEFAULT;
f.item.url = "default";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_PRIV;
f.item.url = "priv";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_RM;
f.item.url = "rm";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_LOGOUT;
f.item.url = "logout";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_LOGIN;
f.item.url = "login";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_RUN;
f.item.url = "run";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_WHO;
f.item.url = "who";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_LAST;
f.item.url = "last";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_CREATETHREAD;
f.item.url = "createthread";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_THREAD;
f.item.url = "thread";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_UPLOAD;
f.item.url = "upload";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_CREATETICKET;
f.item.url = "createticket";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_EDITTICKET;
f.item.url = "editticket";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_TICKET;
f.item.url = "ticket";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_UPTIME;
f.item.url = "uptime";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_MV;
f.item.url = "mv";
table.insert( std::make_pair(f.item.url, f) );
/*
f.code = FUN_UNAME;
f.item.url = "uname";
table.insert( std::make_pair(f.item.url, f) );
*/
f.code = FUN_CHMOD;
f.item.url = "chmod";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_CHOWN;
f.item.url = "chown";
table.insert( std::make_pair(f.item.url, f) );
fun.item.user_id = -1;
fun.item.group_id = -1;
fun.item.privileges = 0755;
fun.item.parent_id = -1; // !! temporarily doesn't matter
fun.item.id = -1;
fun.item.type = Item::file;
f.code = FUN_CKEDITOR;
f.item.url = "ckeditor";
table.insert( std::make_pair(f.item.url, f) );
AddFun(FUN_LS, "ls");
AddFun(FUN_CAT, "cat");
AddFun(FUN_NODE, "node");
AddFun(FUN_EMACS, "emacs");
AddFun(FUN_MKDIR, "mkdir");
AddFun(FUN_DEFAULT, "default");
AddFun(FUN_PRIV, "priv");
AddFun(FUN_RM, "rm");
AddFun(FUN_LOGOUT, "logout");
AddFun(FUN_LOGIN, "login");
AddFun(FUN_RUN, "run");
AddFun(FUN_WHO, "who");
AddFun(FUN_LAST, "last");
AddFun(FUN_CREATETHREAD, "createthread");
AddFun(FUN_THREAD, "thread");
AddFun(FUN_UPLOAD, "upload");
AddFun(FUN_CREATETICKET, "createticket");
AddFun(FUN_EDITTICKET, "editticket");
AddFun(FUN_TICKET, "ticket");
AddFun(FUN_UPTIME, "uptime");
AddFun(FUN_MV, "mv");
AddFun(FUN_UNAME, "uname");
AddFun(FUN_CHMOD, "chmod");
AddFun(FUN_CHOWN, "chown");
AddFun(FUN_CKEDITOR, "ckeditor");
AddFun(FUN_DOWNLOAD, "download");
AddFun(FUN_ADDUSER, "adduser");
AddFun(FUN_SUBJECT, "subject");
f.code = FUN_DOWNLOAD;
f.item.url = "download";
table.insert( std::make_pair(f.item.url, f) );
f.code = FUN_ADDUSER;
f.item.url = "adduser";
table.insert( std::make_pair(f.item.url, f) );
// functions which need more privileges
fun.item.privileges = 0700;
f.code = FUN_RELOAD;
f.item.url = "reload";
f.item.privileges = 0700;
table.insert( std::make_pair(f.item.url, f) );
AddFun(FUN_RELOAD, "reload");
}