From c835a2179b1c7d7c1b03810b3deec06bfec492c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 18 Nov 2013 15:57:17 +0100 Subject: [PATCH] Fix search on non compliant client (Stanza, Moon+ Reader, ...). was broken for at least 6 months. fix #110 --- OPDS_renderer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OPDS_renderer.php b/OPDS_renderer.php index 60f3636..cbd9212 100644 --- a/OPDS_renderer.php +++ b/OPDS_renderer.php @@ -126,15 +126,19 @@ class OPDSRenderer self::renderLink ($link); $link = new LinkNavigation ("?" . $_SERVER['QUERY_STRING'], "self"); self::renderLink ($link); - $urlparam = "?page=" . self::PAGE_OPENSEARCH; + $urlparam = "?"; if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB)); if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) { // Good and compliant way of handling search + $urlparam = addURLParameter ($urlparam, "page", self::PAGE_OPENSEARCH); $link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here"); } else { // Bad way, will be removed when OPDS client are fixed + $urlparam = addURLParameter ($urlparam, "query", "{searchTerms}"); + $urlparam = str_replace ("%7B", "{", $urlparam); + $urlparam = str_replace ("%7D", "}", $urlparam); $link = new Link ($config['cops_full_url'] . 'feed.php' . $urlparam, "application/atom+xml", "search", "Search here"); } self::renderLink ($link);