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
This commit is contained in:
64
core/app.cpp
64
core/app.cpp
@@ -7,6 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "wand/MagickWand.h"
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
@@ -142,17 +143,24 @@ bool App::Init()
|
||||
templates.ReadTemplates();
|
||||
|
||||
// init notify after templates (it uses locales from templates)
|
||||
|
||||
system.notify.ReadTemplates();
|
||||
|
||||
session_manager.LoadSessions();
|
||||
|
||||
CreateStaticTree();
|
||||
MagickWandGenesis();
|
||||
|
||||
plugin.Call(WINIX_PLUGIN_INIT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void App::Uninit()
|
||||
{
|
||||
MagickWandTerminus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void App::Close()
|
||||
{
|
||||
@@ -165,30 +173,14 @@ void App::Close()
|
||||
|
||||
bool App::BaseUrlRedirect()
|
||||
{
|
||||
if( request.role == Request::responder )
|
||||
{
|
||||
if( config.base_url_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( Equal(config.base_url_http_host.c_str(), request.env_http_host) )
|
||||
return false;
|
||||
if( config.base_url_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( Equal(config.base_url_http_host.c_str(), request.env_http_host) )
|
||||
return false;
|
||||
|
||||
request.redirect_to = config.base_url;
|
||||
AssignString(request.env_request_uri, request.redirect_to, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// authorizer
|
||||
|
||||
if( config.base_url_auth_http_host.empty() )
|
||||
return false;
|
||||
|
||||
if( Equal(config.base_url_auth_http_host.c_str(), request.env_http_host) )
|
||||
return false;
|
||||
|
||||
request.redirect_to = config.base_url_auth;
|
||||
AssignString(request.env_request_uri, request.redirect_to, false);
|
||||
}
|
||||
request.redirect_to = config.base_url;
|
||||
AssignString(request.env_request_uri, request.redirect_to, false);
|
||||
|
||||
log << log3 << "RC: BaseUrlRedirect from: " << request.env_http_host << logend;
|
||||
|
||||
@@ -294,7 +286,7 @@ bool sent = false;
|
||||
return;
|
||||
|
||||
|
||||
if( request.is_item && request.item.auth == Item::auth_none &&
|
||||
if( request.is_item && request.item.file_type == WINIX_ITEM_FILETYPE_NONE &&
|
||||
request.item.content_type == Item::ct_raw && request.status == WINIX_ERR_OK && request.function )
|
||||
{
|
||||
if( request.function == &functions.fun_cat )
|
||||
@@ -669,7 +661,7 @@ bool App::CanSendContent(Header header)
|
||||
// if there is a redirect or a file to send then we do not send a content
|
||||
return false;
|
||||
|
||||
if( header == h_200 && request.role == Request::authorizer && request.is_item && request.item.auth != Item::auth_none )
|
||||
if( header == h_200 && request.role == Request::authorizer && request.is_item && request.item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
// if there is an item and the item has 'file' storage we do not send a content
|
||||
return false;
|
||||
|
||||
@@ -1063,3 +1055,21 @@ sigset_t set;
|
||||
|
||||
|
||||
|
||||
void App::CreateStaticTree()
|
||||
{
|
||||
if( config.upload_dir.empty() )
|
||||
{
|
||||
log << log1 << "App: config: upload_dir not set, you are not allowed to upload static content" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirs(L"/", config.upload_dir.c_str(), config.upload_dirs_chmod);
|
||||
|
||||
CreateDirs(config.upload_dir.c_str(), L"simplefs/normal", config.upload_dirs_chmod);
|
||||
CreateDirs(config.upload_dir.c_str(), L"simplefs/thumb", config.upload_dirs_chmod);
|
||||
|
||||
CreateDirs(config.upload_dir.c_str(), L"hashfs/normal", config.upload_dirs_chmod);
|
||||
CreateDirs(config.upload_dir.c_str(), L"hashfs/thumb", config.upload_dirs_chmod);
|
||||
|
||||
CreateDirs(config.upload_dir.c_str(), L"tmp", config.upload_dirs_chmod);
|
||||
}
|
||||
|
Reference in New Issue
Block a user