Version 4.7.6

This commit is contained in:
Neo committed 2025-12-19 16:05:19 -08:00
1 parent 8ba7d43898
commit 7b7404e741
1085 files changed
+30590 -7837

No files matched your search

+77 -1
View File
@@ -782,7 +782,7 @@ class _members extends \IPS\Api\Controller
200,
\IPS\Db::i()->select( '*', 'core_notifications', array( "`member`=? AND notification_app IN('" . implode( "','", array_keys( \IPS\Application::enabledApplications() ) ) . "')", $member->member_id ), "updated_time DESC" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\Notification\Inline',
'IPS\Notification\RestApi',
\IPS\Db::i()->select( 'COUNT(*)', 'core_notifications', array( "`member`=? AND notification_app IN('" . implode( "','", array_keys( \IPS\Application::enabledApplications() ) ) . "')", $member->member_id ) )->first(),
$this->member,
isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : NULL
@@ -1230,4 +1230,80 @@ class _members extends \IPS\Api\Controller
throw new \IPS\Api\Exception( 'INVALID_ID', '2C292/14', 404 );
}
}
/**
* POST /core/members/{id}/secgroup/{groupId}
* Adds a secondary group to the member
*
* @param int $id ID Number
* @reqapiparam int $groupId Group To Add
* @return \IPS\Member
* @throws 2C292/15 INVALID_GROUP The group could not be found
* @throws 2C292/16 INVALID_MEMBER The member could not be found
*/
public function POSTitem_secgroup( int $id, int $groupId ): \IPS\Api\Response
{
/* Load member */
$member = \IPS\Member::load( $id );
if( !$member->member_id )
{
throw new \IPS\Api\Exception( 'INVALID_MEMBER', '2C292/16', 404 );
}
try
{
$group = \IPS\Member\Group::load( $groupId );
}
catch( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_GROUP', '2C292/15', 404 );
}
$mgroup_others = array_filter( explode( ',', $member->mgroup_others ) );
$newSecondaryGroups = array_unique( array_merge( [$group->g_id], $mgroup_others ) );
$member->mgroup_others = implode( ',', $newSecondaryGroups );
$member->save();
return new \IPS\Api\Response( 201, $member->apiOutput( $this->member ) );
}
/**
* DELETE /core/members/{id}/secgroup/{groupId}
* Removes a secondary group
*
* @param int $id ID Number
* @reqapiparam int $groupId Group To Add
* @return \IPS\Member
* @throws 2C292/17 INVALID_GROUP The group could not be found
* @throws 2C292/18 INVALID_MEMBER The member could not be found
*/
public function DELETEitem_secgroup( int $id, int $groupId ): \IPS\Api\Response
{
/* Load member */
$member = \IPS\Member::load( $id );
if( !$member->member_id )
{
throw new \IPS\Api\Exception( 'INVALID_MEMBER', '2C292/18', 404 );
}
try
{
$group = \IPS\Member\Group::load( $groupId );
}
catch( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_GROUP', '2C292/17', 404 );
}
$secondaryGroups = array_filter( explode( ',', $member->mgroup_others ) );
$key = array_search( $group->g_id, $secondaryGroups );
unset( $secondaryGroups[ $key ] );
$member->mgroup_others = implode( ',', array_unique( $secondaryGroups ) );
$member->save();
return new \IPS\Api\Response( 201, $member->apiOutput( $this->member ) );
}
}
+83
View File
@@ -0,0 +1,83 @@
<?php
/**
* @brief Promotions API
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 21 June 2022
*/
namespace IPS\core\api;
/* 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;
}
/**
* @brief Promotions API
*/
class _promotions extends \IPS\Node\Api\NodeController
{
/**
* GET /core/promotions
* Get list of promoted items
*
* @apiparam int page Page number
* @apiparam int perPage Number of results per page - defaults to 25
* @return \IPS\Api\PaginatedResponse<IPS\core\Promote>
* @throws 2C429/1 NO_PERMISSION The current authorized user does not have permission to issue warnings and as such cannot view the list of warn reasons
*/
public function GETindex()
{
$page = isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1;
$perPage = isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : 25;
$sortDir = ( isset( \IPS\Request::i()->sortDir ) and \in_array( mb_strtolower( \IPS\Request::i()->sortDir ), array( 'asc', 'desc' ) ) ) ? \IPS\Request::i()->sortDir : 'asc';
$sortBy = ( isset( \IPS\Request::i()->sortBy ) and \in_array( mb_strtolower( \IPS\Request::i()->sortBy ), array( 'promote_id', 'promote_scheduled' ) ) ) ? \IPS\Request::i()->sortBy :'promote_id';
/* Check permissions */
if( $this->member AND !$this->member->modPermission('mod_see_warn') )
{
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2C429/1', 403 );
}
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'core_social_promote', array(), "{$sortBy} {$sortDir}" ),
$page,
'IPS\core\Promote',
\IPS\Db::i()->select( 'COUNT(*)', 'core_social_promote', array() )->first(),
$this->member,
$perPage
);
}
/**
* GET /core/promotions/{id}
* Get specific promotion object
*
* @param int $id ID Number
* @throws 12C429/2 INVALID_ID The promotion does not exist
* @return \IPS\core\Promote
*/
public function GETitem( $id )
{
try
{
$promotion = \IPS\core\Promote::load( $id );
/* Return */
return new \IPS\Api\Response( 200, $promotion->apiOutput( $this->member ) );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2C429/2', 404 );
}
}
}
+1 -1
View File
@@ -148,7 +148,7 @@ class _warnreasons extends \IPS\Node\Api\NodeController
* @param \IPS\node\Model $reason The node
* @return \IPS\node\Model
*/
protected function _createOrUpdate( \IPS\node\Model $reason )
protected function _createOrUpdate( \IPS\Node\Model $reason )
{
if( \IPS\Request::i()->name )
{
+5
View File
@@ -29,6 +29,7 @@ class _webhooks extends \IPS\Api\Controller
* @apiclientonly
* @reqapiparam array events List of events to subscribe to
* @reqapiparam string url URL to send webhook to
* @apiparam string content_header The content type for the request.
* @return \IPS\Api\Webhook
* @throws 1C293/1 NO_EVENTS No events were specified
* @throws 1C293/2 INVALID_URL The URL specified was not valid
@@ -55,6 +56,10 @@ class _webhooks extends \IPS\Api\Controller
$webhook->events = $events;
$webhook->filters = ( \IPS\Request::i()->filters ?: array() );
$webhook->url = $url;
if( \IPS\Request::i()->content_header )
{
$webhook->content_type = \IPS\Request::i()->content_header;
}
$webhook->save();
return new \IPS\Api\Response( 201, $webhook->apiOutput() );