Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -306,7 +306,8 @@ class _members extends \IPS\Api\Controller
|
||||
|
||||
$member = new \IPS\Member;
|
||||
$member->member_group_id = \IPS\Settings::i()->member_group;
|
||||
|
||||
$member->members_bitoptions['created_externally'] = TRUE;
|
||||
|
||||
$member = $this->_createOrUpdate( $member );
|
||||
|
||||
return new \IPS\Api\Response( 201, $member->apiOutput( $this->member ) );
|
||||
|
||||
@@ -47,20 +47,34 @@ class _search extends \IPS\Api\Controller
|
||||
* @apiparam string eitherTermsOrTags Whether to search both tags and search term ("and") or either ("or")
|
||||
* @apiparam string search_and_or Whether to perform an "and" search or an "or" search for all search terms
|
||||
* @apiparam string search_in Specify "titles" to search in titles only, otherwise titles and content are both searched
|
||||
* @apiparam int search_as Member ID to perform the search as (guest permissions will be used when this parameter is omitted)
|
||||
* @return array
|
||||
* @apiresponse int page api_int_page
|
||||
* @apiresponse int perPage api_int_perpage
|
||||
* @apiresponse int totalResults api_int_totalresults
|
||||
* @apiresponse int totalPages api_int_totalpages
|
||||
* @apiresponse [\IPS\Content\Search\Result] results api_results_thispage
|
||||
* @note For requests using an OAuth Access Token for a particular member, only content the authorized user can view will be included and the "search_as" parameter will be ignored.
|
||||
*/
|
||||
public function GETindex()
|
||||
{
|
||||
$memberPermissions = $this->member;
|
||||
|
||||
if( !$this->member AND isset( \IPS\Request::i()->search_as ) )
|
||||
{
|
||||
$memberPermissions = \IPS\Member::load( \IPS\Request::i()->search_as );
|
||||
|
||||
if( !$memberPermissions->member_id )
|
||||
{
|
||||
$memberPermissions = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get valid content types */
|
||||
$contentTypes = \IPS\core\modules\front\search\search::contentTypes();
|
||||
$contentTypes = \IPS\core\modules\front\search\search::contentTypes( $memberPermissions ?: TRUE );
|
||||
|
||||
/* Initialize search */
|
||||
$query = \IPS\Content\Search\Query::init();
|
||||
$query = \IPS\Content\Search\Query::init( $memberPermissions ?: NULL );
|
||||
|
||||
/* Set content type */
|
||||
if ( isset( \IPS\Request::i()->type ) and array_key_exists( \IPS\Request::i()->type, $contentTypes ) )
|
||||
@@ -209,4 +223,28 @@ class _search extends \IPS\Api\Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /core/search/contenttypes
|
||||
* Get list of content types that can be searched
|
||||
*
|
||||
* @clientapiparam int search_as Member ID to perform the search as (by default, search results are based on guest permissions)
|
||||
* @return array
|
||||
* @apiresponse array contenttypes Content types that can be used in /search requests in the 'type' parameter
|
||||
*/
|
||||
public function GETitem()
|
||||
{
|
||||
$memberPermissions = $this->member;
|
||||
|
||||
if( !$this->member AND isset( \IPS\Request::i()->search_as ) )
|
||||
{
|
||||
$memberPermissions = \IPS\Member::load( \IPS\Request::i()->search_as );
|
||||
|
||||
if( !$memberPermissions->member_id )
|
||||
{
|
||||
$memberPermissions = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return new \IPS\Api\Response( 200, array( 'contenttypes' => array_keys( \IPS\core\modules\front\search\search::contentTypes( $memberPermissions ?: TRUE ) ) ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user