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:
@@ -1,5 +1,14 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
adduser.o: templates.h patterncacher.h ../core/item.h misc.h localefilter.h
|
||||
adduser.o: ../core/locale.h ../confparser/confparser.h ckeditorgetparser.h
|
||||
adduser.o: ../core/httpsimpleparser.h ../core/log.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
|
||||
dir.o: templates.h patterncacher.h ../core/item.h misc.h localefilter.h
|
||||
dir.o: ../core/locale.h ../confparser/confparser.h ckeditorgetparser.h
|
||||
dir.o: ../core/httpsimpleparser.h ../core/log.h ../core/request.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
o = dir.o doc.o done.o item.o last.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o sys.o templates.o thread.o ticket.o upload.o uptime.o user.o who.o winix.o
|
||||
o = adduser.o dir.o doc.o done.o item.o last.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o sys.o templates.o thread.o ticket.o upload.o uptime.o user.o who.o winix.o
|
||||
|
||||
37
templates/adduser.cpp
Executable file
37
templates/adduser.cpp
Executable file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include "templates.h"
|
||||
#include "../core/request.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
void adduser_last_login(Info & i)
|
||||
{
|
||||
std::string * last_login = request.PostVar("login");
|
||||
|
||||
if( last_login )
|
||||
i.out << *last_login;
|
||||
}
|
||||
|
||||
|
||||
void adduser_last_email(Info & i)
|
||||
{
|
||||
std::string * last_email = request.PostVar("email");
|
||||
|
||||
if( last_email )
|
||||
i.out << *last_email;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -83,17 +83,6 @@ void doc_current_url(Info & i)
|
||||
|
||||
|
||||
|
||||
void doc_is_error(Info & i)
|
||||
{
|
||||
i.result = request.status != Error::ok;
|
||||
}
|
||||
|
||||
|
||||
void doc_status(Info & i)
|
||||
{
|
||||
i.out << static_cast<int>( request.status );
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
@@ -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 @@ namespace TemplatesFunctions
|
||||
|
||||
void done_is_error(Info & i)
|
||||
{
|
||||
i.result = request.session->done_status != Error::ok;
|
||||
i.result = request.session->done_status != WINIX_ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,24 +32,15 @@ void done_status(Info & i)
|
||||
|
||||
void done_status_no_item(Info & i)
|
||||
{
|
||||
i.result = request.session->done_status == Error::no_item;
|
||||
i.result = request.session->done_status == WINIX_ERR_NO_ITEM;
|
||||
}
|
||||
|
||||
|
||||
void done_status_incorrect_dir(Info & i)
|
||||
{
|
||||
i.result = request.session->done_status == Error::incorrect_dir;
|
||||
i.result = request.session->done_status == WINIX_ERR_INCORRECT_DIR;
|
||||
}
|
||||
|
||||
void done_status_incorrect_rebus(Info & i)
|
||||
{
|
||||
i.result = request.session->done_status == Error::incorrect_rebus;
|
||||
}
|
||||
|
||||
void done_status_spam(Info & i)
|
||||
{
|
||||
i.result = request.session->done_status == Error::spam;
|
||||
}
|
||||
|
||||
void done_added_item(Info & i)
|
||||
{
|
||||
|
||||
@@ -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) 2010, 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) 2010, 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -65,10 +65,9 @@ Ezc::Pattern * p = 0;
|
||||
{FUN_UPTIME, pat_fun_uptime},
|
||||
{FUN_LOGIN, pat_fun_login},
|
||||
/* {FUN_MV, pat_fun_mv},
|
||||
{FUN_UNAME, pat_fun_uname},
|
||||
{FUN_CHMOD, pat_fun_chmod},
|
||||
{FUN_CHOWN, pat_fun_chown}, */
|
||||
{FUN_CKEDITOR, pat_fun_ckeditor}
|
||||
{FUN_UNAME, pat_fun_uname},*/
|
||||
{FUN_CKEDITOR, pat_fun_ckeditor},
|
||||
{FUN_ADDUSER, pat_fun_adduser}
|
||||
};
|
||||
|
||||
size_t i, len = sizeof(pat_name_tab)/sizeof(PatName);
|
||||
@@ -101,35 +100,36 @@ Ezc::Pattern * p = 0;
|
||||
|
||||
switch( request.status )
|
||||
{
|
||||
case Error::ok:
|
||||
case Error::spam:
|
||||
case Error::incorrect_rebus:
|
||||
p = content_for_function();
|
||||
break;
|
||||
|
||||
//case Error::no_item: !! we need something like 'error::item_required'
|
||||
//case WINIX_ERR_NO_ITEM: !! we need something like 'error::item_required'
|
||||
//p = &pat_err_item_required;
|
||||
//break;
|
||||
|
||||
case Error::permission_denied:
|
||||
case Error::cant_change_user:
|
||||
case Error::cant_change_group:
|
||||
case Error::cant_change_privileges:
|
||||
case WINIX_ERR_PERMISSION_DENIED:
|
||||
case WINIX_ERR_CANT_CHANGE_USER:
|
||||
case WINIX_ERR_CANT_CHANGE_GROUP:
|
||||
case WINIX_ERR_CANT_CHANGE_PRIVILEGES:
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_per_denied];
|
||||
break;
|
||||
|
||||
case Error::no_item:
|
||||
case Error::no_function:
|
||||
case Error::unknown_param:
|
||||
case WINIX_ERR_NO_ITEM:
|
||||
case WINIX_ERR_NO_FUNCTION:
|
||||
case WINIX_ERR_UNKNOWN_PARAM:
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_404];
|
||||
break;
|
||||
|
||||
default:
|
||||
//default:
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_others];
|
||||
break;
|
||||
//p = &patterns[locale.GetLang()][pat_err_others];
|
||||
//break;
|
||||
|
||||
//case WINIX_ERR_OK:
|
||||
//case WINIX_ERR_SPAM:
|
||||
//case WINIX_ERR_INCORRECT_REBUS:
|
||||
default:
|
||||
p = content_for_function();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,13 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("sys_ver_revision", sys_ver_revision);
|
||||
|
||||
|
||||
/*
|
||||
adduser
|
||||
*/
|
||||
functions.Insert("adduser_last_login", adduser_last_login);
|
||||
functions.Insert("adduser_last_email", adduser_last_email);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
@@ -177,8 +184,6 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("doc_base_url_static", doc_base_url_static);
|
||||
functions.Insert("doc_base_url_common", doc_base_url_common);
|
||||
functions.Insert("doc_current_url", doc_current_url);
|
||||
functions.Insert("doc_is_error", doc_is_error);
|
||||
functions.Insert("doc_status", doc_status);
|
||||
|
||||
|
||||
/*
|
||||
@@ -325,8 +330,6 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("done_status", done_status);
|
||||
functions.Insert("done_status_no_item", done_status_no_item);
|
||||
functions.Insert("done_status_incorrect_dir", done_status_incorrect_dir);
|
||||
functions.Insert("done_status_incorrect_rebus", done_status_incorrect_rebus);
|
||||
functions.Insert("done_status_spam", done_status_spam);
|
||||
functions.Insert("done_added_item", done_added_item);
|
||||
functions.Insert("done_edited_item", done_edited_item);
|
||||
functions.Insert("done_deleted_item", done_deleted_item);
|
||||
@@ -481,7 +484,10 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("winix_req_per_sec_1", winix_req_per_sec_1);
|
||||
functions.Insert("winix_req_per_sec_5", winix_req_per_sec_5);
|
||||
functions.Insert("winix_req_per_sec_15", winix_req_per_sec_15);
|
||||
|
||||
functions.Insert("winix_err_is", winix_err_is);
|
||||
functions.Insert("winix_err_code", winix_err_code);
|
||||
functions.Insert("winix_is_err_in_locales", winix_is_err_in_locales);
|
||||
functions.Insert("winix_err_msg_from_locales",winix_err_msg_from_locales);
|
||||
|
||||
|
||||
plugin.Call(WINIX_TEMPLATES_CREATEFUNCTIONS, &functions);
|
||||
@@ -523,7 +529,6 @@ using namespace TemplatesFunctions;
|
||||
ReadFile(pat_fun_mkdir, "fun_mkdir.html");
|
||||
ReadFile(pat_fun_default, "fun_default.html");
|
||||
ReadFile(pat_fun_priv, "fun_priv.html");
|
||||
ReadFile(pat_err_others, "err_others.html");
|
||||
ReadFile(pat_fun_who, "fun_who.html");
|
||||
ReadFile(pat_fun_run, "fun_run.html");
|
||||
ReadFile(pat_fun_last, "fun_last.html");
|
||||
@@ -539,10 +544,9 @@ using namespace TemplatesFunctions;
|
||||
ReadFile(pat_fun_uptime, "fun_uptime.html");
|
||||
ReadFile(pat_fun_login, "fun_login.html");
|
||||
/*ReadFile(pat_fun_mv, "fun_mv.html");
|
||||
ReadFile(pat_fun_uname, "fun_uname.html");
|
||||
ReadFile(pat_fun_chmod, "fun_chmod.html");
|
||||
ReadFile(pat_fun_chown, "fun_chown.html"); */
|
||||
ReadFile(pat_fun_uname, "fun_uname.html");*/
|
||||
ReadFile(pat_fun_ckeditor, "fun_ckeditor.html");
|
||||
ReadFile(pat_fun_adduser, "fun_adduser.html");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -44,13 +44,11 @@ namespace TemplatesFunctions
|
||||
pat_fun_login,
|
||||
pat_fun_mv,
|
||||
pat_fun_uname,
|
||||
pat_fun_chmod,
|
||||
pat_fun_chown,
|
||||
pat_fun_createticket,
|
||||
pat_fun_ckeditor,
|
||||
pat_fun_adduser,
|
||||
pat_err_404,
|
||||
pat_err_per_denied,
|
||||
pat_err_others,
|
||||
pat_item_info,
|
||||
pat_item_tab_info,
|
||||
pat_dir_last_info,
|
||||
@@ -81,6 +79,13 @@ namespace TemplatesFunctions
|
||||
void sys_ver_revision(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
adduser
|
||||
*/
|
||||
void adduser_last_login(Info & i);
|
||||
void adduser_last_email(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
@@ -90,8 +95,6 @@ namespace TemplatesFunctions
|
||||
void doc_base_url_static(Info & i);
|
||||
void doc_base_url_common(Info & i);
|
||||
void doc_current_url(Info & i);
|
||||
void doc_is_error(Info & i);
|
||||
void doc_status(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
@@ -236,8 +239,6 @@ namespace TemplatesFunctions
|
||||
void done_status(Info & i);
|
||||
void done_status_no_item(Info & i);
|
||||
void done_status_incorrect_dir(Info & i);
|
||||
void done_status_incorrect_rebus(Info & i);
|
||||
void done_status_spam(Info & i);
|
||||
|
||||
void done_added_item(Info & i);
|
||||
void done_edited_item(Info & i);
|
||||
@@ -388,6 +389,10 @@ namespace TemplatesFunctions
|
||||
void winix_req_per_sec_1(Info & i);
|
||||
void winix_req_per_sec_5(Info & i);
|
||||
void winix_req_per_sec_15(Info & i);
|
||||
void winix_err_is(Info & i);
|
||||
void winix_err_code(Info & i);
|
||||
void winix_is_err_in_locales(Info & i);
|
||||
void winix_err_msg_from_locales(Info & i);
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
@@ -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-2010, 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
|
||||
|
||||
@@ -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-2010, Tomasz Sowa
|
||||
@@ -134,5 +134,48 @@ char buf[20];
|
||||
}
|
||||
|
||||
|
||||
void winix_err_is(Info & i)
|
||||
{
|
||||
if( !i.is )
|
||||
return;
|
||||
|
||||
int value = atoi( i.is->c_str() );
|
||||
i.result = request.status == value;
|
||||
}
|
||||
|
||||
|
||||
void winix_err_code(Info & i)
|
||||
{
|
||||
i.out << request.status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static std::string winix_error_key;
|
||||
|
||||
|
||||
void winix_is_err_in_locales(Info & i)
|
||||
{
|
||||
char buff[40];
|
||||
|
||||
sprintf(buff, "winix_err_%d", request.status);
|
||||
winix_error_key = buff;
|
||||
|
||||
i.result = locale.IsKey(winix_error_key);
|
||||
}
|
||||
|
||||
|
||||
void winix_err_msg_from_locales(Info & i)
|
||||
{
|
||||
char buff[40];
|
||||
|
||||
sprintf(buff, "winix_err_%d", request.status);
|
||||
winix_error_key = buff;
|
||||
|
||||
i.out << locale.Get(winix_error_key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user