winix/content/download.cpp

49 lines
906 B
C++
Raw Normal View History

/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#include "content.h"
#include "../core/request.h"
#include "../core/data.h"
void Content::FunDownload()
{
// !! moze wywalic to no_item i wszedzie w takich miejscach dac poprostu permission_denied?
if( !request.is_item )
{
log << log1 << "Content: pv function requires an item" << logend;
request.status = Error::no_item;
return;
}
if( !request.HasReadAccess(request.item) ||
request.item.static_auth == Item::static_none ||
data.static_simplefs_dir.empty() )
{
request.status = Error::permission_denied;
return;
}
request.send_as_attachment = request.IsParam("attachment");
if( !request.MakePath(request.x_sendfile) )
{
request.status = Error::permission_denied;
return;
}
}