Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -23,128 +23,6 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _builder extends \IPS\core\modules\front\system\widgets
{
/**
* Preview a block (from the ACP or elsewhere dynamically)
*
* @return html
*/
public function previewBlock()
{
if ( !\IPS\Member::loggedIn()->hasAcpRestriction( 'cms', 'blocks', 'block_manage' ) )
{
\IPS\Output::i()->error( 'no_module_permission', '3T419/1', 403, '' );
}
$output = "";
if ( \IPS\Request::i()->_key )
{
try
{
$key = \IPS\Request::i()->_key;
$data = \IPS\Data\Store::i()->$key;
unset( \IPS\Data\Store::i()->$key );
}
catch( \OutOfRangeException $e )
{
$data = array();
}
}
if ( isset( $data['block_plugin'] ) )
{
$block = new \IPS\cms\Blocks\Block;
$block->type = "plugin";
$block->plugin = $data['block_plugin'];
$block->plugin_app = ( isset( $data['block_plugin_app'] ) ) ? $data['block_plugin_app'] : $data['block_app'];
if( isset( $data['block_plugin_plugin'] ) )
{
$block->plugin_plugin = $data['block_plugin_plugin'];
}
$block->key = md5( mt_rand() );
$params = array();
$block->content = NULL;
if ( isset( $data['_sending'] ) )
{
foreach( explode( ",", $data['_sending'] ) as $field )
{
/* Multi-Selects will pass their parameters through as an array, so we need to make sure we check those properly to include all options. */
if ( mb_strstr( $field, '[]' ) !== FALSE )
{
$field = str_replace( '[]', '', $field );
$isArray = TRUE;
}
else
{
$isArray = FALSE;
}
if ( $field and isset( $data[ $field ] ) )
{
if ( $field == 'block_content' )
{
$block->content = $data[ $field ];
if ( isset( $data['template_params'] ) )
{
$block->template_params = $data['template_params'];
}
continue;
}
if( mb_strpos( $field, "widget_feed_container_" ) !== FALSE )
{
/* On means that the all checkbox is ticked */
$params[ 'widget_feed_container'] = $data[ $field ] == 'on' ? 0 : ( \is_array( $data[ $field ] ) ? $data[ $field ] : explode( ',', $data[ $field ] ) );
continue;
}
/* We need to handle tags special */
if( $field == 'widget_feed_tags' )
{
$params[ $field ] = $data[ $field ] ? explode( ',', $data[ $field ] ) : array();
continue;
}
/* We need to handle authors special */
if( $field == 'widget_feed_author' )
{
$params[ $field ] = $data[ $field ] ? array( \IPS\Member::load( $data[ $field ], 'name' )->member_id ) : array();
continue;
}
/* Is it an array? */
if ( $isArray )
{
foreach( $data[ $field ] AS $multi )
{
$params[ $field ][] = $multi;
}
continue;
}
$params[ $field ] = $data[ $field ];
}
}
}
$block->plugin_config = json_encode( $params );
/* Template stuffs */
if ( $data['block_template_use_how'] == 'copy' )
{
$block->widget()->template( array( $block, 'getTemplate' ) );
}
$output = $block->widget()->render();
}
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $output ), 200, 'text/html' );
}
/**
* Get Output For Adding A New Block