we can create links (hard links, symbolic links) now
added winix functions: ln winix function 'default' can be used without redirecting now added new tickets types: TypeProgress, TypeString, TypeMultistring, TypeImages, TypeFiles now tickets are combined with files added winix functions: showtickets fixed mountpoints: when the default root mount was created its parameter table was empty and it caused accessing to a non-existing objects fixed logger: modifiers (log1, log2, log3) were incorrectly treated added modifier: log4 (debug info) now we are moving threads to a new plugin 'thread' created directory: plugins/thread (not finished yet) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@704 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -123,7 +123,7 @@ Error Functions::CheckSpecialFile(const Item & item)
|
||||
|
||||
Error status = system->mounts.ReadMounts(item.content);
|
||||
templates->ReadNewIndexTemplates();
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ void Functions::CreateFunctions()
|
||||
Add(fun_last);
|
||||
Add(fun_login);
|
||||
Add(fun_logout);
|
||||
Add(fun_ln);
|
||||
Add(fun_ls);
|
||||
Add(fun_mkdir);
|
||||
Add(fun_mv);
|
||||
@@ -248,33 +249,26 @@ void Functions::SetDefaultFunctionForFile()
|
||||
|
||||
void Functions::SetDefaultFunctionForDir()
|
||||
{
|
||||
long default_item = request->dir_tab.back()->default_item;
|
||||
|
||||
if( default_item != -1 )
|
||||
{
|
||||
log << log3 << "Functions: Default item: id: " << default_item << logend;
|
||||
system->RedirectTo(default_item);
|
||||
}
|
||||
if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
|
||||
request->function = &fun_thread;
|
||||
else
|
||||
{
|
||||
if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
|
||||
request->function = &fun_thread;
|
||||
else
|
||||
request->function = &fun_ls;
|
||||
request->function = &fun_ls;
|
||||
|
||||
log << log3 << "Functions: default function: " << request->function->fun.url << logend;
|
||||
}
|
||||
log << log3 << "Functions: default function: " << request->function->fun.url << logend;
|
||||
}
|
||||
|
||||
|
||||
void Functions::SetDefaultFunction()
|
||||
{
|
||||
request->function = 0;
|
||||
|
||||
plugin.Call(WINIX_SELECT_DEFAULT_FUNCTION);
|
||||
|
||||
if( request->function )
|
||||
{
|
||||
log << log3 << "Functions: default function: " << request->function->fun.url << logend;
|
||||
log << log3 << "Functions: default function: " << request->function->fun.url
|
||||
<< " (set by a plugin)" << logend;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,75 +281,120 @@ void Functions::SetDefaultFunction()
|
||||
|
||||
|
||||
|
||||
void Functions::MakeGet()
|
||||
|
||||
void Functions::CheckFunctionFollowDir(bool was_default_function)
|
||||
{
|
||||
if( request->role == Request::authorizer )
|
||||
// directory with 'default' flag
|
||||
|
||||
if( was_default_function )
|
||||
{
|
||||
// in authorizer mode only cat function is available
|
||||
// (and must be default)
|
||||
|
||||
if( request->function )
|
||||
if( request->dir_tab.back()->link_redirect == 1 )
|
||||
{
|
||||
request->status = WINIX_ERR_NO_ITEM;
|
||||
log << log1 << "Functions: in authorizer mode only 'cat' funtion is available and must "
|
||||
"be default (not in the url)" << logend;
|
||||
return;
|
||||
system->RedirectTo(request->dir_tab.back()->link_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( system->FollowAllLinks(request->dir_tab.back()->link_to, true, true) )
|
||||
SetDefaultFunction();
|
||||
}
|
||||
|
||||
request->function = &fun_cat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::CheckFunctionFollowSymlink(bool was_default_function)
|
||||
{
|
||||
if( request->item.link_redirect == 1 )
|
||||
{
|
||||
if( was_default_function )
|
||||
system->RedirectTo(request->item.link_to);
|
||||
else
|
||||
system->RedirectWithFunctionAndParamsTo(request->item.link_to);
|
||||
}
|
||||
else
|
||||
if( system->FollowAllLinks(request->item.link_to, true, true) )
|
||||
{
|
||||
if( was_default_function )
|
||||
SetDefaultFunction();
|
||||
|
||||
if( request->status == WINIX_ERR_OK && !request->redirect_to.empty() && !was_default_function && request->function )
|
||||
{
|
||||
// !! nie jestem pewny dodania tej nowej funkcji do redirecta... (sprawdzic to)
|
||||
request->redirect_to += '/';
|
||||
request->redirect_to += request->function->fun.url;
|
||||
system->AddParams(request->param_tab, request->redirect_to, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// making a proper redirection from a directory with 'default' flag
|
||||
// or from a symlink (or just loading it if there is no redirection flag set)
|
||||
void Functions::CheckFunctionAndSymlink()
|
||||
{
|
||||
bool was_default_function = false;
|
||||
|
||||
if( !request->function || request->function == &fun_special_default )
|
||||
{
|
||||
was_default_function = true;
|
||||
SetDefaultFunction();
|
||||
}
|
||||
|
||||
if( !request->redirect_to.empty() )
|
||||
if( request->status != WINIX_ERR_OK || !request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( !request->function )
|
||||
if( !request->is_item && !request->dir_tab.back()->link_to.empty() )
|
||||
CheckFunctionFollowDir(was_default_function);
|
||||
else
|
||||
if( request->is_item && request->item.type == Item::symlink && request->function && request->function->follow_symlinks )
|
||||
CheckFunctionFollowSymlink(was_default_function);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::MakeFunction()
|
||||
{
|
||||
if( !request->function )
|
||||
{
|
||||
request->status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log1 << "Functions: no function (neither cat nor ls)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !system->HasReadExecAccess(request->function->fun) || !request->function->HasAccess() )
|
||||
if( !system->DirsHaveReadExecPerm() ||
|
||||
!system->HasReadExecAccess(request->function->fun) ||
|
||||
!request->function->HasAccess() )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request->function->MakeGet();
|
||||
if( request->method == Request::get )
|
||||
{
|
||||
if( request->redirect_to.empty() )
|
||||
request->function->MakeGet();
|
||||
}
|
||||
else
|
||||
if( request->method == Request::post )
|
||||
{
|
||||
// we don't use post with redirecting (the post variables would be lost)
|
||||
|
||||
if( request->redirect_to.empty() )
|
||||
request->function->MakePost();
|
||||
else
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
else
|
||||
if( request->method == Request::head )
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
log << log1 << "Functions: unknown request method (skipping)" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Functions::MakePost()
|
||||
{
|
||||
if( request->role == Request::authorizer )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !request->function || request->function == &fun_special_default )
|
||||
SetDefaultFunction();
|
||||
|
||||
if( !request->function )
|
||||
{
|
||||
request->status = WINIX_ERR_NO_FUNCTION;
|
||||
log << log1 << "Functions: MakePost: no function" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !system->HasReadExecAccess(request->function->fun) || !request->function->HasAccess() )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
request->function->MakePost();
|
||||
}
|
||||
|
||||
|
||||
void Functions::CheckGetPostTimes(time_t difference)
|
||||
@@ -505,6 +544,7 @@ void Functions::ReadItemContentWithType(Item & item)
|
||||
// item_type - the type of an item you are expecting to read
|
||||
// returns true if the url has to be changed
|
||||
// at the moment this is only checked for Item::file - for Item::dir it returns always true
|
||||
// !! zmienic nazwe na ReadUrlSubjectContent
|
||||
void Functions::ReadItem(Item & item, Item::Type item_type)
|
||||
{
|
||||
if( item_type == Item::none )
|
||||
|
||||
Reference in New Issue
Block a user