Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,57 +12,73 @@
|
||||
namespace IPS\gallery\Album;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\gallery\Album;
|
||||
use IPS\gallery\Image;
|
||||
use IPS\Helpers\Table\Content;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Theme;
|
||||
use function count;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Table Builder for Gallery albums
|
||||
*/
|
||||
class _Table extends \IPS\Helpers\Table\Content
|
||||
class Table extends Content
|
||||
{
|
||||
/**
|
||||
* @brief Container
|
||||
*/
|
||||
protected $container;
|
||||
protected ?Model $container = NULL;
|
||||
|
||||
/**
|
||||
* @brief Additional CSS classes to apply to columns
|
||||
*/
|
||||
public $classes = array( 'cGalleryAlbums' );
|
||||
public array $classes = array( 'cGalleryAlbums' );
|
||||
|
||||
/**
|
||||
* @brief Pagination parameter
|
||||
*/
|
||||
protected $paginationKey = 'albumPage';
|
||||
protected string $paginationKey = 'albumPage';
|
||||
|
||||
/**
|
||||
* @brief Table resort parameter
|
||||
*/
|
||||
public $resortKey = 'albumResort';
|
||||
public string $resortKey = 'albumResort';
|
||||
|
||||
/**
|
||||
* @brief No Moderate
|
||||
*/
|
||||
public $noModerate = TRUE;
|
||||
public bool $noModerate = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Where clauses
|
||||
*/
|
||||
public ?array $where;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Http\Url|NULL $url Base URL (defaults to container URL)
|
||||
* @param \IPS\Node\Model|NULL $container The container
|
||||
* @param Url|NULL $url Base URL (defaults to container URL)
|
||||
* @param Model|NULL $container The container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Http\Url $url=NULL, \IPS\Node\Model $container=NULL )
|
||||
public function __construct( Url $url=NULL, Model $container=NULL )
|
||||
{
|
||||
/* Set container */
|
||||
if ( $container !== NULL )
|
||||
{
|
||||
if ( !$this->sortBy and $container->_sortBy )
|
||||
{
|
||||
$this->sortBy = \IPS\gallery\Album::$databasePrefix . $container->_sortBy;
|
||||
$this->sortBy = Album::$databasePrefix . $container->_sortBy;
|
||||
$this->sortDirection = $container->_sortOrder;
|
||||
}
|
||||
|
||||
@@ -80,18 +96,18 @@ class _Table extends \IPS\Helpers\Table\Content
|
||||
/* Init */
|
||||
parent::__construct( '\\IPS\\gallery\\Album\\Item', ( $url !== NULL ) ? $url : $container->url(), NULL, $container );
|
||||
|
||||
$this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'browse', 'gallery' ), 'albums' );
|
||||
$this->rowsTemplate = array( Theme::i()->getTemplate( 'browse', 'gallery' ), 'albums' );
|
||||
|
||||
/* If we can't moderate in this category, restrict results */
|
||||
if( $container === NULL OR !\IPS\gallery\Image::modPermission( 'edit', NULL, $container ) )
|
||||
if( $container === NULL OR !Image::modPermission( 'edit', NULL, $container ) )
|
||||
{
|
||||
if( \count( \IPS\Member::loggedIn()->socialGroups() ) )
|
||||
if( count( Member::loggedIn()->socialGroups() ) )
|
||||
{
|
||||
$this->where[] = array( '( album_type=1 OR ( album_type=2 AND album_owner_id=? ) OR ( album_type=3 AND ( album_owner_id=? OR ( album_allowed_access IS NOT NULL AND album_allowed_access IN(' . implode( ',', \IPS\Member::loggedIn()->socialGroups() ) . ') ) ) ) )', \IPS\Member::loggedIn()->member_id, \IPS\Member::loggedIn()->member_id );
|
||||
$this->where[] = array( '( album_type=1 OR ( album_type=2 AND album_owner_id=? ) OR ( album_type=3 AND ( album_owner_id=? OR ( album_allowed_access IS NOT NULL AND album_allowed_access IN(' . implode( ',', Member::loggedIn()->socialGroups() ) . ') ) ) ) )', Member::loggedIn()->member_id, Member::loggedIn()->member_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->where[] = array( '( album_type=1 OR ( album_type IN (2,3) AND album_owner_id=? ) )', \IPS\Member::loggedIn()->member_id );
|
||||
$this->where[] = array( '( album_type=1 OR ( album_type IN (2,3) AND album_owner_id=? ) )', Member::loggedIn()->member_id );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -122,10 +138,10 @@ class _Table extends \IPS\Helpers\Table\Content
|
||||
/**
|
||||
* Set owner
|
||||
*
|
||||
* @param \IPS\Member $member The member to filter by
|
||||
* @param Member $member The member to filter by
|
||||
* @return void
|
||||
*/
|
||||
public function setOwner( \IPS\Member $member )
|
||||
public function setOwner( Member $member ) : void
|
||||
{
|
||||
$this->where[] = array( 'album_owner_id=?', $member->member_id );
|
||||
}
|
||||
@@ -136,7 +152,7 @@ class _Table extends \IPS\Helpers\Table\Content
|
||||
* @param array|NULL $advancedSearchValues Advanced search values
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders( $advancedSearchValues )
|
||||
public function getHeaders( array $advancedSearchValues=NULL ): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
@@ -144,10 +160,10 @@ class _Table extends \IPS\Helpers\Table\Content
|
||||
/**
|
||||
* Does the user have permission to use the multi-mod checkboxes?
|
||||
*
|
||||
* @param string|null $action Specific action to check (hide/unhide, etc.) or NULL for a generic check
|
||||
* @param string|null $action Specific action to check (hide/unhide, etc.) or NULL for a generic check
|
||||
* @return bool
|
||||
*/
|
||||
public function canModerate( $action=NULL )
|
||||
public function canModerate( string $action=NULL ): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -156,10 +172,10 @@ class _Table extends \IPS\Helpers\Table\Content
|
||||
* Return the sort direction to use for links
|
||||
*
|
||||
* @note Abstracted so other table helper instances can adjust as needed
|
||||
* @param string $column Sort by string
|
||||
* @param string $column Sort by string
|
||||
* @return string [asc|desc]
|
||||
*/
|
||||
public function getSortDirection( $column )
|
||||
public function getSortDirection( string $column ): string
|
||||
{
|
||||
if( $column == 'album_name' )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user