Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

+39 -76
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Table Builder for Gallery albums
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Gallery
* @since 17 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\Album;
@@ -22,7 +21,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Table Builder for Gallery albums
*/
class _Table extends \IPS\Helpers\Table\Table
class _Table extends \IPS\Helpers\Table\Content
{
/**
* @brief Container
@@ -43,6 +42,11 @@ class _Table extends \IPS\Helpers\Table\Table
* @brief Table resort parameter
*/
public $resortKey = 'albumResort';
/**
* @brief No Moderate
*/
public $noModerate = TRUE;
/**
* Constructor
@@ -53,35 +57,31 @@ class _Table extends \IPS\Helpers\Table\Table
*/
public function __construct( \IPS\Http\Url $url=NULL, \IPS\Node\Model $container=NULL )
{
/* Init */
$this->container = $container;
/* Init */
parent::__construct( ( $url !== NULL ) ? $url : $container->url() );
$this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'browse', 'gallery' ), 'albums' );
/* Set container */
if ( $container !== NULL )
{
$this->where[] = array( 'album_category_id=?', $container->_id );
if ( $this->sortBy === 'album_name' )
if ( !$this->sortBy and $container->_sortBy )
{
$this->sortDirection = 'asc';
}
if ( !$this->sortBy and $container->_sortBy !== NULL )
{
$this->sortBy = $container->_sortBy;
$this->sortBy = '`' . \IPS\gallery\Album::$databaseTable . '`.`' . \IPS\gallery\Album::$databasePrefix . $container->_sortBy . '`';
$this->sortDirection = $container->_sortOrder;
}
if ( !$this->filter )
{
$this->filter = $container->_filter;
}
if ( $this->sortBy === 'name' )
{
$this->sortDirection = 'asc';
}
}
/* Init */
parent::__construct( '\\IPS\\gallery\\Album\\Item', ( $url !== NULL ) ? $url : $container->url(), NULL, $container );
$this->rowsTemplate = array( \IPS\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 ) )
{
@@ -99,23 +99,20 @@ class _Table extends \IPS\Helpers\Table\Table
$this->where[] = array( 'album_type<>4' );
}
/* Set available sort options */
foreach ( array( 'last_img_date', 'count_comments', 'rating_aggregate', 'name', 'count_imgs' ) as $k )
foreach ( array( 'name', 'count_comments', 'count_imgs' ) as $k )
{
if( $k == 'count_comments' AND ( $container === NULL OR !$this->container->allow_comments ) )
{
continue;
}
if( $k == 'rating_aggregate' AND ( $container === NULL OR !$this->container->allow_rating ) )
{
continue;
}
$this->sortOptions[ $k ] = 'album_' . $k;
$this->sortOptions[ 'album_' . $k ] = $k;
}
unset( $this->sortOptions['date'] );
unset( $this->sortOptions['title'] );
if ( !$this->sortBy )
{
$this->sortBy = 'album_last_img_date';
@@ -133,51 +130,6 @@ class _Table extends \IPS\Helpers\Table\Table
$this->where[] = array( 'album_owner_id=?', $member->member_id );
}
/**
* Get rows
*
* @param array $advancedSearchValues Values from the advanced search form
* @return array
*/
public function getRows( $advancedSearchValues )
{
/* Init */
$class = "IPS\\gallery\\Album";
$subquery = NULL;
/* Check sortBy */
$this->sortBy = in_array( $this->sortBy, $this->sortOptions ) ? $this->sortBy : 'album_last_img_date';
/* What are we sorting by? */
$sortBy = $this->sortBy . ' ' . ( mb_strtolower( $this->sortDirection ) == 'asc' ? 'asc' : 'desc' );
/* Specify filter in where clause */
$where = $this->where ? is_array( $this->where ) ? $this->where : array( $this->where ) : array();
if ( $this->filter and isset( $this->filters[ $this->filter ] ) )
{
$where[] = is_array( $this->filters[ $this->filter ] ) ? $this->filters[ $this->filter ] : array( $this->filters[ $this->filter ] );
}
$where[] = array( '(' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_view', \IPS\Member::loggedIn()->groups ) . ' OR ' . 'core_permission_index.perm_view=? )', '*' );
/* Get results */
$it = \IPS\Db::i()->select( '*', 'gallery_albums', $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
$it->join( 'gallery_categories', array( "gallery_categories.category_id=gallery_albums.album_category_id" ) );
$it->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=gallery_categories.category_id", 'gallery', 'category' ) );
$this->pages = ceil( $it->count( TRUE ) / $this->limit );
$rows = iterator_to_array( $it );
foreach( $rows as $index => $row )
{
$rows[ $index ] = \IPS\gallery\Album::constructFromData( $row );
}
/* Return */
return $rows;
}
/**
* Return the table headers
*
@@ -188,4 +140,15 @@ class _Table extends \IPS\Helpers\Table\Table
{
return array();
}
/**
* 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
* @return bool
*/
public function canModerate( $action=NULL )
{
return FALSE;
}
}