Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -33,7 +33,7 @@ class _ChangeNotificationSetting
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -59,7 +59,7 @@ class _ChangeNotificationSetting
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class _DeleteAttachment
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -58,7 +58,7 @@ class _DeleteAttachment
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return bool
|
||||
*/
|
||||
public function resolve($val, $args, $context, $info)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ class _DeleteAttachment
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_ATTACHMENT', '2C398/1', 404 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_ATTACHMENT', 'GQL/0004/1', 404 );
|
||||
}
|
||||
|
||||
/* Delete the maps - Only do this for attachments that have actually been saved (if they haven't been saved, there's nothing in core_attachments_map for us to delete */
|
||||
@@ -92,7 +92,7 @@ class _DeleteAttachment
|
||||
/* If the attachment hasn't been claimed yet, it should only be deletable by the person who uploaded it */
|
||||
if( $attachment['attach_member_id'] != \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANNOT_DELETE_OTHERS_ATTACHMENTS', '2C398/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANNOT_DELETE_OTHERS_ATTACHMENTS', 'GQL/0004/2', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Follow
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'app' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -64,7 +64,7 @@ class _Follow
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
@@ -72,35 +72,14 @@ class _Follow
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_LOGGED_IN', 'GQL/0001/6', 403 );
|
||||
}
|
||||
|
||||
/* Get class */
|
||||
$class = NULL;
|
||||
foreach ( \IPS\Application::load( $args['app'] )->extensions( 'core', 'ContentRouter' ) as $ext )
|
||||
try
|
||||
{
|
||||
foreach ( $ext->classes as $classname )
|
||||
{
|
||||
if ( $classname == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $classname;
|
||||
break;
|
||||
}
|
||||
if ( isset( $classname::$containerNodeClass ) and $classname::$containerNodeClass == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $classname::$containerNodeClass;
|
||||
break;
|
||||
}
|
||||
if( isset( $classname::$containerFollowClasses ) )
|
||||
{
|
||||
foreach( $classname::$containerFollowClasses as $followClass )
|
||||
{
|
||||
if( $followClass == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $followClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$class = \IPS\core\Followed\Follow::getClassToFollow( $args['app'], $args['area'] );
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_FOUND', 'GQL/0001/4', 404 );
|
||||
}
|
||||
|
||||
if( $args['app'] == 'core' and $args['area'] == 'member' )
|
||||
@@ -123,18 +102,6 @@ class _Follow
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANT_FOLLOW_MEMBER', 'GQL/0001/3', 403 );
|
||||
}
|
||||
|
||||
$class = 'IPS\\Member';
|
||||
}
|
||||
|
||||
if( $args['app'] == 'core' and $args['area'] == 'club' )
|
||||
{
|
||||
$class = 'IPS\Member\Club';
|
||||
}
|
||||
|
||||
if ( !$class or !array_key_exists( $args['app'], \IPS\Application::applications() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_FOUND', 'GQL/0001/4', 404 );
|
||||
}
|
||||
|
||||
/* Get our return info ready */
|
||||
|
||||
@@ -33,7 +33,7 @@ class _IgnoreUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'member' => TypeRegistry::nonNull( TypeRegistry::int() ),
|
||||
@@ -56,13 +56,13 @@ class _IgnoreUser
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
if ( !\in_array( $args['type'], \IPS\core\Ignore::types() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_TYPE', 'GQL/0001/4', 404 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_TYPE', 'GQL/0006/1', 404 );
|
||||
}
|
||||
|
||||
$type = $args['type'];
|
||||
@@ -70,17 +70,17 @@ class _IgnoreUser
|
||||
|
||||
if( !$member->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', 'GQL/0006/2', 403 );
|
||||
}
|
||||
|
||||
if ( $member->member_id == \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_SELF', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_SELF', 'GQL/0006/3', 403 );
|
||||
}
|
||||
|
||||
if ( !$member->canBeIgnored() )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_MEMBER', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_MEMBER', 'GQL/0006/4', 403 );
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MarkNotificationRead
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::int()
|
||||
@@ -54,7 +54,7 @@ class _MarkNotificationRead
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array|NULL
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class _AddConversationUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -70,14 +70,14 @@ class _AddConversationUser
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphql', 400 );
|
||||
}
|
||||
|
||||
// Fetch our new member
|
||||
$member = \IPS\Member::load( $args['memberId'] );
|
||||
|
||||
if( !$member->member_id ){
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', '1F294/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', '1F294/2_graphql', 403 );
|
||||
}
|
||||
|
||||
// Check member limit
|
||||
|
||||
@@ -33,7 +33,7 @@ class _LeaveConversation
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
@@ -70,7 +70,7 @@ class _LeaveConversation
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphl', 400 );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -33,7 +33,7 @@ class _RemoveConversationUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -70,7 +70,7 @@ class _RemoveConversationUser
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphl', 400 );
|
||||
}
|
||||
|
||||
if( $conversation->starter_id !== \IPS\Member::loggedIn()->member_id )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Unfollow
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'app' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -59,7 +59,7 @@ class _Unfollow
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ class _UploadAttachment
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'name' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -89,7 +89,7 @@ class _UploadAttachment
|
||||
{
|
||||
if( !\in_array( mb_strtolower( $ext ), array_map( 'mb_strtolower', $allowedFileTypes ) ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_TYPE_NOT_ALLOWED', '2C399/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_TYPE_NOT_ALLOWED', '2C399/1_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +112,7 @@ class _UploadAttachment
|
||||
/* If this is the LAST chunk, finish the process */
|
||||
if ( $args['chunk'] === $args['totalChunks'] )
|
||||
{
|
||||
$url = $storageClass->chunkFinish( $ref );
|
||||
$file = \IPS\File::get( 'core_Attachment', $url );
|
||||
$file = $storageClass->chunkFinish( $ref, 'core_Attachment' );
|
||||
|
||||
/* If it's got an image extension, check it's actually a valid image */
|
||||
if ( \in_array( $ext, \IPS\Image::supportedExtensions() ) )
|
||||
@@ -124,7 +123,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_VALID_IMAGE', '2C399/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_VALID_IMAGE', '2C399/2_graphql', 403 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +149,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \InvalidArgumentException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( $e->getMessage(), '2C399/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( $e->getMessage(), '2C399/2_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +160,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_CREATION_FAILED', '2C399/3', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_CREATION_FAILED', '2C399/3_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class _ActiveUsers
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Club
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args() {
|
||||
public function args(): array {
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief GraphQL: Clubs query
|
||||
* @author <a href='https://invisioncommunity.com/'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2023 Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Cloud
|
||||
* @since 09 February 2023
|
||||
*/
|
||||
|
||||
namespace IPS\core\api\GraphQL\Queries;
|
||||
|
||||
use GraphQL\Type\Definition\ObjectType;
|
||||
use IPS\Api\GraphQL\TypeRegistry;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Club query for GraphQL API
|
||||
*/
|
||||
class _Clubs
|
||||
{
|
||||
/*
|
||||
* @brief Query description
|
||||
*/
|
||||
public static string $description = 'Returns a list of clubs';
|
||||
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'clubs' => TypeRegistry::listOf( TypeRegistry::int() ),
|
||||
'offset' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'defaultValue' => 0
|
||||
],
|
||||
'limit' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'defaultValue' => 25
|
||||
],
|
||||
'orderBy' => [
|
||||
'type' => TypeRegistry::eNum( [
|
||||
'name' => 'clubs_order_by',
|
||||
'description' => 'Fields on which topics can be sorted',
|
||||
'values' => \IPS\core\api\GraphQL\Types\ClubType::getOrderByOptions()
|
||||
] ),
|
||||
'defaultValue' => NULL // will use default sort option
|
||||
],
|
||||
'orderDir' => [
|
||||
'type' => TypeRegistry::eNum( [
|
||||
'name' => 'clubs_order_dir',
|
||||
'description' => 'Directions in which items can be sorted',
|
||||
'values' => [ 'ASC', 'DESC' ]
|
||||
] ),
|
||||
'defaultValue' => 'DESC'
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the query return type
|
||||
*/
|
||||
public function type(): \GraphQL\Type\Definition\ListOfType
|
||||
{
|
||||
return TypeRegistry::listOf( \IPS\core\api\GraphQL\TypeRegistry::club() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves this query
|
||||
*
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\Patterns\ActiveRecordIterator[\IPS\Member\Club]
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context ): \IPS\Patterns\ActiveRecordIterator
|
||||
{
|
||||
$where = [];
|
||||
$sortBy = ( isset( $args['orderBy'] ) and \in_array( $args['orderBy'], \IPS\core\api\GraphQL\Types\ClubType::getOrderByOptions() ) ) ? $args['orderBy'] : 'name';
|
||||
$sortDir = ( isset( $args['orderDir'] ) and \in_array( mb_strtolower( $args['orderDir'] ), array( 'asc', 'desc' ) ) ) ? $args['orderDir'] : 'desc';
|
||||
$limit =( isset( $args['orderDir'] ) and \is_int( $args['limit'] ) ) ? $args['limit'] : 25;
|
||||
|
||||
$query = \IPS\Db::i()->select( '*', 'core_clubs', $where, "{$sortBy} {$sortDir}", $limit );
|
||||
return new \IPS\Patterns\ActiveRecordIterator( $query, '\IPS\Member\Club' );
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class _Content
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'url' => TypeRegistry::nonNull( TypeRegistry::string() )
|
||||
|
||||
@@ -34,7 +34,7 @@ class _Group
|
||||
/*
|
||||
* @brief Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
@@ -59,6 +59,13 @@ class _Group
|
||||
*/
|
||||
public function resolve($val, $args, $context)
|
||||
{
|
||||
return \IPS\Member\Group::load( $args['id'] );
|
||||
try
|
||||
{
|
||||
return \IPS\Member\Group::load( $args['id'] );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_GROUP', '1invalid_group_graph', 400 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class _Language
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::id()
|
||||
|
||||
@@ -34,7 +34,7 @@ class _LoginHandlers
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class _Me
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class _Member
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::id(),
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief GraphQL: Members query
|
||||
* @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 26 01 2023
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\api\GraphQL\Queries;
|
||||
|
||||
use GraphQL\Type\Definition\ObjectType;
|
||||
use IPS\Api\GraphQL\TypeRegistry;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Members query for GraphQL API
|
||||
*/
|
||||
class _Members
|
||||
{
|
||||
/*
|
||||
* @brief Query description
|
||||
*/
|
||||
public static $description = 'Returns a list of members';
|
||||
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'members' => TypeRegistry::listOf( TypeRegistry::int() ),
|
||||
'offset' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'defaultValue' => 0
|
||||
],
|
||||
'limit' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'defaultValue' => 25
|
||||
],
|
||||
'orderBy' => [
|
||||
'type' => TypeRegistry::eNum( [
|
||||
'name' => 'member_order_by',
|
||||
'description' => 'Fields on which topics can be sorted',
|
||||
'values' => \IPS\core\api\GraphQL\Types\MemberType::getOrderByOptions()
|
||||
] ),
|
||||
'defaultValue' => NULL // will use default sort option
|
||||
],
|
||||
'orderDir' => [
|
||||
'type' => TypeRegistry::eNum( [
|
||||
'name' => 'member_order_dir',
|
||||
'description' => 'Directions in which items can be sorted',
|
||||
'values' => [ 'ASC', 'DESC' ]
|
||||
] ),
|
||||
'defaultValue' => 'DESC'
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the query return type
|
||||
*/
|
||||
public function type()
|
||||
{
|
||||
return TypeRegistry::listOf( \IPS\core\api\GraphQL\TypeRegistry::member() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves this query
|
||||
*
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return [\IPS\Members]
|
||||
*/
|
||||
public function resolve( $val, $args, $context, $info )
|
||||
{
|
||||
$where = [];
|
||||
$sortBy = ( isset( $args['orderBy'] ) and \in_array( $args['orderBy'], \IPS\core\api\GraphQL\Types\MemberType::getOrderByOptions() ) ) ? $args['orderBy'] : 'member_id';
|
||||
$sortDir = ( isset( $args['orderDir'] ) and \in_array( mb_strtolower( $args['orderDir'] ), array( 'asc', 'desc' ) ) ) ? $args['orderDir'] : 'desc';
|
||||
$limit =( isset( $args['orderDir'] ) and \is_int( $args['limit'] ) ) ? $args['limit'] : 25;
|
||||
|
||||
$query = \IPS\Db::i()->select( '*', 'core_members', $where, "{$sortBy} {$sortDir}", $limit );
|
||||
return new \IPS\Patterns\ActiveRecordIterator( $query, 'IPS\Member' );
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class _MessengerConversation
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MessengerConversations
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'folder' => TypeRegistry::id(),
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MessengerFolders
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class _NotificationTypes
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class _OurPicks
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'count' => TypeRegistry::int()
|
||||
|
||||
@@ -33,7 +33,7 @@ class _PopularContributors
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'limit' => [
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Search
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'term' => TypeRegistry::string(),
|
||||
|
||||
@@ -34,7 +34,7 @@ class _Settings
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Stats
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Stream
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::id()
|
||||
|
||||
@@ -34,7 +34,7 @@ class _Streams
|
||||
/*
|
||||
* @brief Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -32,17 +32,19 @@ abstract class _Query
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function queries()
|
||||
public static function queries(): array
|
||||
{
|
||||
return [
|
||||
'activeUsers' => new \IPS\core\api\GraphQL\Queries\ActiveUsers(),
|
||||
'club' => new \IPS\core\api\GraphQL\Queries\Club(),
|
||||
'clubs' => new \IPS\core\api\GraphQL\Queries\Clubs(),
|
||||
'content' => new \IPS\core\api\GraphQL\Queries\Content(),
|
||||
'group' => new \IPS\core\api\GraphQL\Queries\Group(),
|
||||
'language' => new \IPS\core\api\GraphQL\Queries\Language(),
|
||||
'loginHandlers' => new \IPS\core\api\GraphQL\Queries\LoginHandlers(),
|
||||
'me' => new \IPS\core\api\GraphQL\Queries\Me(),
|
||||
'member' => new \IPS\core\api\GraphQL\Queries\Member(),
|
||||
'members' => new \IPS\core\api\GraphQL\Queries\Members(),
|
||||
'messengerConversation' => new \IPS\core\api\GraphQL\Queries\MessengerConversation(),
|
||||
'messengerConversations' => new \IPS\core\api\GraphQL\Queries\MessengerConversations(),
|
||||
'messengerFolders' => new \IPS\core\api\GraphQL\Queries\MessengerFolders(),
|
||||
|
||||
@@ -72,7 +72,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActiveUsersType
|
||||
* @return \IPS\core\api\GraphQL\Types\ActiveUsersType
|
||||
*/
|
||||
public static function activeUsers()
|
||||
{
|
||||
@@ -80,7 +80,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActiveUsersType
|
||||
* @return \IPS\core\api\GraphQL\Types\ActiveUserType
|
||||
*/
|
||||
public static function activeUser()
|
||||
{
|
||||
@@ -88,7 +88,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AttachmentType
|
||||
* @return \IPS\core\api\GraphQL\Types\AttachmentType
|
||||
*/
|
||||
public static function attachment()
|
||||
{
|
||||
@@ -96,7 +96,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AttachmentPermissionsType
|
||||
* @return \IPS\core\api\GraphQL\Types\AttachmentPermissionsType
|
||||
*/
|
||||
public static function attachmentPermissions()
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClubNodeType
|
||||
* @return \IPS\core\api\GraphQL\Types\ClubNodeType
|
||||
*/
|
||||
public static function clubNode()
|
||||
{
|
||||
@@ -112,7 +112,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ClubNodeType
|
||||
* @return \IPS\core\api\GraphQL\Types\ClubType
|
||||
*/
|
||||
public static function club()
|
||||
{
|
||||
@@ -120,7 +120,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContentReactionType
|
||||
* @return \IPS\core\api\GraphQL\Types\ContentReactionType
|
||||
*/
|
||||
public static function contentReaction()
|
||||
{
|
||||
@@ -128,7 +128,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return GroupType
|
||||
* @return \IPS\core\api\GraphQL\Types\GroupType
|
||||
*/
|
||||
public static function group()
|
||||
{
|
||||
@@ -136,7 +136,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IgnoreOptionType
|
||||
* @return \IPS\core\api\GraphQL\Types\IgnoreOptionType
|
||||
*/
|
||||
public static function ignoreOption()
|
||||
{
|
||||
@@ -144,7 +144,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MemberType
|
||||
* @return \IPS\core\api\GraphQL\Types\MemberType
|
||||
*/
|
||||
public static function member()
|
||||
{
|
||||
@@ -152,7 +152,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LanguageType
|
||||
* @return \IPS\core\api\GraphQL\Types\LanguageType
|
||||
*/
|
||||
public static function language()
|
||||
{
|
||||
@@ -160,7 +160,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LoginType
|
||||
* @return \IPS\core\api\GraphQL\Types\LoginType
|
||||
*/
|
||||
public static function login()
|
||||
{
|
||||
@@ -168,7 +168,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MessengerConversationType
|
||||
* @return \IPS\core\api\GraphQL\Types\MessengerConversationType
|
||||
*/
|
||||
public static function messengerConversation()
|
||||
{
|
||||
@@ -176,7 +176,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MessengerFolderType
|
||||
* @return \IPS\core\api\GraphQL\Types\MessengerFolderType
|
||||
*/
|
||||
public static function messengerFolder()
|
||||
{
|
||||
@@ -184,7 +184,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MessengerParticipantType
|
||||
* @return \IPS\core\api\GraphQL\Types\MessengerParticipantType
|
||||
*/
|
||||
public static function messengerParticipant()
|
||||
{
|
||||
@@ -192,7 +192,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MessengerReplyType
|
||||
* @return \IPS\core\api\GraphQL\Types\MessengerReplyType
|
||||
*/
|
||||
public static function messengerReply()
|
||||
{
|
||||
@@ -200,7 +200,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NotificationType
|
||||
* @return \IPS\core\api\GraphQL\Types\NotificationType
|
||||
*/
|
||||
public static function notification()
|
||||
{
|
||||
@@ -208,7 +208,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NotificationMethod
|
||||
* @return \IPS\core\api\GraphQL\Types\NotificationMethodType
|
||||
*/
|
||||
public static function notificationMethod()
|
||||
{
|
||||
@@ -216,7 +216,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NotificationTypeType
|
||||
* @return \IPS\core\api\GraphQL\Types\NotificationTypeType
|
||||
*/
|
||||
public static function notificationType()
|
||||
{
|
||||
@@ -224,7 +224,7 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PollType
|
||||
* @return \IPS\core\api\GraphQL\Types\PollType
|
||||
*/
|
||||
public static function poll()
|
||||
{
|
||||
@@ -232,121 +232,121 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PollQuestionType
|
||||
* @return \IPS\core\api\GraphQL\Types\PollQuestionType
|
||||
*/
|
||||
public static function pollQuestion()
|
||||
public static function pollQuestion(): \IPS\core\api\GraphQL\Types\PollQuestionType
|
||||
{
|
||||
return self::$pollQuestion ?: (self::$pollQuestion = new \IPS\core\api\GraphQL\Types\PollQuestionType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PopularContributorType
|
||||
* @return \IPS\core\api\GraphQL\Types\PopularContributorType
|
||||
*/
|
||||
public static function popularContributor()
|
||||
public static function popularContributor(): \IPS\core\api\GraphQL\Types\PopularContributorType
|
||||
{
|
||||
return self::$popularContributor ?: (self::$popularContributor = new \IPS\core\api\GraphQL\Types\PopularContributorType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProfileFieldGroupType
|
||||
* @return \IPS\core\api\GraphQL\Types\ProfileFieldGroupType
|
||||
*/
|
||||
public static function profileFieldGroup()
|
||||
{
|
||||
return self::$profileFieldGroup ?: (self::$profileFieldGroup = new \IPS\core\api\GraphQL\Types\ProfileFieldGroupType());
|
||||
}
|
||||
public static function profileFieldGroup(): \IPS\core\api\GraphQL\Types\ProfileFieldGroupType
|
||||
{
|
||||
return self::$profileFieldGroup ?: (self::$profileFieldGroup = new \IPS\core\api\GraphQL\Types\ProfileFieldGroupType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProfileFieldType
|
||||
* @return \IPS\core\api\GraphQL\Types\ProfileFieldType
|
||||
*/
|
||||
public static function profileField()
|
||||
public static function profileField(): \IPS\core\api\GraphQL\Types\ProfileFieldType
|
||||
{
|
||||
return self::$profileField ?: (self::$profileField = new \IPS\core\api\GraphQL\Types\ProfileFieldType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PromotedItemType
|
||||
* @return \IPS\core\api\GraphQL\Types\PromotedItemType
|
||||
*/
|
||||
public static function promotedItem()
|
||||
public static function promotedItem(): \IPS\core\api\GraphQL\Types\PromotedItemType
|
||||
{
|
||||
return self::$promotedItem ?: (self::$promotedItem = new \IPS\core\api\GraphQL\Types\PromotedItemType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContentSearchResultType
|
||||
* @return \IPS\core\api\GraphQL\Types\ContentSearchResultType
|
||||
*/
|
||||
public static function contentSearchResult()
|
||||
public static function contentSearchResult(): \IPS\core\api\GraphQL\Types\ContentSearchResultType
|
||||
{
|
||||
return self::$contentSearchResult ?: (self::$contentSearchResult = new \IPS\core\api\GraphQL\Types\ContentSearchResultType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReportType
|
||||
* @return \IPS\core\api\GraphQL\Types\ReportType
|
||||
*/
|
||||
public static function report()
|
||||
{
|
||||
return self::$report ?: (self::$report = new \IPS\core\api\GraphQL\Types\ReportType());
|
||||
}
|
||||
public static function report(): \IPS\core\api\GraphQL\Types\ReportType
|
||||
{
|
||||
return self::$report ?: (self::$report = new \IPS\core\api\GraphQL\Types\ReportType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ReportReasonType
|
||||
* @return \IPS\core\api\GraphQL\Types\ReportReasonType
|
||||
*/
|
||||
public static function reportReason()
|
||||
{
|
||||
return self::$reportReason ?: (self::$reportReason = new \IPS\core\api\GraphQL\Types\ReportReasonType());
|
||||
}
|
||||
public static function reportReason(): \IPS\core\api\GraphQL\Types\ReportReasonType
|
||||
{
|
||||
return self::$reportReason ?: (self::$reportReason = new \IPS\core\api\GraphQL\Types\ReportReasonType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SearchResultType
|
||||
* @return \IPS\core\api\GraphQL\Types\SearchResultType
|
||||
*/
|
||||
public static function searchResult()
|
||||
public static function searchResult(): \IPS\core\api\GraphQL\Types\SearchResultType
|
||||
{
|
||||
return self::$searchResult ?: (self::$searchResult = new \IPS\core\api\GraphQL\Types\SearchResultType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SearchType
|
||||
* @return \IPS\core\api\GraphQL\Types\SearchType
|
||||
*/
|
||||
public static function search()
|
||||
public static function search(): \IPS\core\api\GraphQL\Types\SearchType
|
||||
{
|
||||
return self::$search ?: (self::$search = new \IPS\core\api\GraphQL\Types\SearchType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StatsType
|
||||
* @return \IPS\core\api\GraphQL\Types\StatsType
|
||||
*/
|
||||
public static function stats()
|
||||
public static function stats(): \IPS\core\api\GraphQL\Types\StatsType
|
||||
{
|
||||
return self::$stats ?: (self::$stats = new \IPS\core\api\GraphQL\Types\StatsType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StreamType
|
||||
* @return \IPS\core\api\GraphQL\Types\StreamType
|
||||
*/
|
||||
public static function stream()
|
||||
public static function stream(): \IPS\core\api\GraphQL\Types\StreamType
|
||||
{
|
||||
return self::$stream ?: (self::$stream = new \IPS\core\api\GraphQL\Types\StreamType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TagType
|
||||
* @return \IPS\core\api\GraphQL\Types\TagType
|
||||
*/
|
||||
public static function tag()
|
||||
public static function tag(): \IPS\core\api\GraphQL\Types\TagType
|
||||
{
|
||||
return self::$tag ?: (self::$tag = new \IPS\core\api\GraphQL\Types\TagType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SettingsType
|
||||
* @return \IPS\core\api\GraphQL\Types\SettingsType
|
||||
*/
|
||||
public static function settings()
|
||||
public static function settings(): \IPS\core\api\GraphQL\Types\SettingsType
|
||||
{
|
||||
return self::$settings ?: (self::$settings = new \IPS\core\api\GraphQL\Types\SettingsType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UploadProgressType
|
||||
* @return \IPS\core\api\GraphQL\Types\UploadProgressType
|
||||
*/
|
||||
public static function uploadProgress()
|
||||
public static function uploadProgress(): \IPS\core\api\GraphQL\Types\UploadProgressType
|
||||
{
|
||||
return self::$uploadProgress ?: (self::$uploadProgress = new \IPS\core\api\GraphQL\Types\UploadProgressType());
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class _ClubType extends ObjectType
|
||||
'type' => TypeRegistry::int(),
|
||||
'description' => "Timestamp of club creation date",
|
||||
'resolve' => function ($club) {
|
||||
return $club->created;
|
||||
return $club->created->getTimestamp();
|
||||
}
|
||||
],
|
||||
'memberCount' => [
|
||||
@@ -187,4 +187,16 @@ class _ClubType extends ObjectType
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sort options available for this type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getOrderByOptions(): array
|
||||
{
|
||||
return [
|
||||
'created', 'last_activity', 'name'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class _ContentSearchResultType extends ObjectType
|
||||
}
|
||||
],
|
||||
'url' => [
|
||||
'type' => TypeRegistry::url(),
|
||||
'type' => TypeRegistry::string(),
|
||||
'description' => "URL to this result item",
|
||||
'resolve' => function ($result) {
|
||||
return self::url($result);
|
||||
|
||||
@@ -655,10 +655,10 @@ class _MemberType extends ObjectType
|
||||
/**
|
||||
* Resolve ignore status field
|
||||
*
|
||||
* @param \IPS\Member
|
||||
* @param \IPS\Member $member Member to check
|
||||
* @return array
|
||||
*/
|
||||
protected static function ignoreStatus($member)
|
||||
protected static function ignoreStatus( \IPS\Member $member)
|
||||
{
|
||||
if( !$member->canBeIgnored() || $member->member_id === \IPS\Member::loggedIn()->member_id ){
|
||||
return NULL;
|
||||
@@ -686,4 +686,9 @@ class _MemberType extends ObjectType
|
||||
|
||||
return $ignoreStatus;
|
||||
}
|
||||
|
||||
public static function getOrderByOptions()
|
||||
{
|
||||
return ['member_id', 'joined','last_activity','name','last_visit'];
|
||||
}
|
||||
}
|
||||
@@ -41,16 +41,14 @@ class _StatsType extends ObjectType
|
||||
'type' => TypeRegistry::int(),
|
||||
'description' => "Content count",
|
||||
'resolve' => function () {
|
||||
// Return null for now until GQL is fleshed out
|
||||
return NULL;
|
||||
return (int) static::getContentCount();
|
||||
}
|
||||
],
|
||||
'memberCount' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'description' => 'Member count',
|
||||
'resolve' => function () {
|
||||
// Return null for now until GQL is fleshed out
|
||||
return NULL;
|
||||
return (int) static::getMemberCount();
|
||||
}
|
||||
]
|
||||
];
|
||||
@@ -127,7 +125,7 @@ class _StatsType extends ObjectType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Data\Cache::i()->storeWithExpire( $cacheKey, $total, \IPS\DateTime::create()->add( new \DateInterval('P1W') ), TRUE );
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class _members extends \IPS\Api\Controller
|
||||
* GET /core/members
|
||||
* Get list of members
|
||||
*
|
||||
* @apiparam string ids Comma-delimited list of member IDs
|
||||
* @apiparam string sortBy What to sort by. Can be 'joined', 'name', 'last_activity' or leave unspecified for ID
|
||||
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
|
||||
* @apiparam string name (Partial) user name to search for
|
||||
@@ -50,6 +51,12 @@ class _members extends \IPS\Api\Controller
|
||||
/* Where clause */
|
||||
$where = array( array( 'core_members.email<>?', '' ) );
|
||||
|
||||
/* Get members by the id/ids */
|
||||
if ( isset( \IPS\Request::i()->ids ) )
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( 'member_id', array_map( 'intval', explode( ',', \IPS\Request::i()->ids ) ) ) );
|
||||
}
|
||||
|
||||
/* Are we searching? */
|
||||
if( isset( \IPS\Request::i()->name ) )
|
||||
{
|
||||
@@ -568,12 +575,7 @@ class _members extends \IPS\Api\Controller
|
||||
/* Make sure follow app/area/id is valid (Phil I'm looking at you) */
|
||||
try
|
||||
{
|
||||
$classToFollow = 'IPS\\' . \IPS\Request::i()->followApp . '\\' . mb_ucfirst( \IPS\Request::i()->followArea );
|
||||
|
||||
if( !class_exists( $classToFollow ) or !array_key_exists( \IPS\Request::i()->followApp, \IPS\Application::applications() ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
$classToFollow = \IPS\core\Followed\Follow::getClassToFollow( \IPS\Request::i()->followApp, \IPS\Request::i()->followArea );
|
||||
|
||||
$thingToFollow = $classToFollow::load( (int) \IPS\Request::i()->followId );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user