diff --git a/engines/google/text.php b/engines/google/text.php index 070e046..a83c23c 100644 --- a/engines/google/text.php +++ b/engines/google/text.php @@ -8,7 +8,7 @@ $results = array(); $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; $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; @@ -72,13 +72,16 @@ curl_multi_exec($mh, $running); } while ($running); - if (!$disabled_automatic_redirection - && $config->automatic_redirection - && curl_getinfo($google_ch)['http_code'] == '302') { + if (curl_getinfo($google_ch)['http_code'] != '200') { + if ($automatic_redirection + && $config->automatic_redirection) { $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']))); header("Location: " . $instances[array_rand($instances)] . "search.php?q=$query"); die(); + } else { + return $results; + } } diff --git a/settings.php b/settings.php index 914e456..07169b0 100644 --- a/settings.php +++ b/settings.php @@ -1,7 +1,8 @@ automatic_redirection) : ?>
- - > + + >