added: function adduser

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


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

View File

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