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
pull/3/head
Tomasz Sowa 13 years ago
parent 3702efc5be
commit 71a63cc70e

@ -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, Tomasz Sowa

@ -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, Tomasz Sowa

@ -1,5 +1,21 @@
# DO NOT DELETE
adduser.o: content.h ../core/item.h ../templates/templates.h
adduser.o: ../templates/patterncacher.h ../templates/misc.h
adduser.o: ../templates/localefilter.h ../core/locale.h
adduser.o: ../confparser/confparser.h ../templates/ckeditorgetparser.h
adduser.o: ../core/httpsimpleparser.h ../core/log.h ../core/thread.h
adduser.o: ../core/ticket.h ../core/done.h ../core/request.h
adduser.o: ../core/requesttypes.h ../core/session.h ../core/done.h
adduser.o: ../core/item.h ../core/error.h ../core/log.h ../core/user.h
adduser.o: ../core/rebus.h ../core/function.h ../core/thread.h
adduser.o: ../core/compress.h ../core/acceptencodingparser.h
adduser.o: ../core/acceptbaseparser.h ../core/htmlfilter.h
adduser.o: ../core/postmultiparser.h ../core/ticket.h ../core/data.h
adduser.o: ../core/dirs.h ../core/dircontainer.h ../core/users.h
adduser.o: ../core/ugcontainer.h ../core/groups.h ../core/group.h
adduser.o: ../core/functions.h ../core/lastcontainer.h ../core/mounts.h
adduser.o: ../core/mount.h ../core/loadavg.h ../core/db.h
cat.o: content.h ../core/item.h ../templates/templates.h
cat.o: ../templates/patterncacher.h ../templates/misc.h
cat.o: ../templates/localefilter.h ../core/locale.h

@ -1 +1 @@
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 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 node.o priv.o reload.o rm.o run.o thread.o ticket.o upload.o who.o

@ -0,0 +1,111 @@
/*
* 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/data.h"
#include "../core/db.h"
bool Content::CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass)
{
if( !login || !pass || !conf_pass )
{
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
if( login->empty() )
{
request.status = WINIX_ERR_LOGIN_EMPTY;
return false;
}
if( *pass != *conf_pass )
{
request.status = WINIX_ERR_PASSWORDS_DIFFERENT;
return false;
}
if( pass->size() < 5 )
{
request.status = WINIX_ERR_PASSWORD_TOO_SHORT;
return false;
}
if( data.users.IsUser(*login) )
{
request.status = WINIX_ERR_USER_EXISTS;
return false;
}
return true;
}
void Content::PostFunAddUser()
{
User user;
std::string * login = request.PostVar("login");
std::string * pass = request.PostVar("password");
std::string * conf_pass = request.PostVar("confirmpassword");
std::string * email = request.PostVar("email");
if( !CheckAddUserVars(login, pass, conf_pass) )
return;
user.name = *login;
if( email )
user.email = *email;
request.status = db.AddUser(user, *pass);
if( request.status == WINIX_ERR_OK )
{
if( data.users.AddUser(user) )
{
if( !request.session->puser )
LoginUser(user.id, false);
log << log2 << "Content: added a new user: " << user.name << logend;
}
else
{
log << log1 << "Content: I can't add to data.users: " << user.name
<< " but the user was added to the db correctly" << logend;
}
if( request.is_item )
RedirectTo(request.item);
else
RedirectToLastDir();
}
}
void Content::FunAddUser()
{
}

@ -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
@ -20,14 +20,14 @@ void Content::FunCat()
if( !request.is_item )
{
log << log1 << "Content: cat function requires an item" << logend;
request.status = Error::no_item;
request.status = WINIX_ERR_NO_ITEM;
return;
}
if( !request.HasReadAccess(request.item) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -125,7 +125,7 @@ void Content::MakeStandardFunction()
if( request.pfunction )
{
request.status = Error::no_item;
request.status = WINIX_ERR_NO_ITEM;
log << log1 << "Content: in authorizer mode only 'cat' funtion is available and must "
"be default (not in the url)" << logend;
return;
@ -142,7 +142,7 @@ void Content::MakeStandardFunction()
if( !request.pfunction )
{
request.status = Error::no_function;
request.status = WINIX_ERR_NO_FUNCTION;
log << log1 << "Content: no function (neither cat nor ls)" << logend;
return;
}
@ -230,7 +230,10 @@ void Content::MakeStandardFunction()
if( request.pfunction->code == FUN_DOWNLOAD )
FunDownload();
else
request.status = Error::permission_denied;
if( request.pfunction->code == FUN_ADDUSER )
FunAddUser();
else
request.status = WINIX_ERR_PERMISSION_DENIED;
}
@ -242,7 +245,7 @@ void Content::MakePost()
{
if( request.role == Request::authorizer )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}
@ -251,7 +254,7 @@ void Content::MakePost()
if( !request.pfunction )
{
request.status = Error::no_function;
request.status = WINIX_ERR_NO_FUNCTION;
log << log1 << "Content: MakePost: no function" << logend;
return;
}
@ -304,6 +307,10 @@ void Content::MakePost()
PostFunEmacs();
break;
case FUN_ADDUSER:
PostFunAddUser();
break;
default:
log << log1 << "Content: unknown post function" << logend;
break;
@ -321,7 +328,7 @@ bool sent = false;
if( request.is_item && request.item.auth == Item::auth_none &&
request.item.content_type == Item::ct_raw && request.status == Error::ok && request.pfunction )
request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK && request.pfunction )
{
if( request.pfunction->code == FUN_CAT )
{
@ -353,18 +360,18 @@ void Content::Make()
}
// request.status can be changed by function_parser
if( request.status == Error::ok )
if( request.status == WINIX_ERR_OK )
{
if( DirsHaveReadExecPerm() )
{
if( request.method == Request::post )
MakePost();
if( request.redirect_to.empty() && request.status == Error::ok )
if( request.redirect_to.empty() && request.status == WINIX_ERR_OK )
MakeStandardFunction();
}
else
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
}
if( request.session->spam_score > 0 )
@ -467,13 +474,13 @@ void Content::ReadAdditionalInfo()
if( data.mounts.pmount->type == Mount::thread )
{
if( db.GetThreadByDirId(request.dir_table.back()->id, request.thread) == Error::ok )
if( db.GetThreadByDirId(request.dir_table.back()->id, request.thread) == WINIX_ERR_OK )
request.is_thread = true;
}
else
if( data.mounts.pmount->type == Mount::ticket )
{
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) == Error::ok )
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) == WINIX_ERR_OK )
{
request.is_ticket = true;

@ -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
@ -35,6 +35,10 @@ class Content
void PrepareUrl(Item & item);
bool CheckAddUserVars(const std::string * login, const std::string * pass, const std::string * conf_pass);
void PostFunAddUser();
void FunAddUser();
void SetDefaultFunctionForFile();
void SetDefaultFunctionForDir();
@ -87,6 +91,7 @@ class Content
void CheckAccessToItems();
void LoginUser(long user_id, bool remember_me);
void FunLogin();
void PostFunLogin();

@ -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
@ -21,7 +21,7 @@ bool Content::FunCreateThreadCheckAccess()
{
if( !request.CanCreateThread() )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -35,9 +35,9 @@ bool Content::FunCreateThreadCheckAbuse()
{
if( !CheckRebus() )
{
request.status = Error::incorrect_rebus;
request.status = WINIX_ERR_INCORRECT_REBUS;
request.session->done = Done::added_thread;
request.session->done_status = Error::incorrect_rebus;
request.session->done_status = WINIX_ERR_INCORRECT_REBUS;
return false;
}
@ -46,9 +46,9 @@ bool Content::FunCreateThreadCheckAbuse()
if( request.session->spam_score > 0 )
{
request.status = Error::spam;
request.status = WINIX_ERR_SPAM;
request.session->done = Done::added_thread;
request.session->done_status = Error::spam;
request.session->done_status = WINIX_ERR_SPAM;
log << log1 << "Content: ignoring due to suspected spamming" << logend;
return false;
@ -80,7 +80,7 @@ void Content::AddThread()
void Content::PostFunCreateThreadLogAndRedirect()
{
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
request.session->done = Done::added_thread;
@ -113,7 +113,7 @@ void Content::PostFunCreateThread()
Mkdir(request.item, true);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
ReadItemContentWithType(request.item);
request.item.type = Item::file;
@ -121,7 +121,7 @@ void Content::PostFunCreateThread()
request.item.parent_id = request.dir_table.back()->id;
PostFunEmacsAdd();
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
AddThread();
}

@ -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
@ -22,7 +22,7 @@ bool Content::FunCreateTicketCheckAccess()
{
if( !request.CanCreateTicket() )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -36,9 +36,9 @@ bool Content::FunCreateTicketCheckAbuse(const Done & done)
{
if( !CheckRebus() )
{
request.status = Error::incorrect_rebus;
request.status = WINIX_ERR_INCORRECT_REBUS;
request.session->done = done;
request.session->done_status = Error::incorrect_rebus;
request.session->done_status = WINIX_ERR_INCORRECT_REBUS;
return false;
}
@ -47,9 +47,9 @@ bool Content::FunCreateTicketCheckAbuse(const Done & done)
if( request.session->spam_score > 0 )
{
request.status = Error::spam;
request.status = WINIX_ERR_SPAM;
request.session->done = done;
request.session->done_status = Error::spam;
request.session->done_status = WINIX_ERR_SPAM;
log << log1 << "Content: ignoring due to suspected spamming" << logend;
return false;
@ -168,7 +168,7 @@ void Content::AddTicket()
void Content::PostFunCreateTicketLogAndRedirect()
{
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
request.session->done = Done::added_ticket;
@ -201,7 +201,7 @@ void Content::PostFunCreateTicket()
Mkdir(request.item, true);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
ReadItemContentWithType(request.item);
request.item.type = Item::file;
@ -209,7 +209,7 @@ void Content::PostFunCreateTicket()
request.item.parent_id = request.dir_table.back()->id;
PostFunEmacsAdd();
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
AddTicket();
}

@ -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,7 +33,7 @@ long defaultid = -1;
pdir = data.dirs.GetDir(dir);
if( !pdir )
throw Error(Error::incorrect_dir);
throw Error(WINIX_ERR_INCORRECT_DIR);
if( file.empty() )
{
@ -49,7 +49,7 @@ long defaultid = -1;
defaultid = db.GetFileId(pdir->id, file);
if( defaultid == -1 )
throw Error(Error::no_item);
throw Error(WINIX_ERR_NO_ITEM);
}
else
{
@ -72,7 +72,7 @@ void Content::PostFunDefault()
if( !request.HasWriteAccess(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}
@ -82,7 +82,7 @@ void Content::PostFunDefault()
long defaultid = PostFunDefaultParsePath();
request.session->done_status = db.EditDefaultItem(request.dir_table.back()->id, defaultid);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
request.dir_table.back()->default_item = defaultid;
}
catch(const Error & e)
@ -91,7 +91,7 @@ void Content::PostFunDefault()
}
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
RedirectTo(*request.dir_table.back());
else
log << log1 << "Content: PostFunDefaultItem: Error: " << request.session->done_status << logend;
@ -104,7 +104,7 @@ void Content::FunDefault()
{
if( !request.HasWriteAccess(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -21,7 +21,7 @@ void Content::FunDownload()
if( !request.is_item )
{
log << log1 << "Content: pv function requires an item" << logend;
request.status = Error::no_item;
request.status = WINIX_ERR_NO_ITEM;
return;
}
@ -30,7 +30,7 @@ void Content::FunDownload()
request.item.auth == Item::auth_none ||
data.auth_simplefs_dir.empty() )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}
@ -38,7 +38,7 @@ void Content::FunDownload()
if( !request.MakePath(request.x_sendfile) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}
}

@ -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
@ -20,7 +20,7 @@ bool Content::FunEditTicketCheckAccess()
{
if( !request.CanEditTicket() )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -31,7 +31,7 @@ return true;
void Content::EditTicketCheckFirstItem()
{
if( request.session->done_status != Error::ok )
if( request.session->done_status != WINIX_ERR_OK )
return;
@ -49,7 +49,7 @@ void Content::EditTicketCheckFirstItem()
request.session->done_status = db.AddItem(item);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
log << log2 << "Content: added the first item with content for the ticket, item.id: " << item.id << logend;
request.ticket.item_id = item.id;
@ -61,7 +61,7 @@ void Content::EditTicketCheckFirstItem()
void Content::EditTicketModTicket()
{
if( request.session->done_status != Error::ok )
if( request.session->done_status != WINIX_ERR_OK )
return;
Ticket ticket;
@ -81,7 +81,7 @@ void Content::EditTicketModTicket()
void Content::EditTicketModDir()
{
if( request.session->done_status != Error::ok )
if( request.session->done_status != WINIX_ERR_OK )
return;
// we don't modify the url
@ -99,7 +99,7 @@ void Content::EditTicketModDir()
void Content::EditTicketModFirstItem()
{
if( request.session->done_status != Error::ok )
if( request.session->done_status != WINIX_ERR_OK )
return;
// modyfing the first item (the one with content)
@ -119,7 +119,7 @@ void Content::EditTicketModFirstItem()
void Content::PostFunEditTicketLogAndRedirect()
{
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
request.session->done = Done::edited_ticket;
@ -149,9 +149,9 @@ void Content::PostFunEditTicket()
return;
}
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) != Error::ok )
if( db.GetTicketByDirId(request.dir_table.back()->id, request.ticket) != WINIX_ERR_OK )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -24,14 +24,14 @@ bool Content::FunEmacsCheckAccess()
// adding a new item
if( !request.CanUseEmacs(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
}
else // editing an existing item
if( !request.CanUseEmacs(request.item) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -44,7 +44,7 @@ void Content::PostFunEmacsAdd()
request.session->done = Done::added_item;
request.session->done_status = db.AddItem(request.item);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
log << log2 << "Content: added a new item" << logend;
request.notify_code |= WINIX_NOTIFY_ITEM_ADD;
@ -59,7 +59,7 @@ void Content::PostFunEmacsEdit(bool with_url)
request.session->done = Done::edited_item;
request.session->done_status = db.EditItemById(request.item, with_url);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
TemplatesFunctions::pattern_cacher.UpdatePattern(request.item);
log << log2 << "Content: modified an item" << logend;
@ -73,9 +73,9 @@ bool Content::PostEmacsCheckAbuse(bool adding)
{
if( !CheckRebus() )
{
request.status = Error::incorrect_rebus;
request.status = WINIX_ERR_INCORRECT_REBUS;
request.session->done = (adding)? Done::added_item : Done::edited_item;
request.session->done_status = Error::incorrect_rebus;
request.session->done_status = WINIX_ERR_INCORRECT_REBUS;
return false;
}
@ -85,9 +85,9 @@ bool Content::PostEmacsCheckAbuse(bool adding)
if( request.session->spam_score > 0 )
{
request.status = Error::spam;
request.status = WINIX_ERR_SPAM;
request.session->done = (adding)? Done::added_item : Done::edited_item;
request.session->done_status = Error::spam;
request.session->done_status = WINIX_ERR_SPAM;
log << log1 << "Content: ignoring due to suspected spamming" << logend;
return false;
@ -128,7 +128,7 @@ void Content::PostFunEmacs()
bool adding = !request.is_item;
bool edit_with_url = ReadItem(request.item, Item::file);
request.session->done_status = Error::ok;
request.session->done_status = WINIX_ERR_OK;
if( !PostEmacsCheckAbuse(adding) )
return;
@ -146,7 +146,7 @@ void Content::PostFunEmacs()
}
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
PostFunEmacsModifyMountPoint(adding);
CheckSpecialFile();

@ -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

@ -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
@ -18,6 +18,26 @@
void Content::LoginUser(long user_id, bool remember_me)
{
request.session->puser = data.users.GetUser(user_id);
request.session->spam_score = 0;
if( !request.session->puser )
{
log << log1 << "Content: user id: " << user_id << " is not in data.users" << logend;
return;
}
request.session->remember_me = remember_me;
data.last.UserLogin(user_id, request.session->puser->name, inet_addr(request.env_remote_addr), request.session->id);
data.how_many_logged += 1;
log << log2 << "User " << request.session->puser->name << " (id: " << user_id << ") logged" << logend;
}
void Content::PostFunLogin()
{
@ -29,24 +49,7 @@ void Content::PostFunLogin()
long user_id;
if( login && pass && db.CheckUser(*login, *pass, user_id) )
{
request.session->puser = data.users.GetUser(user_id);
request.session->spam_score = 0;
if( !request.session->puser )
{
log << log1 << "Content: user: " << login << " is in the database but is not in data.users" << logend;
return;
}
if( remem )
request.session->remember_me = true;
data.last.UserLogin(user_id, *login, inet_addr(request.env_remote_addr), request.session->id);
data.how_many_logged += 1;
log << log2 << "User " << login << " (id: " << user_id << ") logged" << logend;
}
LoginUser(user_id, remem != 0);
// !! moze zglosic komunikat o nie poprawnym logowaniu
}

@ -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

@ -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

@ -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

@ -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

@ -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
@ -21,7 +21,7 @@ bool Content::FunMkdirCheckAccess()
{
if( request.is_item || !request.CanUseMkdir(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -34,7 +34,7 @@ void Content::Mkdir(Item & item, bool add_to_dir_table)
{
request.session->done_status = db.AddItem(item);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
Item * pdir = data.dirs.AddDir(item);
@ -56,7 +56,7 @@ void Content::PostFunMkdir(bool add_to_dir_table, int privileges)
Mkdir(request.item, add_to_dir_table);
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
request.notify_code |= WINIX_NOTIFY_DIR_ADD;
RedirectTo(request.item);

@ -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

@ -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
@ -27,7 +27,7 @@ bool Content::PrivCheckAccess()
if( !request.session->puser || (request.is_item && request.IsParam("r")) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}

@ -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
@ -22,7 +22,7 @@ void Content::FunReloadTemplates()
notify.ReadTemplates(); // make sure that ReadTemplates() is using some kind of locking
request.session->done = Done::reloaded_templates;
request.session->done_status = Error::ok;
request.session->done_status = WINIX_ERR_OK;
}
@ -35,7 +35,7 @@ void Content::FunReload()
if( !request.session->puser || !request.session->puser->super_user )
{
log << log1 << "Content: Only an admin has access to reload function" << logend;
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -21,14 +21,14 @@ bool Content::FunRmCheckAccess()
{
if( !request.CanRemove(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
}
else
if( !request.CanRemove(request.item) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -64,7 +64,7 @@ void Content::FunRmDirRecursive()
request.session->done = Done::deleted_dir;
request.session->done_status = Error::ok;
request.session->done_status = WINIX_ERR_OK;
request.session->done_timer = 2;
// redirect to the last valid directory
@ -75,7 +75,7 @@ void Content::FunRmDirRecursive()
void Content::FunRmDir()
{
if( request.param_table.empty() )
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
else
if( request.IsParam("confirm") )
return;
@ -83,7 +83,7 @@ void Content::FunRmDir()
if( request.IsParam("r") )
FunRmDirRecursive();
else
request.status = Error::unknown_param;
request.status = WINIX_ERR_UNKNOWN_PARAM;
}
@ -100,7 +100,7 @@ void Content::FunRm()
{
if( db.DelItem( request.item ) )
{
request.session->done_status = Error::ok;
request.session->done_status = WINIX_ERR_OK;
log << log2 << "Content: deleted item: subject: " << request.item.subject << ", id: " << request.item.id << logend;
TemplatesFunctions::pattern_cacher.DeletePattern(request.item);
@ -113,7 +113,7 @@ void Content::FunRm()
}
else
{
request.session->done_status = Error::no_item;
request.session->done_status = WINIX_ERR_NO_ITEM;
}
request.session->done = Done::deleted_item;
@ -125,7 +125,7 @@ void Content::FunRm()
{
if( !request.IsParam("confirm") )
//request.result = Request::err404;
request.status = Error::unknown_param;
request.status = WINIX_ERR_UNKNOWN_PARAM;
}
}

@ -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
@ -19,13 +19,13 @@ void Content::FunRun()
if( !request.is_item )
{
log << log1 << "Content: Run function requires an item" << logend;
request.status = Error::no_item;
request.status = WINIX_ERR_NO_ITEM;
return;
}
if( !request.HasReadExecAccess(request.item) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}
}

@ -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
@ -35,7 +35,7 @@ void Content::FunThread()
{
if( request.is_item )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -29,7 +29,7 @@ void Content::TicketDeleteFirst()
if( !request.HasReadAccess(request.item_table[i]) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
}
request.item_table.erase(request.item_table.begin() + i);
@ -46,7 +46,7 @@ void Content::FunTicket()
{
if( request.is_item || data.mounts.pmount->type != Mount::ticket )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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
@ -23,7 +23,7 @@ bool Content::FunUploadCheckAccess()
{
if( request.is_item || !request.CanUseUpload(*request.dir_table.back()) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -37,7 +37,7 @@ bool Content::UploadCreatePath(std::string & path)
{
if( !request.MakePath(path, true) )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return false;
}
@ -62,7 +62,7 @@ void Content::UploadSaveFile(const std::string & tmp_filename, const std::string
log.SystemErr(err);
log << logend;
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
}
}
@ -72,9 +72,9 @@ bool Content::FunUploadCheckAbuse()
{
if( !CheckRebus() )
{
request.status = Error::incorrect_rebus;
request.status = WINIX_ERR_INCORRECT_REBUS;
request.session->done = Done::added_thread;
request.session->done_status = Error::incorrect_rebus;
request.session->done_status = WINIX_ERR_INCORRECT_REBUS;
return false;
}
@ -83,9 +83,9 @@ bool Content::FunUploadCheckAbuse()
if( request.session->spam_score > 0 )
{
request.status = Error::spam;
request.status = WINIX_ERR_SPAM;
request.session->done = Done::added_thread;
request.session->done_status = Error::spam;
request.session->done_status = WINIX_ERR_SPAM;
log << log1 << "Content: ignoring due to suspected spamming" << logend;
return false;
@ -123,7 +123,7 @@ void Content::UploadMulti()
if( !UploadCreatePath(tmp_path) )
return;
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
UploadSaveFile(i->second.tmp_filename, tmp_path);
}
@ -156,7 +156,7 @@ void Content::UploadSingle()
PostFunEmacsAdd(); // always adding a new item
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
const std::string & tmp_filename = request.post_file_table.begin()->second.tmp_filename;
@ -167,7 +167,7 @@ void Content::UploadSingle()
}
if( request.session->done_status == Error::ok )
if( request.session->done_status == WINIX_ERR_OK )
{
if( !request.IsParam("ckeditor_upload") )
RedirectTo(request.item);
@ -184,7 +184,7 @@ void Content::PostFunUpload()
if( request.post_file_table.empty() )
{
request.status = Error::permission_denied;
request.status = WINIX_ERR_PERMISSION_DENIED;
return;
}

@ -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

@ -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

@ -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

@ -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

@ -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