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:
2010-11-21 00:19:17 +00:00
parent f1f0fa34cb
commit 8e72a820dd
153 changed files with 4270 additions and 2784 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -17,11 +17,11 @@ namespace Fun
AddUser::AddUser()
{
fun.url = "adduser";
fun.url = L"adduser";
}
bool AddUser::CheckAddUserVars(const std::string & login, const std::string & pass, const std::string & conf_pass)
bool AddUser::CheckAddUserVars(const std::wstring & login, const std::wstring & pass, const std::wstring & conf_pass)
{
if( login.empty() )
{
@@ -59,15 +59,15 @@ void AddUser::MakePost()
{
User user;
const std::string & login = request->PostVar("login");
const std::string & pass = request->PostVar("password");
const std::string & conf_pass = request->PostVar("confirmpassword");
const std::wstring & login = request->PostVar(L"login");
const std::wstring & pass = request->PostVar(L"password");
const std::wstring & conf_pass = request->PostVar(L"confirmpassword");
if( !CheckAddUserVars(login, pass, conf_pass) )
return;
user.name = login;
user.email = request->PostVar("email");
user.email = request->PostVar(L"email");
request->status = db->AddUser(user, pass);

View File

@@ -27,7 +27,7 @@ public:
private:
bool CheckAddUserVars(const std::string & login, const std::string & pass, const std::string & conf_pass);
bool CheckAddUserVars(const std::wstring & login, const std::wstring & pass, const std::wstring & conf_pass);
};

View File

@@ -16,7 +16,7 @@ namespace Fun
Cat::Cat()
{
fun.url = "cat";
fun.url = L"cat";
}
@@ -36,7 +36,7 @@ void Cat::MakeGet()
return;
}
request->send_as_attachment = request->IsParam("attachment");
request->send_as_attachment = request->IsParam(L"attachment");
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Chmod::Chmod()
{
fun.url = "chmod";
fun.url = L"chmod";
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Chown::Chown()
{
fun.url = "chown";
fun.url = L"chown";
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Ckeditor::Ckeditor()
{
fun.url = "ckeditor";
fun.url = L"ckeditor";
}

View File

@@ -18,7 +18,7 @@ namespace Fun
Cp::Cp()
{
fun.url = "cp";
fun.url = L"cp";
}
@@ -33,7 +33,7 @@ bool Cp::CpCheckAccessFrom()
}
}
else
if( !request->IsParam("r") )
if( !request->IsParam(L"r") )
{
// directories need 'r' parameter
request->status = WINIX_ERR_PERMISSION_DENIED;
@@ -65,9 +65,9 @@ return true;
bool Cp::ParseDir(long & dir_id, std::string & dir, std::string & file)
bool Cp::ParseDir(long & dir_id, std::wstring & dir, std::wstring & file)
{
int res = system->dirs.AnalyzePath(request->PostVar("to"), dir_id, dir, file);
int res = system->dirs.AnalyzePath(request->PostVar(L"to"), dir_id, dir, file);
if( res == 1 )
request->status = WINIX_ERR_NO_ROOT_DIR;
@@ -296,7 +296,7 @@ void Cp::MakePost()
CheckAccessTo(mv_dir_id) )
{
CpPrepare();
cp_preserve_attr = request->IsPostVar("preserveattr");
cp_preserve_attr = request->IsPostVar(L"preserveattr");
if( request->is_item )
{
@@ -304,9 +304,9 @@ void Cp::MakePost()
}
else
{
cp_remove_defaults = request->IsPostVar("removedefaults");
cp_remove_defaults = request->IsPostVar(L"removedefaults");
if( request->IsPostVar("onlycontent") )
if( request->IsPostVar(L"onlycontent") )
CpContentOfDirCheck(*request->dir_tab.back());
else
CpDirCheck(*request->dir_tab.back());

View File

@@ -35,14 +35,14 @@ private:
long cp_new_user;
long cp_new_group;
std::string mv_dir;
std::string mv_file;
std::string mv_new_path;
std::wstring mv_dir;
std::wstring mv_file;
std::wstring mv_new_path;
long mv_dir_id;
bool CpCheckAccessFrom();
bool CheckAccessTo(long dir_id);
bool ParseDir(long & dir_id, std::string & dir, std::string & file);
bool ParseDir(long & dir_id, std::wstring & dir, std::wstring & file);
void CpAuth(Item & item);
void CpSetNewAttributes(Item & item);
void CpItem(Item & item, long dst_dir_id);

View File

@@ -16,7 +16,7 @@ namespace Fun
CreateThread::CreateThread()
{
fun.url = "createthread";
fun.url = L"createthread";
}

View File

@@ -16,7 +16,7 @@ namespace Fun
Default::Default()
{
fun.url = "default";
fun.url = L"default";
}
@@ -25,12 +25,12 @@ long Default::PostFunDefaultParsePath()
Item * pdir, * pdir2;
long defaultid = -1;
const std::string & path = request->PostVar("defaultitem");
const std::wstring & path = request->PostVar(L"defaultitem");
if( !path.empty() )
{
std::string dir, file;
std::wstring dir, file;
Dirs::SplitPath(path, dir, file);
pdir = system->dirs.GetDir(dir);

View File

@@ -17,7 +17,7 @@ namespace Fun
Download::Download()
{
fun.url = "download";
fun.url = L"download";
}
@@ -40,7 +40,7 @@ void Download::MakeGet()
return;
}
request->send_as_attachment = request->IsParam("attachment");
request->send_as_attachment = request->IsParam(L"attachment");
request->x_sendfile = request->item.auth_path;
}

View File

@@ -18,7 +18,7 @@ namespace Fun
Emacs::Emacs()
{
fun.url = "emacs";
fun.url = L"emacs";
}

View File

@@ -32,7 +32,7 @@ private:
bool PostEmacsCheckAbuse(bool adding);
void PostFunEmacsModifyMountPoint(bool adding);
std::string old_url;
std::wstring old_url;
};

View File

@@ -73,7 +73,7 @@ void FunctionParser::ParseItem()
// request->dir_tab has at least one element
long parent_id = request->dir_tab.back()->id;
const std::string & url = request->get_tab[get_index];
const std::wstring & url = request->get_tab[get_index];
request->status = db->GetItem(parent_id, url, request->item);
@@ -119,7 +119,7 @@ void FunctionParser::ParseFunction()
void FunctionParser::ParseParams(const std::string & par)
void FunctionParser::ParseParams(const std::wstring & par)
{
Param param;
size_t i;

View File

@@ -35,7 +35,7 @@ class FunctionParser
void ParseItem();
bool IsAppFunction();
void ParseFunction();
void ParseParams(const std::string & par);
void ParseParams(const std::wstring & par);
void ParseParams();
public:

View File

@@ -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;

View File

@@ -87,7 +87,7 @@ public:
Fun::Who fun_who;
Fun::Vim fun_vim;
typedef std::map<std::string, FunctionBase*> Table;
typedef std::map<std::wstring, FunctionBase*> Table;
typedef Table::iterator Iterator;
void Init();
@@ -107,7 +107,7 @@ public:
void SetTemplates(Templates * ptemplates);
void SetNotify(Notify * pnotify);
FunctionBase * Find(const std::string & function_name);
FunctionBase * Find(const std::wstring & function_name);
Error CheckSpecialFile(const Item & item);
void PrepareUrl(Item & item);
void SetDefaultFunction();
@@ -118,7 +118,7 @@ public:
// !! dac lepsze nazwy
void ReadItemFilterHtml(Item & item);
void ReadItemContent(Item & item, const std::string & content_type);
void ReadItemContent(Item & item, const std::wstring & content_type);
void ReadItemContentWithType(Item & item);
// if item.url is not empty and there is not a post variable "url"
@@ -141,7 +141,7 @@ private:
Templates * templates;
Notify * notify;
std::string temp;
std::wstring temp;
HTMLFilter html_filter;
void CreateFunctions();

View File

@@ -17,7 +17,7 @@ namespace Fun
FunThread::FunThread()
{
fun.url = "thread";
fun.url = L"thread";
Clear();
}
@@ -66,7 +66,7 @@ void FunThread::MakeGet()
DbItemQuery iq;
if( system->mounts.pmount->IsArg(system->mounts.MountParThread(), "sort_desc") )
if( system->mounts.pmount->IsArg(system->mounts.MountParThread(), L"sort_desc") )
iq.sort_asc = false;
iq.WhereParentId(request->dir_tab.back()->id);

View File

@@ -15,7 +15,7 @@ namespace Fun
Last::Last()
{
fun.url = "last";
fun.url = L"last";
}

View File

@@ -15,16 +15,16 @@ namespace Fun
Login::Login()
{
fun.url = "login";
fun.url = L"login";
}
void Login::MakePost()
{
const std::string & login = request->PostVar("login");
const std::string & pass = request->PostVar("password");
const std::string & remem = request->PostVar("rememberme");
const std::wstring & login = request->PostVar(L"login");
const std::wstring & pass = request->PostVar(L"password");
const std::wstring & remem = request->PostVar(L"rememberme");
long user_id;
if( db->CheckUser(login, pass, user_id) )

View File

@@ -18,7 +18,7 @@ namespace Fun
Logout::Logout()
{
fun.url = "logout";
fun.url = L"logout";
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Ls::Ls()
{
fun.url = "ls";
fun.url = L"ls";
}
@@ -32,7 +32,7 @@ void Ls::MakeGet()
iq.WhereParentId(request->dir_tab.back()->id);
iq.WhereType(Item::file);
if( request->IsParam("ckeditor_browse") )
if( request->IsParam(L"ckeditor_browse") )
{
iq.WhereAuth(Item::auth_image);
db->GetItems(request->item_tab, iq);

View File

@@ -17,7 +17,7 @@ namespace Fun
Mkdir::Mkdir()
{
fun.url = "mkdir";
fun.url = L"mkdir";
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Mv::Mv()
{
fun.url = "mv";
fun.url = L"mv";
}
@@ -43,7 +43,7 @@ Item * last_but_one = 0;
{
// used in POST when the moving is performed
if( request->IsPostVar("onlycontent") )
if( request->IsPostVar(L"onlycontent") )
return system->HasWriteAccess(*last);
else
if( last_but_one )
@@ -131,9 +131,9 @@ return true;
bool Mv::MoveParseDir(long & dir_id, std::string & dir, std::string & file)
bool Mv::MoveParseDir(long & dir_id, std::wstring & dir, std::wstring & file)
{
int res = system->dirs.AnalyzePath(request->PostVar("to"), dir_id, dir, file);
int res = system->dirs.AnalyzePath(request->PostVar(L"to"), dir_id, dir, file);
if( res == 1 )
request->status = WINIX_ERR_NO_ROOT_DIR;
@@ -154,9 +154,9 @@ void Mv::MoveAuth(Item & item)
return;
}
if( rename(item.auth_path.c_str(), mv_new_path.c_str()) == 0 )
if( RenameFile(item.auth_path, mv_new_path) )
{
log << log1 << "Content: moved static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
log << log1 << "Mv: moved static file from: " << item.auth_path << ", to: " << mv_new_path << logend;
item.auth_path = mv_new_path;
request->status = db->EditAuthById(item, item.id);
}
@@ -164,7 +164,7 @@ void Mv::MoveAuth(Item & item)
{
int err = errno;
log << log1 << "Content: can't move a file from: " << item.auth_path << ", to: " << mv_new_path << ", ";
log << log1 << "Mv: can't move a file from: " << item.auth_path << ", to: " << mv_new_path << ", ";
log.SystemErr(err);
log << logend;
@@ -208,7 +208,7 @@ void Mv::MoveFile(Item & item, bool redirect)
if( request->status == WINIX_ERR_OK )
{
log << log2 << "Content: the file was moved to: " << mv_dir << item.url << logend;
log << log2 << "Mv: the file was moved to: " << mv_dir << item.url << logend;
if( item.auth != Item::auth_none )
MoveAuth(item);
@@ -288,7 +288,7 @@ void Mv::MoveDir(Item & item, bool redirect)
if( mv_dir_id == item.id || system->dirs.HasParent(mv_dir_id, item.id) )
{
log << log1 << "Content: cannot move directory to inside it" << logend;
log << log1 << "Mv: cannot move directory to inside it" << logend;
request->status = WINIX_ERR_INCORRECT_DIR;
return;
}
@@ -311,7 +311,7 @@ void Mv::MoveDir(Item & item, bool redirect)
if( request->status == WINIX_ERR_OK )
{
log << log2 << "Content: the directory was moved to: " << mv_dir << item.url << logend;
log << log2 << "Mv: the directory was moved to: " << mv_dir << item.url << logend;
MoveAuthContentOfDir(item);
if( redirect )
@@ -337,7 +337,7 @@ void Mv::MakePost()
{
MoveAuthPrepareQuery();
if( request->IsPostVar("onlycontent") )
if( request->IsPostVar(L"onlycontent") )
{
if( mv_file.empty() )
MoveContentOfDir();

View File

@@ -28,9 +28,9 @@ public:
private:
std::string mv_dir;
std::string mv_file;
std::string mv_new_path;
std::wstring mv_dir;
std::wstring mv_file;
std::wstring mv_new_path;
long mv_dir_id;
std::vector<Item> mv_auth;
DbItemQuery mv_auth_iq;
@@ -39,7 +39,7 @@ private:
bool MoveCheckAccessFrom();
bool MoveCheckAccessTo(long dir_id);
bool MoveCheckMountPoints(long dir_id);
bool MoveParseDir(long & dir_id, std::string & dir, std::string & file);
bool MoveParseDir(long & dir_id, std::wstring & dir, std::wstring & file);
void MoveAuth(Item & item);
bool MoveIsTheSameFile(const Item & item);
void MoveFile(Item & item, bool redirect = true);

View File

@@ -15,7 +15,7 @@ namespace Fun
Node::Node()
{
fun.url = "node";
fun.url = L"node";
}
@@ -28,8 +28,7 @@ void Node::MakeGet()
return;
}
long id = atol( request->param_tab[0].name.c_str() );
long id = Atol(request->param_tab[0].name);
system->RedirectTo(id);
}

View File

@@ -17,7 +17,7 @@ namespace Fun
Priv::Priv()
{
fun.url = "priv";
fun.url = L"priv";
}

View File

@@ -34,7 +34,7 @@ bool PrivChanger::CheckAccess()
// but we cannot use parameter 'r' on files
// and only logged users can change permissions
if( !request->session->puser || (request->is_item && request->IsParam("r")) )
if( !request->session->puser || (request->is_item && request->IsParam(L"r")) )
{
request->status = WINIX_ERR_PERMISSION_DENIED;
return false;
@@ -107,7 +107,7 @@ void PrivChanger::ChangePriv(Item & item, long user_id, long group_id, int privi
void PrivChanger::PrivLogStart(const char * what, long user, long group, int priv)
void PrivChanger::PrivLogStart(const wchar_t * what, long user, long group, int priv)
{
log << log2 << what;
@@ -146,7 +146,7 @@ void PrivChanger::PrivLogStart(const char * what, long user, long group, int pri
void PrivChanger::PrivLog(const char * what, long id, const std::string & url)
void PrivChanger::PrivLog(const wchar_t * what, long id, const std::wstring & url)
{
Item * root = 0;
@@ -181,7 +181,7 @@ void PrivChanger::PrivFilesInDir(long parent_id)
for( ; i != request->item_tab.end() ; ++i)
{
PrivLog("changed file: ", -1, i->url);
PrivLog(L"changed file: ", -1, i->url);
ChangePriv(*i, user_id_file, group_id_file, priv_file);
}
}
@@ -198,7 +198,7 @@ void PrivChanger::PrivDir(long parent_id)
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextParent(i) )
{
PrivLog("changed dir: ", -1, i->second->url);
PrivLog(L"changed dir: ", -1, i->second->url);
ChangePriv(*(i->second), user_id_dir, group_id_dir, priv_dir);
if( subdirectories )
@@ -207,12 +207,12 @@ void PrivChanger::PrivDir(long parent_id)
}
void PrivChanger::ReadPriv(const char * user_in, const char * group_in, const char * priv_in,
void PrivChanger::ReadPriv(const wchar_t * user_in, const wchar_t * group_in, const wchar_t * priv_in,
long & user_id, long & group_id, int & priv)
{
const std::string & user_str = request->PostVar(user_in);
const std::string & group_str = request->PostVar(group_in);
const std::string & priv_str = request->PostVar(priv_in);
const std::wstring & user_str = request->PostVar(user_in);
const std::wstring & group_str = request->PostVar(group_in);
const std::wstring & priv_str = request->PostVar(priv_in);
if( change_owner )
{
@@ -221,28 +221,28 @@ void PrivChanger::ReadPriv(const char * user_in, const char * group_in, const ch
}
if( change_priv )
priv = strtol(priv_str.c_str(), 0, 8);
priv = wcstol(priv_str.c_str(), 0, 8);
}
void PrivChanger::PrivDir()
{
ReadPriv("userfile", "groupfile", "privilegesfile", user_id_file, group_id_file, priv_file);
ReadPriv("userdir", "groupdir", "privilegesdir", user_id_dir, group_id_dir, priv_dir);
ReadPriv(L"userfile", L"groupfile", L"privilegesfile", user_id_file, group_id_file, priv_file);
ReadPriv(L"userdir", L"groupdir", L"privilegesdir", user_id_dir, group_id_dir, priv_dir);
PrivLogStart("Content: changes for files: ", user_id_file, group_id_file, priv_file);
PrivLogStart("Content: changes for dirs: ", user_id_dir, group_id_dir, priv_dir);
PrivLogStart(L"Content: changes for files: ", user_id_file, group_id_file, priv_file);
PrivLogStart(L"Content: changes for dirs: ", user_id_dir, group_id_dir, priv_dir);
if( request->IsPostVar("changecurrentdir") )
if( request->IsPostVar(L"changecurrentdir") )
{
Item & last_dir = *request->dir_tab.back();
PrivLog("changed dir: ", last_dir.id, last_dir.url);
PrivLog(L"changed dir: ", last_dir.id, last_dir.url);
ChangePriv(*request->dir_tab.back(), user_id_dir, group_id_dir, priv_dir);
}
subdirectories = request->IsPostVar("changesubdirs");
subdirectories = request->IsPostVar(L"changesubdirs");
// go through all directories
PrivDir(request->dir_tab.back()->id);
@@ -255,9 +255,8 @@ void PrivChanger::PrivDir()
// changing only one item (either a dir or file)
void PrivChanger::PrivOneItem()
{
ReadPriv("user", "group", "privileges", user_id_file, group_id_file, priv_file);
PrivLogStart("Content: changes: ", user_id_file, group_id_file, priv_file);
ReadPriv(L"user", L"group", L"privileges", user_id_file, group_id_file, priv_file);
PrivLogStart(L"Content: changes: ", user_id_file, group_id_file, priv_file);
if( request->is_item )
{
@@ -281,7 +280,7 @@ void PrivChanger::Change(bool change_owner_, bool change_priv_)
change_owner = change_owner_;
change_priv = change_priv_;
if( request->IsParam("r") )
if( request->IsParam(L"r") )
{
PrivDir();
}

View File

@@ -42,11 +42,11 @@ private:
bool ChangeOwner(Item & item, long user_id, long group_id);
bool ChangePrivileges(Item & item, int privileges);
void ChangePriv(Item & item, long user_id, long group_id, int privileges);
void PrivLogStart(const char * what, long user, long group, int priv);
void PrivLog(const char * what, long id, const std::string & url);
void PrivLogStart(const wchar_t * what, long user, long group, int priv);
void PrivLog(const wchar_t * what, long id, const std::wstring & url);
void PrivFilesInDir(long parent_id);
void PrivDir(long parent_id);
void ReadPriv(const char * user_in, const char * group_in, const char * priv_in,
void ReadPriv(const wchar_t * user_in, const wchar_t * group_in, const wchar_t * priv_in,
long & user_id, long & group_id, int & priv);
void PrivDir();
void PrivOneItem();

View File

@@ -17,7 +17,7 @@ namespace Fun
Reload::Reload()
{
fun.url = "reload";
fun.url = L"reload";
fun.privileges = 0700;
}
@@ -44,7 +44,7 @@ void Reload::MakeGet()
return;
}
if( request->IsParam("templates") )
if( request->IsParam(L"templates") )
FunReloadTemplates();
}

View File

@@ -11,6 +11,7 @@
#include <errno.h>
#include "rm.h"
#include "core/plugin.h"
#include "core/misc.h"
#include "templates/templates.h"
@@ -20,7 +21,7 @@ namespace Fun
Rm::Rm()
{
fun.url = "rm";
fun.url = L"rm";
}
@@ -151,7 +152,7 @@ void Rm::RemoveDir()
if( request->param_tab.empty() )
request->status = WINIX_ERR_PERMISSION_DENIED; // use parameter "r" for removing a directory
else
if( request->IsParam("r") )
if( request->IsParam(L"r") )
RemoveAllDirs();
else
request->status = WINIX_ERR_UNKNOWN_PARAM;
@@ -167,7 +168,7 @@ void Rm::RemoveAuth(Item & item)
return;
}
if( remove(item.auth_path.c_str()) == 0 )
if( ::RemoveFile(item.auth_path) )
{
log << log1 << "Content: removed static file: " << item.auth_path << logend;
item.auth_path.clear();
@@ -230,7 +231,7 @@ void Rm::RemoveFile()
void Rm::MakeGet()
{
if( request->IsParam("confirm") )
if( request->IsParam(L"confirm") )
return; // show confirmation dialog
if( request->is_item )

View File

@@ -16,7 +16,7 @@ namespace Fun
Run::Run()
{
fun.url = "run";
fun.url = L"run";
}

View File

@@ -15,7 +15,7 @@ namespace Fun
Stat::Stat()
{
fun.url = "stat";
fun.url = L"stat";
}

View File

@@ -15,7 +15,7 @@ namespace Fun
Subject::Subject()
{
fun.url = "subject";
fun.url = L"subject";
}
@@ -45,7 +45,7 @@ void Subject::EditDirSubject()
{
Item & dir = *request->dir_tab.back();
request->PostVar("subject", dir.subject);
request->PostVar(L"subject", dir.subject);
db->EditSubjectById(dir, dir.id);
system->RedirectToLastDir();
@@ -55,7 +55,7 @@ void Subject::EditDirSubject()
void Subject::EditFileSubject()
{
request->PostVar("subject", request->item.subject);
request->PostVar(L"subject", request->item.subject);
db->EditSubjectById(request->item, request->item.id);
system->RedirectTo(request->item);

View File

@@ -17,7 +17,7 @@ namespace Fun
Template::Template()
{
fun.url = "template";
fun.url = L"template";
}
@@ -53,9 +53,9 @@ void Template::PutLog(Item & item)
}
void Template::CreateTemplateFileName(const std::string & index_str)
void Template::CreateTemplateFileName(const std::wstring & index_str)
{
int index = atoi(index_str.c_str());
int index = Atoi(index_str);
if( index < 0 )
{
@@ -96,7 +96,7 @@ void Template::ChangeTemplate(Item & item)
void Template::MakePost()
{
CreateTemplateFileName(request->PostVar("template"));
CreateTemplateFileName(request->PostVar(L"template"));
ChangeTemplate(*request->last_item);
system->RedirectToLastItem();

View File

@@ -28,8 +28,8 @@ public:
private:
std::string html_template;
void CreateTemplateFileName(const std::string & index_str);
std::wstring html_template;
void CreateTemplateFileName(const std::wstring & index_str);
void ChangeTemplate(Item & item);
void PutLog(Item & item);
};

View File

@@ -17,7 +17,7 @@ namespace Fun
Tinymce::Tinymce()
{
fun.url = "tinymce";
fun.url = L"tinymce";
}

View File

@@ -15,7 +15,7 @@ namespace Fun
Uname::Uname()
{
fun.url = "uname";
fun.url = L"uname";
}

View File

@@ -22,7 +22,7 @@ namespace Fun
Upload::Upload()
{
fun.url = "upload";
fun.url = L"upload";
}
@@ -91,9 +91,9 @@ return true;
void Upload::UploadSaveFile(const std::string & tmp_filename, const std::string & destination)
void Upload::UploadSaveFile(const std::wstring & tmp_filename, const std::wstring & destination)
{
if( rename(tmp_filename.c_str(), destination.c_str()) == 0 )
if( RenameFile(tmp_filename, destination) )
{
log << log1 << "Content: uploaded a new file: " << destination << logend;
}
@@ -149,7 +149,7 @@ void Upload::UploadMulti()
for( ; i != request->post_file_tab.end() ; ++i)
{
const char * file_name = i->second.filename.c_str();
const wchar_t * file_name = i->second.filename.c_str();
request->item.subject = file_name;
request->item.url = file_name;
@@ -174,8 +174,8 @@ void Upload::UploadMulti()
void Upload::UploadSingle()
{
const std::string & new_subject = request->PostVar("subject");
const std::string & new_url = request->PostVar("url");
const std::wstring & new_subject = request->PostVar(L"subject");
const std::wstring & new_url = request->PostVar(L"url");
bool has_subject = !new_subject.empty();
bool has_url = !new_url.empty(); //(new_url && (*new_url)[0] != 0 );
@@ -183,7 +183,7 @@ void Upload::UploadSingle()
functions->SetUser(request->item);
request->item.privileges = 0644; // !! tymczasowo
const char * file_name = request->post_file_tab.begin()->second.filename.c_str();
const wchar_t * file_name = request->post_file_tab.begin()->second.filename.c_str();
request->item.auth = SelectFileType(file_name);
if( !has_subject )
@@ -203,13 +203,13 @@ void Upload::UploadSingle()
if( request->status == WINIX_ERR_OK )
{
const std::string & tmp_filename = request->post_file_tab.begin()->second.tmp_filename;
const std::wstring & tmp_filename = request->post_file_tab.begin()->second.tmp_filename;
UploadSaveFile(tmp_filename, request->item.auth_path);
request->status = db->EditAuthById(request->item, request->item.id);
}
if( request->status == WINIX_ERR_OK )
system->RedirectTo(request->item, "/cat");
system->RedirectTo(request->item, L"/cat");
}

View File

@@ -30,7 +30,7 @@ private:
bool HasAccess(const Item & item);
bool UploadCreatePath();
void UploadSaveFile(const std::string & tmp_filename, const std::string & destination);
void UploadSaveFile(const std::wstring & tmp_filename, const std::wstring & destination);
bool FunUploadCheckAbuse();
void UploadMulti();
void UploadSingle();

View File

@@ -15,7 +15,7 @@ namespace Fun
Uptime::Uptime()
{
fun.url = "uptime";
fun.url = L"uptime";
}

View File

@@ -52,7 +52,7 @@ static const char vim_wymiframe[] =
Vim::Vim()
{
fun.url = "vim";
fun.url = L"vim";
}
@@ -64,7 +64,7 @@ void Vim::Init()
{
Item temp;
if( db->GetItem(var->id, "wymiframe.html", temp) == WINIX_ERR_NO_ITEM )
if( db->GetItem(var->id, L"wymiframe.html", temp) == WINIX_ERR_NO_ITEM )
{
Item v;
@@ -72,11 +72,11 @@ void Vim::Init()
v.user_id = -1;
v.group_id = -1;
v.privileges = 0755;
v.subject = "wymiframe.html";
v.url = "wymiframe.html";
v.subject = L"wymiframe.html";
v.url = L"wymiframe.html";
v.type = Item::file;
v.content = vim_wymiframe;
v.content_type = Item::ct_raw;
AssignString(vim_wymiframe, v.content);
system->AddFile(v, false);
}

View File

@@ -15,7 +15,7 @@ namespace Fun
Who::Who()
{
fun.url = "who";
fun.url = L"who";
}