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\blog\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;
|
||||
@@ -40,7 +40,7 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
* @apiparam int pinned If 1, only entries which are pinned are returned, if 0 only not pinned
|
||||
* @apiparam int featured If 1, only entries which are featured are returned, if 0 only not featured
|
||||
* @apiparam int draft If 1, only draft entries are returned, if 0 only published
|
||||
* @apiparam string sortBy What to sort by. Can be 'date' for creation date, 'title' or leave unspecified for ID
|
||||
* @apiparam string sortBy What to sort by. Can be 'date' for creation 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
|
||||
@@ -111,7 +111,7 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
* POST /blog/entries
|
||||
* Create an entry
|
||||
*
|
||||
* @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 blog The ID number of the blog the entry should be created in
|
||||
* @reqapiparam int author The ID number of the member creating the entry (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
|
||||
* @reqapiparam string title The entry title
|
||||
@@ -125,6 +125,11 @@ class _entries 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 entry should be pinned
|
||||
* @apiparam int featured 1/0 indicating if the entry should be featured
|
||||
* @apiparam int category The blog entry category
|
||||
* @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 1B300/2 NO_BLOG The blog ID does not exist
|
||||
* @throws 1B300/3 NO_AUTHOR The author ID does not exist
|
||||
* @throws 1B300/4 NO_TITLE No title was supplied
|
||||
@@ -133,7 +138,7 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
* @return \IPS\blog\Entry
|
||||
*/
|
||||
public function POSTindex()
|
||||
{
|
||||
{
|
||||
/* Get blog */
|
||||
try
|
||||
{
|
||||
@@ -187,7 +192,7 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
* POST /blog/entries/{id}
|
||||
* Edit a blog entry
|
||||
*
|
||||
* @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 blog The ID number of the blog the entry should be created in
|
||||
* @reqapiparam int author The ID number of the member creating the entry (0 for guest). Ignored for requests using an OAuth Access Token for a particular member.
|
||||
* @reqapiparam string title The entry title
|
||||
@@ -195,12 +200,17 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
* @apiparam bool draft If this is a draft
|
||||
* @apiparam string prefix Prefix tag
|
||||
* @apiparam string tags Comma-separated list of tags (do not include prefix)
|
||||
* @apiparam datetime date The date/time that should be used for the entry date. If not provided, will use the current date/time. Ignored for requests using an OAuth Access Token for a particular member.
|
||||
* @apiparam string ip_address The IP address that should be stored for the entry/post. If not provided, will use the IP address from the API request. Ignored for requests using an OAuth Access Token for a particular member.
|
||||
* @apiparam int locked 1/0 indicating if the entry should be locked
|
||||
* @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 entry should be pinned
|
||||
* @apiparam int featured 1/0 indicating if the entry should be featured
|
||||
* @apiparam int category The blog entry category
|
||||
* @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 2B300/6 INVALID_ID The entry ID is invalid or the authorized user does not have permission to view it
|
||||
* @throws 1B300/7 NO_BLOG The blog ID does not exist or the authorized user does not have permission to post in it
|
||||
* @throws 1B300/8 NO_AUTHOR The author ID does not exist
|
||||
@@ -297,6 +307,15 @@ class _entries extends \IPS\Content\Api\ItemController
|
||||
}
|
||||
$item->content = $entryContents;
|
||||
}
|
||||
|
||||
/* Do we have a poll to attach? */
|
||||
$this->_createOrUpdatePoll( $item, $type );
|
||||
|
||||
/* Category */
|
||||
if ( isset( \IPS\Request::i()->category ) )
|
||||
{
|
||||
$item->category_id = \IPS\Request::i()->category;
|
||||
}
|
||||
|
||||
/* Pass up */
|
||||
return parent::_createOrUpdate( $item, $type );
|
||||
|
||||
Reference in new issue
Block a user