aboutsummaryrefslogtreecommitdiffstats
path: root/query.php
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-12-27 00:18:07 -0500
committerSquibid <me@zacharyscheiman.com>2023-12-27 00:18:07 -0500
commitef04bbb568f877f8d9604a361c05504be55b689f (patch)
tree14605ef56a18f312f4924aca5560397f15648954 /query.php
parent39dd311cee2255c6cc41d656007f395784e44d31 (diff)
downloadwallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.tar.gz
wallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.tar.bz2
wallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.zip
make the english make sense in the context
Diffstat (limited to 'query.php')
-rw-r--r--query.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/query.php b/query.php
index 2cfa97f..0d55f1c 100644
--- a/query.php
+++ b/query.php
@@ -23,7 +23,18 @@
$res = getwallpapers("https://wallhaven.cc/api/v1/search?q=".$_GET["q"]."&purity=".$purity."&categories=".$categories."&page=".$page);
/* explain query */
- printf("<div id='queryinfo'><p>%s Wallpapers found for \"<a href='/query.php?q=%s'>%s</a>\"</p></div>", $res[1]["total"], $_GET["q"], humanquery($_GET["q"], $_GET["NSFW"] ? true : false));
+ /* HACK: really disgusting code might make it better but for now it works */
+ printf("<div id='queryinfo'>");
+ $humanreadable = humanquery($_GET["q"], $_GET["NSFW"] ? true : false);
+ if (!$_GET["q"])
+ printf("<p>%s Wallpapers found", $res[1]["total"]);
+ else {
+ if (preg_match("/like:/", $_GET["q"]))
+ printf("<p>%s Wallpapers found \"<a href='/query.php?q=%s'>%s</a>\"</p>", $res[1]["total"], $_GET["q"], $humanreadable);
+ else
+ printf("<p>%s Wallpapers found for \"<a href='/query.php?q=%s'>%s</a>\"</p>", $res[1]["total"], $_GET["q"], $humanreadable);
+ }
+ printf("</div>");
/* display wallpapers */
printf("<div id='wallpapers'>\n");