Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,26 +12,37 @@
namespace IPS\calendar\extensions\core\StreamItems;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\calendar\Event;
use IPS\Content\Search\Result\Custom;
use IPS\DateTime;
use IPS\Db;
use IPS\Extensions\StreamItemsAbstract;
use IPS\Member;
use IPS\Theme;
use OutOfRangeException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* @brief Activity stream items extension: StreamItems
*/
class _StreamItems
class StreamItems extends StreamItemsAbstract
{
/**
* Is there content to display?
*
* @param \IPS\Member|NULL $author The author to limit extra items to
* @param Timestamp|NULL $lastTime If provided, only items since this date are included. If NULL, it works out which to include based on what results are being shown
* @param Timestamp|NULL $firstTime If provided, only items before this date are included. If NULL, it works out which to include based on what results are being shown
* @param Member|null $author The author to limit extra items to
* @param int|null $lastTime If provided, only items since this date are included. If NULL, it works out which to include based on what results are being shown
* @param int|null $firstTime If provided, only items before this date are included. If NULL, it works out which to include based on what results are being shown
* @return array Array of \IPS\Content\Search\Result\Custom objects
*/
public function extraItems( $author=NULL, $lastTime=NULL, $firstTime=NULL )
public function extraItems( Member $author=NULL, int $lastTime=NULL, int $firstTime=NULL ): array
{
$rsvps = array();
@@ -45,19 +56,19 @@ class _StreamItems
{
$where[] = array( 'calendar_event_rsvp.rsvp_member_id=?', $author->member_id );
}
foreach ( \IPS\Db::i()->select( '*', 'calendar_event_rsvp', $where, 'rsvp_date DESC', 10 ) as $rsvp )
foreach ( Db::i()->select( '*', 'calendar_event_rsvp', $where, 'rsvp_date DESC', 10 ) as $rsvp )
{
try
{
$event = \IPS\calendar\Event::load( $rsvp[ 'rsvp_event_id' ] );
$event = Event::load( $rsvp[ 'rsvp_event_id' ] );
if( $event->canView() )
{
$member = \IPS\Member::load( $rsvp['rsvp_member_id'] );
$member = Member::load( $rsvp['rsvp_member_id'] );
$title = htmlspecialchars( $event->title, ENT_DISALLOWED, 'UTF-8', FALSE );
$rsvps[] = new \IPS\Content\Search\Result\Custom( \IPS\DateTime::ts( $rsvp[ 'rsvp_date' ] ), \IPS\Member::loggedIn()->language()->addToStack( 'calendar_activity_stream_rsvp', FALSE, array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->userLink( $member ), $event->url(), $title ) ) ) );
$rsvps[] = new Custom( DateTime::ts( $rsvp[ 'rsvp_date' ] ), Member::loggedIn()->language()->addToStack( 'calendar_activity_stream_rsvp', FALSE, array( 'htmlsprintf' => array( Theme::i()->getTemplate( 'global', 'core', 'front' )->userLink( $member ), $event->url(), $title ) ) ) );
}
}
catch ( \OutOfRangeException $e )
catch ( OutOfRangeException $e )
{
/* Event doesn't exist */
}