Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

@@ -41,6 +41,7 @@ use function call_user_func_array;
use function count;
use function defined;
use function mb_substr;
use function method_exists;
use function strlen;
use function strtolower;
use function substr;
@@ -82,7 +83,7 @@ class dataLayer extends Controller
*/
public function __construct()
{
if ( Application::appIsEnabled('cloud') and DataLayerClass::i() instanceof \IPS\cloud\DataLayer\Handler )
if ( Application::appIsEnabled('cloud') and DataLayerClass::i() instanceof \IPS\cloud\DataLayer )
{
static::$handlerClass = 'IPS\cloud\DataLayer\Handler';
}
@@ -101,7 +101,7 @@ class general extends Controller
} ) );
$values['site_address'] = json_encode( $values['site_address'] );
$form->saveAsSettings( $values );
if ( $values['site_online'] )
@@ -113,8 +113,8 @@ class general extends Controller
AdminNotification::send( 'core', 'ConfigurationError', 'siteOffline', FALSE, NULL, Member::loggedIn() );
}
/* Clear manifest and ie browser data stores */
unset( Store::i()->manifest, Store::i()->iebrowserconfig );
/* Clear manifest data store */
unset( Store::i()->manifest );
Session::i()->log( 'acplogs__general_settings' );
Output::i()->redirect( Url::internal( 'app=core&module=settings&controller=general' ), 'saved' );
@@ -19,6 +19,7 @@ use IPS\Data\Store;
use IPS\Db;
use IPS\Dispatcher;
use IPS\Extensions\SSOAbstract;
use IPS\File;
use IPS\GeoLocation;
use IPS\Helpers\Form;
use IPS\Helpers\Form\Address;
@@ -27,11 +28,14 @@ use IPS\Helpers\Form\Number;
use IPS\Helpers\Form\Radio;
use IPS\Helpers\Form\Stack;
use IPS\Helpers\Form\Tel;
use IPS\Helpers\Form\Translatable;
use IPS\Helpers\Form\Url as FormUrl;
use IPS\Helpers\Form\YesNo;
use IPS\Helpers\Wizard;
use IPS\Http\Request\Exception;
use IPS\Http\Url;
use IPS\IPS;
use IPS\Lang;
use IPS\Login as LoginClass;
use IPS\Login\Handler;
use IPS\Member;
@@ -96,6 +100,12 @@ class login extends Controller
{
$buttons['add']['link'] = $buttons['add']['link']->setQueryString( '_new', 1 );
}
/* No add button for managed */
if( !IPS::canManageResources() )
{
unset( $buttons['add'] );
}
return $buttons;
}
@@ -476,6 +486,20 @@ class login extends Controller
'0' => 'force_reg_terms_0',
'1' => 'force_reg_terms_1',
) ) ) );
$form->add( new YesNo( 'reg_welcome_email', Settings::i()->reg_welcome_email, false, [ 'togglesOn' => [ 'reg_welcome_email_text' ] ] ) );
$defaultMessage = Member::loggedIn()->language()->addToStack( 'email_reg_complete', false, [ 'sprintf' => [ Settings::i()->board_name ] ] ) . Member::loggedIn()
->language()->addToStack( 'email_reg_complete_pass' );
$form->add( new Translatable( 'reg_welcome_email_text', Member::loggedIn()->language()->checkKeyExists( 'reg_welcome_email_message' ) ? null : $defaultMessage, null, [
'app' => 'core',
'key' => 'reg_welcome_email_message',
'editor' => [
'app' => 'core',
'key' => 'Admin',
'allowAttachments' => false,
'autoSaveKey' => 'core-Admin-reg_welcome_email_message',
]
], id: 'reg_welcome_email_text' ) );
/* Save */
if ( $values = $form->values() )
@@ -490,6 +514,24 @@ class login extends Controller
{
$values['coppa_address'] = json_encode( $values['coppa_address'] );
}
if( isset( $values['reg_welcome_email_text'] ) )
{
/* We only want to save this if it doesn't match the default */
Member::loggedIn()->language()->parseOutputForDisplay( $defaultMessage );
if( strip_tags( $values['reg_welcome_email_text'][ Member::loggedIn()->language()->id ] ) != trim( strip_tags( $defaultMessage ) ) )
{
Lang::saveCustom( 'core', 'reg_welcome_email_message', $values['reg_welcome_email_text'] );
}
else
{
Lang::deleteCustom( 'core', 'reg_welcome_email_message' );
}
File::claimAttachments( 'core-Admin-reg_welcome_email_message', null, null, 'reg_welcome_email_message', true );
unset( $values['reg_welcome_email_text'] );
}
$form->saveAsSettings( $values );
Session::i()->log( 'acplogs__registration_settings' );
@@ -1052,6 +1052,7 @@ class posting extends Controller
$keys = explode( ',', Request::i()->restrictionKey );
$langs = json_decode( Request::i()->restrictionLang, true );
$descs = json_decode( Request::i()->restrictionDesc, true );
$defaults = json_decode( Request::i()->restrictionDefault, true ) ?: [];
if ( !is_array( $langs ) or !is_array( $descs ) or count( $keys ) != count( $langs ) or count( $keys ) != count( $descs ) )
{
@@ -1067,7 +1068,7 @@ class posting extends Controller
$key = $keys[$i];
$lang = htmlspecialchars( $langs[$i] );
$desc = trim( htmlspecialchars( $descs[$i] ) );
$val = Form\Editor::getRestrictionLevel( $key );
$val = Form\Editor::getRestrictionLevel( $key, $defaults[$key] ?? null );
Member::loggedIn()->language()->words[ $key ] = $lang;
if ( !empty( $desc ) )
{
@@ -82,15 +82,15 @@ class webapp extends Controller
$form->addTab( 'webapp_tab_icons' );
/* Homescreen icons - we accept one upload and create the images we need */
$homeScreen = json_decode( Settings::i()->icons_homescreen, TRUE ) ?? array();
$form->add( new Upload( 'icons_homescreen', ( isset( $homeScreen['original'] ) ) ? File::get( 'core_Icons', $homeScreen['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons' ) ) );
$homeScreen = Settings::i()->icons_homescreen ? json_decode( Settings::i()->icons_homescreen, TRUE ) :[];
$form->add( new Upload( 'icons_homescreen', ( isset( $homeScreen['original'] ) ) ? File::get( 'core_Icons', $homeScreen['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons', 'allowedFileTypes' => array( 'png' ) ) ) );
$homeScreenMaskable = json_decode( Settings::i()->icons_homescreen_maskable, TRUE ) ?? array();
$form->add( new Upload( 'icons_homescreen_maskable', ( isset( $homeScreenMaskable['original'] ) ) ? File::get( 'core_Icons', $homeScreenMaskable['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons', 'allowedFileTypes' => ['png', 'webp' ] ) ) );
$homeScreenMaskable = Settings::i()->icons_homescreen_maskable ? json_decode( Settings::i()->icons_homescreen_maskable, TRUE ) : array();
$form->add( new Upload( 'icons_homescreen_maskable', ( isset( $homeScreenMaskable['original'] ) ) ? File::get( 'core_Icons', $homeScreenMaskable['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons', 'allowedFileTypes' => array( 'png' ) ) ) );
/* Apple startup screen logo - we accept one upload and create the images we need */
$apple = json_decode( Settings::i()->icons_apple_startup, TRUE ) ?? array();
$form->add( new Upload( 'icons_apple_startup', ( isset( $apple['original'] ) ) ? File::get( 'core_Icons', $apple['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons' ) ) );
$apple = Settings::i()->icons_apple_startup ? json_decode( Settings::i()->icons_apple_startup, TRUE ) : array();
$form->add( new Upload( 'icons_apple_startup', ( isset( $apple['original'] ) ) ? File::get( 'core_Icons', $apple['original'] ) : NULL, FALSE, array( 'image' => true, 'storageExtension' => 'core_Icons', 'allowedFileTypes' => array( 'png' ) ) ) );
/* Safari pinned tabs icon and highlight color */
$form->add( new Upload( 'icons_mask_icon', Settings::i()->icons_mask_icon ? File::get( 'core_Icons', Settings::i()->icons_mask_icon ) : NULL, FALSE, array( 'allowedFileTypes' => array( 'svg' ), 'storageExtension' => 'core_Icons', 'obscure' => FALSE ) ) );
@@ -99,14 +99,14 @@ class webapp extends Controller
$form->addTab( 'webapp_tab_manifest' );
/* And finally, additional manifest and livetile details */
$manifestDetails = json_decode( Settings::i()->manifest_details, TRUE );
$manifestDetails = Settings::i()->manifest_details ? json_decode( Settings::i()->manifest_details, TRUE ) : [];
if ( isset( $manifestDetails['cache_key'] ) )
{
unset( $manifestDetails['cache_key'] );
}
$form->add( new YesNo( 'configure_manifest', count( $manifestDetails ) > 0, FALSE, array(
'togglesOn' => array( 'manifest_shortname', 'manifest_fullname', 'manifest_description', 'manifest_defaultapp', 'manifest_themecolor', 'manifest_bgcolor', 'manifest_display', 'manifest_custom_url_toggle' ),
'togglesOn' => array( 'manifest_shortname', 'manifest_fullname', 'manifest_description', 'manifest_defaultapp', 'manifest_themecolor', 'manifest_bgcolor', 'manifest_custom_url_toggle' ),
) ) );
$form->add( new Text( 'manifest_shortname', ( isset( $manifestDetails['short_name'] ) ) ? $manifestDetails['short_name'] : '', FALSE, array(), NULL, NULL, NULL, 'manifest_shortname' ) );
@@ -142,7 +142,6 @@ class webapp extends Controller
$form->add( new Color( 'manifest_themecolor', ( isset( $manifestDetails['theme_color'] ) ) ? $manifestDetails['theme_color'] : NULL, FALSE, array( 'allowNoneLanguage' => 'manifest_themecolor_none', 'allowNone' => true ), NULL, NULL, NULL, 'manifest_themecolor' ) );
$form->add( new Color( 'manifest_bgcolor', ( isset( $manifestDetails['background_color'] ) ) ? $manifestDetails['background_color'] : NULL, FALSE, array(), NULL, NULL, NULL, 'manifest_bgcolor' ) );
$form->add( new Radio( 'manifest_display', ( isset( $manifestDetails['display'] ) ) ? $manifestDetails['display'] : 'standalone', FALSE, array( 'options' => array( 'fullscreen' => 'manifest_fullscreen', 'standalone' => 'manifest_standalone', 'minimal-ui' => 'manifest_minimalui', 'browser' => 'manifest_browser' ) ), NULL, NULL, NULL, 'manifest_display' ) );
if( $values = $form->values() )
{
@@ -194,18 +193,17 @@ class webapp extends Controller
$values['manifest_details']['description'] = $values['manifest_description'];
$values['manifest_details']['theme_color'] = $values['manifest_themecolor'];
$values['manifest_details']['background_color'] = $values['manifest_bgcolor'];
$values['manifest_details']['display'] = $values['manifest_display'];
}
unset( $values['configure_manifest'], $values['manifest_shortname'], $values['manifest_fullname'], $values['manifest_description'], $values['manifest_display'], $values['manifest_bgcolor'], $values['manifest_themecolor'], $values['manifest_custom_url_toggle'], $values['manifest_short_url'] );
unset( $values['configure_manifest'], $values['manifest_shortname'], $values['manifest_fullname'], $values['manifest_description'], $values['manifest_bgcolor'], $values['manifest_themecolor'], $values['manifest_custom_url_toggle'], $values['manifest_short_url'] );
$values['manifest_details'] = json_encode( array_merge( $values['manifest_details'], [ 'cache_key' => time() ] ) );
/* Save the settings */
$form->saveAsSettings( $values );
/* Clear manifest and ie browser data stores */
unset( Store::i()->manifest, Store::i()->iebrowserconfig );
/* Clear manifest data store */
unset( Store::i()->manifest );
/* And log */
Session::i()->log( 'acplogs__webapp' );
@@ -243,28 +241,8 @@ class webapp extends Controller
if( isset( $values[ $type ] ) AND $values[ $type ] )
{
$sizes = array(
'android-chrome-36x36' => array(36, 36),
'android-chrome-48x48' => array(48, 48),
'android-chrome-72x72' => array(72, 72),
'android-chrome-96x96' => array(96, 96),
'android-chrome-144x144' => array(144, 144),
'android-chrome-192x192' => array(192, 192),
'android-chrome-256x256' => array(256, 256),
'android-chrome-384x384' => array(384, 384),
'android-chrome-512x512' => array(512, 512),
'msapplication-square70x70logo' => array(128, 128),
'msapplication-TileImage' => array(144, 144),
'msapplication-square150x150logo' => array(270, 270),
'msapplication-wide310x150logo' => array(558, 558),
'msapplication-square310x310logo' => array(558, 270),
'apple-touch-icon-57x57' => array(57, 57),
'apple-touch-icon-60x60' => array(60, 60),
'apple-touch-icon-72x72' => array(72, 72),
'apple-touch-icon-76x76' => array(76, 76),
'apple-touch-icon-114x114' => array(114, 114),
'apple-touch-icon-120x120' => array(120, 120),
'apple-touch-icon-144x144' => array(144, 144),
'apple-touch-icon-152x152' => array(152, 152),
'apple-touch-icon-180x180' => array(180, 180),
);
@@ -351,7 +329,14 @@ class webapp extends Controller
{
if( $values['icons_apple_startup'] )
{
$values['icons_apple_startup'] = json_encode( array( 'original' => (string) $values['icons_apple_startup'] ) );
if( empty( $apple['original'] ) or (string) $values['icons_apple_startup'] != $apple['original'] )
{
$values['icons_apple_startup'] = json_encode( array( 'original' => (string) $values['icons_apple_startup'] ) );
}
else
{
$values['icons_apple_startup'] = json_encode( $apple );
}
}
else
{
@@ -391,36 +376,33 @@ class webapp extends Controller
if( isset( $setting['original'] ) )
{
$sizes = array(
'apple-startup-1136x640' => array( 320, 568, 2, 'landscape' ),
'apple-startup-2436x1125' => array( 375, 812, 3, 'landscape' ),
'apple-startup-1792x828' => array( 414, 896, 2, 'landscape' ),
'apple-startup-828x1792' => array( 414, 896, 2, 'portrait' ),
'apple-startup-1334x750' => array( 375, 667, 2, 'landscape' ),
'apple-startup-1242x2688' => array( 414, 896, 3, 'portrait' ),
'apple-startup-2208x1242' => array( 414, 736, 3, 'landscape' ),
'apple-startup-1125x2436' => array( 375, 812, 3, 'portrait' ),
'apple-startup-1242x2208' => array( 414, 736, 3, 'portrait' ),
'apple-startup-2732x2048' => array( 1024, 1366, 2, 'landscape' ),
'apple-startup-2688x1242' => array( 414, 896, 3, 'landscape' ),
'apple-startup-2224x1668' => array( 834, 1112, 2, 'landscape' ),
'apple-startup-750x1334' => array( 375, 667, 2, 'portrait' ),
'apple-startup-2048x2732' => array( 1024, 1366, 2, 'portrait' ),
'apple-startup-2388x1668' => array( 834, 1194, 2, 'landscape' ),
'apple-startup-1668x2224' => array( 834, 1112, 2, 'portrait' ),
'apple-startup-640x1136' => array( 320, 568, 2, 'portrait' ),
'apple-startup-1668x2388' => array( 834, 1194, 2, 'portrait' ),
'apple-startup-2048x1536' => array( 768, 1024, 2, 'landscape' ),
'apple-startup-1536x2048' => array( 768, 1024, 2, 'portrait' ),
'apple-startup-2360x1640' => array( 1180, 820, 2, 'landscape' ),
'apple-startup-1640x2360' => array( 1180, 820, 2, 'portrait' ),
'apple-startup-2160x1620' => array( 1080, 810, 2, 'landscape' ),
'apple-startup-1620x2160' => array( 1080, 810, 2, 'portrait' ),
'apple-startup-2778x1284' => array( 428, 926, 3, 'landscape' ),
'apple-startup-1284x2778' => array( 428, 926, 3, 'portrait' ),
'apple-startup-2532x1170' => array( 390, 844, 3, 'landscape' ),
// iPhone 12, 12 Pro, 13, 13 Pro, 14
'apple-startup-1170x2532' => array( 390, 844, 3, 'portrait' ),
'apple-startup-2340x1080' => array( 360, 780, 3, 'landscape' ),
'apple-startup-1080x2340' => array( 360, 780, 3, 'portrait' ),
// iPhone 12 Pro Max, 13 Pro Max, 14 Plus
'apple-startup-1284x2778' => array( 428, 926, 3, 'portrait' ),
// iPhone 14 Pro, iPhone 15, iPhone 15 Pro, iPhone 16
'apple-startup-1179x2556' => array( 393, 852, 3, 'portrait' ),
// iPhone 15 Plus, iPhone 15 Pro Max, iPhone 16 Plus
'apple-startup-1290x2796' => array( 430, 932, 3, 'portrait' ),
// iPhone 16 Pro
'apple-startup-1206x2622' => array( 402, 874, 3, 'portrait' ),
// iPhone 16 Pro Max
'apple-startup-1320x2868' => array( 440, 956, 3, 'portrait' ),
// iPad Air 13" + iPad Pro 12.9"
'apple-startup-2048x2732' => array( 1024, 1366, 2, 'portrait' ),
'apple-startup-2732x2048' => array( 1024, 1366, 2, 'landscape' ),
// iPad Air 4+ (11" displays)
'apple-startup-1640x2360' => array( 820, 1180, 2, 'portrait' ),
'apple-startup-2360x1640' => array( 820, 1180, 2, 'landscape' ),
// iPad Pro 11" (1st to 4th gen)
'apple-startup-1668x2388' => array( 834, 1194, 2, 'portrait' ),
'apple-startup-2388x1668' => array( 834, 1194, 2, 'landscape' ),
// iPad Pro 10.5" and 11" (1st & 2nd gen)
'apple-startup-1668x2224' => array( 834, 1112, 2, 'portrait' ),
'apple-startup-2224x1668' => array( 834, 1112, 2, 'landscape' ),
// iPad Mini 6 and 7
'apple-startup-1488x2266' => array( 430, 932, 2, 'portrait' ),
'apple-startup-2266x1488' => array( 430, 932, 2, 'landscape' ),
);
$file = File::get( 'core_Icons', $setting['original'] );