mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 14:09:27 -04:00
added number of results option, fixed a theme name
This commit is contained in:
parent
435af0af0b
commit
d04315009e
3 changed files with 10 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
|||
// Google results will be in this language
|
||||
"google_language_site" => "",
|
||||
"google_language_results" => "",
|
||||
"google_number_of_results" => 10,
|
||||
|
||||
// You can set a language for results in wikipedia
|
||||
"wikipedia_language" => "en",
|
||||
|
|
|
@ -10,23 +10,21 @@
|
|||
$domain = $config->google_domain;
|
||||
$site_language = isset($_COOKIE["google_language_site"]) ? trim(htmlspecialchars($_COOKIE["google_language_site"])) : $config->google_language_site;
|
||||
$results_language = isset($_COOKIE["google_language_results"]) ? trim(htmlspecialchars($_COOKIE["google_language_results"])) : $config->google_language_results;
|
||||
$number_of_results = isset($_COOKIE["google_number_of_results"]) ? trim(htmlspecialchars($_COOKIE["google_number_of_results"])) : $config->google_number_of_results;
|
||||
|
||||
$url = "https://www.google.$domain/search?q=$query_encoded&start=$page";
|
||||
|
||||
if (3 > strlen($site_language) && 0 < strlen($site_language))
|
||||
{
|
||||
$url .= "&hl=$site_language";
|
||||
}
|
||||
|
||||
if (3 > strlen($results_language) && 0 < strlen($results_language))
|
||||
{
|
||||
$url .= "&lr=lang_$results_language";
|
||||
}
|
||||
|
||||
if (3 > strlen($number_of_results) && 0 < strlen($number_of_results))
|
||||
$url .= "&num=$number_of_results";
|
||||
|
||||
if (isset($_COOKIE["safe_search"]))
|
||||
{
|
||||
$url .= "&safe=medium";
|
||||
}
|
||||
|
||||
$google_ch = curl_init($url);
|
||||
curl_setopt_array($google_ch, $config->curl_settings);
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<option value=\"startpage\">Startpage Dark</option>
|
||||
<option value=\"gruvbox\">Gruvbox</option>
|
||||
<option value=\"github_night\">GitHub Night</option>
|
||||
<option value=\"catppucin\">Catppucin</option>";
|
||||
<option value=\"catppuccin\">Catppucin</option>";
|
||||
|
||||
if (isset($_COOKIE["theme"]))
|
||||
{
|
||||
|
@ -115,6 +115,10 @@
|
|||
echo isset($_COOKIE["google_language_results"]) ? htmlspecialchars($_COOKIE["google_language_results"]) : $config->google_language_results;
|
||||
?>">
|
||||
</div>
|
||||
<div>
|
||||
<label>Number of results per page</label>
|
||||
<input type="number" name="google_number_of_results" value="<?php echo isset($_COOKIE["google_number_of_results"]) ? $_COOKIE["google_number_of_results"] : $config->google_number_of_results; ?>" >
|
||||
</div>
|
||||
<div>
|
||||
<label>Safe search</label>
|
||||
<input type="checkbox" name="safe_search" <?php echo isset($_COOKIE["safe_search"]) ? "checked" : ""; ?> >
|
||||
|
|
Loading…
Add table
Reference in a new issue