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

@@ -40,7 +40,7 @@ void item_id(Info & i)
void item_subject(Info & i)
{
HtmlEscape(i.out, request->item.subject);
i.out << request->item.subject;
}
@@ -53,7 +53,7 @@ void item_subject_noescape(Info & i)
void item_content(Info & i)
{
HtmlEscape(i.out, request->item.content);
i.out << request->item.content;
}
@@ -91,11 +91,11 @@ void item_content_type_is(Info & i)
}
void item_print_content(TextStream<std::wstring> & out, const std::wstring & content, Item::ContentType content_type)
void item_print_content(HtmlTextStream & out, const std::wstring & content, Item::ContentType content_type)
{
if( content_type == Item::ct_text )
{
HtmlEscape(out, content);
out << content;
}
else
if( content_type == Item::ct_formatted_text )
@@ -105,7 +105,7 @@ void item_print_content(TextStream<std::wstring> & out, const std::wstring & con
else
if( content_type == Item::ct_html || content_type == Item::ct_raw )
{
out << content;
out << R(content);
}
else
if( content_type == Item::ct_bbcode )
@@ -115,7 +115,7 @@ void item_print_content(TextStream<std::wstring> & out, const std::wstring & con
out_temp.reserve(content.size()*2);
bbcode_parser.Filter(content.c_str(), out_temp);
out << out_temp;
out << R(out_temp);
}
}
@@ -134,7 +134,7 @@ void item_print_content(Info & i)
void item_privileges(Info & i)
{
i.out << Itoa(request->item.privileges, 8);
i.out << Toa(request->item.privileges, 8);
}
@@ -146,7 +146,7 @@ void item_dir(Info & i)
void item_url(Info & i)
{
HtmlEscape(i.out, request->item.url);
i.out << request->item.url;
}
@@ -161,7 +161,7 @@ void item_url_is(Info & i)
void item_link(Info & i)
{
HtmlEscape(i.out, config->base_url);
i.out << config->base_url;
item_dir(i);
item_url(i);
}
@@ -278,9 +278,9 @@ void item_run(Info & i)
}
Ezc::Pattern * p = pattern_cacher.GetPattern(request->item);
TextStream<std::wstring> item_run_content;
HtmlTextStream item_run_content; // !! zrobic static z tego i tu dac tylko clearowanie
Ezc::Generator<TextStream<std::wstring> > gen(item_run_content, *p, ezc_functions);
EzcGen gen(item_run_content, *p, ezc_functions);
gen.Generate();
item_print_content(i.out, item_run_content.Str(), request->item.content_type);
@@ -289,13 +289,13 @@ void item_run(Info & i)
void item_guest_name(Info & i)
{
HtmlEscape(i.out, request->item.guest_name);
i.out << request->item.guest_name;
}
void item_html_template(Info & i)
{
HtmlEscape(i.out, request->item.html_template);
i.out << request->item.html_template;
}
@@ -330,7 +330,7 @@ void item_tab_id(Info & i)
void item_tab_subject(Info & i)
{
if( item_index < request->item_tab.size() )
HtmlEscape(i.out, request->item_tab[item_index].subject);
i.out << request->item_tab[item_index].subject;
}
void item_tab_subject_noescape(Info & i)
@@ -343,7 +343,7 @@ void item_tab_subject_noescape(Info & i)
void item_tab_content(Info & i)
{
if( item_index < request->item_tab.size() )
HtmlEscape(i.out, request->item_tab[item_index].content);
i.out << request->item_tab[item_index].content;
}
@@ -369,7 +369,7 @@ void item_tab_print_content(Info & i)
void item_tab_privileges(Info & i)
{
if( item_index < request->item_tab.size() )
i.out << "0" << Itoa(request->item_tab[item_index].privileges, 8);
i.out << "0" << Toa(request->item_tab[item_index].privileges, 8);
}
@@ -381,9 +381,9 @@ void item_tab_dir(Info & i)
std::wstring path;
if( system->dirs.MakePath(request->item_tab[item_index].parent_id, path) )
HtmlEscape(i.out, path);
i.out << path;
else
i.out << "/the path does not exist/";
i.out << "/the path does not exist/"; // !! do konfiga
}
}
@@ -391,7 +391,7 @@ void item_tab_dir(Info & i)
void item_tab_url(Info & i)
{
if( item_index < request->item_tab.size() )
HtmlEscape(i.out, request->item_tab[item_index].url);
i.out << request->item_tab[item_index].url;
}
@@ -399,7 +399,7 @@ void item_tab_link(Info & i)
{
if( item_index < request->item_tab.size() )
{
HtmlEscape(i.out, config->base_url);
i.out << config->base_url;
item_tab_dir(i);
item_tab_url(i);
}
@@ -410,7 +410,7 @@ void item_tab_link_auth(Info & i)
{
if( item_index < request->item_tab.size() )
{
HtmlEscape(i.out, config->base_url_auth);
i.out << config->base_url_auth;
item_tab_dir(i);
item_tab_url(i);
}
@@ -477,7 +477,7 @@ void item_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;
}
@@ -551,9 +551,9 @@ void item_tab_run(Info & i)
}
Ezc::Pattern * p = pattern_cacher.GetPattern(request->item_tab[item_index]);
TextStream<std::wstring> item_run_content;
HtmlTextStream item_run_content; // !! zrobic static z tego i tu dac tylko clearowanie
Ezc::Generator<TextStream<std::wstring> > gen(item_run_content, *p, ezc_functions);
EzcGen gen(item_run_content, *p, ezc_functions);
gen.Generate();
item_print_content(i.out, item_run_content.Str(), request->item_tab[item_index].content_type);