From 1428652b84c2541335d68216a22f0fcd321b4938 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 3 Aug 2024 17:42:04 +0100 Subject: [PATCH] Some minor updates to the site and search API. --- cgi-bin/searchapi.cgi | 17 ++++++++++++++- html/donors.php | 48 ++++++++++++++++++++++++++++++++++++++++++ html/header.php | 8 +++++++ html/includes/vars.php | 6 +++++- html/search.shtml | 11 ++++++++-- 5 files changed, 86 insertions(+), 4 deletions(-) diff --git a/cgi-bin/searchapi.cgi b/cgi-bin/searchapi.cgi index 513505b..b6bfa43 100755 --- a/cgi-bin/searchapi.cgi +++ b/cgi-bin/searchapi.cgi @@ -89,7 +89,22 @@ else [[ "${ITEM/$STORAGE_PREFIX}" == "$QS_p" ]] && continue # List the item. - printf "%s\\n" "${ITEM/$STORAGE_PREFIX}" + if [[ -f "$ITEM" ]]; then + # File type. + printf "%s %s\\n" "f" "${ITEM/$STORAGE_PREFIX}" + elif [[ -d "$ITEM" ]]; then + # Directory type. + printf "%s %s\\n" "d" "${ITEM/$STORAGE_PREFIX}" + elif [[ -L "$ITEM" ]]; then + # Symbolic link type. + printf "%s %s\\n" "l" "${ITEM/$STORAGE_PREFIX}" + elif [[ -e "$ITEM" ]]; then + # Other type. + printf "%s %s\\n" "o" "${ITEM/$STORAGE_PREFIX}" + else + # Stale file in database. + printf "%s %s\\n" "?" "${ITEM/$STORAGE_PREFIX}" + fi (( I++ )) done < <(locate -A -d "$LOCATE_DB" -i -l "$(( QS_l * 2 ))" "$STORAGE_PREFIX/${QS_p##/}" $QS_q | sort) diff --git a/html/donors.php b/html/donors.php index 704ee6d..2aea0fe 100644 --- a/html/donors.php +++ b/html/donors.php @@ -29,6 +29,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 25th July 2024 + + M W Magee +
+ 3rd June 2024 + + Karl Gunnar Hammarlund +
+ 15th May 2024 + + Tomasz Szewczyk +
+ 27th March 2024 + + Raul Nevarez Garay +
+ 3rd March 2024 + + Richard Barnes +
+ 30th November 2023 + + Eduardo Alberto Castillo +
20th September 2023 diff --git a/html/header.php b/html/header.php index 8297d6d..e12c496 100644 --- a/html/header.php +++ b/html/header.php @@ -51,6 +51,14 @@ This service is primarily intended to provide a mirror service for Slackware Linux based projects. If you run a Slackware based project, or have a suggestion for a project which may benefit from being mirrored here, please message with full details.
+ Speedtest: + + Curious about the speed you might get downloading from Slackware UK? Try the new speedtest! +
Patronage & Donations: diff --git a/html/includes/vars.php b/html/includes/vars.php index 1a08ea3..7c60d9d 100644 --- a/html/includes/vars.php +++ b/html/includes/vars.php @@ -4,7 +4,11 @@ $title = "Index"; $description = "UK Slackware Linux and Slackware based projects hosting & mirror service"; $keywords = "Slackware UK, Slackware64 UK, Slackware, Slackware64, Slackware Linux, Slackware mirror, Slackware mirrors, Slackware hosting"; - } elseif (preg_match (":^/s(earch)?$:", $_SERVER['REQUEST_URI'])) { + } elseif (preg_match (":^/s(earch)?(\?.*)?$:", $_SERVER['REQUEST_URI'])) { + $title = "Search Results"; + $description = "Search Results"; + $keywords = "Slackware Linux, Slackware mirror, Slackware mirrors, Slackware hosting, Slackware, Slackware64, Slackware UK, Slackware64 UK"; + } elseif (preg_match (":^/html/search\.shtml(\?.*)?$:", $_SERVER['REQUEST_URI'])) { $title = "Search Results"; $description = "Search Results"; $keywords = "Slackware Linux, Slackware mirror, Slackware mirrors, Slackware hosting, Slackware, Slackware64, Slackware UK, Slackware64 UK"; diff --git a/html/search.shtml b/html/search.shtml index a03553d..c814857 100644 --- a/html/search.shtml +++ b/html/search.shtml @@ -76,8 +76,15 @@ /* Read the results and turn into urls */ $count = 0; while ($result_line = stream_get_line ($fh, 0, "\n")) { - print ("• $result_line
"); - $count++; + $type = strtok ($result_line, " "); + $entry = strtok ("\n"); + if ($type == "f" || $type == "l" || $type == "o") { + print ("• $entry
"); + $count++; + } elseif ($type == "d") { + print ("• $entry (Repeat search in this directory)
"); + $count++; + } } /* Output a total */ if ($count == 0) {