diff options
Diffstat (limited to 'application/api/ApiMiddleware.php')
-rw-r--r-- | application/api/ApiMiddleware.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index ff209393..5ffb8c6d 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php | |||
@@ -1,9 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
3 | 3 | ||
4 | use Shaarli\Api\Exceptions\ApiException; | ||
5 | use Shaarli\Api\Exceptions\ApiAuthorizationException; | 4 | use Shaarli\Api\Exceptions\ApiAuthorizationException; |
6 | 5 | use Shaarli\Api\Exceptions\ApiException; | |
7 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
8 | use Slim\Container; | 7 | use Slim\Container; |
9 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -65,7 +64,7 @@ class ApiMiddleware | |||
65 | try { | 64 | try { |
66 | $this->checkRequest($request); | 65 | $this->checkRequest($request); |
67 | $response = $next($request, $response); | 66 | $response = $next($request, $response); |
68 | } catch(ApiException $e) { | 67 | } catch (ApiException $e) { |
69 | $e->setResponse($response); | 68 | $e->setResponse($response); |
70 | $e->setDebug($this->conf->get('dev.debug', false)); | 69 | $e->setDebug($this->conf->get('dev.debug', false)); |
71 | $response = $e->getApiResponse(); | 70 | $response = $e->getApiResponse(); |
@@ -98,7 +97,8 @@ class ApiMiddleware | |||
98 | * | 97 | * |
99 | * @throws ApiAuthorizationException The token couldn't be validated. | 98 | * @throws ApiAuthorizationException The token couldn't be validated. |
100 | */ | 99 | */ |
101 | protected function checkToken($request) { | 100 | protected function checkToken($request) |
101 | { | ||
102 | if (! $request->hasHeader('Authorization')) { | 102 | if (! $request->hasHeader('Authorization')) { |
103 | throw new ApiAuthorizationException('JWT token not provided'); | 103 | throw new ApiAuthorizationException('JWT token not provided'); |
104 | } | 104 | } |
@@ -126,7 +126,7 @@ class ApiMiddleware | |||
126 | */ | 126 | */ |
127 | protected function setLinkDb($conf) | 127 | protected function setLinkDb($conf) |
128 | { | 128 | { |
129 | $linkDb = new \LinkDB( | 129 | $linkDb = new \Shaarli\Bookmark\LinkDB( |
130 | $conf->get('resource.datastore'), | 130 | $conf->get('resource.datastore'), |
131 | true, | 131 | true, |
132 | $conf->get('privacy.hide_public_links'), | 132 | $conf->get('privacy.hide_public_links'), |