Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+12 -10
View File
@@ -6,13 +6,13 @@
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Content
* @since 10 Dec 2015
* @since 21 Feb 2020
*/
namespace IPS\cms\api;
/* 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' );
exit;
@@ -32,26 +32,27 @@ class _comments extends \IPS\Content\Api\CommentController
* Get endpoint data
*
* @param array $pathBits The parts to the path called
* @param string $method HTTP method verb
* @return array
* @throws \RuntimeException
*/
protected function _getEndpoint( $pathBits )
protected function _getEndpoint( $pathBits, $method = 'GET' )
{
if ( !count( $pathBits ) )
if ( !\count( $pathBits ) )
{
throw new \RuntimeException;
}
$database = array_shift( $pathBits );
if ( !count( $pathBits ) )
if ( !\count( $pathBits ) )
{
return array( 'endpoint' => 'index', 'params' => array( $database ) );
}
$nextBit = array_shift( $pathBits );
if ( intval( $nextBit ) != 0 )
if ( \intval( $nextBit ) != 0 )
{
if ( count( $pathBits ) )
if ( \count( $pathBits ) )
{
return array( 'endpoint' => 'item_' . array_shift( $pathBits ), 'params' => array( $database, $nextBit ) );
}
@@ -154,7 +155,7 @@ class _comments extends \IPS\Content\Api\CommentController
* POST /cms/comments/{database_id}
* Create a comment
*
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authentictaed user has permission to hide content).
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authenticated user has permission to hide content).
* @param int $database Database ID
* @reqapiparam int record The ID number of the record the comment is for
* @reqapiparam int author The ID number of the member making the comment (0 for guest). Required for requests made using an API Key or the Client Credentials Grant Type. For requests using an OAuth Access Token for a particular member, that member will always be the author
@@ -238,7 +239,7 @@ class _comments extends \IPS\Content\Api\CommentController
* POST /cms/comments/{database_id}/{comment_id}
* Edit a comment
*
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authentictaed user has permission to hide content).
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authenticated user has permission to hide content).
* @param int $database Database ID
* @param int $comment Comment ID
* @apiparam int author The ID number of the member making the comment (0 for guest). Ignored for requests using an OAuth Access Token for a particular member.
@@ -272,7 +273,8 @@ class _comments extends \IPS\Content\Api\CommentController
try
{
/* Load */
$comment = call_user_func( array( $this->class, 'load' ), $comment );
$className = $this->class;
$comment = $className::load( $comment );
if ( $this->member and !$comment->canView( $this->member ) )
{
throw new \OutOfRangeException;