Files
winix/functions/default.cpp
Tomasz Sowa 915cabdf97 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
2011-01-23 14:15:30 +00:00

53 lines
927 B
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "default.h"
namespace Fun
{
Default::Default()
{
fun.url = L"default";
}
bool Default::HasAccess()
{
return !cur->request->is_item && system->HasWriteAccess(*cur->request->dir_tab.back());
}
void Default::MakePost()
{
Item & dir = *cur->request->dir_tab.back();
dir.link_to = cur->request->PostVar(L"linkto");
dir.link_redirect = cur->request->IsPostVar(L"makeredirect") ? 1 : 0;
TrimWhite(dir.link_to);
// !! dodac sprawdzenie czy link_to jest pusty teraz
cur->request->status = db->EditLinkItem(dir.id, dir.link_to, dir.link_redirect);
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "Default: changed link_to: " << dir.link_to << ", for dir_id: " << dir.id << logend;
system->RedirectToLastDir();
}
}
} // namespace