Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

@@ -0,0 +1,39 @@
<?php
/**
* @brief GraphQL: Gallery mutations
* @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
* @since 18 January 2023
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\api\GraphQL;
use GraphQL\Type\Definition\ObjectType;
use IPS\Api\GraphQL\Types;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Gallery mutations GraphQL API
*/
abstract class _Mutation
{
/**
* Get the supported query types in this app
*
* @return array
*/
public static function mutations(): array
{
return [
];
}
}
@@ -33,7 +33,7 @@ class _Image
/*
* Query arguments
*/
public function args()
public function args(): array
{
return array(
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
@@ -60,18 +60,18 @@ class _Image
{
try
{
$topic = \IPS\gallery\Image::loadAndCheckPerms( $args['id'] );
$image = \IPS\gallery\Image::loadAndCheckPerms( $args['id'] );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\GraphQL\SafeException( 'NO_IMAGE', '1F294/2', 400 );
}
if( !$topic->can('read') )
if( !$image->can('read') )
{
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_ID', '2F294/9', 403 );
}
return $topic;
return $image;
}
}
@@ -27,11 +27,40 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _TypeRegistry
{
protected static $album;
protected static $albumComment;
protected static $albumItem;
protected static $image;
protected static $imageComment;
/**
* Returns the album instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumType
*/
protected static $album;
/**
* Returns the album comment instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumCommentType
*/
protected static $albumComment;
/**
* Returns the album item instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumItemType
*/
protected static $albumItem;
/**
* Returns the image instance
*
* @var \IPS\gallery\api\GraphQL\Types\ImageType
*/
protected static $image;
/**
* Returns the Image comment instance
*
* @var \IPS\gallery\api\GraphQL\Types\ImageCommentType
*/
protected static $imageComment;
/**
* Constructor
@@ -44,7 +73,7 @@ class _TypeRegistry
/**
* @return ImageType
*/
public static function album()
public static function album() : \IPS\gallery\api\GraphQL\Types\AlbumType
{
return self::$album ?: (self::$album = new \IPS\gallery\api\GraphQL\Types\AlbumType());
}
@@ -52,7 +81,7 @@ class _TypeRegistry
/**
* @return AlbumCommentType
*/
public static function albumComment()
public static function albumComment() : \IPS\gallery\api\GraphQL\Types\AlbumCommentType
{
return self::$albumComment ?: (self::$albumComment = new \IPS\gallery\api\GraphQL\Types\AlbumCommentType());
}
@@ -60,7 +89,7 @@ class _TypeRegistry
/**
* @return AlbumCommentType
*/
public static function albumItem()
public static function albumItem() : \IPS\gallery\api\GraphQL\Types\AlbumItemType
{
return self::$albumItem ?: (self::$albumItem = new \IPS\gallery\api\GraphQL\Types\AlbumItemType());
}
@@ -68,7 +97,7 @@ class _TypeRegistry
/**
* @return ImageType
*/
public static function image()
public static function image() : \IPS\gallery\api\GraphQL\Types\ImageType
{
return self::$image ?: (self::$image = new \IPS\gallery\api\GraphQL\Types\ImageType());
}
@@ -76,7 +105,7 @@ class _TypeRegistry
/**
* @return ImageCommentType
*/
public static function imageComment()
public static function imageComment() : \IPS\gallery\api\GraphQL\Types\ImageCommentType
{
return self::$imageComment ?: (self::$imageComment = new \IPS\gallery\api\GraphQL\Types\ImageCommentType());
}
@@ -176,13 +176,6 @@ class _ImageType extends \IPS\Content\Api\GraphQL\ItemType
]
);
// Duplicate fields that have different names in topics
/*$topicFields['forum'] = $defaultFields['container'];
$topicFields['posts'] = $defaultFields['comments'];
$topicFields['postCount'] = $defaultFields['commentCount'];
$topicFields['lastPostAuthor'] = $defaultFields['lastCommentAuthor'];
$topicFields['lastPostDate'] = $defaultFields['lastCommentDate'];*/
// Remove duplicated fields
unset( $defaultFields['poll'] );
unset( $defaultFields['hasPoll'] );