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

@@ -13,7 +13,11 @@ namespace IPS\gallery\extensions\core\AdvertisementLocations;
/* To prevent PHP errors (extending class does not exist) revealing path */
use IPS\core\Advertisement;
use IPS\Extensions\AdvertisementLocationsAbstract;
use IPS\gallery\Image;
use IPS\Request;
use OutOfRangeException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
@@ -35,7 +39,7 @@ class ImageLightbox extends AdvertisementLocationsAbstract
*/
public function getSettings( array $settings ): array
{
return array( 'locations' => array( 'ad_image_lightbox' => array() ), 'settings' => array() );
return array( 'locations' => array( 'ad_image_lightbox' => array( 'IPS_gallery_Category' ) ), 'settings' => array() );
}
/**
@@ -48,4 +52,28 @@ class ImageLightbox extends AdvertisementLocationsAbstract
{
return array();
}
/**
* Check if the advertisement can be displayed, based on settings
*
* @param Advertisement $advertisement
* @param string $location
* @return bool
*/
public function canShow( Advertisement $advertisement, string $location ) : bool
{
if( isset( $advertisement->_additional_settings['IPS_gallery_Category'] ) and is_array( $advertisement->_additional_settings['IPS_gallery_Category'] ) )
{
try
{
return in_array( Image::load( Request::i()->id )->category_id, $advertisement->_additional_settings['IPS_gallery_Category'] );
}
catch( OutOfRangeException )
{
return false;
}
}
return TRUE;
}
}
@@ -14,6 +14,7 @@ namespace IPS\gallery\extensions\core\ContentRouter;
/* To prevent PHP errors (extending class does not exist) revealing path */
use IPS\Application\Module;
use IPS\Content\Filter;
use IPS\Extensions\ContentRouterAbstract;
use IPS\gallery\Album\Item;
use IPS\gallery\Application;
@@ -81,7 +82,7 @@ class Gallery extends ContentRouterAbstract
{
if( !in_array( $className, $this->classes ) or $className == 'IPS\gallery\Album\Item' )
{
return new Content( $className, $url, $where );
return new Content( $className, $url, $where, null, Filter::FILTER_AUTOMATIC, 'read' );
}
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js('front_browse.js', 'gallery' ) );
@@ -89,7 +90,7 @@ class Gallery extends ContentRouterAbstract
Application::outputCss();
$table = new Table( $className, $url, $where, NULL, FALSE );
$table = new Table( $className, $url, $where, NULL, Filter::FILTER_AUTOMATIC, 'read' );
$table->tableTemplate = array( Theme::i()->getTemplate( 'browse', 'gallery' ), 'imageTable' );
/* Get rows template */
@@ -13,6 +13,7 @@ namespace IPS\gallery\extensions\core\EditorLocations;
/* To prevent PHP errors (extending class does not exist) revealing path */
use Exception;
use InvalidArgumentException;
use IPS\Content;
use IPS\Db;
@@ -85,7 +86,14 @@ class Albums extends EditorLocationsAbstract
*/
public function attachmentLookup( int $id1=NULL, int $id2=NULL, string $id3=NULL ): Model|Content|Url|Member|null
{
return Album::load( $id1 );
try
{
return Album::load( $id1 );
}
catch( Exception $e )
{
throw new LogicException;
}
}
/**
@@ -159,7 +159,7 @@ class Categories extends EditorLocationsAbstract
}
catch( InvalidArgumentException $e )
{
if( $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
if( is_array( $callback ) and $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
{
$rebuilt = preg_replace( "#\[/?([^\]]+?)\]#", '', $word['word_custom'] );
}
@@ -90,10 +90,10 @@ class Gallery extends GroupFormAbstract
if( $group->g_id != Settings::i()->guest_group )
{
$group->g_create_albums = (int) $values['g_create_albums'];
$group->g_create_albums_private = (int) $values['g_create_albums_private'];
$group->g_create_albums_fo = (int) $values['g_create_albums_fo'];
$group->g_album_limit = (int) $values['g_album_limit'];
$group->g_img_album_limit = (int) $values['g_img_album_limit'];
$group->g_create_albums_private = $values['g_create_albums'] ? (int) $values['g_create_albums_private'] : 0;
$group->g_create_albums_fo = $values['g_create_albums'] ? (int) $values['g_create_albums_fo'] : 0;
$group->g_album_limit = $values['g_create_albums'] ? (int) $values['g_album_limit'] : 0;
$group->g_img_album_limit = $values['g_create_albums'] ? (int) $values['g_img_album_limit'] : 0;
}
$group->g_download_original = (int) $values['g_download_original'];