Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

+47 -2
View File
@@ -55,6 +55,7 @@ use IPS\Helpers\Form\Upload;
use IPS\Helpers\Form\YesNo;
use IPS\Http\Url;
use IPS\Http\Url\Friendly;
use IPS\IPS;
use IPS\Lang;
use IPS\Member;
use IPS\Node\Model;
@@ -1626,7 +1627,7 @@ class Event extends Item implements Embeddable,
$return = array_merge( $return, parent::formElements( $item, $container ) );
/* If we're copying we need to re-add the auto_follow form element (if comments and reviews are disabled, then we'll just remove it again below) */
if ( $item !== NULL and in_array( 'IPS\Content\Followable', class_implements( get_called_class() ) ) and Member::loggedIn()->member_id AND $isCopy )
if ( $item !== NULL and IPS::classUsesTrait( get_called_class(), Followable::class ) and Member::loggedIn()->member_id AND $isCopy )
{
array_splice( $return, -1, 0, array( 'auto_follow' => new YesNo( static::$formLangPrefix . 'auto_follow', (bool) Member::loggedIn()->auto_follow['content'], FALSE, array( 'label' => Member::loggedIn()->language()->addToStack( static::$formLangPrefix . 'auto_follow_suffix' ) ), NULL, NULL, NULL, static::$formLangPrefix . 'auto_follow' ) ) );
}
@@ -2003,6 +2004,8 @@ class Event extends Item implements Embeddable,
/* And claim attachments */
File::claimAttachments( 'calendar-event', $this->id );
File::claimAttachments( 'calendar-new-venue', $this->id, translatable: true );
/* And expire widget caches so an event for today will show in the upcoming events widget properly */
$this->expireWidgetCaches();
@@ -2562,7 +2565,11 @@ class Event extends Item implements Embeddable,
/* Check if past events can be edited */
if ( $action == 'edit' and $this->hasPassed() and Settings::i()->calendar_block_past_changes )
{
return FALSE;
if ( static::modPermission( 'edit', $member, $this->containerWrapper() ) )
{
return true;
}
return false;
}
return parent::actionEnabled( $action, $member );
@@ -2760,4 +2767,42 @@ class Event extends Item implements Embeddable,
}
public static string $itemMenuCss = '';
/**
* Allow for individual classes to override and
* specify a primary image. Used for grid views, etc.
*
* @return File|null
*/
public function primaryImage() : ?File
{
/* Cover photo first */
if( $coverPhoto = parent::primaryImage() )
{
return $coverPhoto;
}
/* Any images in the description? */
if( $contentImage = $this->contentImages(1) )
{
$attachType = key( $contentImage[0] );
try
{
return File::get( $attachType, $contentImage[0][ $attachType ] );
}
catch( Exception ){}
}
/* Do we have a linked album? */
if( $this->album and Application::appIsEnabled( 'gallery' ) )
{
try
{
return Album::load( $this->album )->primaryImage();
}
catch( OutOfRangeException ){}
}
return null;
}
}