Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -30,23 +30,47 @@ class _builder extends \IPS\core\modules\front\system\widgets
*/
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( \IPS\Request::i()->block_plugin ) )
if ( isset( $data['block_plugin'] ) )
{
$block = new \IPS\cms\Blocks\Block;
$block->type = "plugin";
$block->plugin = \IPS\Request::i()->block_plugin;
$block->plugin_app = ( isset( \IPS\Request::i()->block_plugin_app ) ) ? \IPS\Request::i()->block_plugin_app : \IPS\Request::i()->block_app;
$block->plugin_plugin = \IPS\Request::i()->block_plugin_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( \IPS\Request::i()->_sending ) )
if ( isset( $data['_sending'] ) )
{
foreach( explode( ",", \IPS\Request::i()->_sending ) as $field )
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 )
@@ -59,15 +83,15 @@ class _builder extends \IPS\core\modules\front\system\widgets
$isArray = FALSE;
}
if ( $field and isset( \IPS\Request::i()->$field ) )
if ( $field and isset( $data[ $field ] ) )
{
if ( $field == 'block_content' )
{
$block->content = \IPS\Request::i()->$field;
$block->content = $data[ $field ];
if ( isset( \IPS\Request::i()->template_params ) )
if ( isset( $data['template_params'] ) )
{
$block->template_params = \IPS\Request::i()->template_params;
$block->template_params = $data['template_params'];
}
continue;
}
@@ -75,35 +99,35 @@ class _builder extends \IPS\core\modules\front\system\widgets
if( mb_strpos( $field, "widget_feed_container_" ) !== FALSE )
{
/* On means that the all checkbox is ticked */
$params[ 'widget_feed_container'] = \IPS\Request::i()->$field == 'on' ? 0 : ( \is_array( \IPS\Request::i()->$field ) ? \IPS\Request::i()->$field : explode( ',', \IPS\Request::i()->$field ) );
$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 ] = \IPS\Request::i()->$field ? explode( ',', \IPS\Request::i()->$field ) : array();
$params[ $field ] = $data[ $field ] ? explode( ',', $data[ $field ] ) : array();
continue;
}
/* We need to handle authors special */
if( $field == 'widget_feed_author' )
{
$params[ $field ] = \IPS\Request::i()->$field ? array( \IPS\Member::load( \IPS\Request::i()->$field, 'name' )->member_id ) : array();
$params[ $field ] = $data[ $field ] ? array( \IPS\Member::load( $data[ $field ], 'name' )->member_id ) : array();
continue;
}
/* Is it an array? */
if ( $isArray )
{
foreach( \IPS\Request::i()->$field AS $multi )
foreach( $data[ $field ] AS $multi )
{
$params[ $field ][] = $multi;
}
continue;
}
$params[ $field ] = \IPS\Request::i()->$field;
$params[ $field ] = $data[ $field ];
}
}
}
@@ -111,7 +135,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
$block->plugin_config = json_encode( $params );
/* Template stuffs */
if ( \IPS\Request::i()->block_template_use_how == 'copy' )
if ( $data['block_template_use_how'] == 'copy' )
{
$block->widget()->template( array( $block, 'getTemplate' ) );
}