aboutsummaryrefslogtreecommitdiffstats
path: root/query.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--query.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/query.php b/query.php
index 6aa8ee0..3145472 100644
--- a/query.php
+++ b/query.php
@@ -1,6 +1,7 @@
<?php
include('scrapers/wallhaven.php');
include('style/header.php');
+ include('misc/tools.php');
$config = require('config.php');
$_SERVER['REQUEST_URI'] = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
@@ -21,6 +22,20 @@
$_GET["page"] ? $page = $_GET["page"] : $page = 1;
$res = getwallpapers("https://wallhaven.cc/api/v1/search?q=".$_GET["q"]."&purity=".$purity."&categories=".$categories."&page=".$page);
+ /* explain query */
+ /* 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");
if (!$res[0])