diff --git a/OPDS_renderer.php b/OPDS_renderer.php index 5a05e88..00fdeb1 100644 --- a/OPDS_renderer.php +++ b/OPDS_renderer.php @@ -133,7 +133,7 @@ class OPDSRenderer if ($page->containsBook () && !is_null ($config['cops_books_filter']) && count ($config['cops_books_filter']) > 0) { $Urlfilter = getURLParam ("tag", ""); foreach ($config['cops_books_filter'] as $lib => $filter) { - $link = new LinkFacet ("?" . $_SERVER['QUERY_STRING'] . "&tag=" . $filter, $lib, localize ("tagword.title"), $filter == $Urlfilter); + $link = new LinkFacet ("?" . addURLParameter ($_SERVER['QUERY_STRING'], "tag", $filter), $lib, localize ("tagword.title"), $filter == $Urlfilter); self::renderLink ($link); } } diff --git a/base.php b/base.php index ae4e559..470a62c 100644 --- a/base.php +++ b/base.php @@ -81,6 +81,17 @@ function localize($phrase, $count=-1) { return $translations[$phrase]; } +function addURLParameter($urlParams, $paramName, $paramValue) { + $params = array(); + parse_str($urlParams, $params); + if (empty ($paramValue)) { + unset ($params[$paramName]); + } else { + $params[$paramName] = $paramValue; + } + return http_build_query($params); +} + class Link { const OPDS_THUMBNAIL_TYPE = "http://opds-spec.org/image/thumbnail"; diff --git a/book.php b/book.php index fd62e12..6832643 100644 --- a/book.php +++ b/book.php @@ -119,7 +119,7 @@ class Book extends Base { public function getFilterString () { $filter = getURLParam ("tag", NULL); - if (is_null ($filter)) return ""; + if (empty ($filter)) return ""; $exists = true; if (preg_match ("/^!(.*)$/", $filter, $matches)) { diff --git a/config_default.php b/config_default.php index 247fed9..4cb57ee 100644 --- a/config_default.php +++ b/config_default.php @@ -139,7 +139,7 @@ /* * Filter on tags to book list */ - $config['cops_books_filter'] = array ("Non lus" => "!Read", "lus" => "Read"); + $config['cops_books_filter'] = array ("Tout" => "", "Non lus" => "!Read", "lus" => "Read"); /* * Custom Columns to add as an array containing the lookup names