Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,26 +12,35 @@
namespace IPS\gallery\extensions\core\LiveSearch;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Db;
use IPS\Dispatcher;
use IPS\Extensions\LiveSearchAbstract;
use IPS\gallery\Category;
use IPS\Member;
use IPS\Theme;
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;
}
/**
* @brief ACP Live Search Extension
*/
class _Categories
class Categories extends LiveSearchAbstract
{
/**
* Check we have access
*
* @return bool
*/
public function hasAccess()
public function hasAccess(): bool
{
/* Check Permissions */
return \IPS\Member::loggedIn()->hasAcpRestriction( 'gallery', 'gallery', 'categories_manage' );
return Member::loggedIn()->hasAcpRestriction( 'gallery', 'gallery', 'categories_manage' );
}
/**
@@ -40,7 +49,7 @@ class _Categories
* @param string $searchTerm Search Term
* @return array Array of results
*/
public function getResults( $searchTerm )
public function getResults( string $searchTerm ): array
{
/* Init */
$results = array();
@@ -50,10 +59,10 @@ class _Categories
if( $this->hasAccess() )
{
/* Perform the search */
$categories = \IPS\Db::i()->select(
$categories = Db::i()->select(
"*",
'gallery_categories',
array( "category_club_id IS NULL AND word_custom LIKE CONCAT( '%', ?, '%' ) AND lang_id=?", $searchTerm, \IPS\Member::loggedIn()->language()->id ),
array( "category_club_id IS NULL AND word_custom LIKE CONCAT( '%', ?, '%' ) AND lang_id=?", $searchTerm, Member::loggedIn()->language()->id ),
NULL,
NULL
)->join(
@@ -64,9 +73,9 @@ class _Categories
/* Format results */
foreach ( $categories as $category )
{
$category = \IPS\gallery\Category::constructFromData( $category );
$category = Category::constructFromData( $category );
$results[] = \IPS\Theme::i()->getTemplate( 'livesearch', 'gallery', 'admin' )->category( $category );
$results[] = Theme::i()->getTemplate( 'livesearch', 'gallery', 'admin' )->category( $category );
}
}
@@ -78,8 +87,8 @@ class _Categories
*
* @return bool
*/
public function isDefault()
public function isDefault(): bool
{
return \IPS\Dispatcher::i()->application->directory == 'gallery';
return Dispatcher::i()->application->directory == 'gallery';
}
}