X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=5d689ccb36508aa841611c55cc87fe2e06e61706;hb=c56a540c6ef211cd9cb0189ba09911bb77696f28;hp=9dc67c4b35926f608d44719250f3be9437de2f1c;hpb=029ada5a071240fd10f3557fd3c0fc865c54c5a8;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 9dc67c4b..5d689ccb 100644 --- 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; }