Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,13 +1,12 @@
<?php
/**
* @brief iCalendar feed management
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Calendar
* @since 19 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\calendar\modules\admin\calendars;
@@ -130,25 +129,25 @@ class _ical extends \IPS\Dispatcher\Controller
/* Root buttons */
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'calendar', 'calendars', 'calendar_feeds_add' ) )
{
$table->rootButtons = array(
'add' => array(
'icon' => 'plus',
'title' => 'calendar_feeds_add',
'link' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=add' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('calendar_feeds_add') )
),
'upload' => array(
'icon' => 'upload',
'title' => 'calendar_feeds_upload',
'link' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=upload' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('calendar_feeds_upload') )
),
\IPS\Output::i()->sidebar['actions']['add'] = array(
'primary' => true,
'icon' => 'plus',
'title' => 'calendar_feeds_add',
'link' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=add' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('calendar_feeds_add') )
);
\IPS\Output::i()->sidebar['actions']['upload'] = array(
'icon' => 'upload',
'title' => 'calendar_feeds_upload',
'link' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=upload' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('calendar_feeds_upload') )
);
}
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ical_title');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
\IPS\Output::i()->output = (string) $table;
}
/**
@@ -169,6 +168,10 @@ class _ical extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\Text( 'feed_title', NULL, TRUE ) );
$form->add( new \IPS\Helpers\Form\Url( 'feed_url', NULL, TRUE, array( 'allowedProtocols' => array( 'http', 'https', 'webcal', 'webcals' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'feed_calendar_id', NULL, TRUE, array( 'class' => 'IPS\calendar\Calendar', 'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=add', 'admin' ) ) ) );
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$form->add( new \IPS\Helpers\Form\Node( 'feed_venue_id', NULL, FALSE, array( 'class' => 'IPS\calendar\Venue', 'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=add', 'admin' ) ) ) );
}
$form->add( new \IPS\Helpers\Form\Member( 'feed_member_id', NULL, TRUE, array() ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'feed_allow_rsvp', NULL, FALSE ) );
@@ -194,6 +197,12 @@ class _ical extends \IPS\Dispatcher\Controller
$feed->title = $values['feed_title'];
$feed->url = $values['feed_url'];
$feed->calendar_id = $values['feed_calendar_id']->_id;
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$feed->venue_id = $values['feed_venue_id']->_id;
}
$feed->member_id = $values['feed_member_id']->member_id;
$feed->allow_rsvp = $values['feed_allow_rsvp'];
$feed->save();
@@ -230,6 +239,13 @@ class _ical extends \IPS\Dispatcher\Controller
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=upload' ),
'class' => 'IPS\calendar\Calendar',
) ) );
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$form->add( new \IPS\Helpers\Form\Node( 'feed_venue_id', NULL, TRUE, array(
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=upload' ),
'class' => 'IPS\calendar\Venue',
) ) );
}
$form->add( new \IPS\Helpers\Form\Member( 'feed_member_id', NULL, TRUE ) );
/* Handle submissions */
@@ -239,7 +255,7 @@ class _ical extends \IPS\Dispatcher\Controller
try
{
$icsParser = new \IPS\calendar\Icalendar\ICSParser;
$count = $icsParser->parse( \file_get_contents( $values['feed_file'] ), $values['feed_calendar_id'], $values['feed_member_id'] );
$count = $icsParser->parse( \file_get_contents( $values['feed_file'] ), $values['feed_calendar_id'], $values['feed_member_id'], $values['feed_venue_id'] );
}
catch( \UnexpectedValueException $e )
{
@@ -290,6 +306,12 @@ class _ical extends \IPS\Dispatcher\Controller
}
$form->add( new \IPS\Helpers\Form\Select( 'feed_calendar_id', $feed->calendar_id, TRUE, array( 'options' => $options, 'parse' => 'normal' ) ) );
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$form->add( new \IPS\Helpers\Form\Node( 'feed_venue_id', NULL, FALSE, array( 'class' => 'IPS\calendar\Venue', 'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendars&controller=ical&do=edit', 'admin' ) ) ) );
}
$form->add( new \IPS\Helpers\Form\Member( 'feed_member_id', \IPS\Member::load( $feed->member_id )->name, TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'feed_allow_rsvp', $feed->allow_rsvp, FALSE ) );
@@ -314,6 +336,12 @@ class _ical extends \IPS\Dispatcher\Controller
$feed->title = $values['feed_title'];
$feed->url = $values['feed_url'];
$feed->calendar_id = $values['feed_calendar_id'];
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$feed->venue_id = $values['feed_venue_id']->_id;
}
$feed->member_id = $values['feed_member_id']->member_id;
$feed->allow_rsvp = $values['feed_allow_rsvp'];
$feed->save();