changed: added Cur structure
we have there two pointers: Request * request; Session * session; these are the current request and the current session the session GC was moved to SessionManager (was in SessionContainer) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@708 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -25,7 +25,7 @@ Ln::Ln()
|
||||
|
||||
bool Ln::HasAccess()
|
||||
{
|
||||
return system->HasWriteAccess(*request->dir_tab.back());
|
||||
return system->HasWriteAccess(*cur->request->dir_tab.back());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,53 +33,53 @@ void Ln::CreateSymbolicLink(const std::wstring & link_to)
|
||||
{
|
||||
item.Clear(); // setting the date to now
|
||||
item.type = Item::symlink;
|
||||
item.parent_id = request->dir_tab.back()->id;
|
||||
item.url = request->PostVar(L"url");
|
||||
item.parent_id = cur->request->dir_tab.back()->id;
|
||||
item.url = cur->request->PostVar(L"url");
|
||||
item.link_to = link_to;
|
||||
item.link_redirect = request->IsPostVar(L"makeredirect") ? 1 : 0;
|
||||
item.link_redirect = cur->request->IsPostVar(L"makeredirect") ? 1 : 0;
|
||||
item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
|
||||
functions->SetUser(item);
|
||||
functions->PrepareUrl(item);
|
||||
|
||||
request->status = db->AddItem(item);
|
||||
cur->request->status = db->AddItem(item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
log << log3 << "Ln: created a symbolic link to: " << link_to << logend;
|
||||
}
|
||||
|
||||
|
||||
void Ln::CreateHardLink(const std::wstring & link_to)
|
||||
{
|
||||
int res = system->FollowAllLinks(request->dir_tab, link_to, dir_tab, item, false, false);
|
||||
int res = system->FollowAllLinks(cur->request->dir_tab, link_to, dir_tab, item, false, false);
|
||||
|
||||
if( res == 0 )
|
||||
{
|
||||
log << log2 << "Ln: " << link_to << " is a directory (can't create a hard link)" << logend;
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
else
|
||||
if( res == 1 )
|
||||
{
|
||||
item.SetDateToNow();
|
||||
item.type = Item::file;
|
||||
item.parent_id = request->dir_tab.back()->id;
|
||||
item.url = request->PostVar(L"url");
|
||||
item.parent_id = cur->request->dir_tab.back()->id;
|
||||
item.url = cur->request->PostVar(L"url");
|
||||
item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
|
||||
functions->SetUser(item);
|
||||
functions->PrepareUrl(item);
|
||||
request->status = db->AddHardLink(item);
|
||||
cur->request->status = db->AddHardLink(item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
log << log3 << "Ln: created a hard link to: " << link_to << logend;
|
||||
}
|
||||
else
|
||||
if( res == 5 || res == 6 )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
else
|
||||
{
|
||||
request->status = WINIX_ERR_NO_ITEM;
|
||||
cur->request->status = WINIX_ERR_NO_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,20 +88,20 @@ void Ln::CreateHardLink(const std::wstring & link_to)
|
||||
// we do not use notifications for links
|
||||
void Ln::MakePost()
|
||||
{
|
||||
link_to = request->PostVar(L"linkto");
|
||||
link_to = cur->request->PostVar(L"linkto");
|
||||
TrimWhite(link_to);
|
||||
|
||||
if( link_to.empty() )
|
||||
return;
|
||||
|
||||
int type = Toi(request->PostVar(L"linktype"));
|
||||
int type = Toi(cur->request->PostVar(L"linktype"));
|
||||
|
||||
if( type == 0 )
|
||||
CreateHardLink(link_to);
|
||||
else
|
||||
CreateSymbolicLink(link_to);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user