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:
@@ -169,7 +169,7 @@ Error Functions::CheckSpecialFile(const Item & item)
|
||||
log << log3 << "Functions: reloading mount points" << logend;
|
||||
|
||||
cur->mount = system->mounts.GetEmptyMount();
|
||||
system->mounts.ReadMounts(item.content);
|
||||
system->mounts.ReadMounts(item.item_content.content_raw);
|
||||
cur->mount = system->mounts.pmount;
|
||||
templates->ReadNewIndexTemplates();
|
||||
templates->ReadNewChangeTemplates();
|
||||
@@ -302,7 +302,7 @@ void Functions::Parse()
|
||||
|
||||
void Functions::SetDefaultFunctionForFile()
|
||||
{
|
||||
if( cur->request->item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
if( cur->request->item.item_content.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
cur->request->function = &fun_download;
|
||||
else
|
||||
if( system->HasReadExecAccess(cur->request->item) )
|
||||
@@ -359,13 +359,13 @@ void Functions::CheckFunctionFollowDir(bool was_default_function)
|
||||
|
||||
if( was_default_function )
|
||||
{
|
||||
if( cur->request->dir_tab.back()->link_redirect == 1 )
|
||||
if( cur->request->dir_tab.back()->item_content.link_redirect == 1 )
|
||||
{
|
||||
system->RedirectTo(cur->request->dir_tab.back()->link_to);
|
||||
system->RedirectTo(cur->request->dir_tab.back()->item_content.link_to);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( system->FollowAllLinks(cur->request->dir_tab.back()->link_to, true, true) )
|
||||
if( system->FollowAllLinks(cur->request->dir_tab.back()->item_content.link_to, true, true) )
|
||||
SetDefaultFunction();
|
||||
}
|
||||
}
|
||||
@@ -375,15 +375,15 @@ void Functions::CheckFunctionFollowDir(bool was_default_function)
|
||||
|
||||
void Functions::CheckFunctionFollowSymlink(bool was_default_function)
|
||||
{
|
||||
if( cur->request->item.link_redirect == 1 )
|
||||
if( cur->request->item.item_content.link_redirect == 1 )
|
||||
{
|
||||
if( was_default_function )
|
||||
system->RedirectTo(cur->request->item.link_to);
|
||||
system->RedirectTo(cur->request->item.item_content.link_to);
|
||||
else
|
||||
system->RedirectWithFunctionAndParamsTo(cur->request->item.link_to);
|
||||
system->RedirectWithFunctionAndParamsTo(cur->request->item.item_content.link_to);
|
||||
}
|
||||
else
|
||||
if( system->FollowAllLinks(cur->request->item.link_to, true, true) )
|
||||
if( system->FollowAllLinks(cur->request->item.item_content.link_to, true, true) )
|
||||
{
|
||||
if( was_default_function )
|
||||
SetDefaultFunction();
|
||||
@@ -415,7 +415,7 @@ bool was_default_function = false;
|
||||
if( cur->request->status != WINIX_ERR_OK || !cur->request->redirect_to.empty() )
|
||||
return;
|
||||
|
||||
if( !cur->request->is_item && !cur->request->dir_tab.back()->link_to.empty() )
|
||||
if( !cur->request->is_item && !cur->request->dir_tab.back()->item_content.link_to.empty() )
|
||||
CheckFunctionFollowDir(was_default_function);
|
||||
else
|
||||
if( cur->request->is_item && cur->request->item.type == Item::symlink && cur->request->function && cur->request->function->follow_symlinks )
|
||||
@@ -603,7 +603,7 @@ void Functions::ReadItemFilterHtml(Item & item)
|
||||
html_filter.ClearOrphans();
|
||||
// SetNoFilterTag doesn't have to be called (default empty tag)
|
||||
|
||||
html_filter.Filter(cur->request->PostVar(L"itemcontent"), item.content);
|
||||
html_filter.Filter(cur->request->PostVar(L"itemcontent"), item.item_content.content_raw);
|
||||
}
|
||||
|
||||
|
||||
@@ -618,13 +618,13 @@ void Functions::ReadItemContent(Item & item, const std::wstring & content_type)
|
||||
if( filter_html )
|
||||
ReadItemFilterHtml(item);
|
||||
else
|
||||
cur->request->PostVar(L"itemcontent", item.content);
|
||||
cur->request->PostVar(L"itemcontent", item.item_content.content_raw);
|
||||
}
|
||||
|
||||
|
||||
void Functions::ReadItemContentWithType(Item & item)
|
||||
{
|
||||
item.content_type = Item::ct_formatted_text; // default is formatted text
|
||||
item.item_content.content_raw_type = ItemContent::ct_formatted_text; // default is formatted text
|
||||
cur->request->PostVar(L"contenttype", temp);
|
||||
|
||||
ReadItemContent(item, temp);
|
||||
@@ -633,10 +633,10 @@ void Functions::ReadItemContentWithType(Item & item)
|
||||
// ct_text and ct_formatted_text can use everyone
|
||||
|
||||
if( temp == L"0" )
|
||||
item.content_type = Item::ct_text;
|
||||
item.item_content.content_raw_type = ItemContent::ct_text;
|
||||
else
|
||||
if( temp == L"1" )
|
||||
item.content_type = Item::ct_formatted_text;
|
||||
item.item_content.content_raw_type = ItemContent::ct_formatted_text;
|
||||
|
||||
|
||||
// those below need special privileges
|
||||
@@ -649,19 +649,19 @@ void Functions::ReadItemContentWithType(Item & item)
|
||||
if( temp == L"2" )
|
||||
{
|
||||
if( system->CanUseHtml(user_id) )
|
||||
item.content_type = Item::ct_html;
|
||||
item.item_content.content_raw_type = ItemContent::ct_html;
|
||||
}
|
||||
else
|
||||
if( temp == L"3" )
|
||||
{
|
||||
if( system->CanUseBBCode(user_id) )
|
||||
item.content_type = Item::ct_bbcode;
|
||||
item.item_content.content_raw_type = ItemContent::ct_bbcode;
|
||||
}
|
||||
else
|
||||
if( temp == L"4" )
|
||||
{
|
||||
if( system->CanUseOther(user_id) )
|
||||
item.content_type = Item::ct_other;
|
||||
item.item_content.content_raw_type = ItemContent::ct_other;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -691,16 +691,16 @@ void Functions::SetUser(Item & item)
|
||||
{
|
||||
if( cur->session && cur->session->puser )
|
||||
{
|
||||
item.user_id = cur->session->puser->id;
|
||||
item.guest_name.clear();
|
||||
item.item_content.user_id = cur->session->puser->id;
|
||||
item.item_content.guest_name.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.user_id = -1;
|
||||
cur->request->PostVar(L"guestname", item.guest_name);
|
||||
item.item_content.user_id = -1;
|
||||
cur->request->PostVar(L"guestname", item.item_content.guest_name);
|
||||
}
|
||||
|
||||
item.group_id = cur->request->dir_tab.back()->group_id;
|
||||
item.item_content.group_id = cur->request->dir_tab.back()->item_content.group_id;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user