Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -38,4 +38,15 @@ class _venues extends \IPS\Node\Controller
\IPS\Dispatcher::i()->checkAcpPermission( 'venues_manage' );
parent::execute();
}
/**
* Allow overloading to change how the title is displayed in the tree
*
* @param $node \IPS\Node Node
* @return string
*/
protected static function nodeTitle( $node )
{
return $node->_title;
}
}
@@ -130,13 +130,12 @@ class _event extends \IPS\Content\Controller
$address = $location->toString();
}
/* Add JSON-LD */
\IPS\Output::i()->jsonLd['event'] = array(
'@context' => "http://schema.org",
'@type' => "Event",
'url' => (string) $this->event->url(),
'name' => htmlspecialchars( $this->event->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'name' => $this->event->mapped('title'),
'description' => strip_tags( $this->event->truncated() ),
'eventStatus' => "EventScheduled",
'startDate' => $this->event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?
@@ -151,7 +150,7 @@ class _event extends \IPS\Content\Controller
$this->event->lastOccurrence( 'endDate' )->format( \IPS\DateTime::ISO8601 );
}
if( $this->event->container()->allow_reviews )
if( $this->event->container()->allow_reviews AND $this->event->reviews )
{
\IPS\Output::i()->jsonLd['event']['aggregateRating'] = array(
'@type' => 'AggregateRating',
@@ -159,23 +158,6 @@ class _event extends \IPS\Content\Controller
'ratingValue' => $this->event->averageReviewRating(),
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of,
);
\IPS\Output::i()->jsonLd['event']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ReviewAction",
'userInteractionCount' => $this->event->reviews
);
}
if( $this->event->container()->allow_comments )
{
\IPS\Output::i()->jsonLd['event']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->event->mapped('num_comments')
);
\IPS\Output::i()->jsonLd['event']['commentCount'] = $this->event->mapped('num_comments');
}
if( $this->event->coverPhoto()->file )
@@ -185,12 +167,6 @@ class _event extends \IPS\Content\Controller
if( $this->event->rsvp )
{
\IPS\Output::i()->jsonLd['event']['potentialAction'] = array(
'@type' => 'RsvpAction',
'target' => (string) $this->event->url( 'rsvp' )->setQueryString( 'action', '{rsvpResponse}' ),
'rsvpResponse-input' => "required name=rsvpResponse"
);
if( count( $attendees[1] ) )
{
\IPS\Output::i()->jsonLd['event']['attendee'] = array();
@@ -199,7 +175,7 @@ class _event extends \IPS\Content\Controller
{
\IPS\Output::i()->jsonLd['event']['attendee'][] = array(
'@type' => 'Person',
'name' => htmlspecialchars( $attendee->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )
'name' => $attendee->name
);
}
}
@@ -391,6 +367,12 @@ class _event extends \IPS\Content\Controller
{
\IPS\Session::i()->csrfCheck();
/* Members only */
if( !\IPS\Member::loggedIn()->member_id )
{
\IPS\Output::i()->error( 'node_error', '3L369/1', 403, '' );
}
/* Existing reminder? */
$existing = NULL;
try
@@ -403,7 +385,7 @@ class _event extends \IPS\Content\Controller
/* How far in the future is this event so we can set realistic max reminders */
$diff = $this->event->_start_date->diff( \IPS\DateTime::create() );
$max = $diff->d;
$max = $diff->days;
$form = new \IPS\Helpers\Form;
$form->class = 'ipsForm_vertical';
@@ -30,45 +30,46 @@ class _submit extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
$form = new \IPS\Helpers\Form( 'select_calendar', 'continue' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Node( 'calendar', NULL, TRUE, array(
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ),
'class' => 'IPS\calendar\Calendar',
'permissionCheck' => 'add',
'forceOwner' => \IPS\Member::loggedIn(),
) ) );
$form = new \IPS\Helpers\Form( 'select_calendar', 'continue' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Node( 'calendar', NULL, TRUE, array(
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ),
'class' => 'IPS\calendar\Calendar',
'permissionCheck' => 'add',
'forceOwner' => \IPS\Member::loggedIn(),
'clubs' => \IPS\Settings::i()->club_nodes_in_apps
) ) );
/* Are we creating an event for a specific day? If yes, pass the values to the form */
if( \IPS\Request::i()->y AND \IPS\Request::i()->m AND \IPS\Request::i()->d )
/* Are we creating an event for a specific day? If yes, pass the values to the form */
if( \IPS\Request::i()->y AND \IPS\Request::i()->m AND \IPS\Request::i()->d )
{
$form->hiddenValues['y'] = \IPS\Request::i()->y;
$form->hiddenValues['m'] = \IPS\Request::i()->m;
$form->hiddenValues['d'] = \IPS\Request::i()->d;
}
/* Are we coming from a venue? */
if( \IPS\Settings::i()->calendar_venues_enabled and \IPS\Request::i()->venue )
{
$form->hiddenValues['venue'] = \IPS\Request::i()->venue;
}
if ( $values = $form->values() )
{
$url = \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit&do=submit', 'front', 'calendar_submit' )->setQueryString( 'id', $values['calendar']->_id );
if( isset( $values['y'], $values['m'], $values['d'] ) )
{
$form->hiddenValues['y'] = \IPS\Request::i()->y;
$form->hiddenValues['m'] = \IPS\Request::i()->m;
$form->hiddenValues['d'] = \IPS\Request::i()->d;
$url = $url->setQueryString( 'd', $values['d'] )->setQueryString( 'm', $values['m'] )->setQueryString( 'y', $values['y'] );
}
/* Are we coming from a venue? */
if( \IPS\Settings::i()->calendar_venues_enabled and \IPS\Request::i()->venue )
if( \IPS\Settings::i()->calendar_venues_enabled and isset( $values['venue'] ) )
{
$form->hiddenValues['venue'] = \IPS\Request::i()->venue;
$url = $url->setQueryString( 'venue', $values['venue'] );
}
if ( $values = $form->values() )
{
$url = \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit&do=submit', 'front', 'calendar_submit' )->setQueryString( 'id', $values['calendar']->_id );
if( isset( $values['y'], $values['m'], $values['d'] ) )
{
$url = $url->setQueryString( 'd', $values['d'] )->setQueryString( 'm', $values['m'] )->setQueryString( 'y', $values['y'] );
}
if( \IPS\Settings::i()->calendar_venues_enabled and isset( $values['venue'] ) )
{
$url = $url->setQueryString( 'venue', $values['venue'] );
}
\IPS\Output::i()->redirect( $url );
}
\IPS\Output::i()->redirect( $url );
}
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'submit_event' );
@@ -138,19 +139,15 @@ class _submit extends \IPS\Dispatcher\Controller
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->redirect( IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ) );
}
/* Are we the author of the existing event? */
if( $existing->author() !== \IPS\Member::loggedIn() )
{
\IPS\Output::i()->redirect( IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ) );
}
/* Reset elements we don't want to copy */
$existing->start_date = NULL;
$existing->end_date = NULL;
$form = new \IPS\Helpers\Form( 'form', \IPS\Member::loggedIn()->language()->checkKeyExists( \IPS\Calendar\Event::$formLangPrefix . '_save' ) ? \IPS\Calendar\Event::$formLangPrefix . '_save' : 'save' );
$form->class = 'ipsForm_vertical';
$formElements = \IPS\Calendar\Event::formElements( $existing, $existing->container() );
@@ -168,6 +165,12 @@ class _submit extends \IPS\Dispatcher\Controller
if ( $values = $form->values() )
{
/* Set the container */
if ( !isset( $values[ 'event_container' ] ) )
{
$values[ 'event_container' ] = $existing->container();
}
/* Disable read/write separation */
\IPS\Db::i()->readWriteSeparation = FALSE;
@@ -73,7 +73,7 @@ class _venue extends \IPS\Dispatcher\Controller
}
catch( \InvalidArgumentException $e )
{
\IPS\Output::i()->error( 'error_bad_date', '', 403, '' ); //@todo
\IPS\Output::i()->error( 'error_bad_date', '2L354/2', 403, '' );
}
$upcoming = \IPS\calendar\Event::retrieveEvents(
@@ -107,7 +107,7 @@ class _venue extends \IPS\Dispatcher\Controller
'@context' => "http://schema.org",
'@type' => "EventVenue",
'url' => (string) $this->venue->url(),
'name' => htmlspecialchars( $this->venue->_title, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )
'name' => $this->venue->_title
);
\IPS\Output::i()->title = $this->venue->_title;
@@ -52,7 +52,7 @@ class _view extends \IPS\Dispatcher\Controller
}
/* Is there only one calendar? */
$roots = \IPS\calendar\Calendar::roots();
$roots = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
if ( count( $roots ) == 1 AND !isset( \IPS\Request::i()->id ) )
{
$roots = array_shift( $roots );
@@ -96,6 +96,11 @@ class _view extends \IPS\Dispatcher\Controller
/* Get the date jumper - do this first in case we need to redirect */
$jump = $this->_jump();
if( !\IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_browse.js', 'calendar', 'front' ) );
}
/* If there is a view requested in the URL, use it */
if( isset( \IPS\Request::i()->view ) )
{
@@ -118,7 +123,7 @@ class _view extends \IPS\Dispatcher\Controller
}
/* Online User Location */
if ($this->_calendar)
if ( $this->_calendar )
{
\IPS\Session::i()->setLocation( $this->_calendar->url(), array(), 'loc_calendar_viewing_calendar', array( "calendar_calendar_{$this->_calendar->id}" => TRUE ) );
}
@@ -138,7 +143,7 @@ class _view extends \IPS\Dispatcher\Controller
protected function _viewMonth( $jump, $featured=array() )
{
/* Get the calendars we can view */
$calendars = \IPS\calendar\Calendar::roots();
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
/* Get the month data */
$day = NULL;
@@ -164,7 +169,7 @@ class _view extends \IPS\Dispatcher\Controller
}
catch( \Exception $e )
{
\IPS\Output::i()->error( 'error_bad_date', '3L182/3', 403, '' );
\IPS\Output::i()->error( 'error_bad_date', '2L182/7', 403, '' );
}
/* If there are no events, tell search engines not to index the page but do NOT tell them not to follow links */
@@ -182,7 +187,6 @@ class _view extends \IPS\Dispatcher\Controller
}
else
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_browse.js', 'calendar', 'front' ) );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('cal_month_title', FALSE, array( 'sprintf' => array( $date->monthName, $date->year ) ) );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->calendarWrapper(
@@ -207,7 +211,7 @@ class _view extends \IPS\Dispatcher\Controller
protected function _viewWeek( $jump, $featured=array() )
{
/* Get the calendars we can view */
$calendars = \IPS\calendar\Calendar::roots();
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
/* Get the month data */
$week = \IPS\Request::i()->w ? explode( '-', \IPS\Request::i()->w ) : NULL;
@@ -217,32 +221,39 @@ class _view extends \IPS\Dispatcher\Controller
}
catch( \Exception $e )
{
\IPS\Output::i()->error( 'error_bad_date', '3L182/4', 403, '' );
\IPS\Output::i()->error( 'error_bad_date', '2L182/8', 403, '' );
}
$nextWeek = $date->adjust( '+1 week' );
$lastWeek = $date->adjust( '-1 week' );
/* Get the days of the week - we do this in PHP to help keep template a little cleaner */
$days = array();
for( $i = 0; $i < 7; $i++ )
try
{
$days[] = \IPS\calendar\Date::getDate( $date->firstDayOfWeek('year'), $date->firstDayOfWeek('mon'), $date->firstDayOfWeek('mday') )->adjust( $i . ' days' );
$days = array();
for( $i = 0; $i < 7; $i++ )
{
$days[] = \IPS\calendar\Date::getDate( $date->firstDayOfWeek('year'), $date->firstDayOfWeek('mon'), $date->firstDayOfWeek('mday') )->adjust( $i . ' days' );
}
/* Get birthdays */
$birthdays = ( $this->_calendar === NULL OR count( $calendars ) == 1 ) ? $date->getBirthdays( FALSE, TRUE ) : array();
/* Get the events within this range */
$events = \IPS\calendar\Event::retrieveEvents(
\IPS\calendar\Date::getDate( $date->firstDayOfWeek('year'), $date->firstDayOfWeek('mon'), $date->firstDayOfWeek('mday') ),
\IPS\calendar\Date::getDate( $date->lastDayOfWeek('year'), $date->lastDayOfWeek('mon'), $date->lastDayOfWeek('mday'), 23, 59, 59 ),
$this->_calendar
);
}
catch( \Exception $e )
{
\IPS\Output::i()->error( 'error_bad_date', '2L182/C', 403, '' );
}
/* Get birthdays */
$birthdays = ( $this->_calendar === NULL OR count( $calendars ) == 1 ) ? $date->getBirthdays( FALSE, TRUE ) : array();
/* Get the events within this range */
$events = \IPS\calendar\Event::retrieveEvents(
\IPS\calendar\Date::getDate( $date->firstDayOfWeek('year'), $date->firstDayOfWeek('mon'), $date->firstDayOfWeek('mday') ),
\IPS\calendar\Date::getDate( $date->lastDayOfWeek('year'), $date->lastDayOfWeek('mon'), $date->lastDayOfWeek('mday'), 23, 59, 59 ),
$this->_calendar
);
/* 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 )
if( count( $events ) === 0 )
{
\IPS\Output::i()->metaTags['robots'] = 'noindex';
}
@@ -287,7 +298,7 @@ class _view extends \IPS\Dispatcher\Controller
protected function _viewDay( $jump, $featured=array() )
{
/* Get the calendars we can view */
$calendars = \IPS\calendar\Calendar::roots();
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
/* Get the month data */
try
@@ -296,7 +307,7 @@ class _view extends \IPS\Dispatcher\Controller
}
catch( \Exception $e )
{
\IPS\Output::i()->error( 'error_bad_date', '3L182/5', 403, '' );
\IPS\Output::i()->error( 'error_bad_date', '2L182/9', 403, '' );
}
$tomorrow = $date->adjust( '+1 day' );
@@ -312,6 +323,7 @@ class _view extends \IPS\Dispatcher\Controller
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'browse', 'calendar', 'front' ), 'birthday' );
\IPS\Output::i()->output = $table;
\IPS\Output::i()->metaTags['robots'] = 'noindex';
return;
}
@@ -394,7 +406,7 @@ class _view extends \IPS\Dispatcher\Controller
protected function _viewStream( $jump, $featured=array() )
{
/* Get the calendars we can view */
$calendars = \IPS\calendar\Calendar::roots();
$calendars = \IPS\Settings::i()->club_nodes_in_apps ? \IPS\calendar\Calendar::rootsWithClubs() : \IPS\calendar\Calendar::roots();
/* Get the month data */
$day = NULL;
@@ -407,21 +419,21 @@ class _view extends \IPS\Dispatcher\Controller
try
{
$date = \IPS\calendar\Date::getDate( \IPS\Request::i()->y ?: NULL, \IPS\Request::i()->m ?: NULL, $day );
/* Get the events within this range */
$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 ),
$this->_calendar,
NULL,
FALSE
);
}
catch( \InvalidArgumentException $e )
{
\IPS\Output::i()->error( 'error_bad_date', '3L182/6', 403, '' );
\IPS\Output::i()->error( 'error_bad_date', '2L182/A', 403, '' );
}
/* Get the events within this range */
$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 ),
$this->_calendar,
NULL,
FALSE
);
/* Sort */
$startDate = \IPS\calendar\Date::getDate();
@usort( $events, function( $a, $b ) use ( $startDate )
@@ -457,7 +469,7 @@ class _view extends \IPS\Dispatcher\Controller
}
/* 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 )
if( count( $events ) === 0 )
{
\IPS\Output::i()->metaTags['robots'] = 'noindex';
}
@@ -466,6 +478,12 @@ class _view extends \IPS\Dispatcher\Controller
$events = array_slice( $events, ( $pagination['page'] - 1 ) * $this->streamPerPage, $this->streamPerPage );
}
/* Non-existent page */
if( $pagination['page'] > 1 AND !count( $events ) )
{
\IPS\Output::i()->error( 'no_events_month', '2L182/B', 404, '' );
}
/* Display */
$output = \IPS\Theme::i()->getTemplate( 'browse' )->calendarStream( $calendars, $date, $featured, $events, $this->_calendar, $jump, $pagination );