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

@@ -12,7 +12,7 @@
namespace IPS\cms\modules\front\pages;
/* 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;
@@ -75,14 +75,21 @@ 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 : \IPS\Request::i()->$field;
$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 ) );
continue;
}
/* We need to handle tags special */
if( $field == 'widget_feed_tags' )
{
$params[ $field ] = explode( ',', \IPS\Request::i()->$field );
$params[ $field ] = \IPS\Request::i()->$field ? explode( ',', \IPS\Request::i()->$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();
continue;
}
@@ -112,7 +119,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
$output = $block->widget()->render();
}
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $output ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $output ), 200, 'text/html' );
}
/**
@@ -188,7 +195,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
protected function getConfiguration()
{
/* Standard widget area, allow the core stuff to handle this */
if( in_array( \IPS\Request::i()->area, array( 'sidebar', 'header', 'footer' ) ) )
if( \in_array( \IPS\Request::i()->area, array( 'sidebar', 'header', 'footer' ) ) )
{
return parent::getConfiguration();
}
@@ -241,11 +248,20 @@ class _builder extends \IPS\core\modules\front\system\widgets
$values = $widget->preConfig( $values );
}
/* Special advanced builder stuff */
if ( \in_array( 'IPS\Widget\Builder', class_implements( $widget ) ) )
{
if( isset( $values['widget_adv__background_custom_image'] ) and $values['widget_adv__background_custom_image'] )
{
$values['widget_adv__background_custom_image'] = (string) $values['widget_adv__background_custom_image'];
}
}
$blocks[ $k ]['configuration'] = $values;
\IPS\Db::i()->insert( 'cms_page_widget_areas', array( 'area_page_id' => \IPS\Request::i()->pageID, 'area_area' => \IPS\Request::i()->pageArea, 'area_widgets' => json_encode( $blocks ) ), TRUE );
\IPS\Output::i()->json( 'OK' );
}
\IPS\Output::i()->output = $widget->configuration()->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'widgets', 'core' ) ), 'formTemplate' ), $widget );
\IPS\Output::i()->output = $widget->configuration()->customTemplate( array( \IPS\Theme::i()->getTemplate( 'widgets', 'core' ), 'formTemplate' ), $widget );
}
}
}
@@ -319,13 +335,13 @@ class _builder extends \IPS\core\modules\front\system\widgets
}
/* Anything to update? */
if ( count( $widgets ) > count( $newOrder ) )
if ( \count( $widgets ) > \count( $newOrder ) )
{
/* No items left in area, or one has been removed */
foreach( $widgets as $widget )
{
/* If we haven't seen this widget, it's been removed, so add to trash */
if ( ! in_array( $widget['unique'], $seen ) )
if ( ! \in_array( $widget['unique'], $seen ) )
{
\IPS\Widget::trash( $widget['unique'], $widget );
}
@@ -360,7 +376,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
*/
protected function _checkAndDeleteFromCoreWidgets( $uniqueId, $widgets )
{
if ( ! in_array( $uniqueId, $widgets ) )
if ( ! \in_array( $uniqueId, $widgets ) )
{
/* This widget hasn't been seen, so it isn't in the cms table */
try
@@ -378,7 +394,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
}
/* Anything to save? */
if ( count( $newWidgets ) )
if ( \count( $newWidgets ) )
{
\IPS\Db::i()->replace( 'core_widget_areas', array( 'app' => 'cms', 'module' => 'pages', 'controller' => 'page', 'widgets' => json_encode( $newWidgets ), 'area' => \IPS\Request::i()->area ) );
}