Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

@@ -43,6 +43,18 @@ class _event extends \IPS\Content\Controller
if ( !$this->event->canView( \IPS\Member::loggedIn() ) )
{
if ( $this->event->container()->can('view') AND !$this->event->container()->can('read') )
{
if ( \IPS\Member::loggedIn()->member_id )
{
\IPS\Output::i()->error( 'no_module_permission', '2L179/8', 404, '' );
}
else
{
\IPS\Output::i()->error( 'no_module_permission_guest', '2L179/9', 404, '' );
}
}
\IPS\Output::i()->error( 'node_error', '2L179/1', 403, '' );
}
@@ -141,6 +153,11 @@ class _event extends \IPS\Content\Controller
'name' => $this->event->mapped('title'),
'description' => $this->event->truncated( TRUE, NULL ),
'eventStatus' => "EventScheduled",
'organizer' => array(
'@type' => 'Person',
'name' => $this->event->author()->name
),
'eventAttendanceMode' => ( $this->event->online ) ? 'OnlineEventAttendanceMode' : 'OfflineEventAttendanceMode',
'startDate' => $this->event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?
$this->event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' )->format( $format ) :
$this->event->lastOccurrence( 'startDate' )->format( $format )
@@ -183,7 +200,8 @@ class _event extends \IPS\Content\Controller
}
}
}
/* If we have a physical location, use that. */
if( $location )
{
\IPS\Output::i()->jsonLd['event']['location'] = array(
@@ -202,6 +220,7 @@ class _event extends \IPS\Content\Controller
\IPS\Output::i()->jsonLd['event']['location']['name'] = $addressName;
}
}
/* If not, default to events URL */
else
{
\IPS\Output::i()->jsonLd['event']['location'] = array(
@@ -211,6 +230,15 @@ class _event extends \IPS\Content\Controller
'url' => \IPS\Output::i()->jsonLd['event']['url']
);
}
/* Finally, if event is online and there is a URL, use that */
if ( $this->event->online AND $this->event->url )
{
\IPS\Output::i()->jsonLd['event']['location'] = array(
'@type' => 'VirtualLocation',
'url' => $this->event->url
);
}
/* Display */
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->event, $commentsAndReviews, $attendees, $address, $reminder );
@@ -346,19 +374,19 @@ class _event extends \IPS\Content\Controller
'rsvp_response' => (int) $_go
) );
$webhookData = [
'event' => $this->event->apiOutput(),
'action' => \IPS\Request::i()->action,
'attendee' => \IPS\Member::loggedIn()->apiOutput(),
];
$message = 'rsvp_selection_' . \IPS\Request::i()->action;
\IPS\Api\Webhook::fire( 'calendarEvent_rsvp', $webhookData );
\IPS\Member::loggedIn()->achievementAction( 'calendar', 'Rsvp', $this->event );
}
$webhookData = [
'event' => $this->event->apiOutput(),
'action' => \IPS\Request::i()->action,
'attendee' => \IPS\Member::loggedIn()->apiOutput(),
];
$message = 'rsvp_selection_' . \IPS\Request::i()->action;
\IPS\Api\Webhook::fire( 'calendarEvent_rsvp', $webhookData );
\IPS\Output::i()->redirect( $this->event->url(), $message );
}
@@ -456,13 +456,17 @@ class _view extends \IPS\Dispatcher\Controller
/* Featured events */
$featured = iterator_to_array( \IPS\calendar\Event::featured( 13, '_rand' ) );
/* Get the calendars we can view */
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
/* If there are no featured get upcoming */
if( \count( $featured ) === 0 )
{
$featured = \IPS\calendar\Event::retrieveEvents(
$this->_today,
\IPS\calendar\Date::getDate()->adjust( "next year" ),
NULL,
array_keys($calendars),
3,
FALSE,
NULL,
@@ -493,13 +497,11 @@ class _view extends \IPS\Dispatcher\Controller
}
}
/* Get the calendars we can view */
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
$nearme = \IPS\calendar\Event::retrieveEvents(
$this->_today,
\IPS\calendar\Date::getDate()->adjust( "next year" ),
NULL,
array_keys($calendars),
6,
FALSE,
NULL,
@@ -548,7 +550,7 @@ class _view extends \IPS\Dispatcher\Controller
$events = \IPS\calendar\Event::retrieveEvents(
\IPS\calendar\Date::getDate( $date->firstDayOfMonth('year'), $date->firstDayOfMonth('mon'), $date->firstDayOfMonth('mday') ),
\IPS\calendar\Date::getDate( $date->lastDayOfMonth('year'), $date->lastDayOfMonth('mon'), $date->lastDayOfMonth('mday'), 23, 59, 59 ),
NULL,
array_keys($calendars),
NULL,
FALSE,
NULL,
@@ -584,7 +586,7 @@ class _view extends \IPS\Dispatcher\Controller
} );
/* Pagination */
$offset = isset( \IPS\Request::i()->offset ) ? min( array( \IPS\Request::i()->offset, \count( $events ) ) ) : 0;
$offset = isset( \IPS\Request::i()->offset ) ? min( [(int) \IPS\Request::i()->offset, \count( $events )] ) : 0;
/* If there are no events, tell search engines not to index the page but do NOT tell them not to follow links */
if( \count( $events ) === 0 )
@@ -641,7 +643,7 @@ class _view extends \IPS\Dispatcher\Controller
$online = \IPS\calendar\Event::retrieveEvents(
$startTime,
NULL,
NULL,
array_keys($calendars),
NULL,
FALSE,
NULL,
@@ -705,16 +707,16 @@ class _view extends \IPS\Dispatcher\Controller
/* Build the search form */
$form = $this->getForm();
$select = 'calendar_events.*, core_clubs.name';
$sort = 'event_start_date asc';
$location = NULL;
$having = [];
$where = [];
$where[] = ['event_approved=?', 1];
$searchNearLocation = FALSE; // Should results be limited to near the provided location only? If not, we'll just use location to allow sorting.
if( $values = $form->values() )
{
$select = "calendar_events.*, core_clubs.name";
$sort = 'event_start_date asc';
$location = NULL;
$having = array();
$where = array();
$where[] = array( 'event_approved=?', 1 );
$searchNearLocation = FALSE; // Should results be limited to near the provided location only? If not, we'll just use location to allow sorting.
if( isset( \IPS\Request::i()->searchNearLocation ) && \IPS\Request::i()->searchNearLocation )
{
$searchNearLocation = TRUE;
@@ -730,7 +732,7 @@ class _view extends \IPS\Dispatcher\Controller
{
if( $locations[0]['value'] )
{
$having[] = "( event_title LIKE CONCAT( '%', '" . $locations[0]['value'] . "', '%' ) OR name LIKE CONCAT( '%', '" . $locations[0]['value'] . "', '%' ) )";
$having[] = "( event_title LIKE CONCAT( '%', '" . \IPS\Db::i()->real_escape_string( $locations[0]['value'] ) . "', '%' ) OR name LIKE CONCAT( '%', '" . \IPS\Db::i()->real_escape_string( $locations[0]['value'] ) . "', '%' ) )";
}
$location = array( 'lat' => $locations[0]['lat'], 'lon' => $locations[0]['long'] );
@@ -738,7 +740,7 @@ class _view extends \IPS\Dispatcher\Controller
}
else
{
$having[] = "( event_title LIKE CONCAT( '%', '" . \IPS\Request::i()->location . "', '%' ) OR name LIKE CONCAT( '%', '" . \IPS\Request::i()->location . "', '%' ) )";
$having[] = "( event_title LIKE CONCAT( '%', '" . \IPS\Db::i()->real_escape_string( \IPS\Request::i()->location ) . "', '%' ) OR name LIKE CONCAT( '%', '" . \IPS\Db::i()->real_escape_string( \IPS\Request::i()->location ) . "', '%' ) )";
}
}
else if ( isset( \IPS\Request::i()->lat ) and isset( \IPS\Request::i()->lon ) and \IPS\Request::i()->lat !== 0 and \IPS\Request::i()->lon !== 0 )