mirror of
https://git.lolcat.ca/lolcat/4get.git
synced 2024-11-14 03:49:48 +01:00
opensearch onion fix
This commit is contained in:
parent
0dc9d62985
commit
81dc93802c
3 changed files with 17 additions and 3 deletions
|
@ -5,14 +5,27 @@ include "data/config.php";
|
||||||
|
|
||||||
$domain =
|
$domain =
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
((isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on" || $_SERVER["HTTPS"] === 1)) ? "https" : "http") .
|
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http") .
|
||||||
'://' . $_SERVER["HTTP_HOST"]
|
'://' . $_SERVER["HTTP_HOST"]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(
|
||||||
|
preg_match(
|
||||||
|
'/\.onion$/',
|
||||||
|
$domain
|
||||||
|
)
|
||||||
|
){
|
||||||
|
|
||||||
|
$onion = true;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$onion = false;
|
||||||
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<?xml version="1.0" encoding="UTF-8"?>' .
|
'<?xml version="1.0" encoding="UTF-8"?>' .
|
||||||
'<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">' .
|
'<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">' .
|
||||||
'<ShortName>' . htmlspecialchars(config::SERVER_NAME) . '</ShortName>' .
|
'<ShortName>' . htmlspecialchars(config::SERVER_NAME) . ($onion ? " (onion)" : "") . '</ShortName>' .
|
||||||
'<InputEncoding>UTF-8</InputEncoding>' .
|
'<InputEncoding>UTF-8</InputEncoding>' .
|
||||||
'<Image width="16" height="16">' . $domain . '/favicon.ico</Image>' .
|
'<Image width="16" height="16">' . $domain . '/favicon.ico</Image>' .
|
||||||
'<Url type="text/html" method="GET" template="' . $domain . '/web?s={searchTerms}"/>';
|
'<Url type="text/html" method="GET" template="' . $domain . '/web?s={searchTerms}"/>';
|
||||||
|
|
|
@ -259,6 +259,7 @@ class qwant{
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close($curlproc);
|
curl_close($curlproc);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ include "data/config.php";
|
||||||
|
|
||||||
$domain =
|
$domain =
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
((isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on" || $_SERVER["HTTPS"] === 1)) ? "https" : "http") .
|
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http") .
|
||||||
'://' . $_SERVER["HTTP_HOST"]
|
'://' . $_SERVER["HTTP_HOST"]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue