Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\forums\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;
|
||||
@@ -42,7 +42,7 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
* @apiparam int pinned If 1, only topics which are pinned are returned, if 0 only not pinned
|
||||
* @apiparam int featured If 1, only topics which are featured are returned, if 0 only not featured
|
||||
* @apiparam int archived If 1, only topics which are archived are returned, if 0 only not archived
|
||||
* @apiparam string sortBy What to sort by. Can be 'date', 'title' or leave unspecified for ID
|
||||
* @apiparam string sortBy What to sort by. Can be 'date', 'title', 'updated' or leave unspecified for ID
|
||||
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
|
||||
* @apiparam int page Page number
|
||||
* @apiparam int perPage Number of results per page - defaults to 25
|
||||
@@ -145,6 +145,9 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
{
|
||||
$item->topic_close_time = ( new \DateTime( \IPS\Request::i()->close_time ) )->getTimestamp();
|
||||
}
|
||||
|
||||
/* Do we have a poll to attach? */
|
||||
$this->_createOrUpdatePoll( $item, $type );
|
||||
|
||||
/* Pass up */
|
||||
return parent::_createOrUpdate( $item, $type );
|
||||
@@ -154,7 +157,7 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
* POST /forums/topics
|
||||
* Create a topic
|
||||
*
|
||||
* @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, locked will only be honoured if the authentictaed user has permission to lock topics).
|
||||
* @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, locked will only be honoured if the authenticated user has permission to lock topics).
|
||||
* @reqapiparam int forum The ID number of the forum the topic should be created in
|
||||
* @apiparam int author The ID number of the member creating the topic (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
|
||||
* @apiparam string author_name If author is 0, the guest name that should be used
|
||||
@@ -170,11 +173,15 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
* @apiparam int hidden 0 = unhidden; 1 = hidden, pending moderator approval; -1 = hidden (as if hidden by a moderator)
|
||||
* @apiparam int pinned 1/0 indicating if the topic should be pinned
|
||||
* @apiparam int featured 1/0 indicating if the topic should be featured
|
||||
* @apiparam string poll_title Poll title (to create a poll)
|
||||
* @apiparam bool poll_public Make the poll public
|
||||
* @apiparam bool poll_only Make this a poll-only topic
|
||||
* @apiparam array poll_options Array of objects with keys 'title' (string), 'answers' (array of objects with key 'value' set to the choice) and 'multichoice' (bool)
|
||||
* @throws 1F294/2 NO_FORUM The forum ID does not exist
|
||||
* @throws 1F294/3 NO_AUTHOR The author ID does not exist
|
||||
* @throws 1F294/5 NO_TITLE No title was supplied
|
||||
* @throws 1F294/4 NO_POST No post was supplied
|
||||
* @throws 2F294/9 NO_PERMISSION The authorized user does not have permission to create a topic in that forum
|
||||
* @throws 2F294/C NO_PERMISSION The authorized user does not have permission to create a topic in that forum
|
||||
* @return \IPS\forums\Topic
|
||||
*/
|
||||
public function POSTindex()
|
||||
@@ -194,7 +201,7 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
{
|
||||
if ( !$forum->can( 'add', $this->member ) )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2F294/9', 403 );
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2F294/C', 403 );
|
||||
}
|
||||
$author = $this->member;
|
||||
}
|
||||
@@ -233,7 +240,7 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
* POST /forums/topics/{id}
|
||||
* Edit a topic
|
||||
*
|
||||
* @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, locked will only be honoured if the authentictaed user has permission to lock topics).
|
||||
* @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, locked will only be honoured if the authenticated user has permission to lock topics).
|
||||
* @apiparam int forum The ID number of the forum the topic should be created in
|
||||
* @apiparam int author The ID number of the member creating the topic (0 for guest). Ignored for requests using an OAuth Access Token for a particular member.
|
||||
* @apiparam string author_name If author is 0, the guest name that should be used
|
||||
@@ -249,6 +256,11 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
* @apiparam int hidden 1/0 indicating if the topic should be hidden
|
||||
* @apiparam int pinned 1/0 indicating if the topic should be pinned
|
||||
* @apiparam int featured 1/0 indicating if the topic should be featured
|
||||
* @apiparam string poll_title Poll title (to create a poll)
|
||||
* @apiparam bool poll_public Make the poll public
|
||||
* @apiparam bool poll_only Make this a poll-only topic
|
||||
* @apiparam array poll_options Array of objects with keys 'title' (string), 'answers' (array of objects with key 'value' set to the choice) and 'multichoice' (bool)
|
||||
* @param int $id ID Number
|
||||
* @throws 2F294/6 INVALID_ID The topic ID does not exist or the authorized user does not have permission to view it
|
||||
* @throws 1F294/7 NO_FORUM The forum ID does not exist or the authorized user does not have permission to post in it
|
||||
* @throws 1F294/8 NO_AUTHOR The author ID does not exist
|
||||
|
||||
Reference in new issue
Block a user