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

@@ -11,7 +11,7 @@
namespace IPS\core\modules\front\system;
/* 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;
@@ -32,7 +32,7 @@ class _widgets extends \IPS\Dispatcher\Controller
/* Check Permissions */
if ( ! \IPS\Member::loggedIn()->modPermission('can_manage_sidebar') )
{
\IPS\Output::i()->error( 'no_permission_manage_sidebar', '3S172/1', 403, '' );
\IPS\Output::i()->error( 'no_permission_manage_sidebar', '2S172/1', 403, '' );
}
parent::execute();
@@ -147,7 +147,7 @@ class _widgets extends \IPS\Dispatcher\Controller
}
}
\IPS\Output::i()->sendOutput( (string) $widget );
\IPS\Output::i()->json( array( 'html' => (string) $widget, 'devices' => ( isset( $widget->configuration['devices_to_show'] ) ) ? $widget->configuration['devices_to_show'] : array('Phone', 'Tablet', 'Desktop') ) );
}
/**
@@ -214,7 +214,8 @@ class _widgets extends \IPS\Dispatcher\Controller
$widget->menuStyle = $widgetMaster['menu_style'];
$form = new \IPS\Helpers\Form( 'form', 'saveSettings' );
if ( $widget->configuration( $form ) !== NULL )
if ( $configurationForm = $widget->configuration( $form ) )
{
if ( $values = $form->values() )
{
@@ -223,12 +224,30 @@ class _widgets extends \IPS\Dispatcher\Controller
$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'];
}
}
if( isset( $values['show_on_all_devices'] ) and $values['show_on_all_devices'] )
{
$values['devices_to_show'] = array( 'Phone', 'Tablet', 'Desktop' );
}
unset( $values['show_on_all_devices'] );
$blocks[ $k ]['configuration'] = $values;
\IPS\Db::i()->insert( 'core_widget_areas', array( 'app' => \IPS\Request::i()->pageApp, 'module' => \IPS\Request::i()->pageModule, 'controller' => \IPS\Request::i()->pageController, 'area' => \IPS\Request::i()->pageArea, 'widgets' => json_encode( $blocks ) ), TRUE );
\IPS\Widget::deleteCaches( $block['key'], ( isset( $block['app'] ) ) ? $block['app'] : NULL, ( isset( $block['plugin'] ) ) ? $block['plugin'] : NULL );
\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\Member::loggedIn()->language()->words['widget_adv__custom_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'widget_adv__custom__desc', NULL, array( 'sprintf' => array( \IPS\Request::i()->block ) ) );
\IPS\Output::i()->output = $configurationForm->customTemplate( array( \IPS\Theme::i()->getTemplate( 'widgets', 'core' ), 'formTemplate' ), $widget );
}
}
}
@@ -242,7 +261,7 @@ class _widgets extends \IPS\Dispatcher\Controller
*/
protected function saveOrder()
{
if( !in_array( \IPS\Request::i()->area, array( 'sidebar', 'header', 'footer' ) ) )
if( !\in_array( \IPS\Request::i()->area, array( 'sidebar', 'header', 'footer' ) ) )
{
\IPS\Output::i()->error( 'invalid_widget_area', '3S172/2', 403, '' );
}
@@ -307,13 +326,13 @@ class _widgets extends \IPS\Dispatcher\Controller
}
/* 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 );
}