Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -0,0 +1,67 @@
<?php
/**
* @brief rsvp
* @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 10 Sep 2021
*/
namespace IPS\calendar\modules\admin\stats;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* rsvp
*/
class _rsvp extends \IPS\Dispatcher\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'rsvp_manage' );
parent::execute();
}
/**
* Manage
*
* @return void
*/
protected function manage()
{
$chart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( 'app=calendar&module=stats&controller=rsvp' ), 'calendar_event_rsvp', 'rsvp_date', '', array(
'isStacked' => FALSE,
'backgroundColor' => '#ffffff',
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
'lineWidth' => 1,
'areaOpacity' => 0.4
) );
$chart->groupBy = 'rsvp_response';
foreach( array( 0,1,2 ) as $response )
{
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('calendar_stats_rsvp_response_' . $response ), 'number', 'COUNT(*)', FALSE );
}
$chart->title = \IPS\Member::loggedIn()->language()->addToStack('calendar_stats_rsvp_title');
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__calendar_stats_rsvp');
\IPS\Output::i()->output = (string) $chart;
}
// Create new methods with the same name as the 'do' parameter which should execute it
}
@@ -348,8 +348,16 @@ 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 );
}
@@ -181,11 +181,15 @@ class _submit extends \IPS\Dispatcher\Controller
$obj = \IPS\calendar\Event::createFromForm( $values );
/* Set cover photo offset from original if we're using the same photo */
if( $existing->cover_photo == $obj->cover_photo )
if( $existing->cover_photo and $existing->cover_photo == $obj->cover_photo )
{
$obj->cover_photo = \IPS\File::get( 'calendar_Events', $existing->cover_photo )->duplicate();
$obj->cover_offset = $existing->cover_offset;
$obj->save();
try
{
$obj->cover_photo = \IPS\File::get( 'calendar_Events', $existing->cover_photo )->duplicate();
$obj->cover_offset = $existing->cover_offset;
$obj->save();
}
catch ( \IPS\File\Exception $e ){}
}
if ( !\IPS\Member::loggedIn()->member_id and $obj->hidden() )
@@ -156,9 +156,20 @@ class _view extends \IPS\Dispatcher\Controller
try
{
$date = \IPS\calendar\Date::getDate( \IPS\Request::i()->y ?: NULL, \IPS\Request::i()->m ?: NULL, $day );
$showBirthday = FALSE;
/* Show birthdays if we're on the calendar landing page */
if ( $this->_calendar === NULL OR \count( $this->roots ) == 0 )
{
$showBirthday = TRUE;
}
/* show birthdays if there's only one calendar */
if ( \IPS\Request::i()->id AND $this->_calendar !== NULL OR \count( $this->roots ) == 1 )
{
$showBirthday = TRUE;
}
/* Get birthdays */
$birthdays = ( $this->_calendar === NULL OR \count( $this->roots ) == 1 ) ? $date->getBirthdays( FALSE, TRUE ) : array();
$birthdays = $showBirthday ? $date->getBirthdays( FALSE, TRUE ) : array();
/* Get the events within this range */
$events = \IPS\calendar\Event::retrieveEvents(
@@ -210,7 +221,7 @@ class _view extends \IPS\Dispatcher\Controller
*/
protected function _viewWeek( $jump, $featured=array() )
{
/* Get the month data */
/* Get the week data */
$week = \IPS\Request::i()->w ? explode( '-', \IPS\Request::i()->w ) : NULL;
try
{
@@ -235,7 +246,7 @@ class _view extends \IPS\Dispatcher\Controller
}
/* Get birthdays */
$birthdays = ( $this->_calendar === NULL OR \count( $this->roots ) == 1 ) ? $date->getBirthdays( FALSE, TRUE ) : array();
$birthdays = ( $this->_calendar === NULL OR \count( $this->roots ) == 0 ) ? $date->getBirthdays( FALSE, TRUE ) : array();
/* Get the events within this range */
$events = \IPS\calendar\Event::retrieveEvents(
@@ -294,7 +305,7 @@ class _view extends \IPS\Dispatcher\Controller
*/
protected function _viewDay( $jump, $featured=array() )
{
/* Get the month data */
/* Get the day data */
try
{
$date = \IPS\calendar\Date::getDate( \IPS\Request::i()->y ?: NULL, \IPS\Request::i()->m ?: NULL, \IPS\Request::i()->d ?: NULL );
@@ -321,8 +332,8 @@ class _view extends \IPS\Dispatcher\Controller
return;
}
$birthdayCount = ( $this->_calendar === NULL OR \count( $this->roots ) == 1 ) ? $date->getBirthdays( TRUE, TRUE ) : array();
$birthdays = ( $this->_calendar === NULL OR \count( $this->roots ) == 1 ) ? $date->getBirthdays( TRUE, FALSE ) : array();
$birthdayCount = \IPS\Settings::i()->show_bday_calendar ? $date->getBirthdays( TRUE, TRUE ) : [];
$birthdays = \IPS\Settings::i()->show_bday_calendar ? $date->getBirthdays( TRUE, FALSE ) : [];
/* Get the events within this range */
$events = \IPS\calendar\Event::retrieveEvents( clone $date, clone $date, $this->_calendar );
@@ -346,19 +357,19 @@ class _view extends \IPS\Dispatcher\Controller
$dayEvents['count']++;
if( $_event->all_day AND (
$_event->nextOccurrence( $date, 'startDate' )->strFormat('%d') == \IPS\Request::i()->d OR
$_event->nextOccurrence( $date, 'endDate' ) AND $_event->nextOccurrence( $date, 'endDate' )->strFormat('%d') == \IPS\Request::i()->d
$_event->nextOccurrence( $date, 'startDate' )->strFormat('%d') == $date->mday OR
$_event->nextOccurrence( $date, 'endDate' ) AND $_event->nextOccurrence( $date, 'endDate' )->strFormat('%d') == $date->mday
) )
{
$dayEvents['allDay'][ $_event->id ] = $_event;
}
else
{
if( $_event->nextOccurrence( $date, 'startDate' )->strFormat('%d') == \IPS\Request::i()->d )
if( $_event->nextOccurrence( $date, 'startDate' )->strFormat('%d') == $date->mday )
{
$dayEvents[ $_event->_start_date->hours ][ $_event->id ] = $_event;
}
elseif( $_event->nextOccurrence( $date, 'endDate' ) AND $_event->nextOccurrence( $date, 'endDate' )->strFormat('%d') == \IPS\Request::i()->d )
elseif( $_event->nextOccurrence( $date, 'endDate' ) AND $_event->nextOccurrence( $date, 'endDate' )->strFormat('%d') == $date->mday )
{
$dayEvents[ 0 ][ $_event->id ] = $_event;
}
@@ -526,7 +537,7 @@ class _view extends \IPS\Dispatcher\Controller
if ( \IPS\Member::loggedIn()->member_id )
{
$key = md5( ( \IPS\Member::loggedIn()->members_pass_hash ?: \IPS\Member::loggedIn()->email ) . \IPS\Member::loggedIn()->members_pass_salt );
$key = \IPS\Member::loggedIn()->getUniqueMemberHash();
if( $this->_calendar )
{