From 39dd311cee2255c6cc41d656007f395784e44d31 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 26 Dec 2023 22:58:20 -0500 Subject: feat:explain the users query --- query.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'query.php') diff --git a/query.php b/query.php index 41cc918..2cfa97f 100644 --- a/query.php +++ b/query.php @@ -1,6 +1,7 @@

%s Wallpapers found for \"%s\"

", $res[1]["total"], $_GET["q"], humanquery($_GET["q"], $_GET["NSFW"] ? true : false)); + /* display wallpapers */ printf("
\n"); if (!$res[0]) -- cgit v1.2.1 From ef04bbb568f877f8d9604a361c05504be55b689f Mon Sep 17 00:00:00 2001 From: Squibid Date: Wed, 27 Dec 2023 00:18:07 -0500 Subject: make the english make sense in the context --- query.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'query.php') 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("

%s Wallpapers found for \"%s\"

", $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("
"); + $humanreadable = humanquery($_GET["q"], $_GET["NSFW"] ? true : false); + if (!$_GET["q"]) + printf("

%s Wallpapers found", $res[1]["total"]); + else { + if (preg_match("/like:/", $_GET["q"])) + printf("

%s Wallpapers found \"%s\"

", $res[1]["total"], $_GET["q"], $humanreadable); + else + printf("

%s Wallpapers found for \"%s\"

", $res[1]["total"], $_GET["q"], $humanreadable); + } + printf("
"); /* display wallpapers */ printf("
\n"); -- cgit v1.2.1