Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,25 +12,32 @@
|
||||
namespace IPS\core\api;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Api\Controller;
|
||||
use IPS\Api\Response;
|
||||
use IPS\DateTime;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Me API
|
||||
*/
|
||||
class _me extends \IPS\Api\Controller
|
||||
class me extends Controller
|
||||
{
|
||||
/**
|
||||
* GET /core/me
|
||||
* Get basic information about the authorized user
|
||||
*
|
||||
* @apimemberonly
|
||||
* @return \IPS\Member
|
||||
* @apireturn \IPS\Member
|
||||
* @return Response
|
||||
*/
|
||||
public function GETindex()
|
||||
public function GETindex(): Response
|
||||
{
|
||||
$output = $this->member->apiOutput( $this->member );
|
||||
|
||||
@@ -39,10 +46,10 @@ class _me extends \IPS\Api\Controller
|
||||
$output['email'] = $this->member->email;
|
||||
}
|
||||
|
||||
$output['lastVisit'] = $this->member->last_visit ? \IPS\DateTime::ts( $this->member->last_visit )->rfc3339() : NULL;
|
||||
$output['lastPost'] = $this->member->member_last_post ? \IPS\DateTime::ts( $this->member->member_last_post )->rfc3339() : NULL;
|
||||
$output['lastVisit'] = $this->member->last_visit ? DateTime::ts( $this->member->last_visit )->rfc3339() : NULL;
|
||||
$output['lastPost'] = $this->member->member_last_post ? DateTime::ts( $this->member->member_last_post )->rfc3339() : NULL;
|
||||
|
||||
return new \IPS\Api\Response( 200, $output );
|
||||
return new Response( 200, $output );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,11 +58,12 @@ class _me extends \IPS\Api\Controller
|
||||
*
|
||||
* @apimemberonly
|
||||
* @param string $path Requested path
|
||||
* @return array
|
||||
* @apireturn array
|
||||
* @apiresponse string email Email address
|
||||
* @return Response
|
||||
*/
|
||||
public function GETitem( $path )
|
||||
public function GETitem( string $path = '' ): Response
|
||||
{
|
||||
return new \IPS\Api\Response( 200, array( 'email' => $this->member->email ) );
|
||||
return new Response( 200, array( 'email' => $this->member->email ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user