Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

@@ -81,11 +81,77 @@ class _onboard extends \IPS\Dispatcher\Controller
}
/**
* Show a form allowing the admin to configure some common settings after an initial installation
* Save the form values
*
* @return void
* @param $values
* @param \IPS\Helpers\Form $form
* @return void
*/
protected function manage()
public function handleForm( $values, \IPS\Helpers\Form $form )
{
/* If we dismissed, do that but also send an email */
if( isset( \IPS\Request::i()->dismiss ) and \IPS\Request::i()->dismiss == 1 )
{
\IPS\Email::buildFromTemplate( 'core', 'onboard_reminder', array(), \IPS\Email::TYPE_TRANSACTIONAL )->send( \IPS\Member::loggedIn() );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=overview&controller=dashboard' ) );
}
/* If we said to remind us later, set the flag and redirect */
if( isset( \IPS\Request::i()->remind ) and \IPS\Request::i()->remind == 1 )
{
\IPS\Settings::i()->changeValues( array( 'onboard_complete'=>\IPS\DateTime::ts( time() )->add( new \DateInterval( 'PT20M' ) )->getTimestamp() ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=overview&controller=dashboard' ), 'onboard_will_remind' );
}
array_walk( $values[ 'site_social_profiles' ], function( &$value ){
$value[ 'key' ]= (string) $value[ 'key' ];
} );
$values[ 'site_social_profiles' ]=json_encode( array_filter( $values[ 'site_social_profiles' ], function( $value ){
return (bool)$value[ 'key' ];
} ) );
$values[ 'site_address' ] = json_encode( $values[ 'site_address' ] );
$values[ 'icons_favicon' ] = (string) $values[ 'icons_favicon' ];
$values=\IPS\core\modules\admin\customization\icons::processApplicationIcon( $values );
$values=\IPS\core\modules\admin\settings\terms::processForm( $values );
/* If a logo was uploaded, do stuff with it... */
if( isset( $values[ 'initial_logo' ] ) )
{
$values[ 'email_logo' ]=(string)$values[ 'initial_logo' ];
/* Do this once for efficiency */
$image=\IPS\Image::create( $values[ 'initial_logo' ]->contents() );
$width=$image->width;
$height=$image->height;
unset( $image );
foreach( \IPS\Theme::themes() as $theme )
{
$logoUrl=(string)\IPS\File::create( 'core_Theme', $values[ 'initial_logo' ]->originalFilename, $values[ 'initial_logo' ]->contents(), NULL, TRUE );
$theme->saveSet( array( 'logo'=>array( 'front'=>array( 'url'=>$logoUrl, 'width'=>$width, 'height'=>$height ) ) ) );
}
unset( $values[ 'initial_logo' ] );
}
elseif( array_key_exists( 'initial_logo', $values ) )
{
unset( $values[ 'initial_logo' ] );
}
$form->saveAsSettings( $values );
}
/**
* Returns the onboarding form
*
* @return \IPS\Helpers\Form
*/
public function getForm(): \IPS\Helpers\Form
{
/* Create the form and add our message to it */
$form = new \IPS\Helpers\Form;
@@ -115,7 +181,7 @@ class _onboard extends \IPS\Dispatcher\Controller
}
}
if( !\IPS\Settings::i()->email_logo AND !$hasCustomLogo )
if( !\IPS\Settings::i()->email_logo and !$hasCustomLogo )
{
$form->add( new \IPS\Helpers\Form\Upload( 'initial_logo', NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Theme' ) ) );
}
@@ -125,7 +191,7 @@ class _onboard extends \IPS\Dispatcher\Controller
/* Homescreen icons - we accept one upload and create the images we need */
$homeScreen = json_decode( \IPS\Settings::i()->icons_homescreen, TRUE ) ?? array();
$form->add( new \IPS\Helpers\Form\Upload( 'icons_homescreen', ( isset( $homeScreen['original'] ) ) ? \IPS\File::get( 'core_Icons', $homeScreen['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons' ) ) );
$form->add( new \IPS\Helpers\Form\Upload( 'icons_homescreen', ( isset( $homeScreen[ 'original' ] ) ) ? \IPS\File::get( 'core_Icons', $homeScreen[ 'original' ] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons' ) ) );
$form->add( new \IPS\Helpers\Form\Color( 'email_color', \IPS\Settings::i()->email_color, TRUE ) );
@@ -151,64 +217,21 @@ class _onboard extends \IPS\Dispatcher\Controller
$form->addButton( 'onboard_remind_later', 'submit', NULL, 'ipsButton ipsButton_secondary', array( 'name' => 'remind', 'value' => 1, 'csrfKey' => \IPS\Session::i()->csrfKey ) );
$form->addButton( 'dismiss', 'submit', NULL, 'ipsButton ipsButton_secondary', array( 'name' => 'dismiss', 'value' => 1, 'csrfKey' => \IPS\Session::i()->csrfKey ) );
}
return $form;
}
/**
* Show a form allowing the admin to configure some common settings after an initial installation
*
* @return void
*/
protected function manage()
{
$form = $this->getForm();
if ( $values = $form->values() )
{
/* If we dismissed, do that but also send an email */
if( isset( \IPS\Request::i()->dismiss ) AND \IPS\Request::i()->dismiss == 1 )
{
\IPS\Email::buildFromTemplate( 'core', 'onboard_reminder', array(), \IPS\Email::TYPE_TRANSACTIONAL )->send( \IPS\Member::loggedIn() );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=overview&controller=dashboard' ) );
}
/* If we said to remind us later, set the flag and redirect */
if( isset( \IPS\Request::i()->remind ) AND \IPS\Request::i()->remind == 1 )
{
\IPS\Settings::i()->changeValues( array( 'onboard_complete' => \IPS\DateTime::ts( time() )->add( new \DateInterval( 'PT20M' ) )->getTimestamp() ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=overview&controller=dashboard' ), 'onboard_will_remind' );
}
array_walk( $values['site_social_profiles'], function( &$value ){
$value['key'] = (string) $value['key'];
});
$values['site_social_profiles'] = json_encode( array_filter( $values['site_social_profiles'], function( $value ) {
return (bool) $value['key'];
} ) );
$values['site_address'] = json_encode( $values['site_address'] );
$values['icons_favicon'] = (string) $values['icons_favicon'];
$values = \IPS\core\modules\admin\customization\icons::processApplicationIcon( $values );
$values = \IPS\core\modules\admin\settings\terms::processForm( $values );
/* If a logo was uploaded, do stuff with it... */
if( isset( $values['initial_logo'] ) )
{
$values['email_logo'] = (string) $values['initial_logo'];
/* Do this once for efficiency */
$image = \IPS\Image::create( $values['initial_logo']->contents() );
$width = $image->width;
$height = $image->height;
unset( $image );
foreach( \IPS\Theme::themes() as $theme )
{
$logoUrl = (string) \IPS\File::create( 'core_Theme', $values['initial_logo']->originalFilename, $values['initial_logo']->contents(), NULL, TRUE );
$theme->saveSet( array( 'logo' => array( 'front' => array( 'url' => $logoUrl, 'width' => $width, 'height' => $height ) ) ) );
}
unset( $values['initial_logo'] );
}
elseif( array_key_exists( 'initial_logo', $values ) )
{
unset( $values['initial_logo'] );
}
$form->saveAsSettings( $values );
$this->handleForm( $values, $form );
/* Clear create menu caches */
\IPS\Member::clearCreateMenu();
@@ -217,10 +240,10 @@ class _onboard extends \IPS\Dispatcher\Controller
\IPS\Data\Cache::i()->clearAll();
/* Clear data stores */
unset(
\IPS\Data\Store::i()->manifest,
\IPS\Data\Store::i()->iebrowserconfig,
\IPS\Data\Store::i()->frontNavigation
unset(
\IPS\Data\Store::i()->manifest,
\IPS\Data\Store::i()->iebrowserconfig,
\IPS\Data\Store::i()->frontNavigation
);
\IPS\Session::i()->log( 'acplogs__onboard_settings' );
@@ -231,7 +254,7 @@ class _onboard extends \IPS\Dispatcher\Controller
\IPS\Output::i()->output .= $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'dashboard' ), 'onboardForm' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'settings/general.css', 'core', 'admin' ) );
}
/**
* Show a confirmation screen with "next steps"
*