From 1d18b7fa128c5b209bebd448220727641743bf64 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sun, 27 Jun 2021 23:31:50 +0200 Subject: [PATCH] - updated to the new pikotools api (child spaces were removed) some plugins need to be fixed yet: ticket, gallery, group, menu - added current user to default models as "user" - renamed in User: super_user -> is_super_user, env -> admin_env, pass_hash_salted -> is_pass_hash_salted - now Users class has a WinixModel as a base class some plugin calls have to be fixed yet - added UserWrapper model with a pointer to User class - removed from ItemContent: methods for accessing 'meta' and 'admin_meta', now ezc can iterate through Space classes - fixed in env winix function: if there is "changeuser" parameter then we should only switch the user (not save anything) --- winixd/core/app.cpp | 5 + winixd/core/crypt.cpp | 4 +- winixd/core/groups.cpp | 2 +- winixd/core/sessionmanager.cpp | 2 +- winixd/core/sessionparser.cpp | 2 +- winixd/core/system.cpp | 18 +- winixd/core/timezone.cpp | 19 +- winixd/core/timezones.cpp | 8 +- winixd/core/ugcontainer.h | 34 +- winixd/core/users.cpp | 153 ++- winixd/core/users.h | 21 +- winixd/etc/time_zones.conf | 1295 +++++++++++++-------- winixd/functions/account.cpp | 6 +- winixd/functions/adduser.cpp | 16 +- winixd/functions/emacs.cpp | 2 +- winixd/functions/env.cpp | 99 +- winixd/functions/env.h | 8 +- winixd/functions/functions.cpp | 2 +- winixd/functions/ipban.cpp | 2 +- winixd/functions/login.cpp | 2 +- winixd/functions/meta.cpp | 4 +- winixd/functions/mkdir.cpp | 2 +- winixd/functions/mount.cpp | 2 +- winixd/functions/passwd.cpp | 12 +- winixd/functions/privchanger.cpp | 2 +- winixd/functions/reload.cpp | 4 +- winixd/functions/rmuser.cpp | 6 +- winixd/functions/subject.cpp | 2 +- winixd/functions/template.cpp | 2 +- winixd/functions/upload.cpp | 2 +- winixd/locale/en | 2 + winixd/locale/pl | 2 + winixd/main/main.cpp | 1 + winixd/models/item.cpp | 2 +- winixd/models/itemcontent.cpp | 138 +-- winixd/models/itemcontent.h | 14 +- winixd/models/user.cpp | 72 +- winixd/models/user.h | 21 +- winixd/models/userwrapper.h | 88 ++ winixd/notify/notifythread.cpp | 2 +- winixd/plugins/export/exportinfo.cpp | 19 +- winixd/plugins/mailregister/templates.cpp | 1 - winixd/plugins/seo/seo.cpp | 4 +- winixd/plugins/thread/reply.cpp | 2 +- winixd/plugins/ticket/editticket.cpp | 6 +- winixd/plugins/ticket/sessiondata.cpp | 8 +- winixd/plugins/ticket/ticketinfo.cpp | 37 +- winixd/templates/currentdate.cpp | 1 - winixd/templates/dir.cpp | 111 +- winixd/templates/env.cpp | 297 ----- winixd/templates/item.cpp | 1 - winixd/templates/locale.cpp | 2 +- winixd/templates/miscspace.cpp | 239 ---- winixd/templates/miscspace.h | 94 -- winixd/templates/priv.cpp | 6 +- winixd/templates/templates.cpp | 54 +- winixd/templates/templates.h | 54 +- winixd/templates/user.cpp | 8 +- winixd/templates/who.cpp | 2 +- 59 files changed, 1419 insertions(+), 1607 deletions(-) create mode 100644 winixd/models/userwrapper.h delete mode 100644 winixd/templates/env.cpp delete mode 100644 winixd/templates/miscspace.cpp delete mode 100644 winixd/templates/miscspace.h diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index 83c103b..d5fa67b 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -881,6 +881,11 @@ void App::AddDefaultModels() { cur.request->models.Add(L"request", cur.request); + if( cur.session && cur.session->puser ) + { + cur.request->models.Add(L"user", *cur.session->puser); + } + if( cur.request->is_item ) { cur.request->models.Add(L"item", cur.request->item); diff --git a/winixd/core/crypt.cpp b/winixd/core/crypt.cpp index 47448b3..d5c8037 100644 --- a/winixd/core/crypt.cpp +++ b/winixd/core/crypt.cpp @@ -270,7 +270,7 @@ bool Crypt::RSA(bool encrypt, const std::wstring & keypath, const std::string & bool Crypt::PassHash(const std::wstring & salt, User & user) { bool result = true; - user.pass_hash_salted = false; + user.is_pass_hash_salted = false; if( user.pass_type != WINIX_CRYPT_HASH_NONE ) { @@ -281,7 +281,7 @@ bool Crypt::PassHash(const std::wstring & salt, User & user) if( HashHex(user.pass_type, pass_salted, user.password) ) { if( !salt.empty() ) - user.pass_hash_salted = true; + user.is_pass_hash_salted = true; } else { diff --git a/winixd/core/groups.cpp b/winixd/core/groups.cpp index 0e0a6d2..93e260b 100644 --- a/winixd/core/groups.cpp +++ b/winixd/core/groups.cpp @@ -71,7 +71,7 @@ void Groups::ReadGroups(Db * db) for(Group & group : groups_tmp) { - table.PushBack(group); + table.PushBack(group, group.name); } } diff --git a/winixd/core/sessionmanager.cpp b/winixd/core/sessionmanager.cpp index aebc969..70a0d15 100644 --- a/winixd/core/sessionmanager.cpp +++ b/winixd/core/sessionmanager.cpp @@ -241,7 +241,7 @@ void SessionManager::SetSessionPutLogInfo(Session & ses, bool has_index, unsigne main_log << ", index difference: " << (size_t)difference; if( ses.puser ) - main_log << log2 << ", user: " << ses.puser->name << ", id: " << ses.puser->id; + main_log << log2 << ", user: " << ses.puser->login << ", id: " << ses.puser->id; main_log << log2 << logend; } diff --git a/winixd/core/sessionparser.cpp b/winixd/core/sessionparser.cpp index 6044a56..49e27e9 100644 --- a/winixd/core/sessionparser.cpp +++ b/winixd/core/sessionparser.cpp @@ -135,7 +135,7 @@ void SessionParser::MakeSession(long id, long user_id, SessionContainer & contai // !! IMPROVE ME we do not save last_time_get users->IncrementLoggedUsers(); - log << log2 << "SP: read session id: " << id << " for user: " << puser->name << logend; + log << log2 << "SP: read session id: " << id << " for user: " << puser->login << logend; } else { diff --git a/winixd/core/system.cpp b/winixd/core/system.cpp index e1abb67..151672f 100644 --- a/winixd/core/system.cpp +++ b/winixd/core/system.cpp @@ -87,7 +87,8 @@ void System::set_dependency(WinixModelDeprecated * winix_model) dirs.set_dependency(this); mounts.set_dependency(this); - users.set_dependency(this); + //users.set_dependency(this); + users.set_connector(model_connector); groups.set_dependency(this); rebus.set_dependency(this); load_avg.set_dependency(this); @@ -140,8 +141,9 @@ void System::Init() mounts.CreateMounts(); mounts.ReadMounts(); - users.SetCur(cur); - users.SetSessionManager(session_manager); +// users.SetCur(cur); +// users.SetSessionManager(session_manager); + users.set_connector(model_connector); users.ReadUsers(db); groups.ReadGroups(db); // !! chwilowe przekazanie argumentu, db bedzie zmienione @@ -533,7 +535,7 @@ bool System::CanChangeUser(const Item & item, long new_user_id) // session must be set return false; - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user is allowed everything return true; @@ -553,7 +555,7 @@ bool System::CanChangeGroup(const Item & item, long new_group_id) // session must be set return false; - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user is allowed everything return true; @@ -587,7 +589,7 @@ bool System::CanChangePrivileges(const Item & item, int new_priv) // session must be set return false; - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user is allowed everything return true; @@ -751,7 +753,7 @@ bool System::CanRemoveRenameChild(const Item & dir, long child_item_user_id) if( cur->session->puser ) { - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) return true; if( dir.item_content.user_id != -1 && cur->session->puser->id != -1 && child_item_user_id != -1 ) @@ -811,7 +813,7 @@ bool System::IsSuperUser(long user_id) if( !puser ) return false; -return puser->super_user; +return puser->is_super_user; } diff --git a/winixd/core/timezone.cpp b/winixd/core/timezone.cpp index 7345e03..74253aa 100644 --- a/winixd/core/timezone.cpp +++ b/winixd/core/timezone.cpp @@ -258,7 +258,7 @@ bool TimeZone::SetTzDst(pt::Space & year) Dst dst; int year_int = 0; - std::wstring * year_name = year.find_child_space_name(); + std::wstring * year_name = year.get_wstr(L"year"); if( year_name ) year_int = Toi(*year_name); @@ -297,7 +297,7 @@ bool TimeZone::SetTz(pt::Space & space) bool result = true; name.clear(); - std::wstring * space_name = space.find_child_space_name(); + std::wstring * space_name = space.get_wstr(L"name"); if( space_name ) name = *space_name; @@ -309,21 +309,16 @@ bool TimeZone::SetTz(pt::Space & space) if( offset < -h24 || offset > h24 ) result = false; - pt::Space * dst = space.find_child_space(L"dst"); + pt::Space::TableType * dst = space.get_table(L"dst"); if( dst ) { - pt::Space::TableType * child_table = dst->find_child_space_table(); - - if( child_table ) + for(pt::Space * dst_space : *dst) { - for(pt::Space * year : *child_table) + if( !SetTzDst(*dst_space) ) { - if( !SetTzDst(*year) ) - { - result = false; - break; - } + result = false; + break; } } } diff --git a/winixd/core/timezones.cpp b/winixd/core/timezones.cpp index bfb50ec..d35b112 100644 --- a/winixd/core/timezones.cpp +++ b/winixd/core/timezones.cpp @@ -123,11 +123,11 @@ bool TimeZones::Empty() const void TimeZones::ParseZones() { - pt::Space::TableType * child_table = temp_space.find_child_space_table(); + pt::Space::TableType * timezones_table = temp_space.get_table(L"timezones"); - if( child_table ) + if( timezones_table ) { - for(pt::Space * zone : *child_table) + for(pt::Space * zone : *timezones_table) { temp_zone.Clear(); @@ -155,7 +155,7 @@ void TimeZones::ParseZones() else { log << log1 << "System: problem with reading time zone info from time zone: " - << zone->get_child_space_name() << " (skipping) " << logend; + << zone->to_wstr(L"name") << " (skipping) " << logend; } } } diff --git a/winixd/core/ugcontainer.h b/winixd/core/ugcontainer.h index a000942..c2ea85a 100644 --- a/winixd/core/ugcontainer.h +++ b/winixd/core/ugcontainer.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2014, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,7 +65,7 @@ public: Iterator End(); SizeType Size(); bool Empty(); - Iterator PushBack(const Type & type); // can return End() if the user already exists + Iterator PushBack(const Type & type, const std::wstring & name); // can return End() if the user already exists void Clear(); bool Is(long id); @@ -78,17 +78,20 @@ public: + + // main table + Table table; + + private: // don't copy these objects UGContainer(const UGContainer &); UGContainer & operator=(const UGContainer &); - void AddIndexes(Iterator iter); + void AddIndexes(Iterator iter, const std::wstring & name); void RebuildIndexes(); - // main table - Table table; // table.size() has O(n) complexity size_t table_size; @@ -163,16 +166,16 @@ bool UGContainer::Empty() template -typename UGContainer::Iterator UGContainer::PushBack(const Type & type) +typename UGContainer::Iterator UGContainer::PushBack(const Type & type, const std::wstring & name) { - if( Is(type.id) || Is(type.name) ) + if( Is(type.id) || Is(name) ) return End(); table.push_back(type); table_size += 1; Iterator i = --table.end(); - log << log3 << "UGCont: added, id: " << type.id << ", name: " << type.name << logend; - AddIndexes(i); + log << log3 << "UGCont: added, id: " << type.id << ", name: " << name << logend; + AddIndexes(i, name); return i; } @@ -242,12 +245,12 @@ return i->second; template -void UGContainer::AddIndexes(UGContainer::Iterator iter) +void UGContainer::AddIndexes(UGContainer::Iterator iter, const std::wstring & name) { table_id.insert( std::make_pair(iter->id, iter) ); - table_name.insert( std::make_pair(iter->name, iter) ); + table_name.insert( std::make_pair(name, iter) ); - log << log4 << "UGCont: added indexes to: id: " << iter->id << ", name: " << iter->name << logend; + log << log4 << "UGCont: added indexes to: id: " << iter->id << ", name: " << name << logend; } @@ -286,14 +289,15 @@ bool UGContainer::Remove(long id) { if( n->second == i->second ) { + + log << log4 << "UGCont: removed index_name to: id: " << i->second->id << ", name: " << n->first << logend; table_name.erase(n); - log << log4 << "UGCont: removed index_id to: id: " << i->second->id << ", name: " << i->second->name << logend; break; } } - log << log4 << "UGCont: removed index_name to: id: " << i->second->id << ", name: " << i->second->name << logend; - log << log3 << "UGCont: removed: id: " << i->second->id << ", name: " << i->second->name << logend; + log << log4 << "UGCont: removed index_id to: id: " << i->second->id << logend; + log << log3 << "UGCont: removed: id: " << i->second->id << logend; table.erase(i->second); table_id.erase(i); result = true; diff --git a/winixd/core/users.cpp b/winixd/core/users.cpp index 724b25b..e78992a 100644 --- a/winixd/core/users.cpp +++ b/winixd/core/users.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +35,7 @@ #include #include "users.h" #include "sessionmanager.h" +#include "slog.h" namespace Winix @@ -45,29 +46,38 @@ namespace Winix Users::Users() { how_many_logged = 0; // !! CHECK ME may it should be moved to Clear() method? - table.set_dependency(this); +// table.set_dependency(this); Clear(); } -void Users::set_dependency(WinixModelDeprecated * winix_model) + +void Users::fields() { - WinixModelDeprecated::set_dependency(winix_model); - table.set_dependency(winix_model); - last.set_dependency(winix_model); + field(L"users", table.table); } -void Users::SetCur(Cur * pcur) -{ - cur = pcur; -} -void Users::SetSessionManager(SessionManager * sm) -{ - session_manager = sm; -} +//void Users::set_dependency(WinixModelDeprecated * winix_model) +//{ +// WinixModelDeprecated::set_dependency(winix_model); +// table.set_dependency(winix_model); +// last.set_dependency(winix_model); +//} + + +//void Users::SetCur(Cur * pcur) +//{ +// cur = pcur; +//} + + +//void Users::SetSessionManager(SessionManager * sm) +//{ +// session_manager = sm; +//} void Users::Clear() @@ -89,7 +99,7 @@ void Users::ReadUsers(Db * db) for(User & user : users_tmp) { - table.PushBack(user); + table.PushBack(user, user.login); } } @@ -98,7 +108,7 @@ void Users::ReadUsers(Db * db) bool Users::AddUser(const User & user) { - Table::Iterator i = table.PushBack(user); + Table::Iterator i = table.PushBack(user, user.login); return (i != table.End()); } @@ -173,11 +183,11 @@ bool Users::Remove(long user_id) if( puser ) { LogoutUser(user_id); - plugin->Call(WINIX_PREPARE_TO_REMOVE_USER, puser); + // plugin->Call(WINIX_PREPARE_TO_REMOVE_USER, puser); FIXME result = table.Remove(user_id); - if( result ) - plugin->Call(WINIX_USER_REMOVED, user_id); +// if( result ) +// plugin->Call(WINIX_USER_REMOVED, user_id); FIXME } return result; @@ -187,15 +197,20 @@ return result; // private bool Users::LoginUserCheckSession(bool use_ses_log) { - if( !cur->session ) + Session * session = get_session(); + Log * log = get_logger(); + SLog * slog = get_session_logger(); + + if( !session ) return false; - if( cur->session->id == 0 ) + if( session->id == 0 ) { - log << log1 << "Users: I cannot login a user on a temporary session" << logend; + if( log ) + (*log) << log1 << "Users: I cannot login a user on a temporary session" << logend; -// if( use_ses_log ) -// slog << logerror << T(L"service_unavailable") << logend; + if( slog && use_ses_log ) + (*slog) << logerror << T(L"service_unavailable") << logend; return false; } @@ -208,34 +223,35 @@ return true; User * Users::LoginUserCheckStatus(long user_id, bool use_ses_log) { User * puser = GetUser(user_id); + Log * log = get_logger(); + SLog * slog = get_session_logger(); if( !puser ) { - log << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend; + if( log ) + (*log) << log1 << "Users: user id: " << user_id << " is not in system.users table" << logend; -// if( use_ses_log ) -// slog << logerror << T(L"service_unavailable") << logend; + if( slog && use_ses_log ) + (*slog) << logerror << T(L"service_unavailable") << logend; return 0; } if( puser->status != WINIX_ACCOUNT_READY ) { - log << log1 << "Users: user id: " << user_id << " is not ready for logging in (status: " + (*log) << log1 << "Users: user id: " << user_id << " is not ready for logging in (status: " << puser->status << ")" << logend; - if( use_ses_log ) + if( slog && use_ses_log ) { - /* if( puser->status == WINIX_ACCOUNT_NOT_ACTIVATED ) - slog << logerror << T(L"account_not_activated") << logend; + (*slog) << logerror << T(L"account_not_activated") << logend; else if( puser->status == WINIX_ACCOUNT_SUSPENDED ) - slog << logerror << T(L"account_suspended") << logend; + (*slog) << logerror << T(L"account_suspended") << logend; else if( puser->status == WINIX_ACCOUNT_BLOCKED ) - slog << logerror << T(L"account_banned") << logend; - */ + (*slog) << logerror << T(L"account_banned") << logend; } return 0; @@ -252,34 +268,43 @@ bool Users::LoginUser(long user_id, bool remember_me, bool use_ses_log) return false; User * puser = LoginUserCheckStatus(user_id, use_ses_log); + Log * log = get_logger(); + Session * session = get_session(); + SessionManager * session_manager = get_session_manager(); + Request * request = get_request(); - if( !puser ) + if( !puser || !session || !session_manager || !request ) return false; - PluginRes res = plugin->Call(WINIX_PREPARE_USER_TO_LOGIN, puser); + PluginRes res; + //PluginRes res = plugin->Call(WINIX_PREPARE_USER_TO_LOGIN, puser); FIXME if( res.res_false > 0 ) { - log << log3 << "Users: login prevented by a plugin" << logend; + if( log ) + (*log) << log3 << "Users: login prevented by a plugin" << logend; + return false; } - if( cur->session->puser ) + if( session->puser ) LogoutCurrentUser(); - cur->session->puser = puser; - cur->session->spam_score = 0; - cur->session->remember_me = remember_me; + session->puser = puser; + session->spam_score = 0; + session->remember_me = remember_me; // change session id before last.UserLogin() - if( !cur->session->new_session ) - session_manager->ChangeSessionId(cur->session->id); + if( !session->new_session ) + session_manager->ChangeSessionId(session->id); - last.UserLogin(user_id, cur->session->puser->name, cur->request->ip, cur->session->id); + last.UserLogin(user_id, session->puser->login, request->ip, session->id); how_many_logged += 1; - log << log2 << "Users: user " << cur->session->puser->name << " (id: " << user_id << ") logged" << logend; - plugin->Call(WINIX_USER_LOGGED); + if( log ) + (*log) << log2 << "Users: user " << session->puser->login << " (id: " << user_id << ") logged" << logend; + + //plugin->Call(WINIX_USER_LOGGED); FIXME return true; } @@ -289,18 +314,26 @@ size_t Users::LogoutUser(long user_id) { size_t how_many = 0; User * puser = GetUser(user_id); + Log * log = get_logger(); + SessionManager * session_manager = get_session_manager(); - if( puser ) + if( puser && session_manager ) { - log << log2 << "Users: logging out user " << puser->name << ", id: " - << puser->id << " from all sessions" << logend; + if( log ) + { + (*log) << log2 << "Users: logging out user " << puser->login << ", id: " + << puser->id << " from all sessions" << logend; + } // WINIX_PREPARE_USER_TO_LOGOUT will be sent by MarkAllSessionsToRemove() how_many = session_manager->MarkAllSessionsToRemove(user_id); how_many_logged -= how_many; if( how_many ) - log << log3 << "Users: " << how_many << " user(s) were logged out" << logend; + { + if( log ) + (*log) << log3 << "Users: " << how_many << " user(s) were logged out" << logend; + } } return how_many; @@ -310,20 +343,26 @@ return how_many; void Users::LogoutCurrentUser() { - if( !cur->session || !cur->session->puser ) + Log * log = get_logger(); + Session * session = get_session(); + + if( !session || !session->puser ) return; - log << log2 << "Users: user " << cur->session->puser->name << ", id: " - << cur->session->puser->id << " logged out" << logend; + if( log ) + { + (*log) << log2 << "Users: user " << session->puser->login << ", id: " + << session->puser->id << " logged out" << logend; + } - plugin->Call(WINIX_PREPARE_USER_TO_LOGOUT, cur->session->puser); - last.UserLogout(cur->session->puser->id, cur->session->id); + //plugin->Call(WINIX_PREPARE_USER_TO_LOGOUT, cur->session->puser); // FIXME + last.UserLogout(session->puser->id, session->id); if( how_many_logged > 0 ) // for safety how_many_logged -= 1; - cur->session->puser = 0; - cur->session->remember_me = false; + session->puser = 0; + session->remember_me = false; } diff --git a/winixd/core/users.h b/winixd/core/users.h index 25aee56..083c6fd 100644 --- a/winixd/core/users.h +++ b/winixd/core/users.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ #include "lastcontainer.h" #include "cur.h" #include "db/db.h" -#include "winixmodeldeprecated.h" +#include "models/winixmodel.h" @@ -53,13 +53,13 @@ namespace Winix class SessionManager; -class Users : public WinixModelDeprecated +class Users : public WinixModel { typedef UGContainer Table; public: - void set_dependency(WinixModelDeprecated * winix_model); + //void set_dependency(WinixModelDeprecated * winix_model); typedef Table::Iterator Iterator; @@ -69,8 +69,8 @@ public: Users(); - void SetCur(Cur * pcur); - void SetSessionManager(SessionManager * sm); +// void SetCur(Cur * pcur); +// void SetSessionManager(SessionManager * sm); void Clear(); void ReadUsers(Db * db); @@ -91,12 +91,17 @@ public: void IncrementLoggedUsers(); long HowManyLogged(); +protected: + + void fields(); + + private: Table table; - Cur * cur; - SessionManager * session_manager; + //Cur * cur; + //SessionManager * session_manager; long how_many_logged; bool LoginUserCheckSession(bool use_ses_log); diff --git a/winixd/etc/time_zones.conf b/winixd/etc/time_zones.conf index 362d3d8..8b1eba8 100644 --- a/winixd/etc/time_zones.conf +++ b/winixd/etc/time_zones.conf @@ -1,691 +1,812 @@ -"tz_-12:00" { # the name of a space is also a key to the locale files -id = "0" # an integer identyfier of a time zone {each time zone has a different id} -offset_str = "-12:00" # a string representing the offset from UTC in a format: [+|-]HH:MM +timezones = ( + + +# first timezone +{ +name = "tz_-12:00" # the name of a timezone is also a key to the locale files +id = "0" # an integer identifier of a time zone {each time zone has a different id} +offset_str = "-12:00" # a string representing the offset from UTC in a format: (+|-)HH:MM # insted of "offset_str" there can be "offset" used # e.g. offset = "3600" where 3600 is an offset in seconds -dst { +dst = ( -2012 { # daylight saving time in a specified year -has_dst = false # whether the time zone has daylight saving time {bool} in this year +{ +year = "2012" # daylight saving time in a specified year +has_dst = false # whether the time zone has daylight saving time {bool} in this year offset_str = "00:00" # offset of the daylight saving time start = "" # when the daylight saving time starts, format: MM:DD HH:MM:SS -end = ""} # when the daylight saving time ends, format: MM:DD HH:MM:SS - -} # end of dst +end = "" # when the daylight saving time ends, format: MM:DD HH:MM:SS } +) # end of dst +} # end of first timezone -"tz_-11:00" { + +{ +name = "tz_-11:00" id = "1" offset_str = "-11:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-10:00" { +{ +name = "tz_-10:00" id = "2" offset_str = "-10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-09:00" { +{ +name = "tz_-09:00" id = "3" offset_str = "-09:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-08:00" { +{ +name = "tz_-08:00" id = "4" offset_str = "-08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-08:00b" { +{ +name = "tz_-08:00b" id = "5" offset_str = "-08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-07:00" { +{ +name = "tz_-07:00" id = "6" offset_str = "-07:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-07:00b" { +{ +name = "tz_-07:00b" id = "7" offset_str = "-07:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-07:00c" { +{ +name = "tz_-07:00c" id = "8" offset_str = "-07:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-06:00" { +{ +name = "tz_-06:00" id = "9" offset_str = "-06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-06:00b" { +{ +name = "tz_-06:00b" id = "10" offset_str = "-06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-06:00c" { +{ +name = "tz_-06:00c" id = "11" offset_str = "-06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-06:00d" { +{ +name = "tz_-06:00d" id = "12" offset_str = "-06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-05:00" { +{ +name = "tz_-05:00" id = "13" offset_str = "-05:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-05:00b" { +{ +name = "tz_-05:00b" id = "14" offset_str = "-05:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-05:00c" { +{ +name = "tz_-05:00c" id = "15" offset_str = "-05:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:30" { +{ +name = "tz_-04:30" id = "16" offset_str = "-04:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:00" { +{ +name = "tz_-04:00" id = "17" offset_str = "-04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:00b" { +{ +name = "tz_-04:00b" id = "18" offset_str = "-04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:00c" { +{ +name = "tz_-04:00c" id = "19" offset_str = "-04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:00d" { +{ +name = "tz_-04:00d" id = "20" offset_str = "-04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-04:00e" { +{ +name = "tz_-04:00e" id = "21" offset_str = "-04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:30" { +{ +name = "tz_-03:30" id = "22" offset_str = "-03:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00" { +{ +name = "tz_-03:00" id = "23" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00b" { +{ +name = "tz_-03:00b" id = "24" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00c" { +{ +name = "tz_-03:00c" id = "25" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00d" { +{ +name = "tz_-03:00d" id = "26" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00e" { +{ +name = "tz_-03:00e" id = "27" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-03:00f" { +{ +name = "tz_-03:00f" id = "28" offset_str = "-03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-02:00" { +{ +name = "tz_-02:00" id = "29" offset_str = "-02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-02:00b" { +{ +name = "tz_-02:00b" id = "30" offset_str = "-02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-01:00" { +{ +name = "tz_-01:00" id = "31" offset_str = "-01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_-01:00b" { +{ +name = "tz_-01:00b" id = "32" offset_str = "-01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_00:00" { +{ +name = "tz_00:00" id = "33" offset_str = "00:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_00:00b" { +{ +name = "tz_00:00b" id = "34" offset_str = "00:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_00:00c" { +{ +name = "tz_00:00c" id = "35" offset_str = "00:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_00:00d" { +{ +name = "tz_00:00d" id = "36" offset_str = "00:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_+01:00" { +{ +name = "tz_+01:00" id = "37" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_+01:00b" { +{ +name = "tz_+01:00b" id = "38" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_+01:00c" { +{ +name = "tz_+01:00c" id = "39" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_+01:00d" { +{ +name = "tz_+01:00d" id = "40" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = true offset_str = "+01:00" start = "03-25 01:00" @@ -697,1011 +818,1189 @@ offset_str = "+01:00" start = "03-25 01:00" end = "10-28 01:00"} -} # end of dst +) # end of dst } -"tz_+01:00e" { +{ +name = "tz_+01:00e" id = "41" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+01:00f" { +{ +name = "tz_+01:00f" id = "42" offset_str = "+01:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00" { +{ +name = "tz_+02:00" id = "43" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00b" { +{ +name = "tz_+02:00b" id = "44" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00c" { +{ +name = "tz_+02:00c" id = "45" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00d" { +{ +name = "tz_+02:00d" id = "46" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00e" { +{ +name = "tz_+02:00e" id = "47" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00f" { +{ +name = "tz_+02:00f" id = "48" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00g" { +{ +name = "tz_+02:00g" id = "49" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00h" { +{ +name = "tz_+02:00h" id = "50" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00i" { +{ +name = "tz_+02:00i" id = "51" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+02:00j" { +{ +name = "tz_+02:00j" id = "52" offset_str = "+02:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+03:00" { +{ +name = "tz_+03:00" id = "53" offset_str = "+03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+03:00b" { +{ +name = "tz_+03:00b" id = "54" offset_str = "+03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+03:00c" { +{ +name = "tz_+03:00c" id = "55" offset_str = "+03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+03:00d" { +{ +name = "tz_+03:00d" id = "56" offset_str = "+03:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+03:30" { +{ +name = "tz_+03:30" id = "57" offset_str = "+03:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00" { +{ +name = "tz_+04:00" id = "58" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00b" { +{ +name = "tz_+04:00b" id = "59" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00c" { +{ +name = "tz_+04:00c" id = "60" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00d" { +{ +name = "tz_+04:00d" id = "61" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00e" { +{ +name = "tz_+04:00e" id = "62" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:00f" { +{ +name = "tz_+04:00f" id = "63" offset_str = "+04:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+04:30" { +{ +name = "tz_+04:30" id = "64" offset_str = "+04:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+05:00" { +{ +name = "tz_+05:00" id = "65" offset_str = "+05:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+05:00b" { +{ +name = "tz_+05:00b" id = "66" offset_str = "+05:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+05:30" { +{ +name = "tz_+05:30" id = "67" offset_str = "+05:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+05:30b" { +{ +name = "tz_+05:30b" id = "68" offset_str = "+05:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+05:45" { +{ +name = "tz_+05:45" id = "69" offset_str = "+05:45" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+06:00" { +{ +name = "tz_+06:00" id = "70" offset_str = "+06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+06:00b" { +{ +name = "tz_+06:00b" id = "71" offset_str = "+06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+06:00c" { +{ +name = "tz_+06:00c" id = "72" offset_str = "+06:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+06:30" { +{ +name = "tz_+06:30" id = "73" offset_str = "+06:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+07:00" { +{ +name = "tz_+07:00" id = "74" offset_str = "+07:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+07:00b" { +{ +name = "tz_+07:00b" id = "75" offset_str = "+07:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00" { +{ +name = "tz_+08:00" id = "76" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00b" { +{ +name = "tz_+08:00b" id = "77" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00c" { +{ +name = "tz_+08:00c" id = "78" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00d" { +{ +name = "tz_+08:00d" id = "79" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00e" { +{ +name = "tz_+08:00e" id = "80" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+08:00f" { +{ +name = "tz_+08:00f" id = "81" offset_str = "+08:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+09:00" { +{ +name = "tz_+09:00" id = "82" offset_str = "+09:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+09:00b" { +{ +name = "tz_+09:00b" id = "83" offset_str = "+09:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+09:00c" { +{ +name = "tz_+09:00c" id = "84" offset_str = "+09:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+09:30" { +{ +name = "tz_+09:30" id = "85" offset_str = "+09:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+09:30b" { +{ +name = "tz_+09:30b" id = "86" offset_str = "+09:30" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+10:00" { +{ +name = "tz_+10:00" id = "87" offset_str = "+10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+10:00b" { +{ +name = "tz_+10:00b" id = "88" offset_str = "+10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+10:00c" { +{ +name = "tz_+10:00c" id = "89" offset_str = "+10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+10:00d" { +{ +name = "tz_+10:00d" id = "90" offset_str = "+10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+10:00e" { +{ +name = "tz_+10:00e" id = "91" offset_str = "+10:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+11:00" { +{ +name = "tz_+11:00" id = "92" offset_str = "+11:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+11:00b" { +{ +name = "tz_+11:00b" id = "93" offset_str = "+11:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+12:00" { +{ +name = "tz_+12:00" id = "94" offset_str = "+12:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+12:00b" { +{ +name = "tz_+12:00b" id = "95" offset_str = "+12:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+12:00c" { +{ +name = "tz_+12:00c" id = "96" offset_str = "+12:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+12:00d" { +{ +name = "tz_+12:00d" id = "97" offset_str = "+12:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+13:00" { +{ +name = "tz_+13:00" id = "98" offset_str = "+13:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } -"tz_+13:00b" { +{ +name = "tz_+13:00b" id = "99" offset_str = "+13:00" -dst { +dst = ( -2012 { +{ +year = "2012" has_dst = false offset_str = "00:00" start = "" -end = ""} +end = "" +} -} # end of dst +) # end of dst } +) # end of timezones table diff --git a/winixd/functions/account.cpp b/winixd/functions/account.cpp index 0d9c66e..50a83c7 100644 --- a/winixd/functions/account.cpp +++ b/winixd/functions/account.cpp @@ -55,18 +55,18 @@ Account::Account() bool Account::ActivateAccount(User * puser, long code, bool use_ses_log) { - std::wstring * user_code_str = puser->aenv.get_wstr(L"activation_code"); + std::wstring * user_code_str = puser->admin_env.get_wstr(L"activation_code"); if( user_code_str ) { if( Tol(*user_code_str) == code ) { puser->status = WINIX_ACCOUNT_READY; - puser->aenv.remove(L"activation_code"); + puser->admin_env.remove(L"activation_code"); if( puser->update() ) { - log << log2 << "Account: account: " << puser->name << " activated" << logend; + log << log2 << "Account: account: " << puser->login << " activated" << logend; if( use_ses_log ) slog << loginfo << T(L"account_activated") << logend; diff --git a/winixd/functions/adduser.cpp b/winixd/functions/adduser.cpp index 01865d2..c41f07a 100644 --- a/winixd/functions/adduser.cpp +++ b/winixd/functions/adduser.cpp @@ -170,12 +170,12 @@ bool AddUser::AddNewUser(User & user, const std::wstring & pass) { if( system->users.AddUser(user) ) { - log << log2 << "AddUser: added a new user: " << user.name << logend; + log << log2 << "AddUser: added a new user: " << user.login << logend; return true; } else { - log << log1 << "AddUser: I can't add to system->users: " << user.name + log << log1 << "AddUser: I can't add to system->users: " << user.login << " but the user was added to the db correctly" << logend; } } @@ -217,9 +217,9 @@ bool AddUser::AddNewUser(const std::wstring & login, user.clear(); //user.Clear(); - user.name = login; + user.login = login; user.email = email; - user.super_user = false; + user.is_super_user = false; user.notify = 0; user.locale_id = config->locale_default_id; user.time_zone_id = config->time_zone_default_id; @@ -232,7 +232,7 @@ bool AddUser::AddNewUser(const std::wstring & login, if( user.status == WINIX_ACCOUNT_NOT_ACTIVATED ) { code = std::rand(); - user.aenv.add(L"activation_code", code); + user.admin_env.add(L"activation_code", code); } if( AddNewUser(user, pass) ) @@ -240,13 +240,13 @@ bool AddUser::AddNewUser(const std::wstring & login, if( try_login && !cur->session->puser && user.status == WINIX_ACCOUNT_READY ) { system->users.LoginUser(user.id, false); - log << log2 << "AddUser: now logged as: " << user.name << logend; + log << log2 << "AddUser: now logged as: " << user.login << logend; plugin->Call(WINIX_USER_LOGGED); } if( user.status == WINIX_ACCOUNT_NOT_ACTIVATED ) { - system->notify.ActivateAccount(user.name, user.email, code); + system->notify.ActivateAccount(user.login, user.email, code); if( use_ses_log ) slog << loginfo << T(L"account_email_sent") << logend; @@ -277,7 +277,7 @@ void AddUser::MakePost() !functions->fun_passwd.IsPasswordCorrect(pass, conf_pass, true) ) return; - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) { autoactivate = cur->request->IsPostVar(L"autoactivate"); diff --git a/winixd/functions/emacs.cpp b/winixd/functions/emacs.cpp index a05f14d..542db95 100644 --- a/winixd/functions/emacs.cpp +++ b/winixd/functions/emacs.cpp @@ -54,7 +54,7 @@ Emacs::Emacs() bool Emacs::HasAccess(const Item & item) { - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user can use emacs everywhere return true; diff --git a/winixd/functions/env.cpp b/winixd/functions/env.cpp index 3d4e483..b921b97 100644 --- a/winixd/functions/env.cpp +++ b/winixd/functions/env.cpp @@ -46,7 +46,6 @@ namespace Fun Env::Env() { fun.url = L"env"; - puser = 0; } @@ -59,7 +58,7 @@ bool Env::HasAccess() { // show/change admin environment variables for a user - if( !cur->session->puser->super_user ) + if( !cur->session->puser->is_super_user ) return false; } @@ -78,16 +77,16 @@ bool Env::EditAdminEnv(const std::wstring & env_str, bool use_ses_log) { if( Parse(env_str) ) { - puser->aenv = space; + user_wrapper.user->admin_env = space; - if( puser->update() ) + if( user_wrapper.user->update() ) { return true; } else { log << log1 << "Evn: a database problem with changing admin environment variables for user: " - << puser->name << ", id: " << puser->id << logend; + << user_wrapper.user->login << ", id: " << user_wrapper.user->id << logend; } } else @@ -106,16 +105,16 @@ bool Env::EditEnv(const std::wstring & env_str, bool use_ses_log) { if( Parse(env_str) ) { - puser->env = space; + user_wrapper.user->env = space; - if( puser->update() ) + if( user_wrapper.user->update() ) { return true; } else { log << log1 << "Evn: a database problem with changing admin environment variables for user: " - << puser->name << ", id: " << puser->id << logend; + << user_wrapper.user->login << ", id: " << user_wrapper.user->id << logend; } } else @@ -138,61 +137,89 @@ void Env::SaveEnv() if( cur->request->IsParam(L"a") ) { - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) + { status = EditAdminEnv(env_str, true); + + if( status ) + { + slog << loginfo << T(L"env_admin_changed_successfully") << logend; + } + } } else { status = EditEnv(env_str, true); - } - if( status ) - system->RedirectToLastItem(); + if( status ) + { + slog << loginfo << T(L"env_changed_successfully") << logend; + } + } +} + + +void Env::RegisterModels() +{ + cur->request->models.Add(L"users", system->users); + cur->request->models.Add(L"env_user", user_wrapper); } void Env::MakePost() { - puser = nullptr; + user_wrapper.user = nullptr; + user_wrapper.set_connector(model_connector); if( cur->session->puser ) { - puser = cur->session->puser; + user_wrapper.user = cur->session->puser; - if( cur->request->IsPostVar(L"changeuser") ) + if( cur->session->puser->is_super_user && cur->request->IsPostVar(L"userid") ) { - // show environments variables for the specified user - if( puser->super_user && cur->request->IsPostVar(L"userid") ) - { - long id = Tol(cur->request->PostVar(L"userid")); - puser = system->users.GetUser(id); + long id = Tol(cur->request->PostVar(L"userid")); + user_wrapper.user = system->users.GetUser(id); - if( puser ) - { - log << log2 << "Env: changing user to: " << puser->name << ", id: " << puser->id << logend; - } + if( user_wrapper.user->id != cur->session->puser->id ) + { + log << log2 << "Env: changing user to: " << user_wrapper.user->login << ", id: " << user_wrapper.user->id << logend; } } - if( puser ) + if( !cur->request->IsPostVar(L"changeuser") ) { - /* - * this puser should be set in a new struct (based on Model) - * and put to templates - * - */ - - SaveEnv(); - } - else - { - cur->request->status = WINIX_ERR_PERMISSION_DENIED; + if( user_wrapper.user ) + { + SaveEnv(); + } + else + { + cur->request->status = WINIX_ERR_PERMISSION_DENIED; + } } } + + RegisterModels(); } +void Env::MakeGet() +{ + user_wrapper.user = cur->session->puser; + user_wrapper.set_connector(model_connector); + + RegisterModels(); +} + + +void Env::Clear() +{ + user_wrapper.user = nullptr; +} + + + } // namespace diff --git a/winixd/functions/env.h b/winixd/functions/env.h index 5ce3a0f..87950b8 100644 --- a/winixd/functions/env.h +++ b/winixd/functions/env.h @@ -35,9 +35,11 @@ #ifndef headerfile_winix_functions_env #define headerfile_winix_functions_env +#include "models/userwrapper.h" #include "functionbase.h" #include "space/spaceparser.h" + namespace Winix { @@ -54,13 +56,15 @@ public: bool HasAccess(); void MakePost(); + void MakeGet(); + void Clear(); private: pt::SpaceParser conf_parser; pt::Space space; - User * puser; + UserWrapper user_wrapper; bool EditAdminEnv(const std::wstring & env_str, bool use_ses_log = false); bool EditEnv(const std::wstring & env_str, bool use_ses_log = false); @@ -68,6 +72,8 @@ private: bool Parse(const std::wstring & env_str); void SaveEnv(); + void RegisterModels(); + }; diff --git a/winixd/functions/functions.cpp b/winixd/functions/functions.cpp index e891ea4..555bbbb 100644 --- a/winixd/functions/functions.cpp +++ b/winixd/functions/functions.cpp @@ -615,7 +615,7 @@ void Functions::ReadItemFilterHtml(Item & item) void Functions::ReadItemContent(Item & item, const std::wstring & content_type) { - bool is_root = cur->session->puser && cur->session->puser->super_user; + bool is_root = cur->session->puser && cur->session->puser->is_super_user; bool filter_html = (content_type == L"2") && config->editors_html_safe_mode; if( filter_html && is_root && config->editors_html_safe_mode_skip_root ) diff --git a/winixd/functions/ipban.cpp b/winixd/functions/ipban.cpp index 42c369b..a284089 100644 --- a/winixd/functions/ipban.cpp +++ b/winixd/functions/ipban.cpp @@ -58,7 +58,7 @@ IPBanFun::IPBanFun() bool IPBanFun::HasAccess() { - return cur->session->puser && cur->session->puser->super_user; + return cur->session->puser && cur->session->puser->is_super_user; } diff --git a/winixd/functions/login.cpp b/winixd/functions/login.cpp index 4f935fa..57a4c5c 100644 --- a/winixd/functions/login.cpp +++ b/winixd/functions/login.cpp @@ -81,7 +81,7 @@ bool Login::CheckPasswords(User & user, const std::wstring & password) std::wstring password_from_db = user.password; user.password = password; - if( user.pass_hash_salted ) + if( user.is_pass_hash_salted ) salt = config->pass_hash_salt; else salt.clear(); diff --git a/winixd/functions/meta.cpp b/winixd/functions/meta.cpp index e23428b..fa1dbce 100644 --- a/winixd/functions/meta.cpp +++ b/winixd/functions/meta.cpp @@ -53,7 +53,7 @@ Meta::Meta() bool Meta::HasAccess() { if( cur->request->IsParam(L"a") ) - return cur->session->puser && cur->session->puser->super_user; + return cur->session->puser && cur->session->puser->is_super_user; else return system->HasWriteAccess(*cur->request->last_item); } @@ -134,7 +134,7 @@ void Meta::ChangeAdminMeta() { // IMPROVE ME we need to show an error msg if the user is not an admin - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) { const std::wstring & meta_str = cur->request->PostVar(L"itemmeta"); diff --git a/winixd/functions/mkdir.cpp b/winixd/functions/mkdir.cpp index 35e9204..76dc8e2 100644 --- a/winixd/functions/mkdir.cpp +++ b/winixd/functions/mkdir.cpp @@ -60,7 +60,7 @@ bool Mkdir::HasAccess(const Item & item) if( item.type != Item::dir ) return false; - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user can use mkdir everywhere return true; diff --git a/winixd/functions/mount.cpp b/winixd/functions/mount.cpp index cf79da4..e96cad4 100644 --- a/winixd/functions/mount.cpp +++ b/winixd/functions/mount.cpp @@ -53,7 +53,7 @@ Mount::Mount() bool Mount::HasAccess() { - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) return true; return false; diff --git a/winixd/functions/passwd.cpp b/winixd/functions/passwd.cpp index cca307a..15213ca 100644 --- a/winixd/functions/passwd.cpp +++ b/winixd/functions/passwd.cpp @@ -117,7 +117,7 @@ bool result = false; result = puser->update(); if( result ) - log << log2 << "Passwd: password for user " << puser->name << " has been changed" << logend; + log << log2 << "Passwd: password for user " << puser->login << " has been changed" << logend; else log << log1 << "Passwd: I cannot change password -- database problem" << logend; } @@ -140,7 +140,7 @@ long user_id; const std::wstring & pass_new = cur->request->PostVar(L"passwordnew"); const std::wstring & pass_conf = cur->request->PostVar(L"passwordconfirm"); - if( !cur->session->puser->super_user && !functions->fun_login.CheckUserPass(puser->name, pass_cur, user_id) ) + if( !cur->session->puser->is_super_user && !functions->fun_login.CheckUserPass(puser->login, pass_cur, user_id) ) { log << log3 << "Passwd: incorrect current password" << logend; slog << logerror << T("passwd_err_bad_current_password") << logend; @@ -190,7 +190,7 @@ return result; bool Passwd::ResetPassword(User * puser, long code, bool use_ses_log, bool only_check_access) { - std::wstring * user_code_str = puser->aenv.get_wstr(L"password_change_code"); + std::wstring * user_code_str = puser->admin_env.get_wstr(L"password_change_code"); if( user_code_str ) { @@ -230,7 +230,7 @@ bool Passwd::ResetPassword(const std::wstring & login, long code, bool use_ses_l { long t = static_cast(cur->request->start_time); - if( puser->aenv.to_long(L"password_change_time") + config->reset_password_code_expiration_time > t ) + if( puser->admin_env.to_long(L"password_change_time") + config->reset_password_code_expiration_time > t ) { result = ResetPassword(puser, code, use_ses_log, only_check_access); } @@ -297,10 +297,10 @@ const std::wstring * plogin; if( cur->session->puser ) { - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) plogin = &cur->request->PostVar(L"login"); else - plogin = &cur->session->puser->name; + plogin = &cur->session->puser->login; User * puser = system->users.GetUser(*plogin); diff --git a/winixd/functions/privchanger.cpp b/winixd/functions/privchanger.cpp index 58f255e..f02e01f 100644 --- a/winixd/functions/privchanger.cpp +++ b/winixd/functions/privchanger.cpp @@ -156,7 +156,7 @@ void PrivChanger::PrivLogStart(const wchar_t * what, long user, long group, int log << "new user: "; if( puser ) - log << puser->name; + log << puser->login; else log << "id: " << user; diff --git a/winixd/functions/reload.cpp b/winixd/functions/reload.cpp index 4c6f1fa..282d5e7 100644 --- a/winixd/functions/reload.cpp +++ b/winixd/functions/reload.cpp @@ -53,7 +53,7 @@ Reload::Reload() bool Reload::HasAccess() { - return cur->session->puser && cur->session->puser->super_user; + return cur->session->puser && cur->session->puser->is_super_user; } @@ -74,7 +74,7 @@ void Reload::MakeGet() { // !! temporarily only an admin has access - if( !cur->session->puser || !cur->session->puser->super_user ) + if( !cur->session->puser || !cur->session->puser->is_super_user ) { log << log1 << "Content: Only an admin has access to reload function" << logend; cur->request->status = WINIX_ERR_PERMISSION_DENIED; diff --git a/winixd/functions/rmuser.cpp b/winixd/functions/rmuser.cpp index a4a8429..8fc6ffc 100644 --- a/winixd/functions/rmuser.cpp +++ b/winixd/functions/rmuser.cpp @@ -55,7 +55,7 @@ RmUser::RmUser() bool RmUser::HasAccess() { - return cur->session->puser && cur->session->puser->super_user; + return cur->session->puser && cur->session->puser->is_super_user; } @@ -66,7 +66,7 @@ bool RmUser::RemoveUser(long user_id) if( puser ) { - name = puser->name; + name = puser->login; if( system->users.Remove(user_id) ) { @@ -88,7 +88,7 @@ void RmUser::MakePost() { long user_id; - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) user_id = Tol(cur->request->PostVar(L"userid")); else user_id = cur->session->puser->id; diff --git a/winixd/functions/subject.cpp b/winixd/functions/subject.cpp index 44b8b3e..88f08b0 100644 --- a/winixd/functions/subject.cpp +++ b/winixd/functions/subject.cpp @@ -53,7 +53,7 @@ Subject::Subject() bool Subject::SubjectCheckAccess() { // super user can always - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) return true; bool access; diff --git a/winixd/functions/template.cpp b/winixd/functions/template.cpp index 5f99460..fb357c3 100644 --- a/winixd/functions/template.cpp +++ b/winixd/functions/template.cpp @@ -58,7 +58,7 @@ bool Template::HasAccess() if( config->template_only_root_use_template_fun ) { // only root is allowed to change the template - return (cur->session->puser && cur->session->puser->super_user); + return (cur->session->puser && cur->session->puser->is_super_user); } diff --git a/winixd/functions/upload.cpp b/winixd/functions/upload.cpp index 6d0f6a4..6812479 100644 --- a/winixd/functions/upload.cpp +++ b/winixd/functions/upload.cpp @@ -74,7 +74,7 @@ bool Upload::HasAccess(const Item & item) return false; } - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) // super user can use upload everywhere return true; diff --git a/winixd/locale/en b/winixd/locale/en index 5cd63a7..7580324 100644 --- a/winixd/locale/en +++ b/winixd/locale/en @@ -139,6 +139,8 @@ env_header = Environment variables for a user env_change_env_for_user = Change environment variables for user env_change_admin_env_for_user = Change admin environment variables for user env_change_user = Change user +env_admin_changed_successfully = Admin environments variables have been changed successfully +env_changed_successfully = Environments variables have been changed successfully default_header = Default item in a directory default_make_redirect = Make redirect diff --git a/winixd/locale/pl b/winixd/locale/pl index a8c172f..20fb533 100644 --- a/winixd/locale/pl +++ b/winixd/locale/pl @@ -145,6 +145,8 @@ env_header = Zmienne środowiskowe env_change_env_for_user = Zmień zmienne środowiskowe dla użytkownika env_change_admin_env_for_user = Zmień zmienne środowiskowe administracyjne dla użytkownika env_change_user = Zmień użytkownika +env_admin_changed_successfully = Zmienne środowiskowe administracyjne zostały zmienione +env_changed_successfully = Zmienne środowiskowe zostały zmienione default_header = Domyślny element w katalogu diff --git a/winixd/main/main.cpp b/winixd/main/main.cpp index d63f8b1..f86e949 100644 --- a/winixd/main/main.cpp +++ b/winixd/main/main.cpp @@ -206,6 +206,7 @@ using Winix::app; if( !app.Init() ) { Winix::RemovePidFile(); + log << Winix::logsave; return 1; } diff --git a/winixd/models/item.cpp b/winixd/models/item.cpp index dfe09a5..0c70be2 100644 --- a/winixd/models/item.cpp +++ b/winixd/models/item.cpp @@ -327,7 +327,7 @@ bool Item::can_remove_child(const User * current_user, long child_user_id) const if( type == Type::dir ) { - if( current_user && current_user->super_user ) + if( current_user && current_user->is_super_user ) { res = true; } diff --git a/winixd/models/itemcontent.cpp b/winixd/models/itemcontent.cpp index 0559f96..5cfea70 100644 --- a/winixd/models/itemcontent.cpp +++ b/winixd/models/itemcontent.cpp @@ -40,7 +40,6 @@ #include "core/request.h" #include "core/users.h" #include "core/groups.h" -#include "templates/miscspace.h" namespace Winix @@ -104,20 +103,6 @@ void ItemContent::fields() field(L"has_thumb", &ItemContent::has_thumb); field(L"display_user_name", &ItemContent::display_user_name); - field(L"meta_to_str", &ItemContent::meta_to_str); - field(L"meta_prop", &ItemContent::meta_prop); - field(L"meta_prop_no_escape", &ItemContent::meta_prop_no_escape); - field(L"meta_prop_tab", &ItemContent::meta_prop_tab); - field(L"meta_prop_tab_value", &ItemContent::meta_prop_tab_value); - field(L"meta_prop_tab_has_next",&ItemContent::meta_prop_tab_has_next); - - field(L"admin_meta_to_str", &ItemContent::admin_meta_to_str); - field(L"admin_meta_prop", &ItemContent::admin_meta_prop); - field(L"admin_meta_prop_no_escape", &ItemContent::admin_meta_prop_no_escape); - field(L"admin_meta_prop_tab", &ItemContent::admin_meta_prop_tab); - field(L"admin_meta_prop_tab_value", &ItemContent::admin_meta_prop_tab_value); - field(L"admin_meta_prop_tab_has_next", &ItemContent::admin_meta_prop_tab_has_next); - // IMPROVEME prepare a setter functions which tests whether content_raw_type_helper and content_parsed_type_helper are correct values content_raw_type = static_cast(content_raw_type_helper); @@ -268,16 +253,7 @@ bool ItemContent::do_migration_to_3() }; size_t len = sizeof(str) / sizeof(const char*); - - for(size_t i=0 ; i < len ; ++i) - { - if( !db_query(str[i]) ) - { - return false; - } - } - - return true; + return db_query(str, len); } @@ -285,7 +261,7 @@ bool ItemContent::has_access(const User * current_user, int mask) const { if( current_user ) { - if( current_user->super_user ) + if( current_user->is_super_user ) { // super user is allowed everything return true; @@ -332,7 +308,7 @@ bool ItemContent::has_read_write_access(const User * current_user) const bool ItemContent::has_read_exec_access(const User * current_user) const { - if( current_user && current_user->super_user ) + if( current_user && current_user->is_super_user ) { // there must be at least one 'x' (for the root) // !! CHECK ME: is it applicable to directories too? @@ -492,23 +468,30 @@ void ItemContent::group(morm::ModelWrapper ** model_wrapper) } +bool ItemContent::content_type_is(const std::wstring & type) +{ + if( content_raw_type == ItemContent::ct_text && type == L"text" ) + return true; + else + if( content_raw_type == ItemContent::ct_formatted_text && type == L"formatted text" ) + return true; + else + if( content_raw_type == ItemContent::ct_html && type == L"html" ) + return true; + else + if( content_raw_type == ItemContent::ct_bbcode && type == L"bbcode" ) + return true; + else + if( content_raw_type == ItemContent::ct_other && type == L"other" ) + return true; + + return false; +} + void ItemContent::type_is(EzcEnv & env) { - if( content_raw_type == ItemContent::ct_text && env.par == L"text" ) - env.res = true; - else - if( content_raw_type == ItemContent::ct_formatted_text && env.par == L"formatted text" ) - env.res = true; - else - if( content_raw_type == ItemContent::ct_html && env.par == L"html" ) - env.res = true; - else - if( content_raw_type == ItemContent::ct_bbcode && env.par == L"bbcode" ) - env.res = true; - else - if( content_raw_type == ItemContent::ct_other && env.par == L"other" ) - env.res = true; + env.res = content_type_is(env.par); } @@ -603,79 +586,6 @@ void ItemContent::display_user_name(EzcEnv & env) } -/* - * IMPROVEME may it would be better to browse by Space struct in the same way as in Models? - * so Model should have support for it - * - */ -void ItemContent::meta_to_str(EzcEnv & env) -{ - meta.serialize_to_space_stream(env.out, true); -} - -void ItemContent::meta_prop(EzcEnv & env) -{ - TemplatesFunctions::space_value(env, meta); -} - -void ItemContent::meta_prop_no_escape(EzcEnv & env) -{ - TemplatesFunctions::space_value(env, meta, false); -} - - -void ItemContent::meta_prop_tab(EzcEnv & env) -{ - TemplatesFunctions::space_list_tab(env, meta); -} - -void ItemContent::meta_prop_tab_value(EzcEnv & env) -{ - // FIXME there is no "item_meta_tab" now - TemplatesFunctions::space_list_tab_value(env, meta, L"item_meta_tab"); -} - -void ItemContent::meta_prop_tab_has_next(EzcEnv & env) -{ - // FIXME there is no "item_meta_tab" now - TemplatesFunctions::space_list_tab_has_next(env, meta, L"item_meta_tab"); -} - - - -void ItemContent::admin_meta_to_str(EzcEnv & env) -{ - meta_admin.serialize_to_space_stream(env.out, true); -} - -void ItemContent::admin_meta_prop(EzcEnv & env) -{ - TemplatesFunctions::space_value(env, meta_admin); -} - -void ItemContent::admin_meta_prop_no_escape(EzcEnv & env) -{ - TemplatesFunctions::space_value(env, meta_admin, false); -} - - -void ItemContent::admin_meta_prop_tab(EzcEnv & env) -{ - TemplatesFunctions::space_list_tab(env, meta_admin); -} - -void ItemContent::admin_meta_prop_tab_value(EzcEnv & env) -{ - // FIXME there is no "item_admin_meta_tab" now - TemplatesFunctions::space_list_tab_value(env, meta_admin, L"item_admin_meta_tab"); -} - -void ItemContent::admin_meta_prop_tab_has_next(EzcEnv & env) -{ - // FIXME there is no "item_admin_meta_tab" now - TemplatesFunctions::space_list_tab_has_next(env, meta_admin, L"item_admin_meta_tab"); -} - } // namespace Winix diff --git a/winixd/models/itemcontent.h b/winixd/models/itemcontent.h index 2b24efe..cbcb328 100644 --- a/winixd/models/itemcontent.h +++ b/winixd/models/itemcontent.h @@ -280,6 +280,7 @@ protected: bool do_migration_to_3(); bool has_access(const User * current_user, int mask) const; + bool content_type_is(const std::wstring & type); void print_content(EzcEnv & env); void has_static_file(EzcEnv & env); @@ -294,18 +295,7 @@ protected: void file_type_is_sound(EzcEnv & env); void has_thumb(EzcEnv & env); void display_user_name(EzcEnv & env); - void meta_to_str(EzcEnv & env); - void meta_prop(EzcEnv & env); - void meta_prop_no_escape(EzcEnv & env); - void meta_prop_tab(EzcEnv & env); - void meta_prop_tab_value(EzcEnv & env); - void meta_prop_tab_has_next(EzcEnv & env); - void admin_meta_to_str(EzcEnv & env); - void admin_meta_prop(EzcEnv & env); - void admin_meta_prop_no_escape(EzcEnv & env); - void admin_meta_prop_tab(EzcEnv & env); - void admin_meta_prop_tab_value(EzcEnv & env); - void admin_meta_prop_tab_has_next(EzcEnv & env); + MORM_MEMBER_FIELD(ItemContent) diff --git a/winixd/models/user.cpp b/winixd/models/user.cpp index 890c6df..5f31be2 100644 --- a/winixd/models/user.cpp +++ b/winixd/models/user.cpp @@ -53,22 +53,28 @@ User::User() void User::fields() { field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key); - field(L"login", name); // IMPROVEME set the same name, either 'login' or 'name' - field(L"super_user", super_user); // IMPROVEME rename to is_super_user + field(L"login", login); + field(L"is_super_user", is_super_user); field(L"has_pass", has_pass); field(L"pass_type", pass_type); field(L"password", L"", password); field(L"pass_encrypted", L"", pass_encrypted, morm::FT::binary); - field(L"pass_hash_salted", pass_hash_salted); // IMPROVEME rename to pass_is_hash_salted or is_pass_hash_salted + field(L"is_pass_hash_salted", is_pass_hash_salted); field(L"email", email); field(L"notify", notify); field(L"env", env); - field(L"aenv", aenv); // IMPROVEME rename to admin_env + field(L"admin_env", admin_env); field(L"status", status); field(L"locale_id", locale_id); field(L"time_zone_id", time_zone_id); + + field(L"", L"id_is", &User::id_is); + field(L"", L"is_guest", &User::is_guest); + field(L"", L"is_env_object", &User::is_env_object); + field(L"", L"is_admin_env_object", &User::is_admin_env_object); + } @@ -95,20 +101,20 @@ void User::after_insert() void User::Clear() { id = -1; - name.clear(); - super_user = false; + login.clear(); + is_super_user = false; groups.clear(); email.clear(); notify = 0; env.clear(); - aenv.clear(); + admin_env.clear(); status = WINIX_ACCOUNT_BLOCKED; locale_id = 0; time_zone_id = 0; has_pass = false; pass_type = 0; - pass_hash_salted = false; + is_pass_hash_salted = false; clear_passwords(); } @@ -143,6 +149,7 @@ bool User::do_migration(int & current_table_version) bool ok = true; ok = ok && morm::Model::do_migration(current_table_version, 1, this, &User::do_migration_to_1); + ok = ok && morm::Model::do_migration(current_table_version, 2, this, &User::do_migration_to_2); return ok; } @@ -160,11 +167,11 @@ bool User::do_migration_to_1() email character varying(255), notify integer, pass_type integer, - pass_hash_salted boolean, + is_pass_hash_salted boolean, pass_encrypted bytea, - super_user boolean, + is_super_user boolean, env text, - aenv text, + admin_env text, status integer, locale_id integer, time_zone_id integer, @@ -177,18 +184,57 @@ bool User::do_migration_to_1() } +bool User::do_migration_to_2() +{ + const char * str[] = { + "alter table core.user rename column aenv to admin_env", + "alter table core.user rename column super_user to is_super_user", + "alter table core.user rename column pass_hash_salted to is_pass_hash_salted", + }; + + size_t len = sizeof(str) / sizeof(const char*); + return db_query(str, len); +} + void User::display_name(EzcEnv & env) { - std::wstring * dname = aenv.get_wstr(L"display_name"); + std::wstring * dname = admin_env.get_wstr(L"display_name"); if( dname && !IsWhite(*dname, true) ) env.out << *dname; else - env.out << name; + env.out << login; } +void User::id_is(EzcEnv & env) +{ + if( !env.par.empty() ) + { + long par_user_id = pt::Tol(env.par.c_str()); + env.res = id == par_user_id; + } +} + + +bool User::is_guest() +{ + return id == -1; +} + + +bool User::is_env_object() +{ + return env.is_object(); +} + + +bool User::is_admin_env_object() +{ + return admin_env.is_object(); +} + } // namespace Winix diff --git a/winixd/models/user.h b/winixd/models/user.h index 51f7306..c478167 100644 --- a/winixd/models/user.h +++ b/winixd/models/user.h @@ -41,6 +41,7 @@ #include "space/space.h" #include "date/date.h" #include "templates/misc.h" +#include "winixmodel.h" namespace Winix @@ -86,13 +87,13 @@ namespace Winix (when the pointer is not null then winix do not check what the value of 'status' is -- the status is only tested in 'login' function) */ -class User : public morm::Model +class User : public WinixModel { public: long id; - std::wstring name; - bool super_user; + std::wstring login; + bool is_super_user; bool has_pass; // true if the user has a password set @@ -100,7 +101,7 @@ public: int pass_type; // the kind of hash (WINIX_CRYPT_HASH_* see crypt.h) std::wstring password; // password hashed or plain text if pass_type==0 std::string pass_encrypted; // password encrypted - bool pass_hash_salted; // true when the hash was salted (plain text passwords are never salted) + bool is_pass_hash_salted; // true when the hash was salted (plain text passwords are never salted) std::wstring email; @@ -113,7 +114,7 @@ public: // environment variables set only by an administrator // an administrator can use 'env' winix function with 'a' parameter // IMPROVEME rename me to something better (env_admin?) - pt::Space aenv; + pt::Space admin_env; // account status // WINIX_ACCOUNT_* @@ -149,11 +150,21 @@ public: void display_name(EzcEnv & env); + bool is_env_object(); + bool is_admin_env_object(); + + private: bool do_migration_to_1(); + bool do_migration_to_2(); + + void id_is(EzcEnv & env); // takes one argument as a user id + bool is_guest(); + + MORM_MEMBER_FIELD(User) }; diff --git a/winixd/models/userwrapper.h b/winixd/models/userwrapper.h new file mode 100644 index 0000000..6b5fb3e --- /dev/null +++ b/winixd/models/userwrapper.h @@ -0,0 +1,88 @@ +/* + * This file is a part of Winix + * and is distributed under the 2-Clause BSD licence. + * Author: Tomasz Sowa + */ + +/* + * Copyright (c) 2021, Tomasz Sowa + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef headerfile_winix_models_userhelper +#define headerfile_winix_models_userhelper + +#include "user.h" + + +namespace Winix +{ + +class UserWrapper : public WinixModel +{ +public: + + User * user; + + + UserWrapper() + { + user = nullptr; + } + + + void fields() + { + field(L"", L"user", &UserWrapper::get_user); + field(L"", L"has_user", &UserWrapper::has_user); + } + + +protected: + + void get_user(morm::ModelWrapper ** model_wrapper) + { + if( user ) + { + *model_wrapper = new morm::ModelWrapperModel(user); + } + } + + bool has_user() + { + return user != nullptr; + } + + + + MORM_MEMBER_FIELD(UserWrapper) +}; + + +} // namespace Winix + + +#endif diff --git a/winixd/notify/notifythread.cpp b/winixd/notify/notifythread.cpp index 1ef2c4a..2fa93bd 100644 --- a/winixd/notify/notifythread.cpp +++ b/winixd/notify/notifythread.cpp @@ -147,7 +147,7 @@ bool res = false; { if( (i->notify & TemplatesNotifyFunctions::notify_msg.code) != 0 ) { - msg.name = i->name; + msg.name = i->login; msg.email = i->email; msg.lang = config->locale_default_id; // !! IMPROVE ME bedzie osobno dla kazdego uzytkownika diff --git a/winixd/plugins/export/exportinfo.cpp b/winixd/plugins/export/exportinfo.cpp index 1a42dc7..b8a25c2 100644 --- a/winixd/plugins/export/exportinfo.cpp +++ b/winixd/plugins/export/exportinfo.cpp @@ -330,16 +330,21 @@ void ExportInfo::SendAllFilesFromDir(long dir_id) void ExportInfo::AdditionalExport(const Item & item) { - const pt::Space::TableType * child_table = item.item_content.meta.find_child_space_table(); + const pt::Space * export_space = item.item_content.meta.get_space(L"export");// CHECK ME it was find_child_space_table(); - if( child_table ) + if( export_space ) { - for(const pt::Space * child : *child_table) - { - if( child->is_child_space_name(L"export") ) - AdditionalExport(item, *child); - } + AdditionalExport(item, *export_space); } + +// if( export_space ) +// { +// for(const pt::Space * child : *export_space) +// { +// if( child->is_child_space_name(L"export") ) +// AdditionalExport(item, *child); +// } +// } } diff --git a/winixd/plugins/mailregister/templates.cpp b/winixd/plugins/mailregister/templates.cpp index 7aefa63..bea2526 100644 --- a/winixd/plugins/mailregister/templates.cpp +++ b/winixd/plugins/mailregister/templates.cpp @@ -37,7 +37,6 @@ #include "core/log.h" #include "core/misc.h" #include "cache.h" -#include "templates/miscspace.h" #include "registermail_info.h" #include "models/item.h" diff --git a/winixd/plugins/seo/seo.cpp b/winixd/plugins/seo/seo.cpp index 9da1eba..f8518e3 100644 --- a/winixd/plugins/seo/seo.cpp +++ b/winixd/plugins/seo/seo.cpp @@ -55,7 +55,7 @@ Seo::Seo() bool Seo::HasAccess() { - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) return true; return system->HasWriteAccess(*cur->request->last_item); @@ -77,7 +77,7 @@ void Seo::MakePost() item.subject = subject; - pt::Space & seo = item.item_content.meta.find_add_child_space(L"seo"); + pt::Space & seo = item.item_content.meta.get_add_space(L"seo"); seo.add(L"description", description); seo.add(L"keywords", keywords); diff --git a/winixd/plugins/thread/reply.cpp b/winixd/plugins/thread/reply.cpp index 9532da2..b3ab761 100644 --- a/winixd/plugins/thread/reply.cpp +++ b/winixd/plugins/thread/reply.cpp @@ -80,7 +80,7 @@ bool Reply::HasAccess() return false; - pt::Space * thread_space = cur->request->item.item_content.meta_admin.find_child_space(L"thread"); + pt::Space * thread_space = cur->request->item.item_content.meta_admin.get_space(L"thread"); if( thread_space ) { diff --git a/winixd/plugins/ticket/editticket.cpp b/winixd/plugins/ticket/editticket.cpp index d28151c..c17c1d0 100644 --- a/winixd/plugins/ticket/editticket.cpp +++ b/winixd/plugins/ticket/editticket.cpp @@ -185,7 +185,7 @@ pt::Space & EditTicket::PrepareSpace() if( is_new ) { - pt::Space * ticket_space = cur->request->item.item_content.meta.find_child_space(L"ticket"); + pt::Space * ticket_space = cur->request->item.item_content.meta.get_space(L"ticket"); // CHECKME it was find_child_space(L"ticket"); if( ticket_space ) { @@ -203,10 +203,10 @@ bool EditTicket::CloseTicket() { cur->request->item.propagate_connector(); - pt::Space & ticket_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"ticket"); + pt::Space & ticket_space = cur->request->item.item_content.meta_admin.get_add_space(L"ticket"); //CHECKME it was find_add_child_space(L"ticket"); ticket_space.add(L"closed", true); - pt::Space & thread_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"thread"); + pt::Space & thread_space = cur->request->item.item_content.meta_admin.get_add_space(L"thread"); //CHECKME it was find_add_child_space(L"thread"); thread_space.add(L"closed", true); //if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK ) diff --git a/winixd/plugins/ticket/sessiondata.cpp b/winixd/plugins/ticket/sessiondata.cpp index 421c3a0..919b5ab 100644 --- a/winixd/plugins/ticket/sessiondata.cpp +++ b/winixd/plugins/ticket/sessiondata.cpp @@ -144,13 +144,13 @@ void SessionData::BuildFileList(std::vector & file_tab, pt::Space & space) { file_tab.clear(); - pt::Space::TableType * child_table = space.find_child_space_table(); + pt::Space::TableType * child_table = space.get_table(L"params"); // CHECKME it was space.find_child_space_table(); if( child_table ) { for(pt::Space * sp : *child_table) { - if( sp->is_child_space_name(L"param") ) + if( sp->is_equal(L"name", L"param") ) CheckFile(file_tab, *sp); } } @@ -159,13 +159,13 @@ void SessionData::BuildFileList(std::vector & file_tab, pt::Space & space) void SessionData::CheckFile(std::vector & file_tab, pt::Space & space) { - pt::Space::TableType * child_table = space.find_child_space_table(); + pt::Space::TableType * child_table = space.get_table(L"files"); // CHECKME it was space.find_child_space_table(); if( child_table ) { for(pt::Space * sp : *child_table) { - if( sp->is_child_space_name(L"file") ) + if( sp->is_equal(L"name", L"file") ) { file_tab.push_back(sp->to_long(L"itemid")); } diff --git a/winixd/plugins/ticket/ticketinfo.cpp b/winixd/plugins/ticket/ticketinfo.cpp index fb8f3c7..4d3ec81 100644 --- a/winixd/plugins/ticket/ticketinfo.cpp +++ b/winixd/plugins/ticket/ticketinfo.cpp @@ -302,13 +302,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par) else if( *type == L"select" ) { - pt::Space::TableType * child_table = space.find_child_space_table(); + pt::Space::TableType * child_table = space.get_table(L"ticket_params"); // CHECKME it was space.find_child_space_table(); if( child_table ) { for(pt::Space * sp : *child_table) { - if( sp->is_child_space_name(L"option") ) + if( sp->is_equal(L"name", L"option") ) { if( sp->to_long(L"id") == par.intv ) { @@ -329,13 +329,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par) pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param) { - pt::Space::TableType * child_table = meta.find_child_space_table(); + pt::Space * child_table = meta.get_space(L"params"); // CHECKME it was meta.find_child_space_table(); - if( child_table ) + if( child_table && child_table->is_table() ) { - for(pt::Space * sp : *child_table) + for(pt::Space * sp : *child_table->get_table() ) { - if( sp->is_child_space_name(L"param") ) + if( sp->is_equal(L"name", L"param") ) { if( sp->to_long(L"id") == param ) { @@ -344,8 +344,14 @@ pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param) } } } + else + if( !child_table ) + { + child_table = &meta.add_empty_space(L"params"); + } - pt::Space & sp = meta.add_child_space(L"param"); + pt::Space & sp = child_table->add_empty_space(); + sp.add(L"name", L"param"); sp.add(L"id", param); return sp; @@ -419,7 +425,7 @@ void TicketInfo::ReadTicketValue(pt::Space & space, if( cur->request->status == WINIX_ERR_OK ) { pt::Space & space = FindAddMetaByParam(meta, param_id); - pt::Space & file_space = space.add_child_space(L"file"); + pt::Space & file_space = space.get_add_space(L"file"); // CHECKME it was space.add_child_space(L"file"); if( file.item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE ) file_space.add(L"type", L"image"); @@ -493,14 +499,13 @@ void TicketInfo::ReadTicketParam(pt::Space & space, Ticket & ticket, long param_ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta) { ticket_param.Clear(); - - pt::Space::TableType * child_table = cur_conf->find_child_space_table(); + pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table(); if( child_table ) { for(pt::Space * space : *child_table) { - if( space->is_child_space_name(L"param") && space->to_long(L"id") == param_id ) + if( space->is_equal(L"name", L"param") && space->to_long(L"id") == param_id ) { ReadTicketParam(*space, ticket, param_id, value, meta); return; @@ -515,13 +520,13 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr // always adds a new parameter void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Space & meta) { - pt::Space::TableType * child_table = cur_conf->find_child_space_table(); + pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table(); if( child_table ) { for(pt::Space * sp : *child_table) { - if( sp->is_child_space_name(L"param") ) + if( sp->is_equal(L"name", L"param") ) { if( sp->to_long(L"id") == param_id ) { @@ -541,6 +546,8 @@ void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Spac bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta) { + // FIXME !!!!!!!!!!!!!!1 + /* pt::Space::TableType * meta_child_table = meta.find_child_space_table(); if( meta_child_table ) @@ -572,7 +579,9 @@ bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & met } } +*/ return false; + } @@ -642,7 +651,7 @@ void TicketInfo::RemoveTicket(long file_id) void TicketInfo::CopyTicketSpace(pt::Space & ticket_space, Item & item) { - pt::Space & ticket_meta = item.item_content.meta.find_add_child_space(L"ticket"); + pt::Space & ticket_meta = item.item_content.meta.get_add_space(L"ticket"); ticket_meta = ticket_space; } diff --git a/winixd/templates/currentdate.cpp b/winixd/templates/currentdate.cpp index b32232a..d197a4d 100644 --- a/winixd/templates/currentdate.cpp +++ b/winixd/templates/currentdate.cpp @@ -35,7 +35,6 @@ #include "templates.h" #include "core/misc.h" #include "functions/functions.h" -#include "miscspace.h" namespace Winix { diff --git a/winixd/templates/dir.cpp b/winixd/templates/dir.cpp index 0ed6dcd..30898e3 100644 --- a/winixd/templates/dir.cpp +++ b/winixd/templates/dir.cpp @@ -35,7 +35,6 @@ #include "templates.h" #include "core/misc.h" #include "functions/functions.h" -#include "miscspace.h" namespace Winix { @@ -121,7 +120,7 @@ bool result = true; { // rm for the root dir // only the superuser can do it - if( !cur->session->puser || !cur->session->puser->super_user ) + if( !cur->session->puser || !cur->session->puser->is_super_user ) result = false; } else @@ -270,7 +269,7 @@ void dir_childs_tab_user(Info & i) User * puser = system->users.GetUser(user_id); if( puser ) - i.out << puser->name; + i.out << puser->login; else { i.out << "~"; @@ -293,7 +292,7 @@ void dir_childs_tab_group(Info & i) Group * pgroup = system->groups.GetGroup(group_id); if( pgroup ) - i.out << pgroup->name; + i.out << pgroup->login; else i.out << group_id; } @@ -370,7 +369,7 @@ void dir_last_user(Info & i) User * puser = system->users.GetUser(cur->request->dir_tab.back()->item_content.user_id); if( puser ) - i.out << puser->name; + i.out << puser->login; else { i.out << "~"; @@ -468,61 +467,61 @@ void dir_last_meta_str(Info & i) } -void dir_last_meta(Info & i) -{ - space_value(i, cur->request->dir_tab.back()->item_content.meta); -} - - -void dir_last_meta_tab(Info & i) -{ - space_list_tab(i, cur->request->dir_tab.back()->item_content.meta); -} - - -void dir_last_meta_tab_value(Info & i) -{ - space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab"); -} - - - -void dir_last_meta_tab_has_next(Info & i) -{ - space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab"); -} +//void dir_last_meta(Info & i) +//{ +// space_value(i, cur->request->dir_tab.back()->item_content.meta); +//} +// +// +//void dir_last_meta_tab(Info & i) +//{ +// space_list_tab(i, cur->request->dir_tab.back()->item_content.meta); +//} +// +// +//void dir_last_meta_tab_value(Info & i) +//{ +// space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab"); +//} +// +// +// +//void dir_last_meta_tab_has_next(Info & i) +//{ +// space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta, L"dir_last_meta_tab"); +//} -void dir_last_admin_meta_str(Info & i) -{ - cur->request->dir_tab.back()->item_content.meta_admin.serialize_to_space_stream(i.out, true); -} - - -void dir_last_admin_meta(Info & i) -{ - space_value(i, cur->request->dir_tab.back()->item_content.meta_admin); -} - - -void dir_last_admin_meta_tab(Info & i) -{ - space_list_tab(i, cur->request->dir_tab.back()->item_content.meta_admin); -} - - -void dir_last_admin_meta_tab_value(Info & i) -{ - space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab"); -} - - -void dir_last_admin_meta_tab_has_next(Info & i) -{ - space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab"); -} +//void dir_last_admin_meta_str(Info & i) +//{ +// cur->request->dir_tab.back()->item_content.meta_admin.serialize_to_space_stream(i.out, true); +//} +// +// +//void dir_last_admin_meta(Info & i) +//{ +// space_value(i, cur->request->dir_tab.back()->item_content.meta_admin); +//} +// +// +//void dir_last_admin_meta_tab(Info & i) +//{ +// space_list_tab(i, cur->request->dir_tab.back()->item_content.meta_admin); +//} +// +// +//void dir_last_admin_meta_tab_value(Info & i) +//{ +// space_list_tab_value(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab"); +//} +// +// +//void dir_last_admin_meta_tab_has_next(Info & i) +//{ +// space_list_tab_has_next(i, cur->request->dir_tab.back()->item_content.meta_admin, L"dir_last_admin_meta_tab"); +//} diff --git a/winixd/templates/env.cpp b/winixd/templates/env.cpp deleted file mode 100644 index ce8ffd4..0000000 --- a/winixd/templates/env.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * This file is a part of Winix - * and is distributed under the 2-Clause BSD licence. - * Author: Tomasz Sowa - */ - -/* - * Copyright (c) 2012-2021, Tomasz Sowa - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "templates.h" -#include "core/misc.h" -#include "functions/functions.h" -#include "miscspace.h" - - -namespace Winix -{ - - -namespace TemplatesFunctions -{ - - - -void env_str(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - puser->env.serialize_to_space_stream(i.out, true); -} - - -void env(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_value(i, puser->env); -} - - -void env_tab(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab(i, puser->env); -} - - -void env_tab_value(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab_value(i, puser->env, L"env_tab"); -} - - - -void env_tab_has_next(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab_has_next(i, puser->env, L"env_tab"); -} - - - - - - - - - -void env_admin_str(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - puser->aenv.serialize_to_space_stream(i.out, true); -} - - -void env_admin(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_value(i, puser->aenv); -} - - -void env_admin_tab(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab(i, puser->aenv); -} - - -void env_admin_tab_value(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab_value(i, puser->aenv, L"env_admin_tab"); -} - - - -void env_admin_tab_has_next(Info & i) -{ - User * puser = cur->session->puser; - - if( puser ) - space_list_tab_has_next(i, puser->aenv, L"env_admin_tab"); -} - - - -static size_t req_id = 0; -static User * puser = nullptr; - - -/* - * IMPROVEME - * in the future the user pointer will be set by the env controller - * a new struct will be added and put to templates (when new ezc object templates will be ready) - * - */ -User * env_get_user() -{ - if( cur->request->id != req_id ) - { - req_id = cur->request->id; - puser = 0; - - if( cur->session->puser ) - { - if( cur->session->puser->super_user && cur->request->IsPostVar(L"userid") ) - { - long id = Tol(cur->request->PostVar(L"userid")); - puser = system->users.GetUser(id); - } - else - { - puser = cur->session->puser; - } - } - } - - return puser; -} - - -void env_user_admin_env_str(Info & i) -{ - // only an admin is able to see this variables - - if( cur->session->puser && cur->session->puser->super_user ) - { - User * puser = env_get_user(); - - if( puser ) - i.out << puser->aenv; - } -} - - -void env_user_env_str(Info & i) -{ - User * puser = env_get_user(); - - if( puser ) - i.out << puser->env; -} - - -void env_user_id(Info & i) -{ - User * puser = env_get_user(); - - if( puser ) - i.out << puser->id; -} - - -void env_user_name(Info & i) -{ - User * puser = env_get_user(); - - if( puser ) - i.out << puser->name; -} - - - - -static Users::Iterator user_iter; -static size_t user_reqid = 0; -static size_t user_index; // only information - - -bool env_user_tab_init() -{ - if( user_reqid != cur->request->id ) - { - user_reqid = cur->request->id; - user_iter = system->users.End(); - } - -return user_iter != system->users.End(); -} - - -void env_user_tab(Info & i) -{ - env_user_tab_init(); - - if( cur->session->puser && cur->session->puser->super_user ) - { - user_index = i.iter; - - if( i.iter == 0 ) - user_iter = system->users.Begin(); - else - if( user_iter != system->users.End() ) - ++user_iter; - - i.res = user_iter != system->users.End(); - } -} - - -void env_user_tab_id(Info & i) -{ - if( env_user_tab_init() ) - i.out << user_iter->id; -} - - -void env_user_tab_name(Info & i) -{ - if( env_user_tab_init() ) - i.out << user_iter->name; -} - - -void env_user_tab_is_current(Info & i) -{ - if( env_user_tab_init() ) - { - User * puser = env_get_user(); - - if( puser ) - i.res = (user_iter->id == puser->id ); - } -} - - - - -} // namespace TemplatesFunctions - -} // namespace Winix - - - diff --git a/winixd/templates/item.cpp b/winixd/templates/item.cpp index b1ec2ff..b79cca4 100644 --- a/winixd/templates/item.cpp +++ b/winixd/templates/item.cpp @@ -38,7 +38,6 @@ #include "core/misc.h" #include "core/bbcodeparser.h" #include "core/textstream.h" -#include "miscspace.h" namespace Winix { diff --git a/winixd/templates/locale.cpp b/winixd/templates/locale.cpp index 5283033..6d72706 100644 --- a/winixd/templates/locale.cpp +++ b/winixd/templates/locale.cpp @@ -508,7 +508,7 @@ bool Locale::IsKeyByIndex(const std::wstring & key, size_t index, bool try_defau { if( index < locale_tab.size() ) { - if( locale_tab[index].get_object_field(key) != 0 ) + if( locale_tab[index].get_space(key) != 0 ) return true; } diff --git a/winixd/templates/miscspace.cpp b/winixd/templates/miscspace.cpp deleted file mode 100644 index 2cab147..0000000 --- a/winixd/templates/miscspace.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * This file is a part of Winix - * and is distributed under the 2-Clause BSD licence. - * Author: Tomasz Sowa - */ - -/* - * Copyright (c) 2012-2021, Tomasz Sowa - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "templates.h" - -namespace Winix -{ - -namespace TemplatesFunctions -{ - - - - -bool are_spaces_the_same(const std::vector & params, const std::vector & spaces) -{ - // last value from params is the parameter name (not a space) - if( spaces.size() + 1 != params.size() ) - return false; - - for(size_t i=0 ; i & params, std::vector & spaces) -{ - if( !params.empty() ) - { - spaces.resize(params.size() - 1); - - for(size_t i=0 ; i & params, pt::Space & space, size_t level = 0) -{ - pt::Space::TableType * child_table = space.find_child_space_table(); - - if( level + 1 < params.size() && child_table ) - { - for(pt::Space * child : *child_table) - { - if( child->is_child_space_name(params[level].str.c_str()) ) - return find_space(params, *child, level+1); - } - - // there is no such a space - return nullptr; - } - else - { - return &space; - } -} - - - - - -/* - * - * IMPROVE ME - * add a private namespace? - * - */ -struct SpaceInfo -{ - bool inited; - pt::Space * last_space; - std::vector spaces; - - SpaceInfo() - { - inited = false; - last_space = 0; - } -}; - -static std::map spaces_map; -static size_t space_reqid = 0; - - - - - -void space_init(const std::vector & params, pt::Space & space, SpaceInfo & space_info) -{ - if( !space_info.inited || !are_spaces_the_same(params, space_info.spaces) ) - { - space_info.inited = true; - copy_space(params, space_info.spaces); - space_info.last_space = find_space(params, space); - } -} - - -void space_check_reqid() -{ - if( space_reqid != cur->request->id ) - { - space_reqid = cur->request->id; - spaces_map.clear(); - } -} - - -void space_value(Info & i, pt::Space & space, bool escape) -{ - space_check_reqid(); - - if( !i.params.empty() ) - { - SpaceInfo & space_info = spaces_map[&space]; - space_init(i.params, space, space_info); - - if( space_info.last_space ) - { - const std::wstring & param = i.params.back().str; - const std::wstring * value = space_info.last_space->get_wstr(param.c_str()); - - if( value ) - { - if( escape ) - i.out << *value; - else - i.out << R(*value); - } - } - } -} - - - - - - - -struct SpaceTabStackItem : public Ezc::FunData -{ - std::vector values; -}; - - - -void space_list_tab(Info & i, pt::Space & space) -{ - if( !i.stack.fun_data ) - { - if( !i.params.empty() ) - { - SpaceTabStackItem * stack_item = new SpaceTabStackItem(); - i.stack.fun_data = stack_item; - - pt::Space * dst_space = find_space(i.params, space); - - if( dst_space ) - dst_space->to_list(i.params.back().str, stack_item->values); - - i.res = i.iter < stack_item->values.size(); - } - } - else - { - auto stack_item = reinterpret_cast(i.stack.fun_data); - i.res = i.iter < stack_item->values.size(); - } -} - - - -void space_list_tab_value(Info & i, pt::Space & space, const std::wstring & function_name) -{ - Ezc::Stack * stack; - auto user_object = i.FindUserObject(function_name, &stack); - - if( user_object && stack->iter < user_object->values.size() ) - i.out << user_object->values[stack->iter]; -} - - -void space_list_tab_has_next(Info & i, pt::Space & space, const std::wstring & function_name) -{ - Ezc::Stack * stack; - auto user_object = i.FindUserObject(function_name, &stack); - - if( user_object && stack->iter + 1 < user_object->values.size() ) - i.res = true; - -} - - - -} // namespace TemplatesFunctions - -} // namespace Winix - - - diff --git a/winixd/templates/miscspace.h b/winixd/templates/miscspace.h deleted file mode 100644 index 269264b..0000000 --- a/winixd/templates/miscspace.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is a part of Winix - * and is distributed under the 2-Clause BSD licence. - * Author: Tomasz Sowa - */ - -/* - * Copyright (c) 2012-2016, Tomasz Sowa - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "templates.h" - -namespace Winix -{ - -namespace TemplatesFunctions -{ - - -/* - * return a value from a space - * you can define you own ezc function e.g. my_space_value(Info &i) in such a way: - * - * void my_space_value(Info & i) - * { - * space_value(i, the_space_object_i_am_interested_in); - * } - * - * and now you can call it from ezc template: - * [my_space_value "foo"] -> looking for parameter "foo" in the global space of the_space_object_i_am_interest_in - * [my_space_value "foo" "bar"] -> first looking for a space with "foo" name then looking for "bar" parameter - * - * - * there is some built-in optimization made: - * if you are looking for parameters from the same space e.g. - * [my_space_value "foo" "foo2" "param1"] - * [my_space_value "foo" "foo2" "param2"] - * [my_space_value "foo" "foo2" "param3"] - * after looking for param1 the address of foo2 space is cached in a local map (first we're looking for foo and then for foo2) - * and when looking for param2 and param3 the address of foo2 is taken from the map - * - * - */ -void space_value(Info & i, pt::Space & space, bool escape = true); - - -// !! IMPROVE ME -// add -// void space_list_tab_size(Info & i, pt::Space & space); - - - -void space_list_tab(Info & i, pt::Space & space); -void space_list_tab_value(Info & i, pt::Space & space, const std::wstring & function_name); -void space_list_tab_has_next(Info & i, pt::Space & space, const std::wstring & function_name); - - - - -// !! IMPROVE ME -// !! add space_tab (iteration through spaces) - - - - -} // namespace TemplatesFunctions - -} // namespace Winix - - diff --git a/winixd/templates/priv.cpp b/winixd/templates/priv.cpp index c90a460..517e842 100644 --- a/winixd/templates/priv.cpp +++ b/winixd/templates/priv.cpp @@ -63,7 +63,7 @@ void priv_user_tab_init(Item & item) priv_user_table.push_back(item.item_content.user_id); } else - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) { // super user is allowed to change to any user for(Users::Iterator i=system->users.Begin() ; i != system->users.End() ; ++i) @@ -112,7 +112,7 @@ void priv_user_tab_name(Info & i) User * puser = system->users.GetUser( uid ); if( puser ) - i.out << puser->name; + i.out << puser->login; else i.out << "user_id: " << uid; } @@ -168,7 +168,7 @@ void priv_group_tab_init(Item & item) priv_group_table.push_back(item.item_content.group_id); } else - if( cur->session->puser->super_user ) + if( cur->session->puser->is_super_user ) { // super user is allowed to change to any group for(Groups::Iterator i=system->groups.Begin() ; i != system->groups.End() ; ++i) diff --git a/winixd/templates/templates.cpp b/winixd/templates/templates.cpp index 75da6a3..565d895 100644 --- a/winixd/templates/templates.cpp +++ b/winixd/templates/templates.cpp @@ -308,15 +308,15 @@ void Templates::CreateFunctions() ezc_functions.Insert("dir_last_html_template", dir_last_html_template); ezc_functions.Insert("dir_last_has_html_template", dir_last_has_html_template); ezc_functions.Insert("dir_last_meta_str", dir_last_meta_str); - ezc_functions.Insert("dir_last_meta", dir_last_meta); - ezc_functions.Insert("dir_last_meta_tab", dir_last_meta_tab); - ezc_functions.Insert("dir_last_meta_tab_value", dir_last_meta_tab_value); - ezc_functions.Insert("dir_last_meta_tab_has_next", dir_last_meta_tab_has_next); - ezc_functions.Insert("dir_last_admin_meta_str", dir_last_admin_meta_str); - ezc_functions.Insert("dir_last_admin_meta", dir_last_admin_meta); - ezc_functions.Insert("dir_last_admin_meta_tab", dir_last_admin_meta_tab); - ezc_functions.Insert("dir_last_admin_meta_tab_value", dir_last_admin_meta_tab_value); - ezc_functions.Insert("dir_last_admin_meta_tab_has_next", dir_last_admin_meta_tab_has_next); +// ezc_functions.Insert("dir_last_meta", dir_last_meta); +// ezc_functions.Insert("dir_last_meta_tab", dir_last_meta_tab); +// ezc_functions.Insert("dir_last_meta_tab_value", dir_last_meta_tab_value); +// ezc_functions.Insert("dir_last_meta_tab_has_next", dir_last_meta_tab_has_next); +// ezc_functions.Insert("dir_last_admin_meta_str", dir_last_admin_meta_str); +// ezc_functions.Insert("dir_last_admin_meta", dir_last_admin_meta); +// ezc_functions.Insert("dir_last_admin_meta_tab", dir_last_admin_meta_tab); +// ezc_functions.Insert("dir_last_admin_meta_tab_value", dir_last_admin_meta_tab_value); +// ezc_functions.Insert("dir_last_admin_meta_tab_has_next", dir_last_admin_meta_tab_has_next); /* @@ -342,24 +342,24 @@ void Templates::CreateFunctions() /* env */ - ezc_functions.Insert("env_str", env_str); - ezc_functions.Insert("env", env); - ezc_functions.Insert("env_tab", env_tab); - ezc_functions.Insert("env_tab_value", env_tab_value); - ezc_functions.Insert("env_tab_has_next", env_tab_has_next); - ezc_functions.Insert("env_admin_str", env_admin_str); - ezc_functions.Insert("env_admin", env_admin); - ezc_functions.Insert("env_admin_tab", env_admin_tab); - ezc_functions.Insert("env_admin_tab_value", env_admin_tab_value); - ezc_functions.Insert("env_admin_tab_has_next", env_admin_tab_has_next); - ezc_functions.Insert("env_user_admin_env_str", env_user_admin_env_str); - ezc_functions.Insert("env_user_env_str", env_user_env_str); - ezc_functions.Insert("env_user_id", env_user_id); - ezc_functions.Insert("env_user_name", env_user_name); - ezc_functions.Insert("env_user_tab", env_user_tab); - ezc_functions.Insert("env_user_tab_id", env_user_tab_id); - ezc_functions.Insert("env_user_tab_name", env_user_tab_name); - ezc_functions.Insert("env_user_tab_is_current", env_user_tab_is_current); +// ezc_functions.Insert("env_str", env_str); +// ezc_functions.Insert("env", env); +// ezc_functions.Insert("env_tab", env_tab); +// ezc_functions.Insert("env_tab_value", env_tab_value); +// ezc_functions.Insert("env_tab_has_next", env_tab_has_next); +// ezc_functions.Insert("env_admin_str", env_admin_str); +// ezc_functions.Insert("env_admin", env_admin); +// ezc_functions.Insert("env_admin_tab", env_admin_tab); +// ezc_functions.Insert("env_admin_tab_value", env_admin_tab_value); +// ezc_functions.Insert("env_admin_tab_has_next", env_admin_tab_has_next); +// ezc_functions.Insert("env_user_admin_env_str", env_user_admin_env_str); +// ezc_functions.Insert("env_user_env_str", env_user_env_str); +// ezc_functions.Insert("env_user_id", env_user_id); +// ezc_functions.Insert("env_user_name", env_user_name); +// ezc_functions.Insert("env_user_tab", env_user_tab); +// ezc_functions.Insert("env_user_tab_id", env_user_tab_id); +// ezc_functions.Insert("env_user_tab_name", env_user_tab_name); +// ezc_functions.Insert("env_user_tab_is_current", env_user_tab_is_current); /* diff --git a/winixd/templates/templates.h b/winixd/templates/templates.h index a1ba83e..580a8ac 100644 --- a/winixd/templates/templates.h +++ b/winixd/templates/templates.h @@ -198,15 +198,15 @@ namespace TemplatesFunctions void dir_last_html_template(Info & i); void dir_last_has_html_template(Info & i); void dir_last_meta_str(Info & i); - void dir_last_meta(Info & i); - void dir_last_meta_tab(Info & i); - void dir_last_meta_tab_value(Info & i); - void dir_last_meta_tab_has_next(Info & i); - void dir_last_admin_meta_str(Info & i); - void dir_last_admin_meta(Info & i); - void dir_last_admin_meta_tab(Info & i); - void dir_last_admin_meta_tab_value(Info & i); - void dir_last_admin_meta_tab_has_next(Info & i); +// void dir_last_meta(Info & i); +// void dir_last_meta_tab(Info & i); +// void dir_last_meta_tab_value(Info & i); +// void dir_last_meta_tab_has_next(Info & i); +// void dir_last_admin_meta_str(Info & i); +// void dir_last_admin_meta(Info & i); +// void dir_last_admin_meta_tab(Info & i); +// void dir_last_admin_meta_tab_value(Info & i); +// void dir_last_admin_meta_tab_has_next(Info & i); /* @@ -232,24 +232,24 @@ namespace TemplatesFunctions /* env */ - void env_str(Info & i); - void env(Info & i); - void env_tab(Info & i); - void env_tab_value(Info & i); - void env_tab_has_next(Info & i); - void env_admin_str(Info & i); - void env_admin(Info & i); - void env_admin_tab(Info & i); - void env_admin_tab_value(Info & i); - void env_admin_tab_has_next(Info & i); - void env_user_admin_env_str(Info & i); - void env_user_env_str(Info & i); - void env_user_id(Info & i); - void env_user_name(Info & i); - void env_user_tab(Info & i); - void env_user_tab_id(Info & i); - void env_user_tab_name(Info & i); - void env_user_tab_is_current(Info & i); +// void env_str(Info & i); +// void env(Info & i); +// void env_tab(Info & i); +// void env_tab_value(Info & i); +// void env_tab_has_next(Info & i); +// void env_admin_str(Info & i); +// void env_admin(Info & i); +// void env_admin_tab(Info & i); +// void env_admin_tab_value(Info & i); +// void env_admin_tab_has_next(Info & i); +// void env_user_admin_env_str(Info & i); +// void env_user_env_str(Info & i); +// void env_user_id(Info & i); +// void env_user_name(Info & i); +// void env_user_tab(Info & i); +// void env_user_tab_id(Info & i); +// void env_user_tab_name(Info & i); +// void env_user_tab_is_current(Info & i); /* diff --git a/winixd/templates/user.cpp b/winixd/templates/user.cpp index 00f79d1..7945a49 100644 --- a/winixd/templates/user.cpp +++ b/winixd/templates/user.cpp @@ -61,7 +61,7 @@ void user_id(Info & i) void user_name(Info & i) { if( cur->session->puser ) - i.out << cur->session->puser->name; + i.out << cur->session->puser->login; } @@ -105,7 +105,7 @@ void user_is_in_all_groups(Info & i) void user_super_user(Info & i) { - if( cur->session->puser && cur->session->puser->super_user ) + if( cur->session->puser && cur->session->puser->is_super_user ) i.res = true; } @@ -260,14 +260,14 @@ void user_tab_id(Info & i) void user_tab_name(Info & i) { if( user_tab_init() ) - i.out << user_iter->name; + i.out << user_iter->login; } void user_tab_is_super_user(Info & i) { if( user_tab_init() ) - i.res = user_iter->super_user; + i.res = user_iter->is_super_user; } diff --git a/winixd/templates/who.cpp b/winixd/templates/who.cpp index 80a0887..91f1f74 100644 --- a/winixd/templates/who.cpp +++ b/winixd/templates/who.cpp @@ -93,7 +93,7 @@ void who_tab_user(Info & i) if( who_iterator->puser ) - i.out << who_iterator->puser->name; + i.out << who_iterator->puser->login; }