aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");