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:
27
core/db.cpp
27
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)
|
||||
{
|
||||
|
@@ -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<User> & user_table);
|
||||
|
@@ -37,12 +37,13 @@
|
||||
#define FUN_TICKET 20
|
||||
#define FUN_UPTIME 21
|
||||
#define FUN_MV 23
|
||||
//#define FUN_UNAME 24
|
||||
#define FUN_UNAME 24
|
||||
#define FUN_CHMOD 25
|
||||
#define FUN_CHOWN 26
|
||||
#define FUN_CKEDITOR 27
|
||||
#define FUN_DOWNLOAD 28
|
||||
#define FUN_ADDUSER 29
|
||||
#define FUN_SUBJECT 30
|
||||
|
||||
|
||||
|
||||
|
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -23,8 +23,11 @@ class Functions
|
||||
typedef std::map<std::string, Function> Table;
|
||||
Table table;
|
||||
|
||||
public:
|
||||
Function fun;
|
||||
|
||||
void AddFun(int code, const char * url);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void Clear();
|
||||
@@ -33,8 +36,6 @@ public:
|
||||
Function * GetFunction(const std::string & name);
|
||||
Function * GetFunction(int code);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -16,12 +16,7 @@
|
||||
#include <ctime>
|
||||
#include "item.h"
|
||||
|
||||
// !! wrzucic do pliku version.h i dodac przedrostek typu WINIX_
|
||||
// albo dac nazwy typu WINIX_VER_MAJOR
|
||||
#define MAJOR_VER 0
|
||||
#define MINOR_VER 2
|
||||
#define REVISION_VER 0
|
||||
|
||||
|
||||
|
||||
void ToString(std::string & s, int value);
|
||||
void ToString(std::string & s, long value);
|
||||
|
19
core/version.h
Executable file
19
core/version.h
Executable file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfilecmslucoreversion
|
||||
#define headerfilecmslucoreversion
|
||||
|
||||
|
||||
#define WINIX_VER_MAJOR 0
|
||||
#define WINIX_VER_MINOR 3
|
||||
#define WINIX_VER_REVISION 0
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user