added: function adduser

changed: errors (removed enum, there are macros now)
added: error messages to locales (winix_err_NN)
removed: templates: err_abuse.html err_others.html


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@593 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-02-28 00:08:10 +00:00
parent 3702efc5be
commit 71a63cc70e
160 changed files with 912 additions and 607 deletions

View File

@@ -24,7 +24,6 @@ dirs.o: request.h requesttypes.h session.h done.h compress.h
dirs.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
dirs.o: postmultiparser.h
done.o: done.h
error.o: error.h log.h
function.o: function.h item.h
functioncodeparser.o: functioncodeparser.h item.h function.h log.h
functionparser.o: functionparser.h requesttypes.h log.h item.h error.h data.h

View File

@@ -1 +1 @@
o = acceptbaseparser.o compress.o config.o data.o db.o db_itemcolumns.o dircontainer.o dirs.o done.o error.o function.o functioncodeparser.o functionparser.o functions.o groups.o htmlfilter.o httpsimpleparser.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o postmultiparser.o rebus.o request.o requestcontroller.o session.o sessioncontainer.o sessionmanager.o sessionparser.o users.o
o = acceptbaseparser.o compress.o config.o data.o db.o db_itemcolumns.o dircontainer.o dirs.o done.o function.o functioncodeparser.o functionparser.o functions.o groups.o htmlfilter.o httpsimpleparser.o lastcontainer.o loadavg.o locale.o log.o misc.o mount.o mountparser.o mounts.o notify.o plugin.o postmultiparser.o rebus.o request.o requestcontroller.o session.o sessioncontainer.o sessionmanager.o sessionparser.o users.o

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -108,7 +108,7 @@ bool was_connection = true;
else
{
log << log1 << "Db: Connection to db server cannot be established" << logend;
throw Error(Error::db_fatal_error_during_connecting);
throw Error(WINIX_ERR_DB_FATAL_ERROR_DURING_CONNECTING);
}
}
@@ -157,7 +157,7 @@ PGresult * Db::AssertQuery(const std::string & q)
log << log1 << "Db: Problem with query: \"" << q << '\"' << logend;
log << log1 << "Db: " << PQerrorMessage(pg_conn) << logend;
throw Error(Error::db_incorrect_query);
throw Error(WINIX_ERR_DB_INCORRECT_QUERY);
}
return r;
@@ -171,7 +171,7 @@ void Db::AssertResultStatus(PGresult * r, ExecStatusType t)
{
log << "Db: Incorrect result status: " << PQerrorMessage(pg_conn) << logend;
throw Error(Error::db_incorrent_result_status);
throw Error(WINIX_ERR_DB_INCORRENT_RESULT_STATUS);
}
}
@@ -185,7 +185,7 @@ int Db::AssertColumn(PGresult * r, const char * column_name)
{
log << log1 << "Db: there is no column: " << column_name << logend;
throw Error(Error::db_no_column);
throw Error(WINIX_ERR_DB_NO_COLUMN);
}
return c;
@@ -200,7 +200,7 @@ const char * Db::AssertValue(PGresult * r, int row, int col)
{
log << log1 << "Db: there is no such an item in the result, row:" << row << ", col:" << col << logend;
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
}
return res;
@@ -234,12 +234,12 @@ bool Db::CheckUser(std::string & login, std::string & password, long & user_id)
int rows = PQntuples(r);
if( rows == 0 )
throw Error(Error::db_incorrect_login);
throw Error(WINIX_ERR_DB_INCORRECT_LOGIN);
if( rows > 1 )
{
log << log1 << "Db: there is more than one user: " << login << " (with the same password)" << logend;
throw Error(Error::db_more_than_one_login);
throw Error(WINIX_ERR_DB_MORE_THAN_ONE_LOGIN);
}
int cuser_id = AssertColumn(r, "id");
@@ -262,6 +262,40 @@ return user_ok;
Error Db::AddUser(User & user, const std::string & password)
{
PGresult * r = 0;
Error status = WINIX_ERR_OK;
try
{
AssertConnection();
std::ostringstream query;
query << "insert into core.user (login, password, super_user, email, cms_notify, thread_notify) values (";
query << '\'' << Escape(user.name) << "', ";
query << '\'' << Escape(password) << "', ";
query << '\'' << static_cast<int>(user.super_user) << "', ";
query << '\'' << Escape(user.email) << "', ";
query << '\'' << user.cms_notify << "', ";
query << '\'' << user.thread_notify << "');";
r = AssertQuery(query.str());
AssertResultStatus(r, PGRES_COMMAND_OK);
user.id = AssertCurrval("core.user_id_seq");
}
catch(const Error & e)
{
status = e;
}
ClearResult(r);
return status;
}
@@ -401,7 +435,7 @@ long Db::AssertCurrval(const char * table)
if( PQntuples(r) != 1 )
{
log << log1 << "Db: error (currval) for table: " << table << ", " << PQerrorMessage(pg_conn) << logend;
throw Error(Error::db_err_currval);
throw Error(WINIX_ERR_DB_ERR_CURRVAL);
}
long res = strtol( AssertValue(r, 0, 0), 0, 10 );
@@ -413,7 +447,7 @@ return res;
Error Db::AddItemIntoItem(Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
bool url_without_id = false;
try
@@ -468,7 +502,7 @@ return result;
Error Db::AddItemIntoContent(Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -499,14 +533,14 @@ return result;
Error Db::AddItem(Item & item)
{
Error result = Error::ok;
Error result = WINIX_ERR_OK;
if( item.type == Item::file )
result = AddItemIntoContent(item);
else
item.content_id = -1;
if( result == Error::ok )
if( result == WINIX_ERR_OK )
result = AddItemIntoItem(item);
return result;
@@ -519,7 +553,7 @@ return result;
Error Db::EditItemInItem(Item & item, bool with_url)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
bool url_without_id = false;
try
@@ -578,7 +612,7 @@ return result;
Error Db::EditItemInContent(Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -607,7 +641,7 @@ return result;
Error Db::EditItemGetId(Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -620,7 +654,7 @@ Error Db::EditItemGetId(Item & item)
AssertResultStatus(r, PGRES_TUPLES_OK);
if( PQntuples(r) != 1 || PQnfields(r) != 2 )
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
// we cannot use AssertColumn() with a name because both columns are called 'id'
item.id = atol( AssertValue(r, 0, 0) );
@@ -640,7 +674,7 @@ return result;
Error Db::EditItemGetContentId(Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -654,7 +688,7 @@ Error Db::EditItemGetContentId(Item & item)
AssertResultStatus(r, PGRES_TUPLES_OK);
if( PQntuples(r) != 1 || PQnfields(r) != 1 )
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
item.content_id = atol( AssertValue(r, 0, 0) );
}
@@ -673,19 +707,19 @@ return result;
// !! moze nazwa poprostu EditItem (nie trzeba tego ById) ? (sprawdzic czy nie koliduje z inna nazwa)
Error Db::EditItemById(Item & item, bool with_url)
{
Error result = Error::ok;
Error result = WINIX_ERR_OK;
// !! dla katalogow nie testowane jeszcze
if( item.type == Item::file )
result = EditItemGetContentId(item);
if( result == Error::ok )
if( result == WINIX_ERR_OK )
{
if( item.type == Item::file )
result = EditItemInContent(item);
if( result == Error::ok )
if( result == WINIX_ERR_OK )
result = EditItemInItem(item, with_url);
}
@@ -700,11 +734,11 @@ Error Db::EditItemByUrl(Item & item, bool with_url)
{
Error result = EditItemGetId(item);
if( result == Error::ok )
if( result == WINIX_ERR_OK )
{
result = EditItemInContent(item);
if( result == Error::ok )
if( result == WINIX_ERR_OK )
result = EditItemInItem(item, with_url);
}
@@ -716,7 +750,7 @@ return result;
Error Db::EditDefaultItem(long id, long new_default_item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -735,7 +769,7 @@ Error Db::EditDefaultItem(long id, long new_default_item)
if( rows == 0 )
{
result = Error::no_item;
result = WINIX_ERR_NO_ITEM;
log << log1 << "Db: EditDefaultItem: no such item, id: " << id << logend;
}
}
@@ -914,7 +948,7 @@ void Db::GetItem(std::vector<Item> & item_table, long id)
Error Db::GetItem(long parent_id, const std::string & url, Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -930,7 +964,7 @@ Error Db::GetItem(long parent_id, const std::string & url, Item & item)
int rows = PQntuples(r);
if( rows == 0 )
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
ItemColumns col;
col.SetColumns(r);
@@ -950,7 +984,7 @@ return result;
Error Db::GetItemById(long item_id, Item & item)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -965,7 +999,7 @@ Error Db::GetItemById(long item_id, Item & item)
int rows = PQntuples(r);
if( rows == 0 )
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
ItemColumns col;
col.SetColumns(r);
@@ -1074,7 +1108,7 @@ return result;
Error Db::EditPrivById(Item & item, long id)
{
PGresult * r = 0;
Error result = Error::ok;
Error result = WINIX_ERR_OK;
try
{
@@ -1106,7 +1140,7 @@ return result;
Error Db::DelDirById(long id)
{
Error result = Error::ok;
Error result = WINIX_ERR_OK;
PGresult * r = 0;
const char * crows;
@@ -1224,7 +1258,7 @@ void Db::DelItemDelContent(const Item & item)
Error Db::DelItemCountContents(const Item & item, long & contents)
{
Error result = Error::ok;
Error result = WINIX_ERR_OK;
PGresult * r = 0;
try
@@ -1259,7 +1293,7 @@ long contents;
Error result = DelItemCountContents(item, contents);
if( result == Error::ok && contents == 1 )
if( result == WINIX_ERR_OK && contents == 1 )
DelItemDelContent(item);
return DelItemDelItem(item);
@@ -1331,7 +1365,7 @@ void Db::GetUsers(UGContainer<User> & user_table)
User u;
long last_id = -1;
UGContainer<User>::Iterator iter;
UGContainer<User>::Iterator iter = user_table.End();
for(int i = 0 ; i<rows ; ++i)
{
@@ -1348,12 +1382,16 @@ void Db::GetUsers(UGContainer<User> & user_table)
log << log1 << "Db: get user: id:" << u.id << ", name:" << u.name << ", super_user:" << u.super_user << logend;
iter = user_table.PushBack( u );
if( iter == user_table.End() )
log << log1 << "Db: can't add a user: " << u.name << logend;
last_id = u.id;
}
long group_id = atol( AssertValue(r, i, cgroup_id) );
if( !PQgetisnull(r, i, cgroup_id) && group_id!=-1 && !user_table.Empty() )
if( !PQgetisnull(r, i, cgroup_id) && group_id!=-1 && iter!=user_table.End() )
{
iter->groups.push_back(group_id);
log << log3 << "Db: user:" << iter->name << " is a member of group_id:" << group_id << logend;
@@ -1485,7 +1523,7 @@ return buffer;
Error Db::GetThreadByDirId(long dir_id, Thread & thread)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1506,7 +1544,7 @@ Error Db::GetThreadByDirId(long dir_id, Thread & thread)
log << log1 << "Db: there is more than one thread with dir_id: " << dir_id << logend;
else
if( rows == 0 )
throw Error(Error::no_thread);
throw Error(WINIX_ERR_NO_THREAD);
int cid = AssertColumn(r, "id");
int cparent_id = AssertColumn(r, "parent_id");
@@ -1542,7 +1580,7 @@ return status;
Error Db::GetThreads(long parent_id, std::vector<Thread> & thread_tab)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1604,7 +1642,7 @@ return status;
Error Db::AddThread(Thread & thread)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1638,7 +1676,7 @@ return status;
Error Db::EditThreadAddItem(long dir_id, long item_id)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1664,7 +1702,7 @@ return status;
Error Db::EditThreadRemoveItem(long dir_id)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1703,7 +1741,7 @@ return status;
Error Db::RemoveThread(long dir_id)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1737,7 +1775,7 @@ return status;
Error Db::GetTicketByDirId(long dir_id, Ticket & ticket)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1758,7 +1796,7 @@ Error Db::GetTicketByDirId(long dir_id, Ticket & ticket)
log << log1 << "Db: there is more than one ticket with dir_id: " << dir_id << logend;
else
if( rows == 0 )
throw Error(Error::no_ticket);
throw Error(WINIX_ERR_NO_TICKET);
TicketColumns tc;
@@ -1782,7 +1820,7 @@ return status;
Error Db::GetTickets(long parent_id, std::vector<Ticket> & ticket_tab)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1856,7 +1894,7 @@ return is_ticket;
Error Db::AddTicket(Ticket & ticket)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1892,7 +1930,7 @@ return status;
Error Db::EditTicketById(Ticket & ticket)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1927,7 +1965,7 @@ return status;
Error Db::EditTicketRemoveItem(long item_id)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{
@@ -1954,7 +1992,7 @@ return status;
Error Db::RemoveTicket(long dir_id)
{
PGresult * r = 0;
Error status = Error::ok;
Error status = WINIX_ERR_OK;
try
{

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -44,6 +44,8 @@ public:
void Init(const std::string & database, const std::string & user, const std::string & pass);
bool CheckUser(std::string & login, std::string & password, long & user_id);
Error AddUser(User & user, const std::string & password);
Error AddItem(Item & item);
Error EditItemById(Item & item, bool with_url = true);
Error EditItemByUrl(Item & item, bool with_url = true);

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -52,7 +52,7 @@ void Dirs::CheckRootDir()
// !! upewnic sie ze baza nie zmieni url (gdyby wczesniej juz byl w bazie pusty url)
// !! zrobic jakis wyjatek do wprowadzania roota?
if( db.AddItem(root) == Error::ok )
if( db.AddItem(root) == WINIX_ERR_OK )
{
dir_table.PushBack(root);
}
@@ -298,7 +298,7 @@ void Dirs::DeleteDir(long id)
DeleteDir(p->second->id);
}
if( db.DelDirById(id) == Error::ok )
if( db.DelDirById(id) == WINIX_ERR_OK )
dir_table.DelById(id);
db.RemoveThread(id);

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,94 +0,0 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#include "error.h"
Error::Error()
{
code = unknown;
}
Error::Error(Code c) : code(c)
{
}
Error::Error(int i)
{
code = static_cast<Code>(i);
}
Error::Error(const Error & e)
{
code = e.code;
}
Error::operator int() const
{
return static_cast<int>(code);
}
Error & Error::operator=(Code c)
{
code = c;
return *this;
}
Error & Error::operator=(const Error & e)
{
code = e.code;
return *this;
}
bool Error::operator==(Code c) const
{
return code == c;
}
bool Error::operator!=(Code c) const
{
return code != c;
}
bool Error::operator==(const Error & e) const
{
return code == e.code;
}
bool Error::operator!=(const Error & e) const
{
return code != e.code;
}
std::ostream & operator<<(std::ostream & out, const Error & e)
{
out << static_cast<int>(e.code);
return out;
}
Log & operator<<(Log & out, const Error & e)
{
out << static_cast<int>(e.code);
return out;
}

View File

@@ -1,8 +1,8 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
@@ -13,84 +13,61 @@
#include <iostream>
#include "log.h"
#define WINIX_ERR_OK 0
//#define WINIX_ERR_INCORRECT_PATH 1
//#define WINIX_ERR_NO_POSTVAR 2
#define WINIX_ERR_INCORRECT_DIR 3
#define WINIX_ERR_CANT_CHANGE_USER 4
#define WINIX_ERR_CANT_CHANGE_GROUP 5
#define WINIX_ERR_CANT_CHANGE_PRIVILEGES 6
#define WINIX_ERR_PERMISSION_DENIED 7
#define WINIX_ERR_NO_ROOT_DIR 8
#define WINIX_ERR_NO_FUNCTION 9
#define WINIX_ERR_NO_ITEM 10
#define WINIX_ERR_UNKNOWN_PARAM 11
#define WINIX_ERR_MOUNT_UNKNOWN 12
#define WINIX_ERR_UNKNOWN_FILESYSTEM 13
#define WINIX_ERR_NO_MOUNTPOINT 14
//#define WINIX_ERR_MOUNT_NO_PARAM 15
#define WINIX_ERR_NO_THREAD 16
#define WINIX_ERR_EMPTY 17
#define WINIX_ERR_SPAM 18
#define WINIX_ERR_INCORRECT_REBUS 19
class Error
{
#define WINIX_ERR_NO_BOUNDARY 20
#define WINIX_ERR_BROKEN_INPUT 21
#define WINIX_ERR_INPUT_TOO_LARGE 22
#define WINIX_ERR_CANT_CREATE_FILE 23
public:
#define WINIX_ERR_NO_TICKET 24
enum Code
{
ok = 0,
incorrect_path,
db_fatal_error_during_connecting,
db_incorrect_query,
db_incorrent_result_status,
db_no_column,
db_incorrect_login,
db_more_than_one_login,
db_err_currval,
no_postvar,
incorrect_dir,
cant_change_user,
cant_change_group,
cant_change_privileges,
permission_denied,
no_root_dir,
no_function,
no_item,
unknown_param,
mount_unknown,
unknown_filesystem,
no_mountpoint,
mount_no_param,
no_thread,
empty,
spam,
incorrect_rebus,
no_boundary,
broken_input,
input_too_large,
cant_create_file,
no_ticket,
unknown = 1000
};
Error();
Error(Code c);
Error(int i);
Error(const Error & e);
Error & operator=(Code c);
Error & operator=(const Error & e);
operator int() const;
bool operator==(Code c) const;
bool operator!=(Code c) const;
bool operator==(const Error & e) const;
bool operator!=(const Error & e) const;
friend std::ostream & operator<<(std::ostream & out, const Error & e);
friend Log & operator<<(Log & out, const Error & e);
#define WINIX_ERR_PASSWORDS_DIFFERENT 25
#define WINIX_ERR_PASSWORD_TOO_SHORT 26
#define WINIX_ERR_USER_EXISTS 27
#define WINIX_ERR_LOGIN_EMPTY 28
private:
#define WINIX_ERR_DB_FATAL_ERROR_DURING_CONNECTING 100
#define WINIX_ERR_DB_INCORRECT_QUERY 101
#define WINIX_ERR_DB_INCORRENT_RESULT_STATUS 102
#define WINIX_ERR_DB_NO_COLUMN 103
#define WINIX_ERR_DB_INCORRECT_LOGIN 104
#define WINIX_ERR_DB_MORE_THAN_ONE_LOGIN 105
#define WINIX_ERR_DB_ERR_CURRVAL 106
Code code;
};
//#define WINIX_ERR_UNKNOWN 1000
typedef int Error;

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -42,7 +42,7 @@
#define FUN_CHOWN 26
#define FUN_CKEDITOR 27
#define FUN_DOWNLOAD 28
#define FUN_ADDUSER 29

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -34,7 +34,7 @@ void FunctionParser::ParseDirectories()
if( !pdir )
{
// there is no the root dir
request.status = Error::no_root_dir;
request.status = WINIX_ERR_NO_ROOT_DIR;
return;
}
@@ -78,12 +78,12 @@ void FunctionParser::ParseItem()
request.status = db.GetItem(parent_id, url, request.item);
if( request.status == Error::ok )
if( request.status == WINIX_ERR_OK )
{
if( request.role == Request::authorizer && request.item.auth == Item::auth_none )
{
log << log1 << "FP: item.url: " << url << " exists but has not a static content (authorizer role)" << logend;
request.status = Error::no_item;
request.status = WINIX_ERR_NO_ITEM;
return;
}
@@ -138,7 +138,7 @@ void FunctionParser::ParseParams()
void FunctionParser::Parse()
{
request.status = Error::ok;
request.status = WINIX_ERR_OK;
get_index = 0;
get_table_len = request.get_table.size();
request.pfunction = 0;
@@ -146,7 +146,7 @@ void FunctionParser::Parse()
ParseDirectories();
if( request.status != Error::ok )
if( request.status != WINIX_ERR_OK )
return;
ParseFunction();
@@ -155,14 +155,14 @@ void FunctionParser::Parse()
{
ParseItem();
if( request.status != Error::ok )
if( request.status != WINIX_ERR_OK )
return;
ParseFunction();
if( !request.pfunction && get_index != get_table_len )
{
request.status = Error::no_function;
request.status = WINIX_ERR_NO_FUNCTION;
log << log3 << "FP: Parse: unknown function: \"" << request.get_table[get_index] << "\"" << logend;
return;
}

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -143,6 +143,9 @@ void Functions::ReadFunctions()
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

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
@@ -111,22 +111,69 @@ void Locale::SetLangDef(Lang lang)
}
bool Locale::IsKey(const std::string & key) const
{
return IsKey(key, current_lang);
}
bool Locale::IsKey(const std::string & key, Lang lang) const
{
if( static_cast<size_t>(lang) >= loc_tab.size() )
{
// ops, something wrong
return false;
}
// looking in the lang language
ConfParser::Table::const_iterator i = loc_tab[lang].find(key);
if( i != loc_tab[lang].end() )
return true;
if( lang == default_lang )
return false;
if( static_cast<size_t>(default_lang) >= loc_tab.size() )
{
// ops, something wrong
return false;
}
// looking in a default language
i = loc_tab[default_lang].find(key);
if( i != loc_tab[default_lang].end() )
return true;
// there is no such a key
return false;
}
const std::string & Locale::Get(const std::string & key) const
{
if( static_cast<size_t>(current_lang) >= loc_tab.size() )
return Get(key, current_lang);
}
const std::string & Locale::Get(const std::string & key, Lang lang) const
{
if( static_cast<size_t>(lang) >= loc_tab.size() )
{
// ops, something wrong
return empty;
}
// looking in the current_lang
ConfParser::Table::const_iterator i = loc_tab[current_lang].find(key);
// looking in the lang language
ConfParser::Table::const_iterator i = loc_tab[lang].find(key);
if( i != loc_tab[current_lang].end() )
if( i != loc_tab[lang].end() )
return i->second;
if( current_lang == default_lang )
if( lang == default_lang )
return empty;

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
@@ -32,7 +32,11 @@ public:
void Read(const char * dir, const char * dir_def = 0);
void Read(const std::string & dir, const std::string & dir_def);
bool IsKey(const std::string & key) const;
bool IsKey(const std::string & key, Lang lang) const;
const std::string & Get(const std::string & key) const;
const std::string & Get(const std::string & key, Lang lang) const;
// default is english
void SetLang(Lang lang);

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
@@ -196,7 +196,7 @@ void MountParser::ReadMountType()
if( temp.empty() )
{
// an empty line (some white characters only)
err = Error::empty;
err = WINIX_ERR_EMPTY;
}
else
if( temp == "cms" )
@@ -218,7 +218,7 @@ void MountParser::ReadMountType()
}
else
{
err = Error::mount_unknown;
err = WINIX_ERR_MOUNT_UNKNOWN;
log << log1 << "MP: unknown mount type: " << temp << logend;
}
}
@@ -238,7 +238,7 @@ void MountParser::ReadMountPoint()
}
else
{
err = Error::no_mountpoint;
err = WINIX_ERR_NO_MOUNTPOINT;
log << log1 << "MP: there is no such a mount point: " << temp << logend;
}
}
@@ -262,7 +262,7 @@ void MountParser::ReadFs()
}
else
{
err = Error::unknown_filesystem;
err = WINIX_ERR_UNKNOWN_FILESYSTEM;
log << log1 << "MP: unknown filesystem: " << temp << logend;
}
}
@@ -315,23 +315,23 @@ void MountParser::ReadRow(std::map<long, Mount> & output)
{
ReadMountType();
if( err == Error::empty )
if( err == WINIX_ERR_EMPTY )
{
err = Error::ok;
err = WINIX_ERR_OK;
SkipLine();
return;
}
if( err == Error::ok )
if( err == WINIX_ERR_OK )
ReadMountPoint();
if( err == Error::ok )
if( err == WINIX_ERR_OK )
ReadFs();
if( err == Error::ok )
if( err == WINIX_ERR_OK )
ReadMountParams();
if( err == Error::ok )
if( err == WINIX_ERR_OK )
{
std::pair<std::map<long, Mount>::iterator, bool> res = output.insert( std::make_pair(mount.dir_id, mount) );
@@ -348,10 +348,10 @@ void MountParser::ReadRow(std::map<long, Mount> & output)
Error MountParser::Parse(const std::string & input, std::map<long, Mount> & output)
{
pinput = input.c_str();
err = Error::ok;
err = WINIX_ERR_OK;
output.clear();
while( *pinput && err == Error::ok )
while( *pinput && err == WINIX_ERR_OK )
ReadRow(output);
return err;

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
@@ -29,7 +29,7 @@ Error Mounts::ReadMounts(const std::string & mounts)
MountParser mp;
Error err = mp.Parse(mounts, mount_tab);
if( err != Error::ok )
if( err != WINIX_ERR_OK )
{
log << log1 << "M: some problems with mountpoints (mountpoints table will be empty)" << logend;
mount_tab.clear();
@@ -52,19 +52,19 @@ Error Mounts::ReadMounts()
if( !etc )
{
log << log1 << "M: there is no /etc directory" << logend;
return Error::no_item;
return WINIX_ERR_NO_ITEM;
}
Item fstab;
Error err = db.GetItem(etc->id, file, fstab);
if( err == Error::no_item )
if( err == WINIX_ERR_NO_ITEM )
{
log << log1 << "M: there is no /etc/fstab file" << logend;
return err;
}
if( err != Error::ok )
if( err != WINIX_ERR_OK )
{
log << log1 << "M: cannot read /etc/fstab" << logend;
return err;

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -106,7 +106,7 @@ void PostMultiParser::ReadHeaderName()
if( last != ':' && last != '=' )
{
err = Error::broken_input;
err = WINIX_ERR_BROKEN_INPUT;
return;
}
@@ -137,7 +137,7 @@ bool was_apost = false;
{
if( last != '"' )
{
err = Error::broken_input;
err = WINIX_ERR_BROKEN_INPUT;
return;
}
@@ -148,7 +148,7 @@ bool was_apost = false;
if( last != ';' && last != 10 )
{
err = Error::broken_input;
err = WINIX_ERR_BROKEN_INPUT;
return;
}
@@ -163,12 +163,12 @@ void PostMultiParser::ReadPartHeader()
ReadHeaderName();
if( err != Error::ok )
if( err != WINIX_ERR_OK )
return;
ReadHeaderValue();
if( err != Error::ok )
if( err != WINIX_ERR_OK )
return;
log << "PMP: " << header_name << ": " << header_value << logend;
@@ -265,7 +265,7 @@ bool has_boundary = false;
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
{
err = Error::input_too_large;
err = WINIX_ERR_INPUT_TOO_LARGE;
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
return;
}
@@ -319,7 +319,7 @@ bool has_boundary = false;
if( data.post_file_max != 0 && content_len > (size_t)data.post_file_max )
{
err = Error::input_too_large;
err = WINIX_ERR_INPUT_TOO_LARGE;
log << log1 << "PMP: content greater than " << data.post_file_max << " (skipping)" << logend;
return;
}
@@ -345,7 +345,7 @@ void PostMultiParser::AddNormalPostVar()
{
if( post_table->size() >= WINIX_POSTTABLE_MAXSIZE )
{
err = Error::input_too_large;
err = WINIX_ERR_INPUT_TOO_LARGE;
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post variables (skipping)" << logend;
return;
}
@@ -366,7 +366,7 @@ void PostMultiParser::AddFilePostVar()
{
if( post_file_table->size() >= WINIX_POSTTABLE_MAXSIZE )
{
err = Error::input_too_large;
err = WINIX_ERR_INPUT_TOO_LARGE;
log << log1 << "PMP: more than " << WINIX_POSTTABLE_MAXSIZE << " post file variables (skipping)" << logend;
return;
}
@@ -411,7 +411,7 @@ void PostMultiParser::CheckBoundaryEnd()
if( last != '-' )
{
err = Error::broken_input;
err = WINIX_ERR_BROKEN_INPUT;
return;
}
@@ -436,7 +436,7 @@ char buf[100];
if( data.auth_tmp_dir.empty() )
{
log << log1 << "PMP: auth_tmp_dir is not set in the config" << logend;
err = Error::cant_create_file;
err = WINIX_ERR_CANT_CREATE_FILE;
return;
}
@@ -449,7 +449,7 @@ char buf[100];
if( !tmp_file )
{
log << log1 << "PMP: can't create a temporary file: " << tmp_filename << logend;
err = Error::cant_create_file;
err = WINIX_ERR_CANT_CREATE_FILE;
return;
}
@@ -465,13 +465,13 @@ void PostMultiParser::ReadPart()
while( IsHeader() )
ReadPartHeader();
if( err != Error::ok )
if( err != WINIX_ERR_OK )
return;
if( !filename.empty() )
CreateTmpFile();
if( err != Error::ok )
if( err != WINIX_ERR_OK )
return;
if( !filename.empty() )
@@ -479,13 +479,13 @@ void PostMultiParser::ReadPart()
else
ReadContent();
if( err == Error::ok )
if( err == WINIX_ERR_OK )
{
AddPostVar();
CheckBoundaryEnd();
}
if( err != Error::ok && !filename.empty() )
if( err != WINIX_ERR_OK && !filename.empty() )
{
log << log1 << "PMP: deleting the tmp file: " << tmp_filename << logend;
unlink(tmp_filename.c_str());
@@ -527,7 +527,7 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTable & post_table_, PostFil
{
in = in_;
last = 0;
err = Error::ok;
err = WINIX_ERR_OK;
line_end_dos = false;
in_buffer_ind = WINIX_POSTMULTI_INPUT_BUFFER;
in_buffer_len = WINIX_POSTMULTI_INPUT_BUFFER;
@@ -539,17 +539,17 @@ Error PostMultiParser::Parse(FCGX_Stream * in_, PostTable & post_table_, PostFil
ReadBoundary();
if( boundary.empty() )
return Error::no_boundary;
return WINIX_ERR_NO_BOUNDARY;
while( last!=-1 && err == Error::ok )
while( last!=-1 && err == WINIX_ERR_OK )
ReadPart();
if( err != Error::ok )
if( err != WINIX_ERR_OK )
{
post_table->clear();
post_file_table->clear();
if( err != Error::input_too_large && err != Error::cant_create_file )
if( err != WINIX_ERR_INPUT_TOO_LARGE && err != WINIX_ERR_CANT_CREATE_FILE )
log << log1 << "PMP: syntax error" << logend;
}

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -90,7 +90,7 @@ void Request::Clear()
pfunction = 0;
param_table.clear();
status = Error::ok;
status = WINIX_ERR_OK;
is_thread = false;
thread.Clear();
@@ -477,7 +477,7 @@ void Request::SendPage(bool compressing, const std::string & source_ref)
{
const std::string * source = &source_ref;
bool raw = request.is_item && request.item.content_type == Item::ct_raw && request.status == Error::ok &&
bool raw = request.is_item && request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK &&
request.pfunction && (request.pfunction->code == FUN_CAT || request.pfunction->code == FUN_RUN);
if( data.html_filter && !raw )
@@ -506,10 +506,10 @@ bool compressing = data.compression && role == responder && redirect_to.empty()
accept_encoding_parser.AcceptDeflate() && source.size() >= 512;
if( status == Error::no_item || status == Error::no_function || status == Error::unknown_param )
if( status == WINIX_ERR_NO_ITEM || status == WINIX_ERR_NO_FUNCTION || status == WINIX_ERR_UNKNOWN_PARAM )
header = h_404;
if( status == Error::permission_denied || status == Error::cant_change_user || status == Error::cant_change_group )
if( status == WINIX_ERR_PERMISSION_DENIED || status == WINIX_ERR_CANT_CHANGE_USER || status == WINIX_ERR_CANT_CHANGE_GROUP )
header = h_403;
SendSessionCookie();

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -32,7 +32,7 @@ void Session::Clear()
time = 0;
puser = 0;
done = Done::none;
done_status = Error::ok;
done_status = WINIX_ERR_OK;
item.Clear();
done_timer = 0;
rebus_item = 0;
@@ -79,7 +79,7 @@ void Session::CheckTimers()
if( DecTimer(done_timer) )
{
done = Done::none;
done_status = Error::ok;
done_status = WINIX_ERR_OK;
}
}
*/
@@ -101,7 +101,7 @@ void Session::CheckTimers()
if( done_timer == 0 )
{
done = Done::none;
done_status = Error::ok;
done_status = WINIX_ERR_OK;
}
}

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -37,9 +37,12 @@ public:
Iterator End();
SizeType Size();
bool Empty();
Iterator PushBack(const Type & type);
Iterator PushBack(const Type & type); // can return End() if the user already exists
void Clear();
bool Is(long id);
bool Is(const std::string & name);
Iterator FindId(long id);
Iterator FindName(const std::string & name);
@@ -102,6 +105,9 @@ bool UGContainer<Type>::Empty()
template<class Type>
typename UGContainer<Type>::Iterator UGContainer<Type>::PushBack(const Type & type)
{
if( Is(type.id) || Is(type.name) )
return End();
table.push_back(type);
log << log2 << "UGCont: added, id: " << type.id << ", name: " << type.name << logend;
@@ -122,6 +128,31 @@ void UGContainer<Type>::Clear()
template<class Type>
bool UGContainer<Type>::Is(long id)
{
typename TableId::iterator i = table_id.find(id);
if( i == table_id.end() )
return false;
return true;
}
template<class Type>
bool UGContainer<Type>::Is(const std::string & name)
{
typename TableName::iterator i = table_name.find(name);
if( i == table_name.end() )
return false;
return true;
}
template<class Type>
typename UGContainer<Type>::Iterator UGContainer<Type>::FindId(long id)
{

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -34,6 +34,19 @@ void Users::ReadUsers()
}
bool Users::AddUser(const User & user)
{
Table::Iterator i = table.PushBack(user);
return (i != table.End());
}
bool Users::IsUser(const std::string & name)
{
return table.Is(name);
}
User * Users::GetUser(long user_id)
{

View File

@@ -1,5 +1,5 @@
/*
* This file is a part of CMSLU -- Content Management System like Unix
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
@@ -33,6 +33,8 @@ public:
Users();
void Clear();
void ReadUsers();
bool AddUser(const User & user);
bool IsUser(const std::string & name);
User * GetUser(long user_id);
User * GetUser(const std::string & name);
long GetUserId(const std::string & name);