summaryrefslogtreecommitdiffstats
path: root/prog/sear.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-01-11 01:30:12 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2024-01-11 01:30:12 +0100
commite273e389b377aa1d24f7c2dc1f174486ca91d598 (patch)
tree83ef4fcf3d6adad5591c3d4851e2b286d8a279ac /prog/sear.php
parentsear.php (diff)
downloadr-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar.gz
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar.bz2
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar.lz
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar.xz
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.tar.zst
r-e273e389b377aa1d24f7c2dc1f174486ca91d598.zip
Diffstat (limited to 'prog/sear.php')
-rw-r--r--prog/sear.php/index.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/prog/sear.php/index.php b/prog/sear.php/index.php
index cd684b8..487e29d 100644
--- a/prog/sear.php/index.php
+++ b/prog/sear.php/index.php
@@ -218,6 +218,8 @@ function handle_response ($query, $response, $limit, $plaintext, $horseshoe, $ad
$resultshtml = results_html($response["results"], $plaintext, $limit);
die(template($response["query"], $queryinfo, $resultshtml, $response["query"], $add_form, $image));
}
+if (!isset($_REQUEST["debug"]))
+ ini_set('display_errors','Off');
$add_form = "";
$add_url = "";
$q = null;
@@ -234,7 +236,10 @@ if (!empty($_REQUEST["e"])) {
}
if (!empty($_REQUEST["json"])) {
header("Content-Type: application/json");
- die(json_encode(query_google($q, $image, $exact)));
+ $response = query_google($q, $image, $exact);
+ if ($response["status"] == false)
+ http_response_code(500);
+ die(json_encode($response));
}
$limit = false;
if (!empty($_REQUEST["l"])) {
@@ -295,12 +300,15 @@ if ($response["status"] != true) {
if ($json["status"] == false) {
if ($json["code"] == "captcha")
continue;
+ http_response_code(500);
die(template("napaka", "napaka pri posredovanju zahteve", "ker je poizvedba vrnila captcho, sem jo posredoval na drug strežnik, ta pa je vrnil napako " . $json["code"] . ".", $q));
}
handle_response($q, $json, $limit, $plaintext, $horseshoe, $add_url, $add_form, $image);
}
+ http_response_code(500);
die(template("napaka", "iskalno zaledje omejuje iskanja", "iskalno zaledje se je odzvalo s CAPTCHO, češ, da ta instanca prehitro pošilja zahteve. obenem se je enako zgodilo tudi vsem rezervnim strežnikom. iščete lahko ročno preko spletne strani zaledne storitve: <a href='" . htmlspecialchars($response["url"]) . "'>kliknite sem</a>.", $q));
}
+ http_response_code(500);
die(template("napaka", "napaka pri poizvedbi", "poizvedba na iskalno zaledje je vrnila napako " . $response["code"] . ".", $q));
}
handle_response($q, $response, $limit, $plaintext, $horseshoe, $add_url, $add_form, $image);