Files
winix/functions/download.cpp
Tomasz Sowa 36c8822e6c changed organization of static files
removed: item.auth item.auth_path
added:   item.file_path, item.file_fs, item.file_type
now the path to a static file is a relative path
added: thumbnails (not finished yet)
fixed: db didn't correctly return the number of deleted items /DelItem() method/




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@696 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-12-10 21:07:01 +00:00

55 lines
1.0 KiB
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 "download.h"
namespace Fun
{
Download::Download()
{
fun.url = L"download";
}
void Download::MakeGet()
{
// !! moze wywalic to no_item i wszedzie w takich miejscach dac poprostu permission_denied?
if( !request->is_item )
{
log << log1 << "Content: download function requires an item" << logend;
request->status = WINIX_ERR_NO_ITEM;
return;
}
if( !system->HasReadAccess(request->item) ||
request->item.file_type == WINIX_ITEM_FILETYPE_NONE ||
request->item.file_path.empty() )
{
request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
request->send_as_attachment = request->IsParam(L"attachment");
if( request->item.file_type == WINIX_ITEM_FILETYPE_IMAGE && config->create_thumb && request->IsParam(L"thumb") )
system->MakeFilePath(request->item, request->x_sendfile, true);
else
system->MakeFilePath(request->item, request->x_sendfile);
}
} // namespace