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

@@ -10,26 +10,32 @@
*/
namespace IPS\core\api\GraphQL\Queries;
use GraphQL\Type\Definition\ObjectType;
use Exception;
use IPS\Api\GraphQL\TypeRegistry;
use IPS\Application;
use IPS\Content as ContentClass;
use IPS\Content\Api\GraphQL\ContentType;
use IPS\Http\Url;
use IPS\Member;
use function defined;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
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;
}
/**
* Me query for GraphQL API
*/
class _Content
class Content
{
/*
* @brief Query description
*/
public static $description = "Return a generic piece of content";
public static string $description = "Return a generic piece of content";
/*
* Query arguments
@@ -44,7 +50,7 @@ class _Content
/**
* Return the query return type
*/
public function type()
public function type() : ContentType
{
return \IPS\Content\Api\GraphQL\TypeRegistry::content();
}
@@ -52,21 +58,20 @@ class _Content
/**
* Resolves this query
*
* @param mixed Value passed into this resolver
* @param array Arguments
* @param array Context values
* @return \IPS\Member|null
* @param mixed $val Value passed into this resolver
* @param array $args Arguments
* @return ContentClass|null
*/
public function resolve($val, $args)
public function resolve( mixed $val, array $args ) : ?ContentClass
{
$url = \IPS\Http\Url::createFromString( $args['url'] );
$url = Url::createFromString( $args['url'] );
if ( !isset( $url->hiddenQueryString['app'] ) )
{
throw new Exception('Not a valid URL');
}
foreach ( \IPS\Application::load( $url->hiddenQueryString['app'] )->extensions( 'core', 'ContentRouter' ) as $ext )
foreach ( Application::load( $url->hiddenQueryString['app'] )->extensions( 'core', 'ContentRouter' ) as $ext )
{
foreach ( $ext->classes as $class )
{
@@ -85,7 +90,7 @@ class _Content
$object = $reviewClass::load( $url->queryString['review'] );
}
if ( !$object->canView( \IPS\Member::loggedIn() ) )
if ( !$object->canView( Member::loggedIn() ) )
{
// No permission
return NULL;
@@ -93,7 +98,7 @@ class _Content
return $object;
}
catch (\Exception $e)
catch (Exception $e)
{}
}
}