Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -14,6 +14,7 @@ namespace IPS\gallery\Album;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use BadMethodCallException;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Content\ContentMenuLink;
|
||||
use IPS\Content\Embeddable;
|
||||
use IPS\Content\Filter;
|
||||
@@ -38,12 +39,14 @@ use IPS\gallery\Category;
|
||||
use IPS\gallery\Image;
|
||||
use IPS\Helpers\Badge;
|
||||
use IPS\Helpers\Menu;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Output;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use OutOfRangeException;
|
||||
use function array_slice;
|
||||
use function count;
|
||||
use function defined;
|
||||
@@ -612,6 +615,28 @@ Filter
|
||||
return 'album_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load record based on a URL
|
||||
*
|
||||
* @param Url $url URL to load from
|
||||
* @return mixed
|
||||
* @throws InvalidArgumentException
|
||||
* @throws OutOfRangeException
|
||||
*/
|
||||
public static function loadFromUrl( Url $url ): mixed
|
||||
{
|
||||
if ( isset( $url->queryString['album'] ) )
|
||||
{
|
||||
return static::load( $url->queryString['album'] );
|
||||
}
|
||||
if ( isset( $url->hiddenQueryString['album'] ) )
|
||||
{
|
||||
return static::load( $url->hiddenQueryString['album'] );
|
||||
}
|
||||
|
||||
return parent::loadFromUrl( $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
|
||||
@@ -374,7 +374,10 @@ class Category extends Model implements Permissions
|
||||
|
||||
$form->add( new Select( 'category_sort_options_img', $this->sort_options_img ?: 'updated', FALSE, array( 'options' => array( 'updated' => 'sort_updated', 'last_comment' => 'sort_last_comment', 'title' => 'album_sort_caption', 'rating' => 'sort_rating', 'date' => 'sort_date', 'num_comments' => 'sort_num_comments', 'num_reviews' => 'sort_num_reviews', 'views' => 'sort_views' ) ), NULL, NULL, NULL, 'category_sort_options_img' ) );
|
||||
|
||||
$form->add( new Radio( 'category_allow_albums', $this->id ? $this->allow_albums : 1, TRUE, array( 'options' => array( 0 => 'cat_no_allow_albums', 1 => 'cat_allow_albums', 2 => 'cat_require_albums' ) ) ) );
|
||||
$form->add( new Radio( 'category_allow_albums', $this->id ? $this->allow_albums : 1, TRUE, array(
|
||||
'options' => array( 0 => 'cat_no_allow_albums', 1 => 'cat_allow_albums', 2 => 'cat_require_albums' ),
|
||||
'toggles' => array( 1 => array( 'category_sort_options' ), 2 => array( 'category_sort_options' ) )
|
||||
) ) );
|
||||
$form->add( new YesNo( 'category_approve_img', $this->approve_img, FALSE ) );
|
||||
|
||||
if( Settings::i()->gallery_watermark_path )
|
||||
@@ -382,11 +385,10 @@ class Category extends Model implements Permissions
|
||||
$form->add( new YesNo( 'category_watermark', $this->id ? $this->watermark : TRUE, FALSE ) );
|
||||
}
|
||||
|
||||
$form->add( new YesNo( 'allow_anonymous_comments', $this->id ? $this->allow_anonymous : FALSE, FALSE, array() ) );
|
||||
|
||||
$form->addHeader( 'category_comments_and_ratings' );
|
||||
$form->add( new YesNo( 'category_allow_comments', $this->id ? $this->allow_comments : TRUE, FALSE, array( 'togglesOn' => array( 'category_approve_com' ) ), NULL, NULL, NULL, 'category_allow_comments' ) );
|
||||
$form->add( new YesNo( 'category_allow_comments', $this->id ? $this->allow_comments : TRUE, FALSE, array( 'togglesOn' => array( 'category_approve_com', 'allow_anonymous_comments' ) ), NULL, NULL, NULL, 'category_allow_comments' ) );
|
||||
$form->add( new YesNo( 'category_approve_com', $this->approve_com, FALSE, array(), NULL, NULL, NULL, 'category_approve_com' ) );
|
||||
$form->add( new YesNo( 'allow_anonymous_comments', $this->id ? $this->allow_anonymous : FALSE, FALSE, array(), null, null, null, 'allow_anonymous_comments' ) );
|
||||
$form->add( new YesNo( 'gcategory_allow_rating', $this->id ? $this->allow_rating : TRUE, FALSE ) );
|
||||
$form->add( new YesNo( 'category_allow_reviews', $this->id ? $this->allow_reviews : FALSE, FALSE, array( 'togglesOn' => array( 'category_review_moderate' ) ) ) );
|
||||
$form->add( new YesNo( 'category_review_moderate', $this->id ? $this->review_moderate : FALSE, FALSE, array(), NULL, NULL, NULL, 'category_review_moderate' ) );
|
||||
@@ -927,7 +929,7 @@ class Category extends Model implements Permissions
|
||||
}
|
||||
else
|
||||
{
|
||||
Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => 'IPS\gallery\Album', 'id' => $album->_id, 'deleteWhenDone' => TRUE ) );
|
||||
Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => 'IPS\gallery\Album', 'id' => $album->_id, 'deleteWhenDone' => TRUE ), priority: 4 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,6 +230,8 @@ Filter
|
||||
$return[] = 'image_album_id';
|
||||
$return[] = 'image_copyright';
|
||||
$return[] = 'image_nsfw';
|
||||
$return[] = 'image_media';
|
||||
$return[] = 'image_file_type';
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -279,7 +281,27 @@ Filter
|
||||
return array();
|
||||
}
|
||||
|
||||
return is_array( $this->_data['metadata'] ) ? $this->_data['metadata'] : ( $this->_data['metadata'] ? json_decode( $this->_data['metadata'], TRUE ) : array() );
|
||||
/* Did we disable metadata viewing? */
|
||||
if( Settings::i()->gallery_metadata == static::IMAGE_METADATA_NONE )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$metadata = is_array( $this->_data['metadata'] ) ? $this->_data['metadata'] : ( $this->_data['metadata'] ? json_decode( $this->_data['metadata'], TRUE ) : array() );
|
||||
|
||||
/* If we're stripping sensitive data, then remove it here */
|
||||
if( Settings::i()->gallery_metadata == static::IMAGE_METADATA_NOSENSITIVE )
|
||||
{
|
||||
foreach( $metadata as $k => $v )
|
||||
{
|
||||
if( str_starts_with( $k, 'GPS.' ) )
|
||||
{
|
||||
unset( $metadata[ $k ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,10 +314,9 @@ Filter
|
||||
if( isset( $this->_data['data'] ) )
|
||||
{
|
||||
$data = is_array( $this->_data['data'] ) ? $this->_data['data'] : json_decode( $this->_data['data'], true );
|
||||
return is_array( $data ) ? $data : [];
|
||||
}
|
||||
|
||||
return [];
|
||||
return $data ?? [ 'large' => [ null, null ], 'small' => [ null, null ] ];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,7 +337,17 @@ Filter
|
||||
*/
|
||||
public function get__notes(): array
|
||||
{
|
||||
return is_array( $this->_data['notes'] ) ? $this->_data['notes'] : ( $this->_data['notes'] ? json_decode( $this->_data['notes'], TRUE ) : array() );
|
||||
if( is_array( ( $this->_data['notes'] ) ) )
|
||||
{
|
||||
return $this->_data['notes'];
|
||||
}
|
||||
|
||||
if( isset( $this->_data['notes'] ) and $data = json_decode( $this->_data['notes'], true ) )
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1587,6 +1618,23 @@ Filter
|
||||
return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Metadata-related constants
|
||||
*/
|
||||
const IMAGE_METADATA_NONE = 0;
|
||||
const IMAGE_METADATA_ALL = 1;
|
||||
const IMAGE_METADATA_NOSENSITIVE = 2;
|
||||
|
||||
/**
|
||||
* Determines if the map and location data should be displayed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function showLocation() : bool
|
||||
{
|
||||
return GeoLocation::enabled() and Settings::i()->gallery_metadata == static::IMAGE_METADATA_ALL and $this->gps_show;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the map for the image if available
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user