- updated to the new pikotools api (child spaces were removed)

some plugins need to be fixed yet: ticket, gallery, group, menu
- added current user to default models as "user"
- renamed in User: super_user -> is_super_user, env -> admin_env, pass_hash_salted -> is_pass_hash_salted
- now Users class has a WinixModel as a base class
  some plugin calls have to be fixed yet
- added UserWrapper model with a pointer to User class
- removed from ItemContent: methods for accessing 'meta' and 'admin_meta', now ezc can iterate through Space classes
- fixed in env winix function: if there is "changeuser" parameter then we should only switch the user (not save anything)
This commit is contained in:
2021-06-27 23:31:50 +02:00
parent 472490c239
commit 1d18b7fa12
59 changed files with 1419 additions and 1607 deletions

View File

@@ -330,16 +330,21 @@ void ExportInfo::SendAllFilesFromDir(long dir_id)
void ExportInfo::AdditionalExport(const Item & item)
{
const pt::Space::TableType * child_table = item.item_content.meta.find_child_space_table();
const pt::Space * export_space = item.item_content.meta.get_space(L"export");// CHECK ME it was find_child_space_table();
if( child_table )
if( export_space )
{
for(const pt::Space * child : *child_table)
{
if( child->is_child_space_name(L"export") )
AdditionalExport(item, *child);
}
AdditionalExport(item, *export_space);
}
// if( export_space )
// {
// for(const pt::Space * child : *export_space)
// {
// if( child->is_child_space_name(L"export") )
// AdditionalExport(item, *child);
// }
// }
}

View File

@@ -37,7 +37,6 @@
#include "core/log.h"
#include "core/misc.h"
#include "cache.h"
#include "templates/miscspace.h"
#include "registermail_info.h"
#include "models/item.h"

View File

@@ -55,7 +55,7 @@ Seo::Seo()
bool Seo::HasAccess()
{
if( cur->session->puser && cur->session->puser->super_user )
if( cur->session->puser && cur->session->puser->is_super_user )
return true;
return system->HasWriteAccess(*cur->request->last_item);
@@ -77,7 +77,7 @@ void Seo::MakePost()
item.subject = subject;
pt::Space & seo = item.item_content.meta.find_add_child_space(L"seo");
pt::Space & seo = item.item_content.meta.get_add_space(L"seo");
seo.add(L"description", description);
seo.add(L"keywords", keywords);

View File

@@ -80,7 +80,7 @@ bool Reply::HasAccess()
return false;
pt::Space * thread_space = cur->request->item.item_content.meta_admin.find_child_space(L"thread");
pt::Space * thread_space = cur->request->item.item_content.meta_admin.get_space(L"thread");
if( thread_space )
{

View File

@@ -185,7 +185,7 @@ pt::Space & EditTicket::PrepareSpace()
if( is_new )
{
pt::Space * ticket_space = cur->request->item.item_content.meta.find_child_space(L"ticket");
pt::Space * ticket_space = cur->request->item.item_content.meta.get_space(L"ticket"); // CHECKME it was find_child_space(L"ticket");
if( ticket_space )
{
@@ -203,10 +203,10 @@ bool EditTicket::CloseTicket()
{
cur->request->item.propagate_connector();
pt::Space & ticket_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"ticket");
pt::Space & ticket_space = cur->request->item.item_content.meta_admin.get_add_space(L"ticket"); //CHECKME it was find_add_child_space(L"ticket");
ticket_space.add(L"closed", true);
pt::Space & thread_space = cur->request->item.item_content.meta_admin.find_add_child_space(L"thread");
pt::Space & thread_space = cur->request->item.item_content.meta_admin.get_add_space(L"thread"); //CHECKME it was find_add_child_space(L"thread");
thread_space.add(L"closed", true);
//if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )

View File

@@ -144,13 +144,13 @@ void SessionData::BuildFileList(std::vector<long> & file_tab, pt::Space & space)
{
file_tab.clear();
pt::Space::TableType * child_table = space.find_child_space_table();
pt::Space::TableType * child_table = space.get_table(L"params"); // CHECKME it was space.find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"param") )
if( sp->is_equal(L"name", L"param") )
CheckFile(file_tab, *sp);
}
}
@@ -159,13 +159,13 @@ void SessionData::BuildFileList(std::vector<long> & file_tab, pt::Space & space)
void SessionData::CheckFile(std::vector<long> & file_tab, pt::Space & space)
{
pt::Space::TableType * child_table = space.find_child_space_table();
pt::Space::TableType * child_table = space.get_table(L"files"); // CHECKME it was space.find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"file") )
if( sp->is_equal(L"name", L"file") )
{
file_tab.push_back(sp->to_long(L"itemid"));
}

View File

@@ -302,13 +302,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
else
if( *type == L"select" )
{
pt::Space::TableType * child_table = space.find_child_space_table();
pt::Space::TableType * child_table = space.get_table(L"ticket_params"); // CHECKME it was space.find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"option") )
if( sp->is_equal(L"name", L"option") )
{
if( sp->to_long(L"id") == par.intv )
{
@@ -329,13 +329,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
{
pt::Space::TableType * child_table = meta.find_child_space_table();
pt::Space * child_table = meta.get_space(L"params"); // CHECKME it was meta.find_child_space_table();
if( child_table )
if( child_table && child_table->is_table() )
{
for(pt::Space * sp : *child_table)
for(pt::Space * sp : *child_table->get_table() )
{
if( sp->is_child_space_name(L"param") )
if( sp->is_equal(L"name", L"param") )
{
if( sp->to_long(L"id") == param )
{
@@ -344,8 +344,14 @@ pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
}
}
}
else
if( !child_table )
{
child_table = &meta.add_empty_space(L"params");
}
pt::Space & sp = meta.add_child_space(L"param");
pt::Space & sp = child_table->add_empty_space();
sp.add(L"name", L"param");
sp.add(L"id", param);
return sp;
@@ -419,7 +425,7 @@ void TicketInfo::ReadTicketValue(pt::Space & space,
if( cur->request->status == WINIX_ERR_OK )
{
pt::Space & space = FindAddMetaByParam(meta, param_id);
pt::Space & file_space = space.add_child_space(L"file");
pt::Space & file_space = space.get_add_space(L"file"); // CHECKME it was space.add_child_space(L"file");
if( file.item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE )
file_space.add(L"type", L"image");
@@ -493,14 +499,13 @@ void TicketInfo::ReadTicketParam(pt::Space & space, Ticket & ticket, long param_
void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta)
{
ticket_param.Clear();
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table();
if( child_table )
{
for(pt::Space * space : *child_table)
{
if( space->is_child_space_name(L"param") && space->to_long(L"id") == param_id )
if( space->is_equal(L"name", L"param") && space->to_long(L"id") == param_id )
{
ReadTicketParam(*space, ticket, param_id, value, meta);
return;
@@ -515,13 +520,13 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr
// always adds a new parameter
void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Space & meta)
{
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"param") )
if( sp->is_equal(L"name", L"param") )
{
if( sp->to_long(L"id") == param_id )
{
@@ -541,6 +546,8 @@ void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Spac
bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta)
{
// FIXME !!!!!!!!!!!!!!1
/*
pt::Space::TableType * meta_child_table = meta.find_child_space_table();
if( meta_child_table )
@@ -572,7 +579,9 @@ bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & met
}
}
*/
return false;
}
@@ -642,7 +651,7 @@ void TicketInfo::RemoveTicket(long file_id)
void TicketInfo::CopyTicketSpace(pt::Space & ticket_space, Item & item)
{
pt::Space & ticket_meta = item.item_content.meta.find_add_child_space(L"ticket");
pt::Space & ticket_meta = item.item_content.meta.get_add_space(L"ticket");
ticket_meta = ticket_space;
}