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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user