added: uptime winix function prints how many sessions there are

changed: functions for text/numbers conversions
         int Toi(const std::string & str,  int base = 10);
         int Toi(const std::wstring & str, int base = 10);
         int Toi(const char * str,         int base = 10);
         int Toi(const wchar_t * str,      int base = 10);

         long Tol(const std::string & str,  int base = 10);
         long Tol(const std::wstring & str, int base = 10);
         long Tol(const char * str,         int base = 10);
         long Tol(const wchar_t * str,      int base = 10);

         template<class CharType>
         bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);

         const wchar_t * Toa(unsigned int value,  int base = 10);
         const wchar_t * Toa(unsigned long value, int base = 10);
         const wchar_t * Toa(int value,  int base = 10);
         const wchar_t * Toa(long value, int base = 10);

         void Toa(int  value, std::string & res,  int base = 10, bool clear = true);
         void Toa(long value, std::string & res,  int base = 10, bool clear = true);
         void Toa(int  value, std::wstring & res, int base = 10, bool clear = true);
         void Toa(long value, std::wstring & res, int base = 10, bool clear = true);

added:   HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
         this is a special stream for automatically escaping html tags
	     



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-11-25 01:34:46 +00:00
parent 518281e101
commit 933c8841ff
53 changed files with 1925 additions and 1098 deletions

View File

@@ -20,10 +20,7 @@ namespace TemplatesFunctions
void dir(Info & i)
{
for(size_t a=0 ; a<request->dir_tab.size() ; ++a)
{
HtmlEscape(i.out, request->dir_tab[a]->url);
i.out << '/';
}
i.out << request->dir_tab[a]->url << '/';
}
@@ -31,7 +28,7 @@ void dir_without_slash(Info & i)
{
for(size_t a=0 ; a<request->dir_tab.size() ; ++a)
{
HtmlEscape(i.out, request->dir_tab[a]->url);
i.out << request->dir_tab[a]->url;
if( a < request->dir_tab.size()-1 )
i.out << '/';
@@ -46,8 +43,7 @@ void dir_parent(Info & i)
for(size_t a=0 ; a<request->dir_tab.size()-1 ; ++a)
{
HtmlEscape(i.out, request->dir_tab[a]->url);
i.out << '/';
i.out << request->dir_tab[a]->url << '/';
}
}
@@ -59,7 +55,7 @@ void dir_parent_without_slash(Info & i)
for(size_t a=0 ; a<request->dir_tab.size()-1 ; ++a)
{
HtmlEscape(i.out, request->dir_tab[a]->url);
i.out << request->dir_tab[a]->url;
if( request->dir_tab.size()>=2 && a<request->dir_tab.size()-2 )
i.out << '/';
@@ -174,7 +170,7 @@ void dir_childs_is_parent(Info & i)
void dir_childs_tab_url(Info & i)
{
if( dir_childs_index < dir_childs_table.size() )
HtmlEscape(i.out, dir_childs_table[dir_childs_index]->url);
i.out << dir_childs_table[dir_childs_index]->url;
}
@@ -182,7 +178,7 @@ void dir_childs_tab_url(Info & i)
void dir_childs_tab_privileges(Info & i)
{
if( dir_childs_index < dir_childs_table.size() )
i.out << "0" << Itoa(dir_childs_table[dir_childs_index]->privileges, 8);
i.out << "0" << Toa(dir_childs_table[dir_childs_index]->privileges, 8);
}
@@ -194,13 +190,13 @@ void dir_childs_tab_user(Info & i)
User * puser = system->users.GetUser(user_id);
if( puser )
HtmlEscape(i.out, puser->name);
i.out << puser->name;
else
{
i.out << "~";
if( !dir_childs_table[dir_childs_index]->guest_name.empty() )
HtmlEscape(i.out, dir_childs_table[dir_childs_index]->guest_name);
i.out << dir_childs_table[dir_childs_index]->guest_name;
else
i.out << "guest"; // !! dodac do konfiga
}
@@ -217,7 +213,7 @@ void dir_childs_tab_group(Info & i)
Group * pgroup = system->groups.GetGroup(group_id);
if( pgroup )
HtmlEscape(i.out, pgroup->name);
i.out << pgroup->name;
else
i.out << group_id;
}
@@ -241,7 +237,7 @@ void dir_tab(Info & i)
void dir_tab_url(Info & i)
{
if( dir_index < request->dir_tab.size() )
HtmlEscape(i.out, request->dir_tab[dir_index]->url);
i.out << request->dir_tab[dir_index]->url;
}
@@ -251,7 +247,7 @@ void dir_tab_link(Info & i)
for(size_t a = 0 ; a <= dir_index && a < request->dir_tab.size() ; ++a)
{
HtmlEscape(i.out, request->dir_tab[a]->url);
i.out << request->dir_tab[a]->url;
i.out << '/';
}
}
@@ -298,7 +294,7 @@ void dir_last_default_item_dir(Info & i)
if( dir_last_default_item.parent_id != -1 )
if( system->dirs.MakePath(dir_last_default_item.parent_id, path) )
HtmlEscape(i.out, path);
i.out << path;
}
@@ -306,13 +302,13 @@ void dir_last_default_item_url(Info & i)
{
dir_last_default_item_init();
HtmlEscape(i.out, dir_last_default_item.url);
i.out << dir_last_default_item.url;
}
void dir_last_subject(Info & i)
{
HtmlEscape(i.out, request->dir_tab.back()->subject);
i.out << request->dir_tab.back()->subject;
}
@@ -321,13 +317,13 @@ void dir_last_user(Info & i)
User * puser = system->users.GetUser(request->dir_tab.back()->user_id);
if( puser )
HtmlEscape(i.out, puser->name);
i.out << puser->name;
else
{
i.out << "~";
if( !request->dir_tab.back()->guest_name.empty() )
HtmlEscape(i.out, request->dir_tab.back()->guest_name);
i.out << request->dir_tab.back()->guest_name;
else
i.out << "guest"; // !! dodac do konfiga
}
@@ -336,7 +332,7 @@ void dir_last_user(Info & i)
void dir_last_url(Info & i)
{
HtmlEscape(i.out, request->dir_tab.back()->url);
i.out << request->dir_tab.back()->url;
}
@@ -402,7 +398,7 @@ void dir_last_modification_user(Info & i)
void dir_last_html_template(Info & i)
{
HtmlEscape(i.out, request->dir_tab.back()->html_template);
i.out << request->dir_tab.back()->html_template;
}