added: to the Item: auth_path - a path to a static file (if auth is different from auth_none)
added: function 'mv' (move) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@596 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -505,7 +505,6 @@ bool compressing = data.compression && role == responder && redirect_to.empty()
|
||||
!browser_msie && !browser_konqueror &&
|
||||
accept_encoding_parser.AcceptDeflate() && source.size() >= 512;
|
||||
|
||||
|
||||
if( status == WINIX_ERR_NO_ITEM || status == WINIX_ERR_NO_FUNCTION || status == WINIX_ERR_UNKNOWN_PARAM )
|
||||
header = h_404;
|
||||
|
||||
@@ -695,6 +694,28 @@ bool Request::HasReadExecAccessForRoot(const Item & item)
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Request::HasReadExecAccessToPath(long dir_id)
|
||||
{
|
||||
while( true )
|
||||
{
|
||||
Item * pdir = data.dirs.GetDir(dir_id);
|
||||
|
||||
if( !pdir )
|
||||
return false;
|
||||
|
||||
if( !HasReadExecAccess(*pdir) )
|
||||
return false;
|
||||
|
||||
dir_id = pdir->parent_id;
|
||||
|
||||
if( dir_id == -1 )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returning true if we can create a thread in the current directory
|
||||
bool Request::CanCreateThread(bool check_root)
|
||||
{
|
||||
@@ -939,29 +960,21 @@ return false;
|
||||
|
||||
|
||||
|
||||
bool Request::MakePathSimpleFs(std::string & path, bool create_dir)
|
||||
bool Request::MakePathSimpleFs(std::string & path, long dir_id, bool create_dir)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
path = data.auth_simplefs_dir;
|
||||
|
||||
if( path.empty() )
|
||||
if( data.auth_simplefs_dir.empty() )
|
||||
{
|
||||
log << log1 << "Request: auth_simplefs_dir is not set in the config file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
// skipping the first - the first is root
|
||||
for(i=1 ; i<dir_table.size() ; ++i)
|
||||
{
|
||||
path += '/';
|
||||
path += dir_table[i]->url;
|
||||
if( !data.dirs.MakePath(dir_id, path) )
|
||||
return false;
|
||||
|
||||
if( create_dir && !CreateDir(path, 0755) )
|
||||
return false;
|
||||
}
|
||||
if( create_dir && !CreateDirs(data.auth_simplefs_dir, path, 0755) )
|
||||
return false;
|
||||
|
||||
path += '/';
|
||||
path.insert(0, data.auth_simplefs_dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -990,10 +1003,10 @@ char * hash = buffer;
|
||||
|
||||
// make sure that the length is even
|
||||
if( (strlen(hash) & 1) != 0 )
|
||||
hash = buffer + 1; // the first character was our zero
|
||||
hash = buffer + 1; // the first character was zero
|
||||
|
||||
// creating dirs without the last part
|
||||
// the last part is a part of a file (not a directory)
|
||||
// the last part is a part of a file
|
||||
for(size_t i=0 ; hash[i] != 0 ; i+=2)
|
||||
{
|
||||
path += hash[i];
|
||||
@@ -1016,22 +1029,24 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
// making a complete path to a request.item static file
|
||||
bool Request::MakePath(std::string & path, bool create_dir)
|
||||
// making a complete path to a static file
|
||||
bool Request::MakePath(const Item & item, std::string & path, bool create_dir)
|
||||
{
|
||||
bool res;
|
||||
|
||||
if( data.mounts.pmount->fs == Mount::hashfs )
|
||||
Mount * pmount = data.mounts.CalcMount(item.parent_id);
|
||||
|
||||
if( !pmount || pmount->fs == Mount::simplefs )
|
||||
{
|
||||
res = MakePathHashFs(path, request.item.id, create_dir);
|
||||
res = MakePathSimpleFs(path, item.parent_id, create_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = MakePathSimpleFs(path, create_dir);
|
||||
res = MakePathHashFs(path, item.id, create_dir);
|
||||
}
|
||||
|
||||
if( res )
|
||||
path += request.item.url;
|
||||
path += item.url;
|
||||
else
|
||||
path.clear();
|
||||
|
||||
@@ -1040,3 +1055,7 @@ return res;
|
||||
|
||||
|
||||
|
||||
bool Request::MakePath(Item & item, bool create_dir)
|
||||
{
|
||||
return MakePath(item, item.auth_path, create_dir);
|
||||
}
|
||||
|
Reference in New Issue
Block a user