]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Remove legacy handling of /add-tag route
authorArthurHoaro <arthur@hoa.ro>
Mon, 18 May 2020 10:21:43 +0000 (12:21 +0200)
committerArthurHoaro <arthur@hoa.ro>
Thu, 23 Jul 2020 19:19:21 +0000 (21:19 +0200)
index.php

index 9dc67c4b35926f608d44719250f3be9437de2f1c..5d689ccb36508aa841611c55cc87fe2e06e61706 100644 (file)
--- a/index.php
+++ b/index.php
@@ -486,45 +486,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
 
     // -------- User clicks on a tag in a link: The tag is added to the list of searched tags (searchtags=...)
     if (isset($_GET['addtag'])) {
-        // Get previous URL (http_referer) and add the tag to the searchtags parameters in query.
-        if (empty($_SERVER['HTTP_REFERER'])) {
-            // In case browser does not send HTTP_REFERER
-            header('Location: ?searchtags='.urlencode($_GET['addtag']));
-            exit;
-        }
-        parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $params);
-
-        // Prevent redirection loop
-        if (isset($params['addtag'])) {
-            unset($params['addtag']);
-        }
-
-        // Check if this tag is already in the search query and ignore it if it is.
-        // Each tag is always separated by a space
-        if (isset($params['searchtags'])) {
-            $current_tags = explode(' ', $params['searchtags']);
-        } else {
-            $current_tags = array();
-        }
-        $addtag = true;
-        foreach ($current_tags as $value) {
-            if ($value === $_GET['addtag']) {
-                $addtag = false;
-                break;
-            }
-        }
-        // Append the tag if necessary
-        if (empty($params['searchtags'])) {
-            $params['searchtags'] = trim($_GET['addtag']);
-        } elseif ($addtag) {
-            $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']);
-        }
-
-        // We also remove page (keeping the same page has no sense, since the
-        // results are different)
-        unset($params['page']);
-
-        header('Location: ?'.http_build_query($params));
+        header('Location: ./add-tag/'. $_GET['addtag']);
         exit;
     }