- 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:
@@ -40,7 +40,6 @@
|
||||
#include "core/request.h"
|
||||
#include "core/users.h"
|
||||
#include "core/groups.h"
|
||||
#include "templates/miscspace.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -104,20 +103,6 @@ void ItemContent::fields()
|
||||
field(L"has_thumb", &ItemContent::has_thumb);
|
||||
field(L"display_user_name", &ItemContent::display_user_name);
|
||||
|
||||
field(L"meta_to_str", &ItemContent::meta_to_str);
|
||||
field(L"meta_prop", &ItemContent::meta_prop);
|
||||
field(L"meta_prop_no_escape", &ItemContent::meta_prop_no_escape);
|
||||
field(L"meta_prop_tab", &ItemContent::meta_prop_tab);
|
||||
field(L"meta_prop_tab_value", &ItemContent::meta_prop_tab_value);
|
||||
field(L"meta_prop_tab_has_next",&ItemContent::meta_prop_tab_has_next);
|
||||
|
||||
field(L"admin_meta_to_str", &ItemContent::admin_meta_to_str);
|
||||
field(L"admin_meta_prop", &ItemContent::admin_meta_prop);
|
||||
field(L"admin_meta_prop_no_escape", &ItemContent::admin_meta_prop_no_escape);
|
||||
field(L"admin_meta_prop_tab", &ItemContent::admin_meta_prop_tab);
|
||||
field(L"admin_meta_prop_tab_value", &ItemContent::admin_meta_prop_tab_value);
|
||||
field(L"admin_meta_prop_tab_has_next", &ItemContent::admin_meta_prop_tab_has_next);
|
||||
|
||||
|
||||
// IMPROVEME prepare a setter functions which tests whether content_raw_type_helper and content_parsed_type_helper are correct values
|
||||
content_raw_type = static_cast<ContentType>(content_raw_type_helper);
|
||||
@@ -268,16 +253,7 @@ bool ItemContent::do_migration_to_3()
|
||||
};
|
||||
|
||||
size_t len = sizeof(str) / sizeof(const char*);
|
||||
|
||||
for(size_t i=0 ; i < len ; ++i)
|
||||
{
|
||||
if( !db_query(str[i]) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return db_query(str, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +261,7 @@ bool ItemContent::has_access(const User * current_user, int mask) const
|
||||
{
|
||||
if( current_user )
|
||||
{
|
||||
if( current_user->super_user )
|
||||
if( current_user->is_super_user )
|
||||
{
|
||||
// super user is allowed everything
|
||||
return true;
|
||||
@@ -332,7 +308,7 @@ bool ItemContent::has_read_write_access(const User * current_user) const
|
||||
|
||||
bool ItemContent::has_read_exec_access(const User * current_user) const
|
||||
{
|
||||
if( current_user && current_user->super_user )
|
||||
if( current_user && current_user->is_super_user )
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
// !! CHECK ME: is it applicable to directories too?
|
||||
@@ -492,23 +468,30 @@ void ItemContent::group(morm::ModelWrapper ** model_wrapper)
|
||||
}
|
||||
|
||||
|
||||
bool ItemContent::content_type_is(const std::wstring & type)
|
||||
{
|
||||
if( content_raw_type == ItemContent::ct_text && type == L"text" )
|
||||
return true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_formatted_text && type == L"formatted text" )
|
||||
return true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_html && type == L"html" )
|
||||
return true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_bbcode && type == L"bbcode" )
|
||||
return true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_other && type == L"other" )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::type_is(EzcEnv & env)
|
||||
{
|
||||
if( content_raw_type == ItemContent::ct_text && env.par == L"text" )
|
||||
env.res = true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_formatted_text && env.par == L"formatted text" )
|
||||
env.res = true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_html && env.par == L"html" )
|
||||
env.res = true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_bbcode && env.par == L"bbcode" )
|
||||
env.res = true;
|
||||
else
|
||||
if( content_raw_type == ItemContent::ct_other && env.par == L"other" )
|
||||
env.res = true;
|
||||
env.res = content_type_is(env.par);
|
||||
}
|
||||
|
||||
|
||||
@@ -603,79 +586,6 @@ void ItemContent::display_user_name(EzcEnv & env)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IMPROVEME may it would be better to browse by Space struct in the same way as in Models?
|
||||
* so Model should have support for it
|
||||
*
|
||||
*/
|
||||
void ItemContent::meta_to_str(EzcEnv & env)
|
||||
{
|
||||
meta.serialize_to_space_stream(env.out, true);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_no_escape(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta, false);
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::meta_prop_tab(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_list_tab(env, meta);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_tab_value(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_value(env, meta, L"item_meta_tab");
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_tab_has_next(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_has_next(env, meta, L"item_meta_tab");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ItemContent::admin_meta_to_str(EzcEnv & env)
|
||||
{
|
||||
meta_admin.serialize_to_space_stream(env.out, true);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta_admin);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_no_escape(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta_admin, false);
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::admin_meta_prop_tab(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_list_tab(env, meta_admin);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_tab_value(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_admin_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_value(env, meta_admin, L"item_admin_meta_tab");
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_tab_has_next(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_admin_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_has_next(env, meta_admin, L"item_admin_meta_tab");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
Reference in New Issue
Block a user