aboutsummaryrefslogtreecommitdiffstats
path: root/query.php
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-12-27 14:50:22 -0500
committerSquibid <me@zacharyscheiman.com>2023-12-27 14:50:22 -0500
commitede8620428aa27de24a9a556f5d71ee6a25ac32f (patch)
treec7239fdb1567aac3c291643600abfc4e2121d6ec /query.php
parentc33a109f4846db21ca06e76826064348b9ee77e8 (diff)
parent3274ca1700480fe68ad4ec6ea2e43d5aa6edb543 (diff)
downloadwallheaven-ede8620428aa27de24a9a556f5d71ee6a25ac32f.tar.gz
wallheaven-ede8620428aa27de24a9a556f5d71ee6a25ac32f.tar.bz2
wallheaven-ede8620428aa27de24a9a556f5d71ee6a25ac32f.zip
Merge branch 'dev'HEAD1.0master
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])