diff options
author | Squibid <me@zacharyscheiman.com> | 2023-12-27 00:18:07 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-12-27 00:18:07 -0500 |
commit | ef04bbb568f877f8d9604a361c05504be55b689f (patch) | |
tree | 14605ef56a18f312f4924aca5560397f15648954 /query.php | |
parent | 39dd311cee2255c6cc41d656007f395784e44d31 (diff) | |
download | wallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.tar.gz wallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.tar.bz2 wallheaven-ef04bbb568f877f8d9604a361c05504be55b689f.zip |
make the english make sense in the context
Diffstat (limited to '')
-rw-r--r-- | query.php | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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"); |