Version 5.0.0 beta 10

This commit is contained in:
Neo committed 2025-12-19 17:53:48 -08:00
1 parent 56979f8ee8
commit 264eeb97e0
325 files changed
+6442 -1849

No files matched your search

+7 -1
View File
@@ -578,7 +578,13 @@ class Album extends Model
$return[] = new Text( 'album_name', $album ? $album->name : '', $required ?: NULL );
$return[] = new Editor( 'album_description', $album ? $album->description : '', FALSE, array( 'app' => 'gallery', 'key' => 'Albums', 'autoSaveKey' => ( $album ? "gallery_album_{$album->id}_desc" : "gallery-new-album" ), 'attachIds' => $album ? array( $album->id, NULL, 'description' ) : NULL ) );
$return[] = new Editor( 'album_description', $album ? $album->description : '', FALSE, array(
'app' => 'gallery',
'key' => 'Albums',
'autoSaveKey' => ( $album ? "gallery_album_{$album->id}_desc" : "gallery-new-album" ),
'attachIds' => $album ? array( $album->id, NULL, 'description' ) : NULL,
'allowAttachments' => false
) );
$return[] = new Node( 'album_category', $category?->id, $required ?: NULL, array(
'class' => 'IPS\gallery\Category',
@@ -36,6 +36,7 @@ use IPS\gallery\Album;
use IPS\gallery\Application;
use IPS\gallery\Category;
use IPS\gallery\Image;
use IPS\Helpers\Badge;
use IPS\Helpers\Menu;
use IPS\Member;
use IPS\Node\Model;
@@ -752,4 +753,25 @@ Filter
}
return $menu;
}
/**
* Return badges that should be displayed with the content header
*
* @return array
*/
public function badges() : array
{
$badges = parent::badges();
if( $this->type == Album::AUTH_TYPE_PRIVATE )
{
$badges[] = new Badge( Badge::BADGE_WARNING, 'album_private_badge' );
}
elseif( $this->type == Album::AUTH_TYPE_RESTRICTED )
{
$badges[] = new Badge( Badge::BADGE_WARNING, 'album_friend_only_badge' );
}
return $badges;
}
}
@@ -613,6 +613,12 @@ class Category extends Model implements Permissions
Lang::deleteCustom( 'gallery', "gallery_category_{$this->id}_rulestitle" );
Lang::deleteCustom( 'gallery', "gallery_category_{$this->id}_rules" );
Lang::deleteCustom( 'gallery', "gallery_category_{$this->id}_permerror" );
/* Unclaim Attachments */
foreach( [ 'permerror', 'rules', 'description' ] as $id3 )
{
File::unclaimAttachments( 'gallery_Categories', $this->_id, null, $id3 );
}
}
/**
@@ -1002,6 +1008,23 @@ class Category extends Model implements Permissions
$oldLangKey = str_replace( $this->id, $oldId, $langKey );
Lang::saveCustom( 'gallery', $langKey, iterator_to_array( Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', $oldLangKey ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
}
/* If the description had attachments, link them */
$attachmentMappings = [];
foreach( Db::i()->select( '*', 'core_attachments_map', [
[ 'location_key=?', 'gallery_Categories' ],
[ 'id1=?', $oldId ],
[ 'id2 is null' ],
[ Db::i()->in( 'id3', [ 'description', 'rules', 'permerror' ] ) ]
] ) as $attachment )
{
$attachment['id1'] = $this->_id;
$attachmentMappings[] = $attachment;
}
if( count( $attachmentMappings ) )
{
Db::i()->insert( 'core_attachments_map', $attachmentMappings );
}
}
/**