]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - index.php
Process main page (linklist) through Slim controller
[github/shaarli/Shaarli.git] / index.php
CommitLineData
45034273 1<?php
49e2b35b 2/**
b786c883 3 * Shaarli - The personal, minimalist, super-fast, database free, bookmarking service.
49e2b35b
V
4 *
5 * Friendly fork by the Shaarli community:
6 * - https://github.com/shaarli/Shaarli
7 *
8 * Original project by sebsauvage.net:
9 * - http://sebsauvage.net/wiki/doku.php?id=php:shaarli
10 * - https://github.com/sebsauvage/Shaarli
11 *
12 * Licence: http://www.opensource.org/licenses/zlib-license.php
49e2b35b 13 */
afd7b77b
V
14
15// Set 'UTC' as the default timezone if it is not defined in php.ini
16// See http://php.net/manual/en/datetime.configuration.php#ini.date.timezone
17if (date_default_timezone_get() == '') {
18 date_default_timezone_set('UTC');
19}
cb49ab94 20
28bb2b74
V
21/*
22 * PHP configuration
23 */
28bb2b74 24
ae00595b 25// http://server.com/x/shaarli --> /shaarli/
684e662a 26define('WEB_PATH', substr($_SERVER['REQUEST_URI'], 0, 1+strrpos($_SERVER['REQUEST_URI'], '/', 0)));
45034273 27
28bb2b74 28// High execution time in case of problematic imports/exports.
93bf0918 29ini_set('max_input_time', '60');
28bb2b74
V
30
31// Try to set max upload file size and read
32ini_set('memory_limit', '128M');
45034273
SS
33ini_set('post_max_size', '16M');
34ini_set('upload_max_filesize', '16M');
45034273 35
28bb2b74
V
36// See all error except warnings
37error_reporting(E_ALL^E_WARNING);
50c9a12e 38
a973afea 39// 3rd-party libraries
52831753
V
40if (! file_exists(__DIR__ . '/vendor/autoload.php')) {
41 header('Content-Type: text/plain; charset=utf-8');
42 echo "Error: missing Composer configuration\n\n"
43 ."If you installed Shaarli through Git or using the development branch,\n"
44 ."please refer to the installation documentation to install PHP"
45 ." dependencies using Composer:\n"
87f14312 46 ."- https://shaarli.readthedocs.io/en/master/Server-configuration/\n"
cc8f572b 47 ."- https://shaarli.readthedocs.io/en/master/Download-and-Installation/";
52831753
V
48 exit;
49}
a973afea
V
50require_once 'inc/rain.tpl.class.php';
51require_once __DIR__ . '/vendor/autoload.php';
52
ca74886f 53// Shaarli library
fe3713d2 54require_once 'application/bookmark/LinkUtils.php';
e6cd773f 55require_once 'application/config/ConfigPlugin.php';
51753e40
V
56require_once 'application/http/HttpUtils.php';
57require_once 'application/http/UrlUtils.php';
bcf056c9 58require_once 'application/updater/UpdaterUtils.php';
2e28269b 59require_once 'application/FileUtils.php';
d1e2f8e5 60require_once 'application/TimeZone.php';
ca74886f 61require_once 'application/Utils.php';
f24896b2 62
6c50a6cc 63use Shaarli\ApplicationUtils;
cf92b4dd 64use Shaarli\Bookmark\BookmarkFileService;
6c50a6cc
A
65use Shaarli\Config\ConfigManager;
66use Shaarli\Container\ContainerBuilder;
6c50a6cc
A
67use Shaarli\History;
68use Shaarli\Languages;
6c50a6cc
A
69use Shaarli\Plugin\PluginManager;
70use Shaarli\Render\PageBuilder;
6c50a6cc
A
71use Shaarli\Security\LoginManager;
72use Shaarli\Security\SessionManager;
6c50a6cc 73use Slim\App;
ca74886f 74
d1e2f8e5
V
75// Ensure the PHP version is supported
76try {
b405a44f 77 ApplicationUtils::checkPHPVersion('7.1', PHP_VERSION);
93bf0918 78} catch (Exception $exc) {
d1e2f8e5 79 header('Content-Type: text/plain; charset=utf-8');
2e28269b 80 echo $exc->getMessage();
d1e2f8e5
V
81 exit;
82}
83
b3e1f92e 84define('SHAARLI_VERSION', ApplicationUtils::getVersion(__DIR__ .'/'. ApplicationUtils::$VERSION_FILE));
b786c883 85
06b6660a
A
86// Force cookie path (but do not change lifetime)
87$cookie = session_get_cookie_params();
88$cookiedir = '';
89if (dirname($_SERVER['SCRIPT_NAME']) != '/') {
90 $cookiedir = dirname($_SERVER["SCRIPT_NAME"]).'/';
91}
92// Set default cookie expiration and path.
93session_set_cookie_params($cookie['lifetime'], $cookiedir, $_SERVER['SERVER_NAME']);
94// Set session parameters on server side.
06b6660a
A
95// Use cookies to store session.
96ini_set('session.use_cookies', 1);
97// Force cookies for session (phpsessionID forbidden in URL).
98ini_set('session.use_only_cookies', 1);
99// Prevent PHP form using sessionID in URL if cookies are disabled.
100ini_set('session.use_trans_sid', false);
101
06b6660a
A
102session_name('shaarli');
103// Start session if needed (Some server auto-start sessions).
f6380409 104if (session_status() == PHP_SESSION_NONE) {
06b6660a
A
105 session_start();
106}
107
68bc2135 108// Regenerate session ID if invalid or not defined in cookie.
fd7d8461 109if (isset($_COOKIE['shaarli']) && !SessionManager::checkId($_COOKIE['shaarli'])) {
68bc2135
V
110 session_regenerate_id(true);
111 $_COOKIE['shaarli'] = session_id();
112}
113
278d9ee2 114$conf = new ConfigManager();
cf92b4dd
A
115
116// In dev mode, throw exception on any warning
117if ($conf->get('dev.debug', false)) {
118 // See all errors (for debugging only)
119 error_reporting(-1);
120
121 set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
122 throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
123 });
124}
125
ebd650c0 126$sessionManager = new SessionManager($_SESSION, $conf);
b49a04f7 127$loginManager = new LoginManager($conf, $sessionManager);
c689e108 128$loginManager->generateStaySignedInToken($_SERVER['REMOTE_ADDR']);
84742084 129$clientIpId = client_ip_id($_SERVER);
12266213 130
b7c412d4
A
131// LC_MESSAGES isn't defined without php-intl, in this case use LC_COLLATE locale instead.
132if (! defined('LC_MESSAGES')) {
133 define('LC_MESSAGES', LC_COLLATE);
134}
135
12266213
A
136// Sniff browser language and set date format accordingly.
137if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
138 autoLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']);
139}
140
141new Languages(setlocale(LC_MESSAGES, 0), $conf);
142
7f179985 143$conf->setEmpty('general.timezone', date_default_timezone_get());
cf92b4dd 144$conf->setEmpty('general.title', t('Shared bookmarks on '). escape(index_url($_SERVER)));
adc4aee8 145RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory
894a3c4b 146RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory
45034273 147
278d9ee2 148$pluginManager = new PluginManager($conf);
da10377b 149$pluginManager->load($conf->get('general.enabled_plugins'));
6fc14d53 150
da10377b 151date_default_timezone_set($conf->get('general.timezone', 'UTC'));
d93d51b2 152
45034273
SS
153ob_start(); // Output buffering for the page cache.
154
45034273
SS
155// Prevent caching on client side or proxy: (yes, it's ugly)
156header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
157header("Cache-Control: no-store, no-cache, must-revalidate");
158header("Cache-Control: post-check=0, pre-check=0", false);
159header("Pragma: no-cache");
160
278d9ee2 161if (! is_file($conf->getConfigFileExt())) {
2e28269b 162 // Ensure Shaarli has proper access to its resources
278d9ee2 163 $errors = ApplicationUtils::checkResourcePermissions($conf);
2e28269b
V
164
165 if ($errors != array()) {
12266213 166 $message = '<p>'. t('Insufficient permissions:') .'</p><ul>';
2e28269b
V
167
168 foreach ($errors as $error) {
169 $message .= '<li>'.$error.'</li>';
170 }
171 $message .= '</ul>';
172
173 header('Content-Type: text/html; charset=utf-8');
174 echo $message;
175 exit;
176 }
177
178 // Display the installation form if no existing config is found
cad4251a 179 install($conf, $sessionManager, $loginManager);
50c9a12e 180}
8a80e4fe 181
c689e108 182$loginManager->checkLoginState($_COOKIE, $clientIpId);
45034273 183
45034273
SS
184// ------------------------------------------------------------------------------------------
185// Process login form: Check if login/password is correct.
db45a36a 186if (isset($_POST['login'])) {
44acf706
V
187 if (! $loginManager->canLogin($_SERVER)) {
188 die(t('I said: NO. You are banned for the moment. Go away.'));
189 }
278d9ee2 190 if (isset($_POST['password'])
ebd650c0 191 && $sessionManager->checkToken($_POST['token'])
84742084 192 && $loginManager->checkCredentials($_SERVER['REMOTE_ADDR'], $clientIpId, $_POST['login'], $_POST['password'])
44acf706 193 ) {
44acf706
V
194 $loginManager->handleSuccessfulLogin($_SERVER);
195
51f0128c
V
196 $cookiedir = '';
197 if (dirname($_SERVER['SCRIPT_NAME']) != '/') {
ad6c27b7 198 // Note: Never forget the trailing slash on the cookie path!
51f0128c 199 $cookiedir = dirname($_SERVER["SCRIPT_NAME"]) . '/';
45034273 200 }
51f0128c
V
201
202 if (!empty($_POST['longlastingsession'])) {
203 // Keep the session cookie even after the browser closes
204 $sessionManager->setStaySignedIn(true);
205 $expirationTime = $sessionManager->extendSession();
206
207 setcookie(
c689e108
V
208 $loginManager::$STAY_SIGNED_IN_COOKIE,
209 $loginManager->getStaySignedInToken(),
51f0128c
V
210 $expirationTime,
211 WEB_PATH
212 );
51f0128c
V
213 } else {
214 // Standard session expiration (=when browser closes)
215 $expirationTime = 0;
45034273 216 }
f4c84ad7 217
51f0128c 218 // Send cookie with the new expiration date to the browser
09390a50 219 session_destroy();
51f0128c 220 session_set_cookie_params($expirationTime, $cookiedir, $_SERVER['SERVER_NAME']);
09390a50 221 session_start();
51f0128c
V
222 session_regenerate_id(true);
223
45034273 224 // Optional redirect after login:
5fbabbb9 225 if (isset($_GET['post'])) {
9e4cc28e 226 $uri = './?post='. urlencode($_GET['post']);
0b04f797 227 foreach (array('description', 'source', 'title', 'tags') as $param) {
5fbabbb9
A
228 if (!empty($_GET[$param])) {
229 $uri .= '&'.$param.'='.urlencode($_GET[$param]);
230 }
231 }
232 header('Location: '. $uri);
233 exit;
234 }
235
236 if (isset($_GET['edit_link'])) {
9e4cc28e 237 header('Location: ./?edit_link='. escape($_GET['edit_link']));
5fbabbb9
A
238 exit;
239 }
240
241 if (isset($_POST['returnurl'])) {
242 // Prevent loops over login screen.
9e4cc28e 243 if (strpos($_POST['returnurl'], '/login') === false) {
e15f08d7 244 header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST']));
5fbabbb9
A
245 exit;
246 }
45034273 247 }
9e4cc28e 248 header('Location: ./?');
93bf0918 249 exit;
44acf706
V
250 } else {
251 $loginManager->handleFailedLogin($_SERVER);
9e4cc28e 252 $redir = '?username='. urlencode($_POST['login']);
5fbabbb9 253 if (isset($_GET['post'])) {
85c4bdc2 254 $redir .= '&post=' . urlencode($_GET['post']);
0b04f797 255 foreach (array('description', 'source', 'title', 'tags') as $param) {
5fbabbb9
A
256 if (!empty($_GET[$param])) {
257 $redir .= '&' . $param . '=' . urlencode($_GET[$param]);
258 }
259 }
260 }
12266213 261 // Redirect to login screen.
9e4cc28e 262 echo '<script>alert("'. t("Wrong login/password.") .'");document.location=\'./login'.$redir.'\';</script>';
45034273
SS
263 exit;
264 }
265}
266
45034273
SS
267// ------------------------------------------------------------------------------------------
268// Token management for XSRF protection
269// Token should be used in any form which acts on data (create,update,delete,import...).
93bf0918
V
270if (!isset($_SESSION['tokens'])) {
271 $_SESSION['tokens']=array(); // Token are attached to the session.
272}
45034273 273
278d9ee2
A
274/**
275 * Installation
276 * This function should NEVER be called if the file data/config.php exists.
277 *
ebd650c0
V
278 * @param ConfigManager $conf Configuration Manager instance.
279 * @param SessionManager $sessionManager SessionManager instance
cad4251a 280 * @param LoginManager $loginManager LoginManager instance
278d9ee2 281 */
93bf0918
V
282function install($conf, $sessionManager, $loginManager)
283{
45034273 284 // On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
93bf0918
V
285 if (endsWith($_SERVER['HTTP_HOST'], '.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'].'/sessions')) {
286 mkdir($_SERVER['DOCUMENT_ROOT'].'/sessions', 0705);
287 }
45034273 288
f37664a2
SS
289
290 // This part makes sure sessions works correctly.
291 // (Because on some hosts, session.save_path may not be set correctly,
292 // or we may not have write access to it.)
9d9f6d75
V
293 if (isset($_GET['test_session'])
294 && ( !isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested']!='Working')) {
12266213
A
295 // Step 2: Check if data in session is correct.
296 $msg = t(
297 '<pre>Sessions do not seem to work correctly on your server.<br>'.
298 'Make sure the variable "session.save_path" is set correctly in your PHP config, '.
299 'and that you have write access to it.<br>'.
300 'It currently points to %s.<br>'.
301 'On some browsers, accessing your server via a hostname like \'localhost\' '.
302 'or any custom hostname without a dot causes cookie storage to fail. '.
303 'We recommend accessing your server via it\'s IP address or Fully Qualified Domain Name.<br>'
304 );
305 $msg = sprintf($msg, session_save_path());
306 echo $msg;
307 echo '<br><a href="?">'. t('Click to try again.') .'</a></pre>';
f37664a2
SS
308 die;
309 }
93bf0918
V
310 if (!isset($_SESSION['session_tested'])) {
311 // Step 1 : Try to store data in session and reload page.
f37664a2 312 $_SESSION['session_tested'] = 'Working'; // Try to set a variable in session.
482d67bd 313 header('Location: '.index_url($_SERVER).'?test_session'); // Redirect to check stored data.
f37664a2 314 }
93bf0918
V
315 if (isset($_GET['test_session'])) {
316 // Step 3: Sessions are OK. Remove test parameter from URL.
482d67bd 317 header('Location: '.index_url($_SERVER));
f37664a2
SS
318 }
319
320
93bf0918 321 if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) {
45034273 322 $tz = 'UTC';
12ff86c9
A
323 if (!empty($_POST['continent']) && !empty($_POST['city'])
324 && isTimeZoneValid($_POST['continent'], $_POST['city'])
325 ) {
326 $tz = $_POST['continent'].'/'.$_POST['city'];
d1e2f8e5 327 }
da10377b 328 $conf->set('general.timezone', $tz);
684e662a 329 $login = $_POST['setlogin'];
da10377b 330 $conf->set('credentials.login', $login);
684e662a 331 $salt = sha1(uniqid('', true) .'_'. mt_rand());
da10377b
A
332 $conf->set('credentials.salt', $salt);
333 $conf->set('credentials.hash', sha1($_POST['setpassword'] . $login . $salt));
684e662a 334 if (!empty($_POST['title'])) {
7f179985 335 $conf->set('general.title', escape($_POST['title']));
684e662a 336 } else {
cf92b4dd 337 $conf->set('general.title', 'Shared bookmarks on '.escape(index_url($_SERVER)));
684e662a 338 }
f39580c6 339 $conf->set('translation.language', escape($_POST['language']));
894a3c4b 340 $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
cbfdcff2
A
341 $conf->set('api.enabled', !empty($_POST['enableApi']));
342 $conf->set(
343 'api.secret',
344 generate_api_secret(
e3a430ba
A
345 $conf->get('credentials.login'),
346 $conf->get('credentials.salt')
cbfdcff2
A
347 )
348 );
dd484b90 349 try {
684e662a 350 // Everything is ok, let's create config file.
63ea23c2 351 $conf->write($loginManager->isLoggedIn());
93bf0918 352 } catch (Exception $e) {
dd484b90 353 error_log(
93bf0918 354 'ERROR while writing config file after installation.' . PHP_EOL .
dd484b90 355 $e->getMessage()
93bf0918 356 );
dd484b90
A
357
358 // TODO: do not handle exceptions/errors in JS.
359 echo '<script>alert("'. $e->getMessage() .'");document.location=\'?\';</script>';
360 exit;
361 }
cf92b4dd
A
362
363 $history = new History($conf->get('resource.history'));
364 $bookmarkService = new BookmarkFileService($conf, $history, true);
365 if ($bookmarkService->count() === 0) {
366 $bookmarkService->initialize();
367 }
368
9d9f6d75
V
369 echo '<script>alert('
370 .'"Shaarli is now configured. '
cf92b4dd 371 .'Please enter your login/password and start shaaring your bookmarks!"'
9e4cc28e 372 .');document.location=\'./login\';</script>';
45034273
SS
373 exit;
374 }
375
28f26524 376 $PAGE = new PageBuilder($conf, $_SESSION, null, $sessionManager->generateToken());
ae3aa968
A
377 list($continents, $cities) = generateTimeZoneData(timezone_identifiers_list(), date_default_timezone_get());
378 $PAGE->assign('continents', $continents);
379 $PAGE->assign('cities', $cities);
f39580c6 380 $PAGE->assign('languages', Languages::getAvailableLanguages());
45034273
SS
381 $PAGE->renderPage('install');
382 exit;
383}
384
684e662a 385if (!isset($_SESSION['LINKS_PER_PAGE'])) {
da10377b 386 $_SESSION['LINKS_PER_PAGE'] = $conf->get('general.links_per_page', 20);
684e662a 387}
18e67967 388
9c75f877 389$containerBuilder = new ContainerBuilder($conf, $sessionManager, $loginManager);
6c50a6cc
A
390$container = $containerBuilder->build();
391$app = new App($container);
18e67967
A
392
393// REST API routes
93bf0918 394$app->group('/api/v1', function () {
68016e37 395 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo')->setName('getInfo');
20433ea7
A
396 $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks')->setName('getLinks');
397 $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink')->setName('getLink');
398 $this->post('/links', '\Shaarli\Api\Controllers\Links:postLink')->setName('postLink');
399 $this->put('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:putLink')->setName('putLink');
400 $this->delete('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:deleteLink')->setName('deleteLink');
d3f42ca4
A
401
402 $this->get('/tags', '\Shaarli\Api\Controllers\Tags:getTags')->setName('getTags');
403 $this->get('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:getTag')->setName('getTag');
404 $this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag');
405 $this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag');
406
18d2d3ae 407 $this->get('/history', '\Shaarli\Api\Controllers\HistoryController:getHistory')->setName('getHistory');
465b1c40 408})->add('\Shaarli\Api\ApiMiddleware');
18e67967 409
6c50a6cc 410$app->group('', function () {
2899ebb5 411 /* -- PUBLIC --*/
1a8ac737
A
412 $this->get('/', '\Shaarli\Front\Controller\Visitor\BookmarkListController:index');
413 $this->get('/shaare/{hash}', '\Shaarli\Front\Controller\Visitor\BookmarkListController:permalink');
414 $this->get('/login', '\Shaarli\Front\Controller\Visitor\LoginController:index')->setName('login');
9c75f877
A
415 $this->get('/picture-wall', '\Shaarli\Front\Controller\Visitor\PictureWallController:index');
416 $this->get('/tags/cloud', '\Shaarli\Front\Controller\Visitor\TagCloudController:cloud');
417 $this->get('/tags/list', '\Shaarli\Front\Controller\Visitor\TagCloudController:list');
418 $this->get('/daily', '\Shaarli\Front\Controller\Visitor\DailyController:index');
1a8ac737
A
419 $this->get('/daily-rss', '\Shaarli\Front\Controller\Visitor\DailyController:rss')->setName('rss');
420 $this->get('/feed/atom', '\Shaarli\Front\Controller\Visitor\FeedController:atom')->setName('atom');
9c75f877
A
421 $this->get('/feed/rss', '\Shaarli\Front\Controller\Visitor\FeedController:rss');
422 $this->get('/open-search', '\Shaarli\Front\Controller\Visitor\OpenSearchController:index');
423
424 $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag');
425 $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag');
2899ebb5
A
426
427 /* -- LOGGED IN -- */
9c75f877
A
428 $this->get('/logout', '\Shaarli\Front\Controller\Admin\LogoutController:index');
429 $this->get('/admin/tools', '\Shaarli\Front\Controller\Admin\ToolsController:index');
430 $this->get('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:index');
431 $this->post('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:change');
432 $this->get('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:index');
433 $this->post('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:save');
434 $this->get('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:index');
435 $this->post('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:save');
baa69791
A
436 $this->get('/admin/add-shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:addShaare');
437 $this->get('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayCreateForm');
438 $this->get('/admin/shaare/{id:[0-9]+}', '\Shaarli\Front\Controller\Admin\ManageShaareController:displayEditForm');
439 $this->post('/admin/shaare', '\Shaarli\Front\Controller\Admin\ManageShaareController:save');
440 $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\ManageShaareController:deleteBookmark');
7b8a6f28 441 $this->get('/admin/shaare/visibility', '\Shaarli\Front\Controller\Admin\ManageShaareController:changeVisibility');
3447d888 442 $this->get('/admin/shaare/{id:[0-9]+}/pin', '\Shaarli\Front\Controller\Admin\ManageShaareController:pinBookmark');
6132d647
A
443 $this->patch(
444 '/admin/shaare/{id:[0-9]+}/update-thumbnail',
445 '\Shaarli\Front\Controller\Admin\ThumbnailsController:ajaxUpdate'
446 );
c70ff64a
A
447 $this->get('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:index');
448 $this->post('/admin/export', '\Shaarli\Front\Controller\Admin\ExportController:export');
78657347
A
449 $this->get('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:index');
450 $this->post('/admin/import', '\Shaarli\Front\Controller\Admin\ImportController:import');
1b8620b1
A
451 $this->get('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:index');
452 $this->post('/admin/plugins', '\Shaarli\Front\Controller\Admin\PluginsController:save');
764d34a7 453 $this->get('/admin/token', '\Shaarli\Front\Controller\Admin\TokenController:getToken');
6132d647 454 $this->get('/admin/thumbnails', '\Shaarli\Front\Controller\Admin\ThumbnailsController:index');
9c75f877
A
455
456 $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage');
457 $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility');
458 $this->get('/untagged-only', '\Shaarli\Front\Controller\Admin\SessionFilterController:untaggedOnly');
6c50a6cc
A
459})->add('\Shaarli\Front\ShaarliMiddleware');
460
18e67967 461$response = $app->run(true);
5d9bc40d 462
1a8ac737 463$app->respond($response);