Item class has been moved to a new directory 'models', a new class has been added: ItemContent

and same fields from Item were moved to ItemContent

Item
- id
- parent_id
- type (file, dir, symlink)
- url
- subject
- template (html template)
- sort_index
- content_id

ItemContent
- id
- ref -> references (renamed)
- user_id
- modification_user_id
- group_id
- privileges
- date_creation
- date_modification
- guest_name
- link_to
- link_redirect
- file_path
- file_fs
- file_type
- file_size
- has_thumb -> file_has_thumb (renamed)
- hash -> file_hash (renamed)
- hash_type -> file_hash_type (renamed)
- content -> content_raw (renamed)
- content_type -> content_raw_type (renamed)
- content_parsed
- content_parsed_type
- meta
- ameta -> meta_admin (renamed)
- modify_index (removed)

WIP: #4
This commit is contained in:
2021-02-24 01:19:47 +01:00
parent 3d7ece15f8
commit 32e93a04c5
118 changed files with 5795 additions and 4514 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,7 @@ void priv_user_tab_init(Item & item)
if( !cur->session->puser )
{
// not logged
priv_user_table.push_back(item.user_id);
priv_user_table.push_back(item.item_content.user_id);
}
else
if( cur->session->puser->super_user )
@@ -75,7 +75,7 @@ void priv_user_tab_init(Item & item)
else
{
// others
priv_user_table.push_back(item.user_id);
priv_user_table.push_back(item.item_content.user_id);
}
}
@@ -133,12 +133,12 @@ void priv_user_tab_isdefault(Info & i)
if( cur->request->is_item )
{
if( uid == cur->request->item.user_id )
if( uid == cur->request->item.item_content.user_id )
i.res = true;
}
else
{
if( uid == cur->request->dir_tab.back()->user_id )
if( uid == cur->request->dir_tab.back()->item_content.user_id )
i.res = true;
}
}
@@ -165,7 +165,7 @@ void priv_group_tab_init(Item & item)
if( !cur->session->puser )
{
// not logged
priv_group_table.push_back(item.group_id);
priv_group_table.push_back(item.item_content.group_id);
}
else
if( cur->session->puser->super_user )
@@ -178,7 +178,7 @@ void priv_group_tab_init(Item & item)
priv_group_table.push_back(-1);
}
else
if( cur->session->puser->id == item.user_id )
if( cur->session->puser->id == item.item_content.user_id )
{
bool was_current_group = false;
// owner of the item -- is allowed to change only to a group in which he belongs to
@@ -186,13 +186,13 @@ void priv_group_tab_init(Item & item)
{
priv_group_table.push_back(cur->session->puser->groups[i]);
if( item.group_id == cur->session->puser->groups[i] )
if( item.item_content.group_id == cur->session->puser->groups[i] )
was_current_group = true;
}
// we're showing the item.group_id if it's different
if( !was_current_group )
priv_group_table.push_back(item.group_id);
priv_group_table.push_back(item.item_content.group_id);
// switching to -1 is allowed too
priv_group_table.push_back(-1);
@@ -200,7 +200,7 @@ void priv_group_tab_init(Item & item)
else
{
// not the owner and not a super user -- the same as not logged
priv_group_table.push_back(item.group_id);
priv_group_table.push_back(item.item_content.group_id);
}
}
@@ -258,12 +258,12 @@ void priv_group_tab_isdefault(Info & i)
if( cur->request->is_item )
{
if( gid == cur->request->item.group_id )
if( gid == cur->request->item.item_content.group_id )
i.res = true;
}
else
{
if( gid == cur->request->dir_tab.back()->group_id )
if( gid == cur->request->dir_tab.back()->item_content.group_id )
i.res = true;
}
}
@@ -273,9 +273,9 @@ void priv_group_tab_isdefault(Info & i)
void priv_privileges(Info & i)
{
if( cur->request->is_item )
i.out << Toa(cur->request->item.privileges, 8);
i.out << Toa(cur->request->item.item_content.privileges, 8);
else
i.out << Toa(cur->request->dir_tab.back()->privileges, 8);
i.out << Toa(cur->request->dir_tab.back()->item_content.privileges, 8);
}