added: parameter 'l' to 'ls' function
added: Db::ItemQuery struct for querying items changed: some refactoring (renamed some config variables) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@589 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -46,7 +46,7 @@ return true;
|
||||
|
||||
void Content::SetDefaultFunctionForFile()
|
||||
{
|
||||
if( request.item.static_auth != Item::static_none )
|
||||
if( request.item.auth != Item::auth_none )
|
||||
request.pfunction = data.functions.GetFunction(FUN_DOWNLOAD);
|
||||
else
|
||||
if( request.HasReadExecAccess(request.item) )
|
||||
@@ -320,7 +320,7 @@ bool sent = false;
|
||||
return;
|
||||
|
||||
|
||||
if( request.is_item && request.item.static_auth == Item::static_none &&
|
||||
if( request.is_item && request.item.auth == Item::auth_none &&
|
||||
request.item.content_type == Item::ct_raw && request.status == Error::ok && request.pfunction )
|
||||
{
|
||||
if( request.pfunction->code == FUN_CAT )
|
||||
|
||||
@@ -55,7 +55,7 @@ class Content
|
||||
void FunEmacs();
|
||||
|
||||
|
||||
void AddPathToStaticAuth(std::string & path);
|
||||
void AddPathToAuth(std::string & path);
|
||||
|
||||
void FunCKEditor();
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ void Content::FunDownload()
|
||||
|
||||
|
||||
if( !request.HasReadAccess(request.item) ||
|
||||
request.item.static_auth == Item::static_none ||
|
||||
data.static_simplefs_dir.empty() )
|
||||
request.item.auth == Item::auth_none ||
|
||||
data.auth_simplefs_dir.empty() )
|
||||
{
|
||||
request.status = Error::permission_denied;
|
||||
return;
|
||||
|
||||
@@ -15,20 +15,25 @@
|
||||
|
||||
void Content::FunLs()
|
||||
{
|
||||
if( request.is_item )
|
||||
if( !request.is_item )
|
||||
{
|
||||
// we're showing only the item
|
||||
request.item_table.push_back( request.item );
|
||||
return;
|
||||
}
|
||||
|
||||
// we're reading only files here
|
||||
db.GetItems(request.item_table, request.dir_table.back()->id, Item::file, false, false, true);
|
||||
Db::ItemQuery iq;
|
||||
|
||||
/*
|
||||
request.IsParam("ckeditor_browse");
|
||||
*/
|
||||
|
||||
iq.sel_content = false;
|
||||
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
|
||||
if( request.IsParam("ckeditor_browse") )
|
||||
{
|
||||
iq.WhereAuth(Item::auth_image);
|
||||
db.GetItems(request.item_table, iq);
|
||||
}
|
||||
else
|
||||
{
|
||||
db.GetItems(request.item_table, iq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -157,7 +157,16 @@ Item * root = 0;
|
||||
|
||||
void Content::PrivFilesInDir(long parent_id)
|
||||
{
|
||||
db.GetItems(request.item_table, parent_id, Item::file, false, false, true);
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.SetAll(false, false);
|
||||
iq.sel_user_id = iq.sel_group_id = iq.sel_guest_name = iq.sel_privileges = true;
|
||||
|
||||
iq.WhereParentId(parent_id);
|
||||
iq.WhereType(Item::file);
|
||||
|
||||
db.GetItems(request.item_table, iq);
|
||||
|
||||
|
||||
std::vector<Item>::iterator i = request.item_table.begin();
|
||||
|
||||
|
||||
@@ -39,13 +39,16 @@ void Content::FunThread()
|
||||
return;
|
||||
}
|
||||
|
||||
bool asc = true;
|
||||
|
||||
Db::ItemQuery iq;
|
||||
|
||||
if( data.mounts.pmount->IsArg(Mount::par_thread, "sort_desc") )
|
||||
asc = false;
|
||||
iq.sort_asc = false;
|
||||
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereAuth(Item::auth_none);
|
||||
|
||||
db.GetItems(request.item_table, request.dir_table.back()->id, Item::file, true, true, asc);
|
||||
db.GetItems(request.item_table, iq);
|
||||
db.GetThreads(request.dir_table.back()->id, request.thread_tab);
|
||||
|
||||
CheckAccessToItems();
|
||||
|
||||
@@ -50,7 +50,13 @@ void Content::FunTicket()
|
||||
return;
|
||||
}
|
||||
|
||||
db.GetItems(request.item_table, request.dir_table.back()->id, Item::file, true, true, true);
|
||||
Db::ItemQuery iq;
|
||||
|
||||
iq.WhereParentId(request.dir_table.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereAuth(Item::auth_none);
|
||||
|
||||
db.GetItems(request.item_table, iq);
|
||||
db.GetTickets(request.dir_table.back()->id, request.ticket_tab);
|
||||
|
||||
TicketDeleteFirst();
|
||||
|
||||
@@ -115,7 +115,7 @@ void Content::UploadMulti()
|
||||
|
||||
request.item.subject = file_name;
|
||||
request.item.url = file_name;
|
||||
request.item.static_auth = SelectFileType(file_name);
|
||||
request.item.auth = SelectFileType(file_name);
|
||||
|
||||
PrepareUrl(request.item);
|
||||
PostFunEmacsAdd(); // always adding a new item
|
||||
@@ -142,7 +142,7 @@ void Content::UploadSingle()
|
||||
request.item.privileges = 0644; // !! tymczasowo
|
||||
|
||||
const char * file_name = request.post_file_table.begin()->second.filename.c_str();
|
||||
request.item.static_auth = SelectFileType(file_name);
|
||||
request.item.auth = SelectFileType(file_name);
|
||||
|
||||
if( !has_subject )
|
||||
request.item.subject = file_name;
|
||||
|
||||
Reference in New Issue
Block a user