Version 5.0.0 beta 4
This commit is contained in:
1 parent
e86153356a
commit
2f24f9de48
276 files changed
+8614
-6044
No files matched your search
@@ -13,6 +13,7 @@ namespace IPS\cms\modules\admin\databases;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Cassandra\Set;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
@@ -764,7 +765,25 @@ class databases extends Controller
|
||||
/* Perms */
|
||||
$existingPerms = $category->permissions();
|
||||
|
||||
Db::i()->update( 'core_permission_index', array_merge( $perms, array( 'perm_id' => $existingPerms['perm_id'], 'perm_type_id' => $category->id ) ), array( 'perm_id=?', $existingPerms['perm_id'] ) );
|
||||
/* Make sure these are at least visible */
|
||||
if( $category->has_perms )
|
||||
{
|
||||
if( !isset( $perms['perm_view'] ) or empty( $perms['perm_view'] ) )
|
||||
{
|
||||
$perms['perm_view'] = '*';
|
||||
}
|
||||
if( !isset( $perms['perm_2'] ) or empty( $perms['perm_2'] ) )
|
||||
{
|
||||
$perms['perm_2'] = Settings::i()->admin_group;
|
||||
}
|
||||
if( !isset( $perms['perm_3'] ) or empty( $perms['perm_3'] ) )
|
||||
{
|
||||
$perms['perm_3'] = Settings::i()->admin_group;
|
||||
}
|
||||
|
||||
Db::i()->update( 'core_permission_index', array_merge( $perms, array( 'perm_id' => $existingPerms['perm_id'], 'perm_type_id' => $category->id ) ), array( 'perm_id=?', $existingPerms['perm_id'] ) );
|
||||
}
|
||||
|
||||
$next = 'template';
|
||||
$doneSomething = true;
|
||||
break;
|
||||
@@ -1030,7 +1049,7 @@ class databases extends Controller
|
||||
|
||||
/* Custom fields */
|
||||
$textFields = array( 'field_extra', 'field_default_value', 'field_name', 'field_description', 'field_display_json', 'field_validator_error' );
|
||||
$removeFields = array( 'field_database_id' );
|
||||
$removeFields = array( 'field_database_id', 'perm_id', 'perm_type', 'perm_type_id' );
|
||||
$fieldSchema = $schema['cms_database_fields'];
|
||||
foreach ( Db::i()->select( 'f.*, w.word_custom as field_name, w2.word_custom as field_description, w3.word_custom as field_validator_error, p.*', array('cms_database_fields', 'f'), array( 'field_database_id=?', $database->id ) )
|
||||
->join( array( 'core_sys_lang_words', 'w' ), "w.word_key=CONCAT( 'content_field_', f.field_id ) and w.lang_id=" . Lang::defaultLanguage() )
|
||||
@@ -1044,7 +1063,7 @@ class databases extends Controller
|
||||
|
||||
foreach( $row as $k => $v )
|
||||
{
|
||||
if ( array_key_exists( $k, $fieldSchema['columns'] ) AND ! in_array( $k, $removeFields ) AND ! in_array( $k, $textFields ) )
|
||||
if ( !in_array( $k, $removeFields ) AND !in_array( $k, $textFields ) and ( mb_substr( $k, 0, 5 ) == 'perm_' or array_key_exists( $k, $fieldSchema['columns'] ) ) )
|
||||
{
|
||||
$xml->startAttribute( $k );
|
||||
$xml->text( $v ?? '' );
|
||||
@@ -1078,7 +1097,7 @@ class databases extends Controller
|
||||
$textFields = array( 'category_name', 'category_description', 'category_meta_keywords', 'category_meta_description', 'category_page_title' );
|
||||
$removeFields = array( 'category_database_id', 'category_last_record_id', 'category_last_record_date', 'category_last_record_member', 'category_last_record_name', 'category_last_record_seo_name', 'category_records', 'category_record_comments',
|
||||
'category_record_comments_queued', 'category_rss_cache', 'category_rss_cached', 'category_rss_exclude', 'category_forum_override', 'category_forum_record', 'category_forum_comments', 'category_forum_delete', 'category_forum_suffix', 'category_forum_prefix',
|
||||
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title');
|
||||
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title', 'perm_id', 'perm_type_id', 'perm_type' );
|
||||
$categorySchema = $schema['cms_database_categories'];
|
||||
foreach ( Db::i()->select( 'c.*, w.word_custom as category_name, w2.word_custom as category_description, p.*', array('cms_database_categories', 'c'), array( 'category_database_id=?', $database->id ) )
|
||||
->join( array( 'core_sys_lang_words', 'w' ), "w.word_key=CONCAT( 'content_cat_name_', c.category_id ) and w.lang_id=" . Lang::defaultLanguage() )
|
||||
@@ -1091,7 +1110,8 @@ class databases extends Controller
|
||||
|
||||
foreach( $row as $k => $v )
|
||||
{
|
||||
if ( array_key_exists( $k, $categorySchema['columns'] ) AND ! in_array( $k, $removeFields ) AND ! in_array( $k, $textFields ) )
|
||||
|
||||
if ( !in_array( $k, $removeFields ) AND !in_array( $k, $textFields ) and ( mb_substr( $k, 0, 5 ) == 'perm_' or array_key_exists( $k, $categorySchema['columns'] ) ) )
|
||||
{
|
||||
$xml->startAttribute( $k );
|
||||
$xml->text( $v ?? '' );
|
||||
@@ -1655,7 +1675,7 @@ class databases extends Controller
|
||||
0 => 'database_use_categories_no'
|
||||
),
|
||||
'toggles' => array(
|
||||
1 => array( 'database_allow_club_categories' ),
|
||||
1 => array( 'database_categories_layout' ),
|
||||
0 => array( 'category_allow_rating', 'category_can_view_others' )
|
||||
),
|
||||
'disabled' => $disabled
|
||||
@@ -1675,7 +1695,7 @@ class databases extends Controller
|
||||
1 => 'database_allow_club_categories_yes',
|
||||
),
|
||||
'disabled' => ( $current?->allow_club_categories and $current->numberOfClubCategories() ),
|
||||
) ) );
|
||||
), null, null, null, 'database_allow_club_categories' ) );
|
||||
}
|
||||
|
||||
Member::loggedIn()->language()->words['category_can_view_others_desc'] = Member::loggedIn()->language()->addToStack('category_can_view_others_database_desc');
|
||||
@@ -1813,7 +1833,7 @@ class databases extends Controller
|
||||
'options' => ( count( $templatesCat ) ? array_merge( $layouts, $custom ) : $layouts ),
|
||||
'toggles' => [ 'custom' => [ 'database_template_categories' ] ],
|
||||
'disabled' => ( count( $templatesCat ) ? null : [ 'custom' ] )
|
||||
] ) );
|
||||
], null, null, null, 'database_categories_layout' ) );
|
||||
if( count( $templatesCat ) )
|
||||
{
|
||||
$form->add( new Select( 'database_template_categories', ( ! empty( $current ) and $current->display_settings['categories']['layout'] == 'custom' ) ? $current->display_settings['categories']['template'] : NULL, null, array( 'options' => $templatesCat ), NULL, NULL, Theme::i()->getTemplate( 'databases', 'cms' )->templateGoButton('database_template_categories'), 'database_template_categories' ) );
|
||||
|
||||
Reference in new issue
Block a user