Fix checkboxes not unchecking when saving
This commit is contained in:
parent
ff1db195d1
commit
b0f449671d
|
@ -8,7 +8,7 @@
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
$domain = $config->google_domain;
|
$domain = $config->google_domain;
|
||||||
$disable_automatic_redirection = isset($_COOKIE["disable_automatic_redirection"]);
|
$automatic_redirection = isset($_COOKIE["automatic_redirection"]);
|
||||||
$site_language = isset($_COOKIE["google_language_site"]) ? trim(htmlspecialchars($_COOKIE["google_language_site"])) : $config->google_language_site;
|
$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;
|
$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;
|
$number_of_results = isset($_COOKIE["google_number_of_results"]) ? trim(htmlspecialchars($_COOKIE["google_number_of_results"])) : $config->google_number_of_results;
|
||||||
|
@ -72,13 +72,16 @@
|
||||||
curl_multi_exec($mh, $running);
|
curl_multi_exec($mh, $running);
|
||||||
} while ($running);
|
} while ($running);
|
||||||
|
|
||||||
if (!$disabled_automatic_redirection
|
if (curl_getinfo($google_ch)['http_code'] != '200') {
|
||||||
&& $config->automatic_redirection
|
if ($automatic_redirection
|
||||||
&& curl_getinfo($google_ch)['http_code'] == '302') {
|
&& $config->automatic_redirection) {
|
||||||
$instances_json = json_decode(file_get_contents("instances.json"), true);
|
$instances_json = json_decode(file_get_contents("instances.json"), true);
|
||||||
$instances = array_map(fn($n) => $n['clearnet'], array_filter($instances_json['instances'], fn($n) => !is_null($n['clearnet'])));
|
$instances = array_map(fn($n) => $n['clearnet'], array_filter($instances_json['instances'], fn($n) => !is_null($n['clearnet'])));
|
||||||
header("Location: " . $instances[array_rand($instances)] . "search.php?q=$query");
|
header("Location: " . $instances[array_rand($instances)] . "search.php?q=$query");
|
||||||
die();
|
die();
|
||||||
|
} else {
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
$config = require "config.php";
|
$config = require "config.php";
|
||||||
|
|
||||||
if (isset($_REQUEST["reset"]))
|
// Reset all cookies when resetting, or before saving new cookies
|
||||||
|
if (isset($_REQUEST["reset"]) || isset($_REQUEST["save"]))
|
||||||
{
|
{
|
||||||
if (isset($_SERVER["HTTP_COOKIE"]))
|
if (isset($_SERVER["HTTP_COOKIE"]))
|
||||||
{
|
{
|
||||||
|
@ -105,8 +106,8 @@
|
||||||
<div class="settings-textbox-container">
|
<div class="settings-textbox-container">
|
||||||
<?php if ($config->automatic_redirection) : ?>
|
<?php if ($config->automatic_redirection) : ?>
|
||||||
<div>
|
<div>
|
||||||
<label>disable automatic redirection</label>
|
<label>Redirect to other instances if this one doesn't work</label>
|
||||||
<input type="checkbox" name="disable_automatic_redirection" <?php echo isset($_COOKIE["disable_automatic_redirection"]) ? "checked" : ""; ?> >
|
<input type="checkbox" name="automatic_redirection" <?php echo isset($_COOKIE["automatic_redirection"]) ? "checked" : ""; ?> >
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue