Fix search on non compliant client (Stanza, Moon+ Reader, ...). was broken for at least 6 months. fix #110
This commit is contained in:
parent
e659c0dc4f
commit
c835a2179b
|
@ -126,15 +126,19 @@ class OPDSRenderer
|
||||||
self::renderLink ($link);
|
self::renderLink ($link);
|
||||||
$link = new LinkNavigation ("?" . $_SERVER['QUERY_STRING'], "self");
|
$link = new LinkNavigation ("?" . $_SERVER['QUERY_STRING'], "self");
|
||||||
self::renderLink ($link);
|
self::renderLink ($link);
|
||||||
$urlparam = "?page=" . self::PAGE_OPENSEARCH;
|
$urlparam = "?";
|
||||||
if (!is_null (GetUrlParam (DB))) $urlparam = addURLParameter ($urlparam, DB, GetUrlParam (DB));
|
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'])) {
|
if ($config['cops_generate_invalid_opds_stream'] == 0 || preg_match("/(MantanoReader|FBReader)/", $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
// Good and compliant way of handling search
|
// 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");
|
$link = new Link ("feed.php" . $urlparam, "application/opensearchdescription+xml", "search", "Search here");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Bad way, will be removed when OPDS client are fixed
|
// 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");
|
$link = new Link ($config['cops_full_url'] . 'feed.php' . $urlparam, "application/atom+xml", "search", "Search here");
|
||||||
}
|
}
|
||||||
self::renderLink ($link);
|
self::renderLink ($link);
|
||||||
|
|
Loading…
Reference in a new issue