X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=3c2bb1d2829dee3a6a9d4e4b9edea6bacc5bd1ae;hb=792b26789fe9f6245a155e47aea0273917ac33d7;hp=d1eee09850e1dac86531be917c7c5c3a3d3e12ec;hpb=6f566b69ba141c29fb3fa1e32a1760a1e8b09840;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index d1eee098..3c2bb1d2 100644 --- a/index.php +++ b/index.php @@ -62,7 +62,6 @@ require_once __DIR__ . '/vendor/autoload.php'; require_once 'application/ApplicationUtils.php'; require_once 'application/Cache.php'; require_once 'application/CachedPage.php'; -require_once 'application/config/ConfigManager.php'; require_once 'application/config/ConfigPlugin.php'; require_once 'application/FeedBuilder.php'; require_once 'application/FileUtils.php'; @@ -80,6 +79,7 @@ require_once 'application/PluginManager.php'; require_once 'application/Router.php'; require_once 'application/Updater.php'; use \Shaarli\ThemeUtils; +use \Shaarli\Config\ConfigManager; // Ensure the PHP version is supported try { @@ -1682,6 +1682,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) 'result_count' => count($linksToDisplay), 'search_term' => $searchterm, 'search_tags' => $searchtags, + 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '', 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. 'links' => $linkDisp, 'tags' => $LINKSDB->allTags(), @@ -2232,12 +2233,13 @@ $app = new \Slim\App($container); $app->group('/api/v1', function() { $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo'); $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks'); + $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink'); })->add('\Shaarli\Api\ApiMiddleware'); $response = $app->run(true); // Hack to make Slim and Shaarli router work together: -// If a Slim route isn't found, we call renderPage(). -if ($response->getStatusCode() == 404) { +// If a Slim route isn't found and NOT API call, we call renderPage(). +if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) { // We use UTF-8 for proper international characters handling. header('Content-Type: text/html; charset=utf-8'); renderPage($conf, $pluginManager, $linkDb);