Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,29 +11,35 @@
|
||||
namespace IPS\Node\Api\GraphQL;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Api\GraphQL\SafeException;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use OutOfRangeException;
|
||||
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 Base mutator class for nodes
|
||||
*/
|
||||
class _NodeMutator
|
||||
class NodeMutator
|
||||
{
|
||||
/**
|
||||
* Mark a node as read
|
||||
*
|
||||
* @param int $reactionID ID of reaction to add
|
||||
* @param \IPS\Content\Comment $comment The comment to add a reaction on
|
||||
* @return void
|
||||
* @param Model $node The comment to add a reaction on
|
||||
* @return Model
|
||||
*/
|
||||
protected function _markRead( $node )
|
||||
protected function _markRead( Model $node ): Model
|
||||
{
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
if( !Member::loggedIn()->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_LOGGED_IN', 'GQL/0004/1', 403 );
|
||||
throw new SafeException( 'NOT_LOGGED_IN', 'GQL/0004/1', 403 );
|
||||
}
|
||||
|
||||
try
|
||||
@@ -41,9 +47,9 @@ class _NodeMutator
|
||||
$itemClass = $node::$contentItemClass;
|
||||
$itemClass::markContainerRead( $node );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_NODE', 'GQL/0004/2', 403 );
|
||||
throw new SafeException( 'INVALID_NODE', 'GQL/0004/2', 403 );
|
||||
}
|
||||
|
||||
return $node;
|
||||
|
||||
@@ -9,35 +9,44 @@
|
||||
*/
|
||||
|
||||
namespace IPS\Node\Api\GraphQL;
|
||||
use Exception;
|
||||
use GraphQL\Type\Definition\ObjectType;
|
||||
use IPS\Api\GraphQL\Fields\TagsEditField;
|
||||
use IPS\Api\GraphQL\TypeRegistry;
|
||||
use IPS\Content\Item;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use function defined;
|
||||
use function is_array;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Base class for Nodes
|
||||
*/
|
||||
class _NodeType extends ObjectType
|
||||
class NodeType extends ObjectType
|
||||
{
|
||||
/*
|
||||
/**
|
||||
* @brief The item classname we use for this type
|
||||
* @var Model|string
|
||||
*/
|
||||
protected static $nodeClass = '\IPS\Node\Model';
|
||||
protected static string $nodeClass = '\IPS\Node\Model';
|
||||
|
||||
/*
|
||||
* @brief GraphQL type name
|
||||
*/
|
||||
protected static $typeName = 'core_Node';
|
||||
protected static string $typeName = 'core_Node';
|
||||
|
||||
/*
|
||||
* @brief GraphQL type description
|
||||
*/
|
||||
protected static $typeDescription = 'A generic node';
|
||||
protected static string $typeDescription = 'A generic node';
|
||||
|
||||
|
||||
public function __construct()
|
||||
@@ -58,7 +67,7 @@ class _NodeType extends ObjectType
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields()
|
||||
public function fields(): array
|
||||
{
|
||||
return array(
|
||||
'id' => [
|
||||
@@ -70,7 +79,7 @@ class _NodeType extends ObjectType
|
||||
'name' => [
|
||||
'type' => TypeRegistry::string(),
|
||||
'resolve' => function ($node) {
|
||||
return $node->getTitleForLanguage( \IPS\Member::loggedIn()->language() );
|
||||
return $node->getTitleForLanguage( Member::loggedIn()->language() );
|
||||
}
|
||||
],
|
||||
'url' => [
|
||||
@@ -82,12 +91,14 @@ class _NodeType extends ObjectType
|
||||
'itemCount' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'resolve' => function ($node) {
|
||||
/* @var Item $contentItemClass */
|
||||
return static::$nodeClass::$contentItemClass::contentCount($node, TRUE, FALSE);
|
||||
}
|
||||
],
|
||||
'commentCount' => [
|
||||
'type' => TypeRegistry::int(),
|
||||
'resolve' => function ($node) {
|
||||
/* @var Item $contentItemClass */
|
||||
return static::$nodeClass::$contentItemClass::contentCount($node, FALSE, TRUE);
|
||||
}
|
||||
],
|
||||
@@ -100,6 +111,7 @@ class _NodeType extends ObjectType
|
||||
'hasUnread' => [
|
||||
'type' => TypeRegistry::boolean(),
|
||||
'resolve' => function ($node) {
|
||||
/* @var Item $contentItemClass */
|
||||
return static::$nodeClass::$contentItemClass::containerUnread( $node );
|
||||
}
|
||||
],
|
||||
@@ -113,7 +125,7 @@ class _NodeType extends ObjectType
|
||||
'follow' => [
|
||||
'type' => TypeRegistry::follow(),
|
||||
'resolve' => function ($node) {
|
||||
if( isset( static::$followData ) && \is_array( static::$followData ) ){
|
||||
if( isset( static::$followData ) && is_array( static::$followData ) ){
|
||||
return array_merge( static::$followData, array(
|
||||
'id' => $node->_id,
|
||||
'node' => $node,
|
||||
@@ -142,7 +154,7 @@ class _NodeType extends ObjectType
|
||||
return array( 'postKey' => $args['postKey'] );
|
||||
}
|
||||
],
|
||||
'tagPermissions' => \IPS\Api\GraphQL\Fields\TagsEditField::getDefinition(static::$typeName . '_tags')
|
||||
'tagPermissions' => TagsEditField::getDefinition(static::$typeName . '_tags')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -151,7 +163,7 @@ class _NodeType extends ObjectType
|
||||
*
|
||||
* @return ObjectType
|
||||
*/
|
||||
public static function getItemType()
|
||||
public static function getItemType(): ObjectType
|
||||
{
|
||||
return \IPS\Content\Api\GraphQL\TypeRegistry::item();
|
||||
}
|
||||
@@ -161,19 +173,20 @@ class _NodeType extends ObjectType
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getNodePermissionFields()
|
||||
public static function getNodePermissionFields(): array
|
||||
{
|
||||
return array(
|
||||
'canCreate' => [
|
||||
'type' => TypeRegistry::boolean(),
|
||||
'resolve' => function ($node, $args, $context) {
|
||||
return $node->can('add', \IPS\Member::loggedIn(), FALSE);
|
||||
return $node->can('add', Member::loggedIn(), FALSE);
|
||||
}
|
||||
],
|
||||
'itemsRequireApproval' => [
|
||||
'type' => TypeRegistry::boolean(),
|
||||
'resolve' => function ($node, $args, $context) {
|
||||
return static::$nodeClass::$contentItemClass::moderateNewItems( \IPS\Member::loggedIn(), $node, FALSE );
|
||||
/* @var Item $contentItemClass */
|
||||
return static::$nodeClass::$contentItemClass::moderateNewItems( Member::loggedIn(), $node, FALSE );
|
||||
}
|
||||
],
|
||||
'commentsRequireApproval' => [
|
||||
@@ -196,10 +209,12 @@ class _NodeType extends ObjectType
|
||||
/**
|
||||
* Resolve children field
|
||||
*
|
||||
* @param \IPS\Node\Model
|
||||
* @return array
|
||||
* @param Model $node
|
||||
* @param array $args
|
||||
* @param array $context
|
||||
* @return array
|
||||
*/
|
||||
protected static function children($node, $args, $context)
|
||||
protected static function children( Model $node, array $args, array $context): array
|
||||
{
|
||||
return $node->children('view');
|
||||
}
|
||||
@@ -207,11 +222,11 @@ class _NodeType extends ObjectType
|
||||
/**
|
||||
* Resolve the topics field
|
||||
*
|
||||
* @param \IPS\forums\Forum
|
||||
* @param array Arguments passed to this resolver
|
||||
* @return array
|
||||
* @param Model $node
|
||||
* @param array $args Arguments passed to this resolver
|
||||
* @return ActiveRecordIterator|int
|
||||
*/
|
||||
protected static function items($node, $args)
|
||||
protected static function items( Model $node, array $args): ActiveRecordIterator|int
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -221,20 +236,24 @@ class _NodeType extends ObjectType
|
||||
}
|
||||
else
|
||||
{
|
||||
/* @var Item $contentItemClass */
|
||||
/* @var array $databaseColumnMap */
|
||||
$orderBy = static::$nodeClass::$contentItemClass::$databaseColumnMap[ $args['orderBy'] ];
|
||||
}
|
||||
|
||||
if( $args['orderBy'] === 'last_comment' )
|
||||
{
|
||||
$orderBy = \is_array( $orderBy ) ? array_pop( $orderBy ) : $orderBy;
|
||||
$orderBy = is_array( $orderBy ) ? array_pop( $orderBy ) : $orderBy;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
$orderBy = 'title';
|
||||
}
|
||||
|
||||
$where = array();
|
||||
|
||||
/* @var Item $class */
|
||||
$class = static::$nodeClass::$contentItemClass;
|
||||
$sortBy = $class::$databaseTable . '.' . $class::$databasePrefix . "{$orderBy} {$args['orderDir']}";
|
||||
|
||||
|
||||
@@ -10,21 +10,21 @@
|
||||
*/
|
||||
|
||||
namespace IPS\Node\Api\GraphQL;
|
||||
use GraphQL\Type\Definition\Type;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* \IPS\Node base types
|
||||
*/
|
||||
class _TypeRegistry
|
||||
class TypeRegistry
|
||||
{
|
||||
protected static $node;
|
||||
protected static ?NodeType $node = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -35,10 +35,10 @@ class _TypeRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CommentType
|
||||
* @return NodeType
|
||||
*/
|
||||
public static function node()
|
||||
public static function node() : NodeType
|
||||
{
|
||||
return self::$node ?: (self::$node = new \IPS\Node\Api\GraphQL\NodeType());
|
||||
return self::$node ?: (self::$node = new NodeType());
|
||||
}
|
||||
}
|
||||
@@ -11,30 +11,46 @@
|
||||
namespace IPS\Node\Api;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Api\Controller;
|
||||
use IPS\Api\Exception;
|
||||
use IPS\Api\PaginatedResponse;
|
||||
use IPS\Api\Response;
|
||||
use IPS\Db;
|
||||
use IPS\IPS;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Node\Permissions;
|
||||
use IPS\Request;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
|
||||
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 Base API endpoint for Nodes
|
||||
*/
|
||||
class _NodeController extends \IPS\Api\Controller
|
||||
class NodeController extends Controller
|
||||
{
|
||||
/**
|
||||
* List
|
||||
*
|
||||
* @param array $where Extra WHERE clause
|
||||
* @return \IPS\Api\PaginatedResponse
|
||||
* @return PaginatedResponse
|
||||
*/
|
||||
protected function _list( $where = array() )
|
||||
protected function _list( array $where = array() ) : PaginatedResponse
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
if ( $this->member and \in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
|
||||
/* @var array $permissionMap */
|
||||
if ( $this->member and in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
{
|
||||
$where[] = array( '(' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_' . $class::$permissionMap['view'], $this->member->permissionArray() ) . ' OR ' . 'core_permission_index.perm_' . $class::$permissionMap['view'] . '=? )', '*' );
|
||||
$where[] = array( '(' . Db::i()->findInSet( 'core_permission_index.perm_' . $class::$permissionMap['view'], $this->member->permissionArray() ) . ' OR ' . 'core_permission_index.perm_' . $class::$permissionMap['view'] . '=? )', '*' );
|
||||
if ( $class::$databaseColumnEnabledDisabled )
|
||||
{
|
||||
$where[] = array( $class::$databasePrefix . $class::$databaseColumnEnabledDisabled . '=1' );
|
||||
@@ -42,28 +58,28 @@ class _NodeController extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Exclude clubs? */
|
||||
if ( \IPS\IPS::classUsesTrait( $class, 'IPS\Content\ClubContainer' ) AND isset( \IPS\Request::i()->clubs ) AND !\IPS\Request::i()->clubs )
|
||||
if ( IPS::classUsesTrait( $class, 'IPS\Content\ClubContainer' ) AND isset( Request::i()->clubs ) AND !Request::i()->clubs )
|
||||
{
|
||||
$where[] = array( $class::$databasePrefix . $class::clubIdColumn() . ' IS NULL' );
|
||||
}
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', $class::$databaseTable, $where, $class::$databaseColumnOrder ? $class::$databasePrefix . $class::$databaseColumnOrder . " asc" : NULL );
|
||||
$select = Db::i()->select( '*', $class::$databaseTable, $where, $class::$databaseColumnOrder ? $class::$databasePrefix . $class::$databaseColumnOrder . " asc" : NULL );
|
||||
|
||||
/* Return permissions */
|
||||
if ( \in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
if ( in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
{
|
||||
$select->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=" . $class::$databaseTable . "." . $class::$databasePrefix . $class::$databaseColumnId, $class::$permApp, $class::$permType ) );
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return new \IPS\Api\PaginatedResponse(
|
||||
return new PaginatedResponse(
|
||||
200,
|
||||
$select,
|
||||
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
|
||||
isset( Request::i()->page ) ? Request::i()->page : 1,
|
||||
$class,
|
||||
NULL,
|
||||
$this->member,
|
||||
isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : NULL
|
||||
isset( Request::i()->perPage ) ? Request::i()->perPage : NULL
|
||||
);
|
||||
}
|
||||
|
||||
@@ -71,19 +87,19 @@ class _NodeController extends \IPS\Api\Controller
|
||||
* View
|
||||
*
|
||||
* @param int $id ID Number
|
||||
* @return \IPS\Api\Response
|
||||
* @return Response
|
||||
*/
|
||||
protected function _view( $id )
|
||||
protected function _view( int $id ) : Response
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
$node = $class::load( $id );
|
||||
if ( $this->member and !$node->can( 'view', $this->member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return new \IPS\Api\Response( 200, $node->apiOutput( $this->member ) );
|
||||
return new Response( 200, $node->apiOutput( $this->member ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,9 +110,9 @@ class _NodeController extends \IPS\Api\Controller
|
||||
* @throws 1S359/1 INVALID_ID The node ID does not exist
|
||||
* @throws 1S359/2 INVALID_TARGET The target node cannot be deleted because the new parent node does not exist
|
||||
* @throws 1S359/3 HAS_CHILDREN The target node cannot be deleted because it has children (pass deleteChildrenOrMove in the request to specify how to handle the children)
|
||||
* @return \IPS\Api\Response
|
||||
* @return Response
|
||||
*/
|
||||
protected function _delete( $id, $deleteChildrenOrMove = NULL )
|
||||
protected function _delete( int $id, ?int $deleteChildrenOrMove = NULL ) : Response
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
@@ -118,15 +134,15 @@ class _NodeController extends \IPS\Api\Controller
|
||||
$target = $class::load( $deleteChildrenOrMove );
|
||||
$node->deleteOrMoveFormSubmit( array( 'node_move_children' => TRUE, 'node_destination' => $target->_id, 'node_move_content' => $target ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_TARGET', '1S359/2', 404 );
|
||||
throw new Exception( 'INVALID_TARGET', '1S359/2', 404 );
|
||||
}
|
||||
}
|
||||
/* Or return an exception if no action was set */
|
||||
if ( !$deleteChildrenOrMove )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'HAS_CHILDREN', '1S359/3', 404 );
|
||||
throw new Exception( 'HAS_CHILDREN', '1S359/3', 404 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -134,25 +150,25 @@ class _NodeController extends \IPS\Api\Controller
|
||||
$node->delete();
|
||||
}
|
||||
|
||||
return new \IPS\Api\Response( 200, NULL );
|
||||
return new Response( 200, NULL );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_ID', '1S359/1', 404 );
|
||||
throw new Exception( 'INVALID_ID', '1S359/1', 404 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or update node
|
||||
*
|
||||
* @param \IPS\node\Model $node The node
|
||||
* @return \IPS\node\Model
|
||||
* @param Model $node The node
|
||||
* @return Model
|
||||
*/
|
||||
protected function _createOrUpdate( \IPS\Node\Model $node )
|
||||
protected function _createOrUpdate( Model $node ): Model
|
||||
{
|
||||
$node->save();
|
||||
|
||||
if( $node instanceof \IPS\Node\Permissions AND isset( \IPS\Request::i()->permissions ) AND \IPS\Request::i()->permissions )
|
||||
if( $node instanceof Permissions AND isset( Request::i()->permissions ) AND Request::i()->permissions )
|
||||
{
|
||||
$insert = array(
|
||||
'app' => $node::$permApp,
|
||||
@@ -162,9 +178,9 @@ class _NodeController extends \IPS\Api\Controller
|
||||
|
||||
foreach( $node::$permissionMap as $key => $field )
|
||||
{
|
||||
if( isset( \IPS\Request::i()->permissions[ $key ] ) )
|
||||
if( isset( Request::i()->permissions[ $key ] ) )
|
||||
{
|
||||
$insert[ 'perm_' . $field ] = \is_array( \IPS\Request::i()->permissions[ $key ] ) ? implode( ',', \IPS\Request::i()->permissions[ $key ] ) : \IPS\Request::i()->permissions[ $key ];
|
||||
$insert[ 'perm_' . $field ] = is_array( Request::i()->permissions[ $key ] ) ? implode( ',', Request::i()->permissions[ $key ] ) : Request::i()->permissions[ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,9 +194,9 @@ class _NodeController extends \IPS\Api\Controller
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
* @return \IPS\Content\Node
|
||||
* @return Model
|
||||
*/
|
||||
protected function _create()
|
||||
protected function _create() : Model
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
@@ -190,14 +206,13 @@ class _NodeController extends \IPS\Api\Controller
|
||||
if( isset( $node::$databaseColumnOrder ) AND $node::$automaticPositionDetermination === TRUE )
|
||||
{
|
||||
$orderColumn = $node::$databaseColumnOrder;
|
||||
$node->$orderColumn = \IPS\Db::i()->select( 'MAX(' . $node::$databasePrefix . $orderColumn . ')', $node::$databaseTable )->first() + 1;
|
||||
$node->$orderColumn = Db::i()->select( 'MAX(' . $node::$databasePrefix . $orderColumn . ')', $node::$databaseTable )->first() + 1;
|
||||
}
|
||||
|
||||
$node->save();
|
||||
$node = $this->_createOrUpdate( $node );
|
||||
|
||||
/* Output */
|
||||
return $node;
|
||||
return $this->_createOrUpdate( $node );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,9 +228,9 @@ class _NodeController extends \IPS\Api\Controller
|
||||
$where = $where ?: [];
|
||||
$idField = $class::$databaseTable . '.' . $class::$databasePrefix . '.' . $class::$databaseColumnId;
|
||||
|
||||
if ( isset( \IPS\Request::i()->ids ) )
|
||||
if ( isset( Request::i()->ids ) )
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( $idField, array_map( 'intval', explode(',', \IPS\Request::i()->ids ) ) ) );
|
||||
$where[] = array( Db::i()->in( $idField, array_map( 'intval', explode(',', Request::i()->ids ) ) ) );
|
||||
}
|
||||
|
||||
return $where;
|
||||
|
||||
Reference in new issue
Block a user