added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -69,7 +69,7 @@ Functions::Iterator Functions::End()
|
||||
}
|
||||
|
||||
|
||||
FunctionBase * Functions::Find(const std::string & function_name)
|
||||
FunctionBase * Functions::Find(const std::wstring & function_name)
|
||||
{
|
||||
Table::iterator i = table.find(function_name);
|
||||
|
||||
@@ -105,7 +105,7 @@ void Functions::PrepareUrl(Item & item)
|
||||
|
||||
Error Functions::CheckSpecialFile(const Item & item)
|
||||
{
|
||||
static std::string fstab = "fstab";
|
||||
static std::wstring fstab = L"fstab";
|
||||
|
||||
Item * etc = system->dirs.GetEtcDir();
|
||||
|
||||
@@ -403,8 +403,8 @@ return false;
|
||||
// returning true if the 'url' has to be changed
|
||||
void Functions::ReadItemUrlSubject(Item & item, Item::Type item_type)
|
||||
{
|
||||
std::string * new_subject = request->PostVarp("subject");
|
||||
std::string * new_url = request->PostVarp("url");
|
||||
std::wstring * new_subject = request->PostVarp(L"subject");
|
||||
std::wstring * new_url = request->PostVarp(L"url");
|
||||
|
||||
if( new_subject )
|
||||
item.subject = *new_subject;
|
||||
@@ -412,7 +412,7 @@ void Functions::ReadItemUrlSubject(Item & item, Item::Type item_type)
|
||||
if( item.subject.empty() )
|
||||
{
|
||||
item.subject = request->dir_tab.back()->subject;
|
||||
item.subject += "_msg_";
|
||||
item.subject += L"_msg_";
|
||||
item.subject += ToStr(db->Size(request->dir_tab.back()->id, Item::file));
|
||||
}
|
||||
|
||||
@@ -432,14 +432,14 @@ void Functions::ReadItemFilterHtml(Item & item)
|
||||
html_filter.CheckOrphans(HTMLFilter::lang_none);
|
||||
html_filter.SafeMode(true);
|
||||
|
||||
html_filter.Filter(request->PostVar("itemcontent"), item.content);
|
||||
html_filter.Filter(request->PostVar(L"itemcontent"), item.content);
|
||||
}
|
||||
|
||||
|
||||
void Functions::ReadItemContent(Item & item, const std::string & content_type)
|
||||
void Functions::ReadItemContent(Item & item, const std::wstring & content_type)
|
||||
{
|
||||
bool is_root = request->session->puser && request->session->puser->super_user;
|
||||
bool filter_html = (content_type == "2") && config->editors_html_safe_mode;
|
||||
bool filter_html = (content_type == L"2") && config->editors_html_safe_mode;
|
||||
|
||||
if( filter_html && is_root && config->editors_html_safe_mode_skip_root )
|
||||
filter_html = false;
|
||||
@@ -447,24 +447,24 @@ void Functions::ReadItemContent(Item & item, const std::string & content_type)
|
||||
if( filter_html )
|
||||
ReadItemFilterHtml(item);
|
||||
else
|
||||
request->PostVar("itemcontent", item.content);
|
||||
request->PostVar(L"itemcontent", item.content);
|
||||
}
|
||||
|
||||
|
||||
void Functions::ReadItemContentWithType(Item & item)
|
||||
{
|
||||
item.content_type = Item::ct_formatted_text; // default is formatted text
|
||||
request->PostVar("contenttype", temp);
|
||||
request->PostVar(L"contenttype", temp);
|
||||
|
||||
ReadItemContent(item, temp);
|
||||
|
||||
|
||||
// ct_text and ct_formatted_text can use everyone
|
||||
|
||||
if( temp == "0" )
|
||||
if( temp == L"0" )
|
||||
item.content_type = Item::ct_text;
|
||||
else
|
||||
if( temp == "1" )
|
||||
if( temp == L"1" )
|
||||
item.content_type = Item::ct_formatted_text;
|
||||
|
||||
|
||||
@@ -476,19 +476,19 @@ void Functions::ReadItemContentWithType(Item & item)
|
||||
long user_id = request->session->puser->id;
|
||||
|
||||
|
||||
if( temp == "2" )
|
||||
if( temp == L"2" )
|
||||
{
|
||||
if( system->CanUseHtml(user_id) )
|
||||
item.content_type = Item::ct_html;
|
||||
}
|
||||
else
|
||||
if( temp == "3" )
|
||||
if( temp == L"3" )
|
||||
{
|
||||
if( system->CanUseBBCode(user_id) )
|
||||
item.content_type = Item::ct_bbcode;
|
||||
}
|
||||
else
|
||||
if( temp == "4" )
|
||||
if( temp == L"4" )
|
||||
{
|
||||
if( system->CanUseRaw(user_id) )
|
||||
item.content_type = Item::ct_raw;
|
||||
@@ -526,7 +526,7 @@ void Functions::SetUser(Item & item)
|
||||
else
|
||||
{
|
||||
item.user_id = -1;
|
||||
request->PostVar("guestname", item.guest_name);
|
||||
request->PostVar(L"guestname", item.guest_name);
|
||||
}
|
||||
|
||||
item.group_id = request->dir_tab.back()->group_id;
|
||||
|
Reference in New Issue
Block a user