Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -115,7 +115,21 @@ class _notifications extends \IPS\Dispatcher\Controller
'daily' => \IPS\Member::loggedIn()->language()->addToStack('follow_type_daily'),
'weekly' => \IPS\Member::loggedIn()->language()->addToStack('follow_type_weekly')
) ), NULL, NULL, NULL, 'auto_track_type' ) );
$form->add( new \IPS\Helpers\Form\Checkbox( 'show_pm_popup', \IPS\Member::loggedIn()->members_bitoptions['show_pm_popup'] ) );
/* Changed in 4.1: since email_notifications_once is new, combined show_pm_popup in and made a checkbox set for better organization */
$notificationPrefValues = array();
if ( \IPS\Member::loggedIn()->members_bitoptions['show_pm_popup'] )
{
$notificationPrefValues[] = 'show_pm_popup';
}
if ( \IPS\Member::loggedIn()->members_bitoptions['email_notifications_once'] )
{
$notificationPrefValues[] = 'email_notifications_once';
}
if ( !\IPS\Member::loggedIn()->members_bitoptions['disable_notification_sounds'] )
{
$notificationPrefValues[] = 'enable_notification_sounds';
}
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'notification_prefs', $notificationPrefValues, FALSE, array( 'options' => array( 'show_pm_popup' => 'show_pm_popup', 'email_notifications_once' => 'email_notifications_once', 'enable_notification_sounds' => 'enable_notification_sounds' ), 'multiple' => TRUE ) ) );
$form->addMatrix( 'notifications', \IPS\Notification::buildMatrix( \IPS\Member::loggedIn() ) );
/* Handle submissions */
@@ -127,21 +141,34 @@ class _notifications extends \IPS\Dispatcher\Controller
'comments' => ( is_array( $values['auto_track'] ) AND in_array( 'comments', $values['auto_track'] ) ) ? 1 : 0,
'method' => $values['auto_track_type']
) );
\IPS\Member::loggedIn()->members_bitoptions['show_pm_popup'] = $values['show_pm_popup'];
if ( isset( $values['notifications']['report_center'] ) and !$values['notifications']['report_center']['member_notifications_inline'] )
\IPS\Member::loggedIn()->members_bitoptions['show_pm_popup'] = ( is_array( $values['notification_prefs'] ) AND in_array( 'show_pm_popup', $values['notification_prefs'] ) ) ? 1 : 0;
\IPS\Member::loggedIn()->members_bitoptions['email_notifications_once'] = ( is_array( $values['notification_prefs'] ) AND in_array( 'email_notifications_once', $values['notification_prefs'] ) ) ? 1 : 0;
\IPS\Member::loggedIn()->members_bitoptions['disable_notification_sounds'] = ( is_array( $values['notification_prefs'] ) AND in_array( 'enable_notification_sounds', $values['notification_prefs'] ) ) ? 0 : 1;
\IPS\Notification::saveMatrix( \IPS\Member::loggedIn(), $values );
/* Refetch config to see if inline report center notification is set. We have to do this because if toggling report center
option is disabled but inline is forced on by the admin, the setting won't be included in the $values array but the saveMatrix()
method will automatically set it and calling notificationsConfiguration() will pull the data directly from the db. */
$config = \IPS\Member::loggedIn()->notificationsConfiguration();
if ( isset( $config['report_center'] ) and !in_array( 'inline', $config['report_center'] ) )
{
\IPS\Member::loggedIn()->members_bitoptions['no_report_count'] = TRUE;
}
else
{
\IPS\Member::loggedIn()->members_bitoptions['no_report_count'] = FALSE;
}
\IPS\Notification::saveMatrix( \IPS\Member::loggedIn(), $values );
}
\IPS\Member::loggedIn()->save();
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved');
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=system&controller=notifications&do=options', 'front', 'notifications_options' ), 'saved' );
}
/* Display */
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_system.js', 'core' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/notification_settings.css' ) );
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'system' ), 'notificationsSettings' ) );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('notification_options');
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=system&controller=notifications', 'front', 'notifications' ), \IPS\Member::loggedIn()->language()->addToStack('notifications') );
@@ -218,6 +245,7 @@ class _notifications extends \IPS\Dispatcher\Controller
/* Get thing */
$thing = NULL;
$indexId = NULL;
try
{
if ( in_array( 'IPS\Node\Model', class_parents( $class ) ) )
@@ -240,6 +268,13 @@ class _notifications extends \IPS\Dispatcher\Controller
{
$thing = $class::loadAndCheckPerms( \IPS\Request::i()->follow_id );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'follow_thing', FALSE, array( 'sprintf' => array( $thing->mapped('title') ) ) );
/* Work out the index ID */
try
{
$indexId = \IPS\Content\Search\Index::i()->getIndexId( $thing );
}
catch ( \UnderflowException $e ) { }
/* Set navigation */
$container = NULL;
@@ -259,7 +294,8 @@ class _notifications extends \IPS\Dispatcher\Controller
}
else
{
$thing = $class::load( \IPS\Request::i()->follow_id );
$thing = $class::load( \IPS\Request::i()->follow_id );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('follow_thing', FALSE, array( 'sprintf' => array( $thing->name ) ) );
/* Set navigation */
@@ -386,7 +422,8 @@ class _notifications extends \IPS\Dispatcher\Controller
'follow_notify_meta' => '',
'follow_notify_freq' => ( $class == "IPS\Member" ) ? 'immediate' : $values['follow_type'],
'follow_notify_sent' => 0,
'follow_visible' => 1
'follow_visible' => 1,
'follow_index_id' => $indexId,
);
if ( $current )
{
@@ -634,13 +671,27 @@ class _notifications extends \IPS\Dispatcher\Controller
\IPS\Output::i()->error( 'node_error', '2C154/6', 404, '' );
}
if ( \IPS\Request::i()->follow_area == 'member' )
if ( \IPS\Request::i()->follow_area == 'member' && ( !isset( \IPS\Request::i()->button_type ) || \IPS\Request::i()->button_type === 'search' ) )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->memberFollowButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id, $count );
if ( isset( \IPS\Request::i()->button_type ) && \IPS\Request::i()->button_type === 'search' )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->memberSearchFollowButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id, $count );
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'profile' )->memberFollowButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id, $count );
}
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->followButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id, $count );
if ( \IPS\Request::i()->button_type == 'manage' )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->manageFollowButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id );
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->followButton( \IPS\Request::i()->follow_app, \IPS\Request::i()->follow_area, \IPS\Request::i()->follow_id, $count );
}
}
}
}