aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-02-19 16:48:59 +0100
committerGitHub <noreply@github.com>2017-02-19 16:48:59 +0100
commitb9eb50c09947ec35838051e1bcfe5bc09a839f8e (patch)
tree514ddc5f97d12d5d0582f081cbdfc8a318aa9d17 /index.php
parent65e56cbe49a7eb2a0cb09dda85daab3b921472ee (diff)
parent16e3d006e9e9386001881053f610657525feb188 (diff)
downloadShaarli-b9eb50c09947ec35838051e1bcfe5bc09a839f8e.tar.gz
Shaarli-b9eb50c09947ec35838051e1bcfe5bc09a839f8e.tar.zst
Shaarli-b9eb50c09947ec35838051e1bcfe5bc09a839f8e.zip
Merge pull request #728 from ArthurHoaro/api/getLink
REST API: implements getLink by ID service
Diffstat (limited to 'index.php')
-rw-r--r--index.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/index.php b/index.php
index d1eee098..8eb36d81 100644
--- a/index.php
+++ b/index.php
@@ -2232,12 +2232,13 @@ $app = new \Slim\App($container);
2232$app->group('/api/v1', function() { 2232$app->group('/api/v1', function() {
2233 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo'); 2233 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo');
2234 $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks'); 2234 $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks');
2235 $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink');
2235})->add('\Shaarli\Api\ApiMiddleware'); 2236})->add('\Shaarli\Api\ApiMiddleware');
2236 2237
2237$response = $app->run(true); 2238$response = $app->run(true);
2238// Hack to make Slim and Shaarli router work together: 2239// Hack to make Slim and Shaarli router work together:
2239// If a Slim route isn't found, we call renderPage(). 2240// If a Slim route isn't found and NOT API call, we call renderPage().
2240if ($response->getStatusCode() == 404) { 2241if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) {
2241 // We use UTF-8 for proper international characters handling. 2242 // We use UTF-8 for proper international characters handling.
2242 header('Content-Type: text/html; charset=utf-8'); 2243 header('Content-Type: text/html; charset=utf-8');
2243 renderPage($conf, $pluginManager, $linkDb); 2244 renderPage($conf, $pluginManager, $linkDb);