Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+20 -10
View File
@@ -348,7 +348,7 @@ class _Stream extends \IPS\Node\Model
if ( $titleType )
{
$titleClass = '\IPS\Helpers\Form\\' . $titleType;
$form->add( new $titleClass( 'stream_title', ( $this->id and $titleType === 'Text' ) ? $this->_title : NULL, $titleRequired, array( 'app' => 'core', 'key' => ( $this->id ? "stream_title_{$this->id}" : NULL ) ) ) );
$form->add( new $titleClass( 'stream_title', ( $this->id and $titleType === 'Text' ) ? $this->_title : NULL, $titleRequired, array( 'app' => 'core', 'key' => ( $this->id ? "stream_title_{$this->id}" : NULL ),'maxLength' => 255 ) ) );
}
/* All content or specific content? */
@@ -494,19 +494,22 @@ class _Stream extends \IPS\Node\Model
) ), NULL, NULL, NULL, 'stream_followed_types' ) );
/* Date */
$form->add( new \IPS\Helpers\Form\Radio( 'stream_date_type', $this->date_type, TRUE, array(
'options' => array(
'all' => 'stream_date_type_all',
'last_visit' => 'stream_date_type_last_visit',
'relative' => 'stream_date_type_relative',
'custom' => 'stream_date_type_custom',
),
$streamDateOptions = [];
if ( \IPS\Settings::i()->search_method === 'elastic' )
{
$streamDateOptions['all'] = 'stream_date_type_all';
}
$streamDateOptions['last_visit'] = 'stream_date_type_last_visit';
$streamDateOptions['relative'] = 'stream_date_type_relative';
$streamDateOptions['custom'] = 'stream_date_type_custom';
$form->add( new \IPS\Helpers\Form\Radio( 'stream_date_type', $this->id ? $this->date_type : ( \IPS\Settings::i()->search_method === 'elastic' ? 'all' : 'relative' ), TRUE, array(
'options' => $streamDateOptions,
'toggles' => array(
'relative' => array( 'stream_date_relative_days' ),
'custom' => array( 'stream_date_range' )
)
) ) );
$form->add( new \IPS\Helpers\Form\Interval( 'stream_date_relative_days', $this->date_relative_days ?: 7, NULL, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), function( $val )
$form->add( new \IPS\Helpers\Form\Interval( 'stream_date_relative_days', $this->date_relative_days ?: 365, NULL, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), function( $val )
{
if ( \IPS\Request::i()->stream_date_type == 'relative' and !$val )
{
@@ -1232,7 +1235,14 @@ class _Stream extends \IPS\Node\Model
$query->$filterDateMethod( \IPS\DateTime::ts( \IPS\Member::loggedIn()->last_visit ) );
break;
case 'relative':
$query->$filterDateMethod( \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \intval( $this->date_relative_days ) . 'D' ) ) );
if ( \is_array( $this->date_relative_days ) )
{
$query->$filterDateMethod( \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \intval( $this->date_relative_days['val'] ) . mb_strtoupper( $this->date_relative_days['unit'] ) ) ) );
}
else
{
$query->$filterDateMethod( \IPS\DateTime::create()->sub( new \DateInterval( 'P' . \intval( $this->date_relative_days ) . 'D' ) ) );
}
case 'custom':
$query->$filterDateMethod( $this->date_start ? \IPS\DateTime::ts( $this->date_start ) : NULL, $this->date_end ? \IPS\DateTime::ts( $this->date_end ) : NULL );
break;