]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Use multi-level routes for existing controllers instead of 1 level everywhere
authorArthurHoaro <arthur@hoa.ro>
Sat, 13 Jun 2020 11:08:01 +0000 (13:08 +0200)
committerArthurHoaro <arthur@hoa.ro>
Thu, 23 Jul 2020 19:19:21 +0000 (21:19 +0200)
Also prefix most admin routes with /admin/

42 files changed:
application/container/ContainerBuilder.php
application/container/ShaarliContainer.php
application/front/ShaarliMiddleware.php
application/front/controller/admin/ConfigureController.php
application/front/controller/admin/LogoutController.php
application/front/controller/admin/ManageTagController.php
application/front/controller/admin/PasswordController.php
application/front/controller/admin/PostBookmarkController.php
application/front/controller/visitor/LoginController.php
application/front/controller/visitor/ShaarliVisitorController.php
application/front/controller/visitor/TagController.php
assets/default/js/base.js
doc/md/RSS-feeds.md
doc/md/Translations.md
index.php
plugins/pubsubhubbub/pubsubhubbub.php
tests/container/ContainerBuilderTest.php
tests/feed/CachedPageTest.php
tests/front/controller/admin/ConfigureControllerTest.php
tests/front/controller/admin/LogoutControllerTest.php
tests/front/controller/admin/ManageTagControllerTest.php
tests/front/controller/admin/PostBookmarkControllerTest.php
tests/front/controller/visitor/LoginControllerTest.php
tests/front/controller/visitor/TagControllerTest.php
tpl/default/addlink.html
tpl/default/changepassword.html
tpl/default/changetag.html
tpl/default/configure.html
tpl/default/editlink.html
tpl/default/includes.html
tpl/default/linklist.html
tpl/default/opensearch.html
tpl/default/page.header.html
tpl/default/tag.list.html
tpl/default/tag.sort.html
tpl/default/tools.html
tpl/vintage/addlink.html
tpl/vintage/editlink.html
tpl/vintage/includes.html
tpl/vintage/opensearch.html
tpl/vintage/page.header.html
tpl/vintage/tools.html

index 851262461fd650c9877d04f30b0c9b54105eeeea..72a85710a7961abc0a029e16109c4b5e7a32766d 100644 (file)
@@ -38,19 +38,17 @@ class ContainerBuilder
     /** @var LoginManager */
     protected $login;
 
-    /** @var string */
-    protected $webPath;
+    /** @var string|null */
+    protected $basePath = null;
 
     public function __construct(
         ConfigManager $conf,
         SessionManager $session,
-        LoginManager $login,
-        string $webPath
+        LoginManager $login
     ) {
         $this->conf = $conf;
         $this->session = $session;
         $this->login = $login;
-        $this->webPath = $webPath;
     }
 
     public function build(): ShaarliContainer
@@ -60,7 +58,7 @@ class ContainerBuilder
         $container['conf'] = $this->conf;
         $container['sessionManager'] = $this->session;
         $container['loginManager'] = $this->login;
-        $container['webPath'] = $this->webPath;
+        $container['basePath'] = $this->basePath;
 
         $container['plugins'] = function (ShaarliContainer $container): PluginManager {
             return new PluginManager($container->conf);
index a95393cd450461fb137ccf24c0814d4ad86d9b81..4b97aae23717482cc8fd0b804c6e7b9290173bb8 100644 (file)
@@ -21,21 +21,20 @@ use Slim\Container;
 /**
  * Extension of Slim container to document the injected objects.
  *
- * @property mixed[]                  $environment     $_SERVER automatically injected by Slim
  * @property string                   $basePath        Shaarli's instance base path (e.g. `/shaarli/`)
+ * @property BookmarkServiceInterface $bookmarkService
  * @property ConfigManager            $conf
- * @property SessionManager           $sessionManager
- * @property LoginManager             $loginManager
- * @property string                   $webPath
+ * @property mixed[]                  $environment     $_SERVER automatically injected by Slim
+ * @property FeedBuilder              $feedBuilder
+ * @property FormatterFactory         $formatterFactory
  * @property History                  $history
- * @property BookmarkServiceInterface $bookmarkService
+ * @property HttpAccess               $httpAccess
+ * @property LoginManager             $loginManager
  * @property PageBuilder              $pageBuilder
- * @property PluginManager            $pluginManager
- * @property FormatterFactory         $formatterFactory
  * @property PageCacheManager         $pageCacheManager
- * @property FeedBuilder              $feedBuilder
+ * @property PluginManager            $pluginManager
+ * @property SessionManager           $sessionManager
  * @property Thumbnailer              $thumbnailer
- * @property HttpAccess               $httpAccess
  */
 class ShaarliContainer extends Container
 {
index 47aa61bbfb6f9d05f6dff325501d45d3b4b82b81..7ad610c7db4984d6c8b923ac95c56b2351297627 100644 (file)
@@ -38,9 +38,9 @@ class ShaarliMiddleware
      */
     public function __invoke(Request $request, Response $response, callable $next)
     {
-        try {
-            $this->container->basePath = rtrim($request->getUri()->getBasePath(), '/');
+        $this->container->basePath = rtrim($request->getUri()->getBasePath(), '/');
 
+        try {
             $response = $next($request, $response);
         } catch (ShaarliFrontException $e) {
             $this->container->pageBuilder->assign('message', $e->getMessage());
@@ -54,7 +54,7 @@ class ShaarliMiddleware
             $response = $response->withStatus($e->getCode());
             $response = $response->write($this->container->pageBuilder->render('error'));
         } catch (UnauthorizedException $e) {
-            return $response->withRedirect($request->getUri()->getBasePath() . '/login');
+            return $response->withRedirect($this->container->basePath . '/login');
         }
 
         return $response;
index 5a482d8e01f11c363e2feca5d8869a7059cdc0fb..44971c43f2ba1453dd9f61c78055d592084e0fcd 100644 (file)
@@ -19,7 +19,7 @@ use Throwable;
 class ConfigureController extends ShaarliAdminController
 {
     /**
-     * GET /configure - Displays the configuration page
+     * GET /admin/configure - Displays the configuration page
      */
     public function index(Request $request, Response $response): Response
     {
@@ -56,7 +56,7 @@ class ConfigureController extends ShaarliAdminController
     }
 
     /**
-     * POST /configure - Update Shaarli's configuration
+     * POST /admin/configure - Update Shaarli's configuration
      */
     public function save(Request $request, Response $response): Response
     {
@@ -115,6 +115,6 @@ class ConfigureController extends ShaarliAdminController
 
         $this->saveSuccessMessage(t('Configuration was saved.'));
 
-        return $response->withRedirect('./configure');
+        return $this->redirect($response, '/admin/configure');
     }
 }
index 41e81984a4c89ef6407e3e0c3463dfe0e649a473..c5984814738674c8601c1c35b4ccf5de971bb220 100644 (file)
@@ -22,8 +22,8 @@ class LogoutController extends ShaarliAdminController
         $this->container->sessionManager->logout();
 
         // TODO: switch to a simple Cookie manager allowing to check the session, and create mocks.
-        setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, $this->container->webPath);
+        setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, $this->container->basePath . '/');
 
-        return $response->withRedirect('./');
+        return $this->redirect($response, '/');
     }
 }
index e015e613d8c60ca4a8a7c0a92e8e10d1e96230f5..7dab288a4e392a56e80189a43b76f62159e374ba 100644 (file)
@@ -16,7 +16,7 @@ use Slim\Http\Response;
 class ManageTagController extends ShaarliAdminController
 {
     /**
-     * GET /manage-tags - Displays the manage tags page
+     * GET /admin/tags - Displays the manage tags page
      */
     public function index(Request $request, Response $response): Response
     {
@@ -32,7 +32,7 @@ class ManageTagController extends ShaarliAdminController
     }
 
     /**
-     * POST /manage-tags - Update or delete provided tag
+     * POST /admin/tags - Update or delete provided tag
      */
     public function save(Request $request, Response $response): Response
     {
@@ -46,7 +46,7 @@ class ManageTagController extends ShaarliAdminController
         if (0 === strlen($fromTag) || false === $isDelete && 0 === strlen($toTag)) {
             $this->saveWarningMessage(t('Invalid tags provided.'));
 
-            return $response->withRedirect('./manage-tags');
+            return $this->redirect($response, '/admin/tags');
         }
 
         // TODO: move this to bookmark service
@@ -80,8 +80,8 @@ class ManageTagController extends ShaarliAdminController
 
         $this->saveSuccessMessage($alert);
 
-        $redirect = true === $isDelete ? './manage-tags' : './?searchtags='. urlencode($toTag);
+        $redirect = true === $isDelete ? '/admin/tags' : '/?searchtags='. urlencode($toTag);
 
-        return $response->withRedirect($redirect);
+        return $this->redirect($response, $redirect);
     }
 }
index 6e8f0bcbf38d5f04113fc7e6350d782dcb902d49..bcce01a6fbd36cbe105607ac7e50c428eb1705b3 100644 (file)
@@ -29,7 +29,7 @@ class PasswordController extends ShaarliAdminController
     }
 
     /**
-     * GET /password - Displays the change password template
+     * GET /admin/password - Displays the change password template
      */
     public function index(Request $request, Response $response): Response
     {
@@ -37,7 +37,7 @@ class PasswordController extends ShaarliAdminController
     }
 
     /**
-     * POST /password - Change admin password - existing and new passwords need to be provided.
+     * POST /admin/password - Change admin password - existing and new passwords need to be provided.
      */
     public function change(Request $request, Response $response): Response
     {
index dbe570e28623f9b26df5593819e5b6a5d412a71a..f3ee5deac844079416e9b04f785590acddaf7444 100644 (file)
@@ -19,7 +19,7 @@ use Slim\Http\Response;
 class PostBookmarkController extends ShaarliAdminController
 {
     /**
-     * GET /add-shaare - Displays the form used to create a new bookmark from an URL
+     * GET /admin/add-shaare - Displays the form used to create a new bookmark from an URL
      */
     public function addShaare(Request $request, Response $response): Response
     {
@@ -32,7 +32,7 @@ class PostBookmarkController extends ShaarliAdminController
     }
 
     /**
-     * GET /shaare - Displays the bookmark form for creation.
+     * GET /admin/shaare - Displays the bookmark form for creation.
      *               Note that if the URL is found in existing bookmarks, then it will be in edit mode.
      */
     public function displayCreateForm(Request $request, Response $response): Response
@@ -93,7 +93,7 @@ class PostBookmarkController extends ShaarliAdminController
     }
 
     /**
-     * GET /shaare-{id} - Displays the bookmark form in edition mode.
+     * GET /admin/shaare/{id} - Displays the bookmark form in edition mode.
      */
     public function displayEditForm(Request $request, Response $response, array $args): Response
     {
@@ -106,7 +106,7 @@ class PostBookmarkController extends ShaarliAdminController
         } catch (BookmarkNotFoundException $e) {
             $this->saveErrorMessage(t('Bookmark not found'));
 
-            return $response->withRedirect('./');
+            return $this->redirect($response, '/');
         }
 
         $formatter = $this->container->formatterFactory->getFormatter('raw');
@@ -116,7 +116,7 @@ class PostBookmarkController extends ShaarliAdminController
     }
 
     /**
-     * POST /shaare
+     * POST /admin/shaare
      */
     public function save(Request $request, Response $response): Response
     {
@@ -170,11 +170,14 @@ class PostBookmarkController extends ShaarliAdminController
         );
     }
 
+    /**
+     * GET /admin/shaare/delete
+     */
     public function deleteBookmark(Request $request, Response $response): Response
     {
         $this->checkToken($request);
 
-        $ids = escape(trim($request->getParam('lf_linkdate')));
+        $ids = escape(trim($request->getParam('id')));
         if (strpos($ids, ' ') !== false) {
             // multiple, space-separated ids provided
             $ids = array_values(array_filter(preg_split('/\s+/', $ids), 'strlen'));
@@ -207,7 +210,7 @@ class PostBookmarkController extends ShaarliAdminController
         }
 
         // Don't redirect to where we were previously because the datastore has changed.
-        return $response->withRedirect('./');
+        return $this->redirect($response, '/');
     }
 
     protected function displayForm(array $link, bool $isNew, Request $request, Response $response): Response
index 4de2f55db0fce3e991bd1f380720a2c852725f95..0db1f4632f3b70f12d61c17e592acb561e1fed71 100644 (file)
@@ -23,7 +23,7 @@ class LoginController extends ShaarliVisitorController
         if ($this->container->loginManager->isLoggedIn()
             || $this->container->conf->get('security.open_shaarli', false)
         ) {
-            return $response->withRedirect('./');
+            return $this->redirect($response, '/');
         }
 
         $userCanLogin = $this->container->loginManager->canLogin($request->getServerParams());
index b90b1e8f2f8396ef3eff59221b15db749a7be516..b494a8e6bed3587a1edf66ebe921e7bc2b89cf97 100644 (file)
@@ -104,6 +104,19 @@ abstract class ShaarliVisitorController
         }
     }
 
+    /**
+     * Simple helper which prepend the base path to redirect path.
+     *
+     * @param Response $response
+     * @param string $path Absolute path, e.g.: `/`, or `/admin/shaare/123` regardless of install directory
+     *
+     * @return Response updated
+     */
+    protected function redirect(Response $response, string $path): Response
+    {
+        return $response->withRedirect($this->container->basePath . $path);
+    }
+
     /**
      * Generates a redirection to the previous page, based on the HTTP_REFERER.
      * It fails back to the home page.
index a0bc1d1b633db4151758e18dddc2a1d0947fc9e7..c176f43f78307bbcc42a204d57e3efcbd4313727 100644 (file)
@@ -11,6 +11,8 @@ use Slim\Http\Response;
  * Class TagController
  *
  * Slim controller handle tags.
+ *
+ * TODO: check redirections with new helper
  */
 class TagController extends ShaarliVisitorController
 {
@@ -27,10 +29,10 @@ class TagController extends ShaarliVisitorController
         // In case browser does not send HTTP_REFERER, we search a single tag
         if (null === $referer) {
             if (null !== $newTag) {
-                return $response->withRedirect('./?searchtags='. urlencode($newTag));
+                return $this->redirect($response, '/?searchtags='. urlencode($newTag));
             }
 
-            return $response->withRedirect('./');
+            return $this->redirect($response, '/');
         }
 
         $currentUrl = parse_url($referer);
@@ -81,7 +83,7 @@ class TagController extends ShaarliVisitorController
 
         // If the referrer is not provided, we can update the search, so we failback on the bookmark list
         if (empty($referer)) {
-            return $response->withRedirect('./');
+            return $this->redirect($response, '/');
         }
 
         $tagToRemove = $args['tag'] ?? null;
index b428a42061fecf64801c4b8180c2671822b12fc4..9f67d9805a95b6246b65153fb2e0ca3f571e4afa 100644 (file)
@@ -463,7 +463,7 @@ function init(description) {
       });
 
       if (window.confirm(message)) {
-        window.location = `${basePath}/?delete_link&lf_linkdate=${ids.join('+')}&token=${token.value}`;
+        window.location = `${basePath}/admin/shaare/delete?id=${ids.join('+')}&token=${token.value}`;
       }
     });
   }
@@ -549,7 +549,7 @@ function init(description) {
       const refreshedToken = document.getElementById('token').value;
       const fromtag = block.getAttribute('data-tag');
       const xhr = new XMLHttpRequest();
-      xhr.open('POST', `${basePath}/manage-tags`);
+      xhr.open('POST', `${basePath}/admin/tags`);
       xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
       xhr.onload = () => {
         if (xhr.status !== 200) {
@@ -566,7 +566,7 @@ function init(description) {
             .setAttribute('href', `${basePath}/?searchtags=${encodeURIComponent(totag)}`);
           block
             .querySelector('a.rename-tag')
-            .setAttribute('href', `${basePath}/manage-tags?fromtag=${encodeURIComponent(totag)}`);
+            .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`);
 
           // Refresh awesomplete values
           existingTags = existingTags.map(tag => (tag === fromtag ? totag : tag));
@@ -600,7 +600,7 @@ function init(description) {
 
       if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) {
         const xhr = new XMLHttpRequest();
-        xhr.open('POST', `${basePath}/manage-tags`);
+        xhr.open('POST', `${basePath}/admin/tags`);
         xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
         xhr.onload = () => {
           block.remove();
index cdfb8c7857db7562a6b6634ec60cd54eb2d9e7b7..ecbff09ab8b7648e153709599df5605b58fb2c12 100644 (file)
@@ -1,14 +1,14 @@
 ### Feeds options
 
-Feeds are available in ATOM with `/feed-atom` and RSS with `/feed-rss`.
+Feeds are available in ATOM with `/feed/atom` and RSS with `/feed/rss`.
 
 Options:
 
 - You can use `permalinks` in the feed URL to get permalink to Shaares instead of direct link to shaared URL.
-    - E.G. `https://my.shaarli.domain/feed-atom?permalinks`.
+    - E.G. `https://my.shaarli.domain/feed/atom?permalinks`.
 - You can use `nb` parameter in the feed URL to specify the number of Shaares you want in a feed (default if not specified: `50`). The keyword `all` is available if you want everything.
-    - `https://my.shaarli.domain/feed-atom?permalinks&nb=42`
-    - `https://my.shaarli.domain/feed-atom?permalinks&nb=all`
+    - `https://my.shaarli.domain/feed/atom?permalinks&nb=42`
+    - `https://my.shaarli.domain/feed/atom?permalinks&nb=all`
 
 ### RSS Feeds or Picture Wall for a specific search/tag
 
index 5c775d30ea34e168abf017a042fda4a5e6653bf1..75eeed7d186d6cca94e008e9a5f1a5f74425a725 100644 (file)
@@ -32,11 +32,11 @@ Here is a list :
 ```
 http://<replace_domain>/
 http://<replace_domain>/?nonope
-http://<replace_domain>/add-shaare
-http://<replace_domain>/?do=changepasswd
+http://<replace_domain>/admin/add-shaare
+http://<replace_domain>/admin/password
 http://<replace_domain>/?do=changetag
-http://<replace_domain>/configure
-http://<replace_domain>/tools
+http://<replace_domain>/admin/configure
+http://<replace_domain>/admin/tools
 http://<replace_domain>/daily
 http://<replace_domain>/?post
 http://<replace_domain>/?do=export
@@ -44,8 +44,8 @@ http://<replace_domain>/?do=import
 http://<replace_domain>/login
 http://<replace_domain>/picture-wall
 http://<replace_domain>/?do=pluginadmin
-http://<replace_domain>/tag-cloud
-http://<replace_domain>/tag-list
+http://<replace_domain>/tags/cloud
+http://<replace_domain>/tags/list
 ```
 
 #### Improve existing translation
index fb528eeb61635e3bc4d620dc56bb2fb3e9dbe4ff..aa358da03aaa469353300fef91c10f3228bf43ba 100644 (file)
--- a/index.php
+++ b/index.php
@@ -412,13 +412,13 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
 
     // -------- Tag cloud
     if ($targetPage == Router::$PAGE_TAGCLOUD) {
-        header('Location: ./tag-cloud');
+        header('Location: ./tags/cloud');
         exit;
     }
 
     // -------- Tag list
     if ($targetPage == Router::$PAGE_TAGLIST) {
-        header('Location: ./tag-list');
+        header('Location: ./tags/list');
         exit;
     }
 
@@ -433,7 +433,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
     if ($targetPage == Router::$PAGE_FEED_ATOM || $targetPage == Router::$PAGE_FEED_RSS) {
         $feedType = $targetPage == Router::$PAGE_FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM;
 
-        header('Location: ./feed-'. $feedType .'?'. http_build_query($_GET));
+        header('Location: ./feed/'. $feedType .'?'. http_build_query($_GET));
         exit;
     }
 
@@ -501,31 +501,31 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
 
     // -------- Display the Tools menu if requested (import/export/bookmarklet...)
     if ($targetPage == Router::$PAGE_TOOLS) {
-        header('Location: ./tools');
+        header('Location: ./admin/tools');
         exit;
     }
 
     // -------- User wants to change his/her password.
     if ($targetPage == Router::$PAGE_CHANGEPASSWORD) {
-        header('Location: ./password');
+        header('Location: ./admin/password');
         exit;
     }
 
     // -------- User wants to change configuration
     if ($targetPage == Router::$PAGE_CONFIGURE) {
-        header('Location: ./configure');
+        header('Location: ./admin/configure');
         exit;
     }
 
     // -------- User wants to rename a tag or delete it
     if ($targetPage == Router::$PAGE_CHANGETAG) {
-        header('Location: ./manage-tags');
+        header('Location: ./admin/tags');
         exit;
     }
 
     // -------- User wants to add a link without using the bookmarklet: Show form.
     if ($targetPage == Router::$PAGE_ADDLINK) {
-        header('Location: ./shaare');
+        header('Location: ./admin/shaare');
         exit;
     }
 
@@ -538,56 +538,10 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
 
     // -------- User clicked the "Delete" button when editing a link: Delete link from database.
     if ($targetPage == Router::$PAGE_DELETELINK) {
-        if (! $sessionManager->checkToken($_GET['token'])) {
-            die(t('Wrong token.'));
-        }
-
-        $ids = trim($_GET['lf_linkdate']);
-        if (strpos($ids, ' ') !== false) {
-            // multiple, space-separated ids provided
-            $ids = array_values(array_filter(
-                preg_split('/\s+/', escape($ids)),
-                function ($item) {
-                    return $item !== '';
-                }
-            ));
-        } else {
-            // only a single id provided
-            $shortUrl = $bookmarkService->get($ids)->getShortUrl();
-            $ids = [$ids];
-        }
-        // assert at least one id is given
-        if (!count($ids)) {
-            die('no id provided');
-        }
-        $factory = new FormatterFactory($conf, $loginManager->isLoggedIn());
-        $formatter = $factory->getFormatter('raw');
-        foreach ($ids as $id) {
-            $id = (int) escape($id);
-            $bookmark = $bookmarkService->get($id);
-            $data = $formatter->format($bookmark);
-            $pluginManager->executeHooks('delete_link', $data);
-            $bookmarkService->remove($bookmark, false);
-        }
-        $bookmarkService->save();
-
-        // If we are called from the bookmarklet, we must close the popup:
-        if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) {
-            echo '<script>self.close();</script>';
-            exit;
-        }
+        $ids = $_GET['lf_linkdate'] ?? '';
+        $token = $_GET['token'] ?? '';
 
-        $location = '?';
-        if (isset($_SERVER['HTTP_REFERER'])) {
-            // Don't redirect to where we were previously if it was a permalink or an edit_link, because it would 404.
-            $location = generateLocation(
-                $_SERVER['HTTP_REFERER'],
-                $_SERVER['HTTP_HOST'],
-                ['delete_link', 'edit_link', ! empty($shortUrl) ? $shortUrl : null]
-            );
-        }
-
-        header('Location: ' . $location); // After deleting the link, redirect to appropriate location
+        header('Location: ./admin/shaare/delete?id=' . $ids . '&token=' . $token);
         exit;
     }
 
@@ -646,13 +600,13 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
     // -------- User clicked the "EDIT" button on a link: Display link edit form.
     if (isset($_GET['edit_link'])) {
         $id = (int) escape($_GET['edit_link']);
-        header('Location: ./shaare-' . $id);
+        header('Location: ./admin/shaare/' . $id);
         exit;
     }
 
     // -------- User want to post a new link: Display link edit form.
     if (isset($_GET['post'])) {
-        header('Location: ./shaare?' . http_build_query($_GET));
+        header('Location: ./admin/shaare?' . http_build_query($_GET));
         exit;
     }
 
@@ -1160,7 +1114,7 @@ if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=
     exit;
 }
 
-$containerBuilder = new ContainerBuilder($conf, $sessionManager, $loginManager, WEB_PATH);
+$containerBuilder = new ContainerBuilder($conf, $sessionManager, $loginManager);
 $container = $containerBuilder->build();
 $app = new App($container);
 
@@ -1183,51 +1137,37 @@ $app->group('/api/v1', function () {
 
 $app->group('', function () {
     /* -- PUBLIC --*/
-    $this->get('/login', '\Shaarli\Front\Controller\Visitor\LoginController:index')->setName('login');
-    $this->get('/picture-wall', '\Shaarli\Front\Controller\Visitor\PictureWallController:index')->setName('picwall');
-    $this->get('/tag-cloud', '\Shaarli\Front\Controller\Visitor\TagCloudController:cloud')->setName('tagcloud');
-    $this->get('/tag-list', '\Shaarli\Front\Controller\Visitor\TagCloudController:list')->setName('taglist');
-    $this->get('/daily', '\Shaarli\Front\Controller\Visitor\DailyController:index')->setName('daily');
-    $this->get('/daily-rss', '\Shaarli\Front\Controller\Visitor\DailyController:rss')->setName('dailyrss');
-    $this->get('/feed-atom', '\Shaarli\Front\Controller\Visitor\FeedController:atom')->setName('feedatom');
-    $this->get('/feed-rss', '\Shaarli\Front\Controller\Visitor\FeedController:rss')->setName('feedrss');
-    $this->get('/open-search', '\Shaarli\Front\Controller\Visitor\OpenSearchController:index')->setName('opensearch');
-
-    $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag')->setName('add-tag');
-    $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag')->setName('remove-tag');
+    $this->get('/login', '\Shaarli\Front\Controller\Visitor\LoginController:index');
+    $this->get('/picture-wall', '\Shaarli\Front\Controller\Visitor\PictureWallController:index');
+    $this->get('/tags/cloud', '\Shaarli\Front\Controller\Visitor\TagCloudController:cloud');
+    $this->get('/tags/list', '\Shaarli\Front\Controller\Visitor\TagCloudController:list');
+    $this->get('/daily', '\Shaarli\Front\Controller\Visitor\DailyController:index');
+    $this->get('/daily-rss', '\Shaarli\Front\Controller\Visitor\DailyController:rss');
+    $this->get('/feed/atom', '\Shaarli\Front\Controller\Visitor\FeedController:atom');
+    $this->get('/feed/rss', '\Shaarli\Front\Controller\Visitor\FeedController:rss');
+    $this->get('/open-search', '\Shaarli\Front\Controller\Visitor\OpenSearchController:index');
+
+    $this->get('/add-tag/{newTag}', '\Shaarli\Front\Controller\Visitor\TagController:addTag');
+    $this->get('/remove-tag/{tag}', '\Shaarli\Front\Controller\Visitor\TagController:removeTag');
 
     /* -- LOGGED IN -- */
-    $this->get('/logout', '\Shaarli\Front\Controller\Admin\LogoutController:index')->setName('logout');
-    $this->get('/tools', '\Shaarli\Front\Controller\Admin\ToolsController:index')->setName('tools');
-    $this->get('/password', '\Shaarli\Front\Controller\Admin\PasswordController:index')->setName('password');
-    $this->post('/password', '\Shaarli\Front\Controller\Admin\PasswordController:change')->setName('changePassword');
-    $this->get('/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:index')->setName('configure');
-    $this->post('/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:save')->setName('saveConfigure');
-    $this->get('/manage-tags', '\Shaarli\Front\Controller\Admin\ManageTagController:index')->setName('manageTag');
-    $this->post('/manage-tags', '\Shaarli\Front\Controller\Admin\ManageTagController:save')->setName('saveManageTag');
-    $this->get('/add-shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:addShaare')->setName('addShaare');
-    $this
-        ->get('/shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:displayCreateForm')
-        ->setName('newShaare');
-    $this
-        ->get('/shaare-{id}', '\Shaarli\Front\Controller\Admin\PostBookmarkController:displayEditForm')
-        ->setName('editShaare');
-    $this
-        ->post('/shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:save')
-        ->setName('saveShaare');
-    $this
-        ->get('/delete-shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:deleteBookmark')
-        ->setName('deleteShaare');
-
-    $this
-        ->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage')
-        ->setName('filter-links-per-page');
-    $this
-        ->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility')
-        ->setName('visibility');
-    $this
-        ->get('/untagged-only', '\Shaarli\Front\Controller\Admin\SessionFilterController:untaggedOnly')
-        ->setName('untagged-only');
+    $this->get('/logout', '\Shaarli\Front\Controller\Admin\LogoutController:index');
+    $this->get('/admin/tools', '\Shaarli\Front\Controller\Admin\ToolsController:index');
+    $this->get('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:index');
+    $this->post('/admin/password', '\Shaarli\Front\Controller\Admin\PasswordController:change');
+    $this->get('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:index');
+    $this->post('/admin/configure', '\Shaarli\Front\Controller\Admin\ConfigureController:save');
+    $this->get('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:index');
+    $this->post('/admin/tags', '\Shaarli\Front\Controller\Admin\ManageTagController:save');
+    $this->get('/admin/add-shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:addShaare');
+    $this->get('/admin/shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:displayCreateForm');
+    $this->get('/admin/shaare/{id:[0-9]+}', '\Shaarli\Front\Controller\Admin\PostBookmarkController:displayEditForm');
+    $this->post('/admin/shaare', '\Shaarli\Front\Controller\Admin\PostBookmarkController:save');
+    $this->get('/admin/shaare/delete', '\Shaarli\Front\Controller\Admin\PostBookmarkController:deleteBookmark');
+
+    $this->get('/links-per-page', '\Shaarli\Front\Controller\Admin\SessionFilterController:linksPerPage');
+    $this->get('/visibility/{visibility}', '\Shaarli\Front\Controller\Admin\SessionFilterController:visibility');
+    $this->get('/untagged-only', '\Shaarli\Front\Controller\Admin\SessionFilterController:untaggedOnly');
 })->add('\Shaarli\Front\ShaarliMiddleware');
 
 $response = $app->run(true);
index 41634dda50ba7f2d6877dd68c142de0f7191dda7..170f34949eb0e7dfadcf099f5014568888b2a7ba 100644 (file)
@@ -60,8 +60,8 @@ function hook_pubsubhubbub_render_feed($data, $conf)
 function hook_pubsubhubbub_save_link($data, $conf)
 {
     $feeds = array(
-        index_url($_SERVER) .'feed-atom',
-        index_url($_SERVER) .'feed-rss',
+        index_url($_SERVER) .'feed/atom',
+        index_url($_SERVER) .'feed/rss',
     );
 
     $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post';
index 656472494cace2e2f3b01f35981b37c0d08a866e..db533f378d11379236e350faa73cbe06eea8ec2a 100644 (file)
@@ -7,12 +7,16 @@ namespace Shaarli\Container;
 use PHPUnit\Framework\TestCase;
 use Shaarli\Bookmark\BookmarkServiceInterface;
 use Shaarli\Config\ConfigManager;
+use Shaarli\Feed\FeedBuilder;
 use Shaarli\Formatter\FormatterFactory;
 use Shaarli\History;
+use Shaarli\Http\HttpAccess;
+use Shaarli\Plugin\PluginManager;
 use Shaarli\Render\PageBuilder;
 use Shaarli\Render\PageCacheManager;
 use Shaarli\Security\LoginManager;
 use Shaarli\Security\SessionManager;
+use Shaarli\Thumbnailer;
 
 class ContainerBuilderTest extends TestCase
 {
@@ -39,8 +43,7 @@ class ContainerBuilderTest extends TestCase
         $this->containerBuilder = new ContainerBuilder(
             $this->conf,
             $this->sessionManager,
-            $this->loginManager,
-            'UT web path'
+            $this->loginManager
         );
     }
 
@@ -51,11 +54,17 @@ class ContainerBuilderTest extends TestCase
         static::assertInstanceOf(ConfigManager::class, $container->conf);
         static::assertInstanceOf(SessionManager::class, $container->sessionManager);
         static::assertInstanceOf(LoginManager::class, $container->loginManager);
-        static::assertSame('UT web path', $container->webPath);
         static::assertInstanceOf(History::class, $container->history);
         static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService);
         static::assertInstanceOf(PageBuilder::class, $container->pageBuilder);
+        static::assertInstanceOf(PluginManager::class, $container->pluginManager);
         static::assertInstanceOf(FormatterFactory::class, $container->formatterFactory);
         static::assertInstanceOf(PageCacheManager::class, $container->pageCacheManager);
+        static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder);
+        static::assertInstanceOf(Thumbnailer::class, $container->thumbnailer);
+        static::assertInstanceOf(HttpAccess::class, $container->httpAccess);
+
+        // Set by the middleware
+        static::assertNull($container->basePath);
     }
 }
index 57f3b09be8ebcbc552b9a8e0fed455f9e90b878c..2e7164321d85e7ca0e487fa69a8a6c1f64faeb82 100644 (file)
@@ -11,7 +11,7 @@ class CachedPageTest extends \PHPUnit\Framework\TestCase
 {
     // test cache directory
     protected static $testCacheDir = 'sandbox/pagecache';
-    protected static $url = 'http://shaar.li/feed-atom';
+    protected static $url = 'http://shaar.li/feed/atom';
     protected static $filename;
 
     /**
@@ -42,8 +42,8 @@ class CachedPageTest extends \PHPUnit\Framework\TestCase
     {
         new CachedPage(self::$testCacheDir, '', true);
         new CachedPage(self::$testCacheDir, '', false);
-        new CachedPage(self::$testCacheDir, 'http://shaar.li/feed-rss', true);
-        new CachedPage(self::$testCacheDir, 'http://shaar.li/feed-atom', false);
+        new CachedPage(self::$testCacheDir, 'http://shaar.li/feed/rss', true);
+        new CachedPage(self::$testCacheDir, 'http://shaar.li/feed/atom', false);
         $this->addToAssertionCount(1);
     }
 
index 40304a1885e332e3023c06764fa904bd3afbbbe4..f2f84bacabde367edfcdbe61f8ea2f9fb8ce2447 100644 (file)
@@ -142,7 +142,7 @@ class ConfigureControllerTest extends TestCase
 
         $result = $this->controller->save($request, $response);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./configure'], $result->getHeader('Location'));
+        static::assertSame(['/subfolder/admin/configure'], $result->getHeader('Location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
@@ -193,7 +193,7 @@ class ConfigureControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./configure'], $result->getHeader('Location'));
+        static::assertSame(['/subfolder/admin/configure'], $result->getHeader('Location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
@@ -242,7 +242,7 @@ class ConfigureControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./configure'], $result->getHeader('Location'));
+        static::assertSame(['/subfolder/admin/configure'], $result->getHeader('Location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayNotHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
index 78a0fe731e0de2fdb9102d793068ca479fc2ed7c..ca177085e7734112fd68c090e50b0822e654b6bf 100644 (file)
@@ -49,7 +49,7 @@ class LogoutControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertContains('./', $result->getHeader('Location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('location'));
         static::assertSame('false', $_COOKIE[LoginManager::$STAY_SIGNED_IN_COOKIE]);
     }
 }
index eed99231ba1d49102c64ad585b5605d4c48ebe76..09ba0b4b7a4d986df45adb866f7db0380edcd39d 100644 (file)
@@ -93,7 +93,7 @@ class ManageTagControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./?searchtags=new-tag'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/?searchtags=new-tag'], $result->getHeader('location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayNotHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
@@ -146,7 +146,7 @@ class ManageTagControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./manage-tags'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/admin/tags'], $result->getHeader('location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayNotHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
@@ -197,7 +197,7 @@ class ManageTagControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./manage-tags'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/admin/tags'], $result->getHeader('location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
@@ -229,7 +229,7 @@ class ManageTagControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./manage-tags'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/admin/tags'], $result->getHeader('location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
@@ -262,7 +262,7 @@ class ManageTagControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./manage-tags'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/admin/tags'], $result->getHeader('location'));
 
         static::assertArrayNotHasKey(SessionManager::KEY_ERROR_MESSAGES, $session);
         static::assertArrayHasKey(SessionManager::KEY_WARNING_MESSAGES, $session);
index 69673bd2371d5d68fdb3e2e3acabdf9a7c5ace6b..8dcd1b50d226f2657168fbaa3ca15ba296f71729 100644 (file)
@@ -395,7 +395,7 @@ class PostBookmarkControllerTest extends TestCase
             'lf_description' => 'Provided description.',
             'lf_tags' => 'abc def',
             'lf_private' => '1',
-            'returnurl' => 'http://shaarli.tld/subfolder/add-shaare'
+            'returnurl' => 'http://shaarli.tld/subfolder/admin/add-shaare'
         ];
 
         $request = $this->createMock(Request::class);
@@ -459,7 +459,7 @@ class PostBookmarkControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertRegExp('@/subfolder/#\w{6}@', $result->getHeader('location')[0]);
+        static::assertRegExp('@/subfolder/#[\w\-]{6}@', $result->getHeader('location')[0]);
     }
 
 
@@ -545,7 +545,7 @@ class PostBookmarkControllerTest extends TestCase
         $result = $this->controller->save($request, $response);
 
         static::assertSame(302, $result->getStatusCode());
-        static::assertRegExp('@/subfolder/\?page=2#\w{6}@', $result->getHeader('location')[0]);
+        static::assertRegExp('@/subfolder/\?page=2#[\w\-]{6}@', $result->getHeader('location')[0]);
     }
 
     /**
index faa8ac7131bae68abe9d751cb53db89aeadd73d2..e57f44b94fa1cab5b8c6d83ce1ea4b301294912f 100644 (file)
@@ -95,7 +95,7 @@ class LoginControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./'], $result->getHeader('Location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('Location'));
     }
 
     public function testLoginControllerOpenShaarli(): void
@@ -116,7 +116,7 @@ class LoginControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./'], $result->getHeader('Location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('Location'));
     }
 
     public function testLoginControllerWhileBanned(): void
index 1242a2e943ff04cc8edadba9cefc6a5424b20388..43076086999dc9e8ee08f606ef4bed4731dbc32b 100644 (file)
@@ -64,7 +64,7 @@ class TagControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./?searchtags=abc'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/?searchtags=abc'], $result->getHeader('location'));
     }
 
     public function testAddTagRemoveLegacyQueryParam(): void
@@ -138,7 +138,7 @@ class TagControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('location'));
     }
 
     public function testRemoveTagWithoutMatchingTag(): void
@@ -184,7 +184,7 @@ class TagControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('location'));
     }
 
     public function testRemoveTagWithoutTag(): void
@@ -210,6 +210,6 @@ class TagControllerTest extends TestCase
 
         static::assertInstanceOf(Response::class, $result);
         static::assertSame(302, $result->getStatusCode());
-        static::assertSame(['./'], $result->getHeader('location'));
+        static::assertSame(['/subfolder/'], $result->getHeader('location'));
     }
 }
index c37827f4c126c60dad89943658ab390bb3365882..67d3ebd1c3f14e5d2dae92da82a2caf93d0178bb 100644 (file)
@@ -9,7 +9,7 @@
   <div class="pure-u-lg-1-3 pure-u-1-24"></div>
   <div id="addlink-form" class="page-form  page-form-light pure-u-lg-1-3 pure-u-22-24">
     <h2 class="window-title">{"Shaare a new link"|t}</h2>
-    <form method="GET" action="{$base_path}/shaare" name="addform" class="addform">
+    <form method="GET" action="{$base_path}/admin/shaare" name="addform" class="addform">
       <div>
         <label for="shaare">{'URL or leave empty to post a note'|t}</label>
         <input type="text" name="post" id="shaare" class="autofocus">
index 80d2f2e115e9005930a0551ba4ecbae74141c11a..736774f37948a60617dbfb7a94304093b2d1a8d5 100644 (file)
@@ -9,7 +9,7 @@
   <div class="pure-u-lg-1-3 pure-u-1-24"></div>
   <div id="addlink-form" class="page-form page-form-light pure-u-lg-1-3 pure-u-22-24">
     <h2 class="window-title">{"Change password"|t}</h2>
-    <form method="POST" action="{$base_path}/password" name="changepasswordform" id="changepasswordform">
+    <form method="POST" action="{$base_path}/admin/password" name="changepasswordform" id="changepasswordform">
       <div>
         <input type="password" name="oldpassword" aria-label="{'Current password'|t}" placeholder="{'Current password'|t}" class="autofocus">
       </div>
index 4e3059d3655e6e506e151d3c829ef4cc0d838ba5..16c558969a085dd5549cf6a64a53da60177a7f33 100644 (file)
@@ -9,7 +9,7 @@
   <div class="pure-u-lg-1-3 pure-u-1-24"></div>
   <div id="addlink-form" class="page-form page-form-light pure-u-lg-1-3 pure-u-22-24">
     <h2 class="window-title">{"Manage tags"|t}</h2>
-    <form method="POST" action="{$base_path}/manage-tags" name="changetag" id="changetag">
+    <form method="POST" action="{$base_path}/admin/tags" name="changetag" id="changetag">
       <div>
         <input type="text" name="fromtag" aria-label="{'Tag'|t}" placeholder="{'Tag'|t}" value="{$fromtag}"
                list="tagsList" autocomplete="off" class="awesomplete autofocus" data-minChars="1">
@@ -32,7 +32,7 @@
       </div>
     </form>
 
-    <p>{'You can also edit tags in the'|t} <a href="{$base_path}/tag-list?sort=usage">{'tag list'|t}</a>.</p>
+    <p>{'You can also edit tags in the'|t} <a href="{$base_path}/tags/list?sort=usage">{'tag list'|t}</a>.</p>
   </div>
 </div>
 {include="page.footer"}
index 9b4401a429178f68f43f96750e5cca6934abaa2c..fa1f7aa646d635d3deaa0e29b3be8ba01baaa910 100644 (file)
@@ -11,7 +11,7 @@
 {$ratioInput='7-12'}
 {$ratioInputMobile='1-8'}
 
-<form method="POST" action="{$base_path}/configure" name="configform" id="configform">
+<form method="POST" action="{$base_path}/admin/configure" name="configform" id="configform">
   <div class="pure-g">
     <div class="pure-u-lg-1-8 pure-u-1-24"></div>
     <div class="pure-u-lg-3-4 pure-u-22-24 page-form page-form-complete">
index f3adcbb0728771135512213f9f574d09a940931e..15edb00d6a80fe3f154671f329f395dced26e7b8 100644 (file)
@@ -9,7 +9,7 @@
     <div class="pure-u-lg-1-5 pure-u-1-24"></div>
     <form method="post"
           name="linkform"
-          action="{$base_path}/shaare"
+          action="{$base_path}/admin/shaare"
           class="page-form pure-u-lg-3-5 pure-u-22-24 page-form page-form-light"
     >
       <h2 class="window-title">
@@ -73,7 +73,7 @@
         <input type="submit" name="save_edit" class="" id="button-save-edit"
                value="{if="$link_is_new"}{'Save'|t}{else}{'Apply Changes'|t}{/if}">
         {if="!$link_is_new"}
-        <a href="{$base_path}/?delete_link&amp;lf_linkdate={$link.id}&amp;token={$token}"
+        <a href="{$base_path}/admin/shaare/delete?id={$link.id}&amp;token={$token}"
            title="" name="delete_link" class="button button-red confirm-delete">
           {'Delete'|t}
         </a>
index 0f6a66280fa99c6686cb4f9d50f6866979265a7e..102314d5ddd1ced1efda07cb69112c034feb4b5d 100644 (file)
@@ -3,8 +3,8 @@
 <meta name="format-detection" content="telephone=no" />
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="referrer" content="same-origin">
-<link rel="alternate" type="application/atom+xml" href="{$feedurl}feed-atom?{$searchcrits}#" title="ATOM Feed" />
-<link rel="alternate" type="application/rss+xml" href="{$feedurl}feed-rss?{$searchcrits}#" title="RSS Feed" />
+<link rel="alternate" type="application/atom+xml" href="{$feedurl}feed/atom?{$searchcrits}#" title="ATOM Feed" />
+<link rel="alternate" type="application/rss+xml" href="{$feedurl}feed/rss?{$searchcrits}#" title="RSS Feed" />
 <link href="{$asset_path}/img/favicon.png#" rel="shortcut icon" type="image/png" />
 <link href="{$asset_path}/img/apple-touch-icon.png#" rel="apple-touch-icon" sizes="180x180" />
 <link type="text/css" rel="stylesheet" href="{$asset_path}/css/shaarli.min.css?v={$version_hash}#" />
index 8951359501ad46297e082d9dff0882663cf7a05c..2e2f96d602b53eb147a8641e31613e40f7e2ddb1 100644 (file)
                       <input type="checkbox" class="link-checkbox" value="{$value.id}">
                     </span>
                     <span class="linklist-item-infos-controls-item ctrl-edit">
-                      <a href="{$base_path}/?edit_link={$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
+                      <a href="{$base_path}/admin/shaare/{$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
                     </span>
                     <span class="linklist-item-infos-controls-item ctrl-delete">
-                      <a href="{$base_path}/?delete_link&amp;lf_linkdate={$value.id}&amp;token={$token}" aria-label="{$strDelete}"
+                      <a href="{$base_path}/admin/shaare/delete?id={$value.id}&amp;token={$token}" aria-label="{$strDelete}"
                          title="{$strDelete}" class="delete-link pure-u-0 pure-u-lg-visible confirm-delete">
                         <i class="fa fa-trash" aria-hidden="true"></i>
                       </a>
                 {/if}
                 {if="$is_logged_in"}
                   &middot;
-                  <a href="{$base_path}/?delete_link&amp;lf_linkdate={$value.id}&amp;token={$token}" aria-label="{$strDelete}"
+                  <a href="{$base_path}/admin/shaare/delete?id={$value.id}&amp;token={$token}" aria-label="{$strDelete}"
                      title="{$strDelete}" class="delete-link confirm-delete">
                     <i class="fa fa-trash" aria-hidden="true"></i>
                   </a>
                   &middot;
-                  <a href="{$base_path}/?edit_link={$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
+                  <a href="{$base_path}/admin/shaare/{$value.id}" aria-label="{$strEdit}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link" aria-hidden="true"></i></a>
                 {/if}
               </div>
             </div>
index 5774d38dfc491f3453f6cd649da578d420b6172b..1c7f279b0d061ff74b310cf79986ebfa57ca0464 100644 (file)
@@ -3,8 +3,8 @@
     <ShortName>Shaarli search - {$pagetitle}</ShortName>
     <Description>Shaarli search - {$pagetitle}</Description>
     <Url type="text/html" template="{$serverurl}?searchterm={searchTerms}" />
-    <Url type="application/atom+xml" template="{$serverurl}feed-atom?searchterm={searchTerms}"/>
-    <Url type="application/rss+xml" template="{$serverurl}feed-rss?searchterm={searchTerms}"/>
+    <Url type="application/atom+xml" template="{$serverurl}feed/atom?searchterm={searchTerms}"/>
+    <Url type="application/rss+xml" template="{$serverurl}feed/rss?searchterm={searchTerms}"/>
     <InputEncoding>UTF-8</InputEncoding>
     <Developer>Shaarli Community - https://github.com/shaarli/Shaarli/</Developer>
     <Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAHRklE
index 7117e3ca2f0e879a5809143f9d15ecf73b30c646..4fe2b69e9609692b19f5dbf4455f7b491bdec8ba 100644 (file)
         </li>
         {if="$is_logged_in || $openshaarli"}
           <li class="pure-menu-item">
-            <a href="{$base_path}/add-shaare" class="pure-menu-link" id="shaarli-menu-shaare">
+            <a href="{$base_path}/admin/add-shaare" class="pure-menu-link" id="shaarli-menu-shaare">
               <i class="fa fa-plus" aria-hidden="true"></i> {'Shaare'|t}
             </a>
           </li>
           <li class="pure-menu-item" id="shaarli-menu-tools">
-            <a href="{$base_path}/tools" class="pure-menu-link">{'Tools'|t}</a>
+            <a href="{$base_path}/admin/tools" class="pure-menu-link">{'Tools'|t}</a>
           </li>
         {/if}
         <li class="pure-menu-item" id="shaarli-menu-tags">
-          <a href="{$base_path}/tag-cloud" class="pure-menu-link">{'Tag cloud'|t}</a>
+          <a href="{$base_path}/tags/cloud" class="pure-menu-link">{'Tag cloud'|t}</a>
         </li>
         {if="$thumbnails_enabled"}
           <li class="pure-menu-item" id="shaarli-menu-picwall">
@@ -52,7 +52,7 @@
           </li>
         {/loop}
         <li class="pure-menu-item pure-u-lg-0 shaarli-menu-mobile" id="shaarli-menu-mobile-rss">
-            <a href="{$base_path}/feed-{$feed_type}?{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a>
+            <a href="{$base_path}/feed/{$feed_type}?{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a>
         </li>
         {if="$is_logged_in"}
           <li class="pure-menu-item pure-u-lg-0 shaarli-menu-mobile" id="shaarli-menu-mobile-logout">
@@ -74,7 +74,7 @@
             </a>
           </li>
           <li class="pure-menu-item" id="shaarli-menu-desktop-rss">
-            <a href="{$base_path}/feed-{$feed_type}?{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}" aria-label="{'RSS Feed'|t}">
+            <a href="{$base_path}/feed/{$feed_type}?{$searchcrits}" class="pure-menu-link" title="{'RSS Feed'|t}" aria-label="{'RSS Feed'|t}">
               <i class="fa fa-rss" aria-hidden="true"></i>
             </a>
           </li>
index 51f42333669273b635ce542533f368da97a6f9e5..99ae44d2487f22a4a339a018968ce883c79b8ed2 100644 (file)
@@ -51,7 +51,7 @@
           <div class="pure-u-1">
             {if="$is_logged_in===true"}
               <a href="#" class="delete-tag" aria-label="{'Delete'|t}"><i class="fa fa-trash" aria-hidden="true"></i></a>&nbsp;&nbsp;
-              <a href="{$base_path}/manage-tags?fromtag={$key|urlencode}" class="rename-tag" aria-label="{'Rename tag'|t}">
+              <a href="{$base_path}/admin/tags?fromtag={$key|urlencode}" class="rename-tag" aria-label="{'Rename tag'|t}">
                 <i class="fa fa-pencil-square-o {$key}" aria-hidden="true"></i>
               </a>
             {/if}
index 6cb1a1143ab31d4d8a9d00b1ed7dc6bac2bd26b2..8718b188370c6008f5edd77334378242a4b92b3b 100644 (file)
@@ -1,8 +1,8 @@
 <div class="pure-g">
   <div class="pure-u-1 pure-alert pure-alert-success tag-sort">
     {'Sort by:'|t}
-    <a href="{$base_path}/tag-cloud">{'Cloud'|t}</a> &middot;
-    <a href="{$base_path}/tag-list?sort=usage">{'Most used'|t}</a> &middot;
-    <a href="{$base_path}/tag-list?sort=alpha">{'Alphabetical'|t}</a>
+    <a href="{$base_path}/tags/cloud">{'Cloud'|t}</a> &middot;
+    <a href="{$base_path}/tags/list?sort=usage">{'Most used'|t}</a> &middot;
+    <a href="{$base_path}/tags/list?sort=alpha">{'Alphabetical'|t}</a>
   </div>
 </div>
index 296abed1afad57f641783b71c7333a8f4aea99ab..fd58cca9bd8430feab9e329ab8c426ed5de7dcc6 100644 (file)
@@ -11,7 +11,7 @@
   <div class="pure-u-lg-1-3 pure-u-22-24 page-form page-form-light">
     <h2 class="window-title">{'Settings'|t}</h2>
     <div class="tools-item">
-      <a href="{$base_path}/configure" title="{'Change Shaarli settings: title, timezone, etc.'|t}">
+      <a href="{$base_path}/admin/configure" title="{'Change Shaarli settings: title, timezone, etc.'|t}">
         <span class="pure-button pure-u-lg-2-3 pure-u-3-4">{'Configure your Shaarli'|t}</span>
       </a>
     </div>
     </div>
     {if="!$openshaarli"}
       <div class="tools-item">
-        <a href="{$base_path}/?do=changepasswd" title="{'Change your password'|t}">
+        <a href="{$base_path}/admin/password" title="{'Change your password'|t}">
           <span class="pure-button pure-u-lg-2-3 pure-u-3-4">{'Change password'|t}</span>
         </a>
       </div>
     {/if}
     <div class="tools-item">
-      <a href="{$base_path}/manage-tags" title="{'Rename or delete a tag in all links'|t}">
+      <a href="{$base_path}/admin/tags" title="{'Rename or delete a tag in all links'|t}">
         <span class="pure-button pure-u-lg-2-3 pure-u-3-4">{'Manage tags'|t}</span>
       </a>
     </div>
index e1d652255763833b784bc06aa8c40e59cd175af4..ade08c7c69cfc108e1944b96d036dfc2e451edc3 100644 (file)
@@ -5,7 +5,7 @@
 <div id="pageheader">
        {include="page.header"}
        <div id="headerform">
-               <form method="GET" action="{$base_path}/shaare" name="addform" class="addform">
+               <form method="GET" action="{$base_path}/admin/shaare" name="addform" class="addform">
                        <input type="text" name="post" class="linkurl">
                        <input type="submit" value="Add link" class="bigbutton">
                </form>
index 593fe71a25a424cc27a1eaee345885056ed03ce1..f751d50b055968123334cd3c4a3e48a39b6d1edb 100644 (file)
@@ -48,7 +48,7 @@
             {/if}
             <input type="submit" value="Save" name="save_edit" class="bigbutton">
             {if="!$link_is_new && isset($link.id)"}
-              <a href="{$base_path}/?delete_link&amp;lf_linkdate={$link.id}&amp;token={$token}"
+              <a href="{$base_path}/admin/shaare/delete?id={$link.id}&amp;token={$token}"
                  name="delete_link" class="bigbutton"
                  onClick="return confirmDeleteLink();">
                 {'Delete'|t}
index 7c4d9311d60d3dbdccbcaa7d1a558eedc2aa4c94..aa2381c6e307710fab555c161c9bfeabf2580614 100644 (file)
@@ -3,8 +3,8 @@
 <meta name="format-detection" content="telephone=no" />
 <meta name="viewport" content="width=device-width,initial-scale=1.0" />
 <meta name="referrer" content="same-origin">
-<link rel="alternate" type="application/rss+xml" href="{$feedurl}feed-rss?{$searchcrits}#" title="RSS Feed" />
-<link rel="alternate" type="application/atom+xml" href="{$feedurl}feed-atom?{$searchcrits}#" title="ATOM Feed" />
+<link rel="alternate" type="application/rss+xml" href="{$feedurl}feed/rss?{$searchcrits}#" title="RSS Feed" />
+<link rel="alternate" type="application/atom+xml" href="{$feedurl}feed/atom?{$searchcrits}#" title="ATOM Feed" />
 <link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon" />
 <link type="text/css" rel="stylesheet" href="css/shaarli.min.css" />
 {if="$formatter==='markdown'"}
index 5774d38dfc491f3453f6cd649da578d420b6172b..1c7f279b0d061ff74b310cf79986ebfa57ca0464 100644 (file)
@@ -3,8 +3,8 @@
     <ShortName>Shaarli search - {$pagetitle}</ShortName>
     <Description>Shaarli search - {$pagetitle}</Description>
     <Url type="text/html" template="{$serverurl}?searchterm={searchTerms}" />
-    <Url type="application/atom+xml" template="{$serverurl}feed-atom?searchterm={searchTerms}"/>
-    <Url type="application/rss+xml" template="{$serverurl}feed-rss?searchterm={searchTerms}"/>
+    <Url type="application/atom+xml" template="{$serverurl}feed/atom?searchterm={searchTerms}"/>
+    <Url type="application/rss+xml" template="{$serverurl}feed/rss?searchterm={searchTerms}"/>
     <InputEncoding>UTF-8</InputEncoding>
     <Developer>Shaarli Community - https://github.com/shaarli/Shaarli/</Developer>
     <Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAHRklE
index 0f79d321736000d715eef8c959907f87bc99ad12..1c00d19b94dfc1cb2e71f93372bc636dc5654b60 100644 (file)
 <li><a href="{$titleLink}" class="nomobile">Home</a></li>
     {if="$is_logged_in"}
     <li><a href="{$base_path}/logout">Logout</a></li>
-    <li><a href="{$base_path}/tools">Tools</a></li>
-    <li><a href="{$base_path}/add-shaare">Add link</a></li>
+    <li><a href="{$base_path}/admin/tools">Tools</a></li>
+    <li><a href="{$base_path}/admin/add-shaare">Add link</a></li>
     {elseif="$openshaarli"}
-    <li><a href="{$base_path}/tools">Tools</a></li>
-    <li><a href="{$base_path}/add-shaare">Add link</a></li>
+    <li><a href="{$base_path}/admin/tools">Tools</a></li>
+    <li><a href="{$base_path}/admin/add-shaare">Add link</a></li>
     {else}
     <li><a href="{$base_path}/login">Login</a></li>
     {/if}
-    <li><a href="{$feedurl}/feed-rss?{$searchcrits}" class="nomobile">RSS Feed</a></li>
+    <li><a href="{$feedurl}/feed/rss?{$searchcrits}" class="nomobile">RSS Feed</a></li>
     {if="$showatom"}
-    <li><a href="{$feedurl}/feed-atom?{$searchcrits}" class="nomobile">ATOM Feed</a></li>
+    <li><a href="{$feedurl}/feed/atom?{$searchcrits}" class="nomobile">ATOM Feed</a></li>
     {/if}
-    <li><a href="{$base_path}/tag-cloud">Tag cloud</a></li>
+    <li><a href="{$base_path}/tags/cloud">Tag cloud</a></li>
     <li><a href="{$base_path}/picture-wall{function="ltrim($searchcrits, '&')"}">Picture wall</a></li>
     <li><a href="{$base_path}/daily">Daily</a></li>
     {loop="$plugins_header.buttons_toolbar"}
index 9caea9cf5b4b6344359357147a89e33f10098cd7..32707efacb151216d929c6063c7b8b99d8b29289 100644 (file)
@@ -5,13 +5,13 @@
 <div id="pageheader">
        {include="page.header"}
        <div id="toolsdiv">
-               <a href="{$base_path}/configure"><b>Configure your Shaarli</b><span>: Change Title, timezone...</span></a>
+               <a href="{$base_path}/admin/configure"><b>Configure your Shaarli</b><span>: Change Title, timezone...</span></a>
                <br><br>
                <a href="{$base_path}/?do=pluginadmin"><b>Plugin administration</b><span>: Enable, disable and configure plugins.</span></a>
     <br><br>
-               {if="!$openshaarli"}<a href="{$base_path}/?do=changepasswd"><b>Change password</b><span>: Change your password.</span></a>
+               {if="!$openshaarli"}<a href="{$base_path}/admin/password"><b>Change password</b><span>: Change your password.</span></a>
     <br><br>{/if}
-               <a href="{$base_path}/manage-tags"><b>Rename/delete tags</b><span>: Rename or delete a tag in all links</span></a>
+               <a href="{$base_path}/admin/tags"><b>Rename/delete tags</b><span>: Rename or delete a tag in all links</span></a>
     <br><br>
                <a href="{$base_path}/?do=import"><b>Import</b><span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a>
     <br><br>