Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+129 -72
View File
@@ -5,20 +5,21 @@
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @subpackage convert
* @since 21 Jan 2015
*/
namespace IPS\convert\Library;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Invision Pages Support
* @note We must extend the Core Library here so we can access methods like convertAttachment, convertFollow, etc
*/
class _Cms extends Core
@@ -47,6 +48,7 @@ class _Cms extends Core
public function menuRows( $rowCounts=FALSE )
{
$return = array();
$extraRows = $this->software->extraMenuRows();
foreach( $this->getConvertableItems() as $k => $v )
{
@@ -75,7 +77,7 @@ class _Cms extends Core
'step_method' => 'convertCmsContainers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_containers' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'per_cycle' => 200,
'dependencies' => array(),
'link_type' => 'cms_containers',
);
@@ -104,7 +106,7 @@ class _Cms extends Core
'step_method' => 'convertCmsDatabaseCategories',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'per_cycle' => 200,
'dependencies' => array( 'convertCmsDatabases' ),
'link_type' => 'cms_database_categories',
);
@@ -122,7 +124,7 @@ class _Cms extends Core
$links[] = "cms_custom_database_{$database}";
}
$dependencies = array();
$dependencies = array( 'convertCmsDatabases' );
if ( array_key_exists( 'convertCmsDatabaseCategories', $this->getConvertableItems() ) )
{
$dependencies[] = 'convertCmsDatabaseCategories';
@@ -133,8 +135,8 @@ class _Cms extends Core
'step_method' => 'convertCmsDatabaseRecords',
'ips_rows' => $count,
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCmsDatabases' ),
'per_cycle' => 200,
'dependencies' => $dependencies,
'link_type' => $links,
'requires_rebuild' => TRUE
);
@@ -146,7 +148,7 @@ class _Cms extends Core
'step_method' => 'convertCmsDatabaseComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'per_cycle' => 200,
'dependencies' => array( 'convertCmsDatabaseRecords' ),
'link_type' => 'cms_database_comments',
'requires_rebuild' => TRUE
@@ -159,7 +161,7 @@ class _Cms extends Core
'step_method' => 'convertCmsDatabaseReviews',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_reviews' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'per_cycle' => 200,
'dependencies' => array( 'convertCmsDatabaseRecords' ),
'link_type' => 'cms_database_reviews',
'requires_rebuild' => TRUE
@@ -172,7 +174,7 @@ class _Cms extends Core
'step_method' => 'convertCmsFolders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_folders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'per_cycle' => 200,
'dependencies' => array(),
'link_type' => 'cms_folders',
);
@@ -190,7 +192,7 @@ class _Cms extends Core
'step_method' => 'convertCmsMedia',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'per_cycle' => 10,
'dependencies' => $dependencies,
'link_type' => 'cms_media',
);
@@ -202,7 +204,7 @@ class _Cms extends Core
'step_method' => 'convertCmsMediaFolders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media_folders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'per_cycle' => 200,
'dependencies' => array(),
'link_type' => 'cms_media_folders',
);
@@ -227,6 +229,18 @@ class _Cms extends Core
break;
case 'convertAttachments':
$dependencies = array( 'convertCmsDatabaseRecords' );
if ( array_key_exists( 'convertCmsDatabaseComments', $this->getConvertableItems() ) )
{
$dependencies[] = 'convertCmsDatabaseComments';
}
if ( array_key_exists( 'convertCmsDatabaseReviews', $this->getConvertableItems() ) )
{
$dependencies[] = 'convertCmsDatabaseReviews';
}
$in = array();
foreach( \IPS\Db::i()->select( 'database_id', 'cms_databases' ) AS $database )
{
@@ -238,16 +252,22 @@ class _Cms extends Core
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
#'dependencies' => array( 'convertCmsDatabaseRecords', 'convertCmsDatabaseComments', 'convertCmsDatabaseReviews' ),
'dependencies' => array( 'convertCmsDatabaseRecords' ), //TODO dear code reviewer... please review this part.. i had to remove it for my further work
'per_cycle' => 10,
'dependencies' => $dependencies,
'link_type' => 'core_attachments',
);
break;
}
}
$return = $this->software->extraMenuRows( $return );
/* Append any extra steps immediately to retain ordering */
if( isset( $v['extra_steps'] ) )
{
foreach( $v['extra_steps'] as $extra )
{
$return[ $extra ] = $extraRows[ $extra ];
}
}
}
/* Run the queries if we want row counts */
if( $rowCounts )
@@ -261,12 +281,13 @@ class _Cms extends Core
/**
* Returns an array of tables that need to be truncated when Empty Local Data is used
*
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
{
$return = array();
$classname = get_class( $this->software );
$classname = \get_class( $this->software );
foreach( $classname::canConvert() as $k => $v )
{
switch( $k )
@@ -284,7 +305,10 @@ class _Cms extends Core
break;
case 'convertCmsBlocks':
$return['convertCmsBlocks'] = array( 'cms_blocks' => NULL );
$return['convertCmsBlocks'] = array(
'cms_blocks' => NULL,
'core_permission_index' => array( 'app=? AND perm_type=?', 'cms', 'blocks' )
);
break;
case 'convertCmsDatabases':
@@ -420,7 +444,7 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_folders', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_folders' );
\IPS\Db::i()->update( 'cms_folders', array( 'folder_parent_id' => $inserted_id ), array( "folder_conv_parent=? AND folder_conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->update( 'cms_folders', array( 'folder_parent_id' => $inserted_id ), array( "folder_conv_parent=?", $id ) );
return $inserted_id;
}
@@ -466,7 +490,7 @@ class _Cms extends Core
if ( isset( $info['page_meta_keywords'] ) )
{
if ( is_array( $info['page_meta_keywords'] ) )
if ( \is_array( $info['page_meta_keywords'] ) )
{
$info['page_meta_keywords'] = implode( ',', $info['page_meta_keywords'] );
}
@@ -511,7 +535,7 @@ class _Cms extends Core
try
{
/* Check folder */
if ( intval( $info['page_folder_id'] ) == \IPS\cms\Pages\Folder::load( $info['page_seo_name'], 'folder_name' )->parent_id )
if ( \intval( $info['page_folder_id'] ) == \IPS\cms\Pages\Folder::load( $info['page_seo_name'], 'folder_name' )->parent_id )
{
$info['page_seo_name'] = \IPS\Http\Url::seoTitle( $info['page_name'] . '-' . $info['page_id'] );
}
@@ -598,7 +622,7 @@ class _Cms extends Core
$info['container_parent_id'] = 0;
}
if ( !isset( $info['container_type'] ) OR !in_array( $info['container_type'], array( 'block' ) ) )
if ( !isset( $info['container_type'] ) OR !\in_array( $info['container_type'], array( 'block' ) ) )
{
$info['container_type'] = 'block';
}
@@ -621,7 +645,7 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_containers', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_containers' );
\IPS\Db::i()->update( 'cms_containers', array( "container_parent_id" => $inserted_id ), array( "container_conv_parent=? AND container_conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->update( 'cms_containers', array( "container_parent_id" => $inserted_id ), array( "container_conv_parent=?", $id ) );
return $inserted_id;
}
@@ -677,7 +701,7 @@ class _Cms extends Core
if ( isset( $info['block_config'] ) )
{
if ( !is_array( $info['block_config'] ) )
if ( !\is_array( $info['block_config'] ) )
{
$info['block_config'] = json_decode( $info['block_config'], TRUE );
}
@@ -688,7 +712,7 @@ class _Cms extends Core
}
else
{
if ( !isset( $info['block_config']['editor'] ) OR !in_array( $info['block_config']['editor'], array( 'editor', 'html', 'php' ) ) )
if ( !isset( $info['block_config']['editor'] ) OR !\in_array( $info['block_config']['editor'], array( 'editor', 'html', 'php' ) ) )
{
$info['block_config']['editor'] = 'html';
}
@@ -795,7 +819,7 @@ class _Cms extends Core
}
/* No fields - we need at least one */
if ( !count( $fields ) )
if ( !\count( $fields ) )
{
$this->software->app->log( 'cms_database_no_fields', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['database_id'] );
return FALSE;
@@ -874,7 +898,7 @@ class _Cms extends Core
if ( !isset( $info['database_key'] ) )
{
$info['database_key'] = \IPS\Http\Url::seoTitle( $name );
$info['database_key'] = \IPS\Http\Url::seoTitle( $name ) . '_' . time();
}
/* Zero Defaults */
@@ -897,7 +921,7 @@ class _Cms extends Core
if ( isset( $info['database_options'] ) )
{
if ( is_array( $info['database_options'] ) )
if ( \is_array( $info['database_options'] ) )
{
$bitoptions = 0;
@@ -919,7 +943,7 @@ class _Cms extends Core
if ( isset( $info['database_fixed_field_perms'] ) )
{
if ( is_array( $info['database_fixed_field_perms'] ) )
if ( \is_array( $info['database_fixed_field_perms'] ) )
{
$info['database_fixed_field_perms'] = json_encode( $info['database_fixed_field_perms'] );
}
@@ -944,7 +968,7 @@ class _Cms extends Core
if ( isset( $info['database_featured_settings'] ) )
{
if ( is_array( $info['database_featured_settings'] ) )
if ( \is_array( $info['database_featured_settings'] ) )
{
$info['database_featured_settings'] = json_encode( $info['database_featured_settings'] );
}
@@ -963,7 +987,7 @@ class _Cms extends Core
if ( isset( $info['database_fixed_field_settings'] ) )
{
if ( is_array( $info['database_fixed_field_settings'] ) )
if ( \is_array( $info['database_fixed_field_settings'] ) )
{
$info['database_fixed_field_settings'] = json_encode( $info['database_fixed_field_settings'] );
}
@@ -1046,7 +1070,7 @@ class _Cms extends Core
if ( isset( $info['database_tags_predefined'] ) )
{
if ( is_array( $info['database_tags_predefined'] ) )
if ( \is_array( $info['database_tags_predefined'] ) )
{
$info['database_tags_predefined'] = implode( ',', $info['database_tags_predefined'] );
}
@@ -1094,7 +1118,7 @@ class _Cms extends Core
/* We already know this */
$field['field_database_id'] = $inserted_id;
if ( !in_array( $field['field_type'], $validFields ) )
if ( !\in_array( $field['field_type'], $validFields ) )
{
continue;
}
@@ -1205,20 +1229,20 @@ class _Cms extends Core
if ( isset( $field['field_format_opts'] ) )
{
$opts = array();
if ( !is_array( $field['field_format_opts'] ) )
if ( !\is_array( $field['field_format_opts'] ) )
{
$field['field_format_opts'] = json_decode( $field['field_format_opts'], TRUE );
}
foreach( $field['field_format_opts'] AS $key => $value )
{
if ( in_array( $value, array( 'strtolower', 'strtoupper', 'ucfirst', 'ucwords', 'punct', 'numerical', 'bold', 'italic' ) ) )
if ( \in_array( $value, array( 'strtolower', 'strtoupper', 'ucfirst', 'ucwords', 'punct', 'numerical', 'bold', 'italic' ) ) )
{
$opts[$key] = $value;
}
}
if ( count( $opts ) )
if ( \count( $opts ) )
{
$field['field_format_opts'] = json_encode( $opts );
}
@@ -1249,7 +1273,7 @@ class _Cms extends Core
if ( isset( $field['field_allowed_extensions'] ) )
{
if ( is_array( $field['field_allowed_extensions'] ) )
if ( \is_array( $field['field_allowed_extensions'] ) )
{
$field['field_allowed_extensions'] = json_encode( $field['field_allow_extensions'] );
}
@@ -1281,7 +1305,7 @@ class _Cms extends Core
if ( isset( $field['field_display_json'] ) )
{
if ( is_array( $field['field_display_json'] ) )
if ( \is_array( $field['field_display_json'] ) )
{
$field['field_display_json'] = json_encode( $field['field_display_json'] );
}
@@ -1329,7 +1353,7 @@ class _Cms extends Core
$fieldsInserted[$fieldInsertedId] = array( 'type' => $field['field_type'], 'multiple' => $field['field_is_multiple'], 'max_length' => $field['field_max_length'] );
}
if ( count( $fieldsInserted ) > 0 )
if ( \count( $fieldsInserted ) > 0 )
{
\IPS\Db::i()->update( 'cms_databases', array( 'database_field_title' => $titleField, 'database_field_content' => $contentField ), array( "database_id=?", $inserted_id ) );
\IPS\Lang::saveCustom( 'cms', "content_db_{$inserted_id}", $name );
@@ -1452,7 +1476,7 @@ class _Cms extends Core
if ( $data['type'] != 'Upload' )
{
if ( $columnDefinition['type'] == 'TEXT' )
if ( \in_array( $columnDefinition['type'], [ 'TEXT', 'MEDIUMTEXT' ] ) )
{
\IPS\Db::i()->addIndex( "cms_custom_database_{$inserted_id}", array( 'type' => 'fulltext', 'name' => $columnDefinition['name'], 'columns' => array( $columnDefinition['name'] ) ) );
}
@@ -1586,7 +1610,7 @@ class _Cms extends Core
if ( !isset( $info['category_last_record_seo_name'] ) )
{
if ( !is_null( $info['category_last_record_name'] ) )
if ( !\is_null( $info['category_last_record_name'] ) )
{
$info['category_last_record_seo_name'] = \IPS\Http\Url::seoTitle( $info['category_last_record_name'] );
}
@@ -1628,7 +1652,7 @@ class _Cms extends Core
if ( isset( $info['category_meta_keywords'] ) )
{
if ( is_array( $info['category_meta_keywords'] ) )
if ( \is_array( $info['category_meta_keywords'] ) )
{
$info['category_meta_keywords'] = implode( ',', $info['category_meta_keywords'] );
}
@@ -1733,7 +1757,7 @@ class _Cms extends Core
if ( !isset( $info['category_last_seo_title'] ) )
{
if ( !is_null( $info['category_last_title'] ) )
if ( !\is_null( $info['category_last_title'] ) )
{
$info['category_last_seo_title'] = \IPS\Http\Url::seoTitle( $info['category_last_title'] );
}
@@ -1749,7 +1773,7 @@ class _Cms extends Core
if ( isset( $info['category_fields'] ) )
{
if ( !is_array( $info['category_fields'] ) )
if ( !\is_array( $info['category_fields'] ) )
{
$info['category_fields'] = json_decode( $info['category_fields'], TRUE );
}
@@ -1767,7 +1791,7 @@ class _Cms extends Core
}
}
if ( count( $fields ) )
if ( \count( $fields ) )
{
$info['category_fields'] = json_encode( $fields );
}
@@ -1794,7 +1818,7 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_database_categories', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_database_categories' );
\IPS\Db::i()->update( 'cms_database_categories', array( "category_parent_id" => $inserted_id ), array( "category_conv_parent=? AND category_conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->update( 'cms_database_categories', array( "category_parent_id" => $inserted_id ), array( "category_conv_parent=?", $id ) );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'categories', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
\IPS\Lang::saveCustom( 'cms', "content_cat_name_{$inserted_id}", $info['category_name'] );
@@ -1909,17 +1933,21 @@ class _Cms extends Core
{
$titleField = \IPS\Db::i()->select( 'database_field_title', 'cms_databases', array( "database_id=?", $database ) )->first();
$info['record_dynamic_furl'] = \IPS\Http\Url::seoTitle( $fields['field_' . $titleField] );
$info['record_dynamic_furl'] = \IPS\Http\Url::seoTitle( $fields['field_' . $titleField ] );
}
if ( !isset( $info['record_static_furl'] ) )
{
$info['record_static_furl'] = NULL;
}
else
{
$info['record_static_furl'] = \IPS\Http\Url::seoTitle( $info['record_static_furl'] );
}
if ( isset( $info['record_meta_keywords'] ) )
{
if ( is_array( $info['record_meta_keywords'] ) )
if ( \is_array( $info['record_meta_keywords'] ) )
{
$info['record_meta_keywords'] = implode( ',', $info['record_meta_keywords'] );
}
@@ -1970,7 +1998,7 @@ class _Cms extends Core
}
/* Last comment and last review dates cannot be in the future */
if( in_array( $currentDate, array( 'record_last_comment', 'record_last_review' ) ) AND $info[ $currentDate ] > time() )
if( \in_array( $currentDate, array( 'record_last_comment', 'record_last_review' ) ) AND $info[ $currentDate ] > time() )
{
$info[ $currentDate ] = time();
}
@@ -2015,7 +2043,7 @@ class _Cms extends Core
$info['record_last_comment_name'] = NULL;
}
if ( isset( $info['record_image'] ) AND ( !is_null( $imagepath ) OR !is_null( $imagedata ) ) )
if ( isset( $info['record_image'] ) AND ( !\is_null( $imagepath ) OR !\is_null( $imagedata ) ) )
{
$container = NULL;
if( $info['record_saved'] )
@@ -2025,7 +2053,7 @@ class _Cms extends Core
try
{
if ( is_null( $imagedata ) AND !is_null( $imagepath ) )
if ( \is_null( $imagedata ) AND !\is_null( $imagepath ) )
{
$imagedata = @file_get_contents( $imagepath );
$imagepath = NULL;
@@ -2138,7 +2166,7 @@ class _Cms extends Core
{
$return = array();
if ( count( $fieldInfo ) )
if ( \count( $fieldInfo ) )
{
foreach( $fieldInfo as $key => $value )
{
@@ -2146,7 +2174,7 @@ class _Cms extends Core
{
$id = str_replace( 'field_', '', $matches[1] );
}
else if ( is_numeric( $key ) )
else if ( \is_numeric( $key ) )
{
$id = $key;
}
@@ -2482,13 +2510,13 @@ class _Cms extends Core
if ( isset( $info['review_votes_data'] ) )
{
if ( !is_array( $info['review_votes_data'] ) )
if ( !\is_array( $info['review_votes_data'] ) )
{
$info['review_votes_data'] = json_decode( $info['review_votes_data'], TRUE );
}
$newVoters = array();
if ( !is_null( $info['review_votes_data'] ) AND count( $info['review_votes_data'] ) )
if ( !\is_null( $info['review_votes_data'] ) AND \count( $info['review_votes_data'] ) )
{
foreach( $info['review_votes_data'] AS $member => $vote )
{
@@ -2505,7 +2533,7 @@ class _Cms extends Core
}
}
if ( count( $newVoters ) )
if ( \count( $newVoters ) )
{
$info['review_votes_data'] = json_encode( $newVoters );
}
@@ -2521,19 +2549,19 @@ class _Cms extends Core
if ( !isset( $info['review_votes_total'] ) )
{
if ( is_null( $info['review_votes_data'] ) )
if ( \is_null( $info['review_votes_data'] ) )
{
$info['review_votes_total'] = 0;
}
else
{
$info['review_votes_total'] = count( json_decode( $info['review_votes_data'], TRUE ) );
$info['review_votes_total'] = \count( json_decode( $info['review_votes_data'], TRUE ) );
}
}
if ( !isset( $info['review_votes_helpful'] ) )
{
if ( is_null( $info['review_votes_data'] ) )
if ( \is_null( $info['review_votes_data'] ) )
{
$info['review_votes_helpful'] = 0;
}
@@ -2612,7 +2640,7 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_media_folders', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_media_folders' );
\IPS\Db::i()->update( 'cms_media_folders', array( "media_folder_parent" => $inserted_id ), array( "media_conv_parent=? AND media_conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->update( 'cms_media_folders', array( "media_folder_parent" => $inserted_id ), array( "media_conv_parent=?", $id ) );
return $inserted_id;
}
@@ -2633,7 +2661,7 @@ class _Cms extends Core
return FALSE;
}
if ( is_null( $filepath ) AND is_null( $filedata ) )
if ( \is_null( $filepath ) AND \is_null( $filedata ) )
{
$this->software->app->log( 'cms_media_file_no_file', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['media_id'] );
return FALSE;
@@ -2657,7 +2685,7 @@ class _Cms extends Core
if ( !isset( $info['media_filename'] ) )
{
if ( !is_null( $filepath ) )
if ( !\is_null( $filepath ) )
{
$name = explode( '/', $filepath );
$name = array_pop( $name );
@@ -2698,7 +2726,7 @@ class _Cms extends Core
try
{
if ( is_null( $filedata ) AND !is_null( $filepath ) )
if ( \is_null( $filedata ) AND !\is_null( $filepath ) )
{
$filedata = @file_get_contents( $filepath );
$filepath = NULL;
@@ -2747,6 +2775,7 @@ class _Cms extends Core
* @param array $map Attachment Map Data
* @param string|NULL $filepath Path to the file, or NULL.
* @param string|NULL $filedata Binary data for the file, or NULL.
* @param string|NULL $thumbnailpath Path to the thumbnail, or NULL.
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath = NULL )
@@ -2757,19 +2786,47 @@ class _Cms extends Core
$map['id1_from_parent'] = FALSE;
$map['id2_from_parent'] = FALSE;
$map['id3_skip_link'] = TRUE;
$map['location_key'] = "cms_Records";
if ( \substr( $map['id3'], -1, 7 ) == '-review' )
$map['location_key'] = "cms_Records" . $database;
if( empty( $map['id2_type'] ) )
{
$map['id2_type'] = 'cms_database_reviews';
}
else
{
$map['id2_type'] = 'cms_database_comments';
if ( \substr( $map['id3'], -1, 7 ) == '-review' )
{
$map['id2_type'] = 'cms_database_reviews';
}
else
{
$map['id2_type'] = 'cms_database_comments';
}
}
$map['id3'] = $database;
return parent::convertAttachment( $info, $map, $filepath, $filedata, $thumbnailpath );
}
/**
* Convert a Tag - CMS, we need to verify the database in a different way that doesn't require it to be on a page
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted tag, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
* @note core_tags_cache and core_tags_perms need to be populated by the converter.
*/
public function convertTag( $info=array() )
{
$classname = 'IPS\cms\\' . ucfirst( $info['tag_meta_area'] );
if( !class_exists( $classname ) )
{
$this->software->app->log( 'tag_area_invalid_cms', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['tag_id'] ?? NULL );
return FALSE;
}
/* Set this as a validated content class */
$this->_ipsTagContentClass = $classname;
return parent::convertTag( $info );
}
}