2016-12-15 10:13:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Shaarli\Api\Controllers;
|
|
|
|
|
2023-05-24 11:35:15 +02:00
|
|
|
use Shaarli\Bookmark\BookmarkFilter;
|
2016-12-15 10:13:00 +01:00
|
|
|
use Slim\Http\Request;
|
|
|
|
use Slim\Http\Response;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Info
|
2018-10-13 00:19:03 +02:00
|
|
|
*
|
2016-12-15 10:13:00 +01:00
|
|
|
* REST API Controller: /info
|
|
|
|
*
|
|
|
|
* @package Api\Controllers
|
|
|
|
* @see http://shaarli.github.io/api-documentation/#links-instance-information-get
|
|
|
|
*/
|
|
|
|
class Info extends ApiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Service providing various information about Shaarli instance.
|
2018-10-13 00:19:03 +02:00
|
|
|
*
|
2016-12-15 10:13:00 +01:00
|
|
|
* @param Request $request Slim request.
|
|
|
|
* @param Response $response Slim response.
|
|
|
|
*
|
|
|
|
* @return Response response.
|
|
|
|
*/
|
|
|
|
public function getInfo($request, $response)
|
|
|
|
{
|
|
|
|
$info = [
|
2023-05-24 11:35:15 +02:00
|
|
|
'global_counter' => $this->bookmarkService->count(),
|
|
|
|
'private_counter' => $this->bookmarkService->count(BookmarkFilter::$PRIVATE),
|
|
|
|
'settings' => [
|
2016-12-15 10:13:00 +01:00
|
|
|
'title' => $this->conf->get('general.title', 'Shaarli'),
|
|
|
|
'header_link' => $this->conf->get('general.header_link', '?'),
|
|
|
|
'timezone' => $this->conf->get('general.timezone', 'UTC'),
|
|
|
|
'enabled_plugins' => $this->conf->get('general.enabled_plugins', []),
|
|
|
|
'default_private_links' => $this->conf->get('privacy.default_private_links', false),
|
2023-05-24 11:35:15 +02:00
|
|
|
],
|
2016-12-15 10:13:00 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
return $response->withJson($info, 200, $this->jsonStyle);
|
|
|
|
}
|
|
|
|
}
|