From cbdb8daef9b4217836132a34286e85099e15d98e Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 22 Aug 2021 00:15:55 +0200 Subject: Commit --- FtechWebring.php | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) diff --git a/FtechWebring.php b/FtechWebring.php index bae77e8..3d61503 100644 --- a/FtechWebring.php +++ b/FtechWebring.php @@ -1,10 +1,134 @@ + +ftww-base { + display: block; + border-radius: 10px; + background-color: rgba(11, 11, 11, .25); + padding: 10px 20px; + margin: 10px 0; + color: white; +} + +ftww-title { + display: block; + font-weight: bold; +} + +ftww-description a { + color: white !important; + text-decoration: underline; +} + +ftww-actions { + display: block; + opacity: .5; +} + +ftww-actions a { + color: white !important; + text-decoration: none; +} + +ftww-disabled { + opacity: .5; + color: white !important; + text-decoration: none; + cursor: not-allowed; +} + +ftww-notice { + border-top: 1px solid rgba(17, 17, 17, .5); + display: block; + margin-top: 5px; + padding-top: 5px; + font-size: small; + text-align: center; +} + + +"); + // We fetch the API $raw = @file_get_contents("https://jae.fi/webring/members"); // If it failed, we stop here -if ($raw === false) { +if ($raw !== false) { // We decode our JSON - $data = json_decode($raw, true); + $sites = json_decode($raw, true); + + // We find the index corresponding to this website + $thisSite = null; + if (isset($_ftww_SiteName) && is_string($_ftww_SiteName)) { // Checking if the required variable is defined + foreach ($sites as $index => $site) { + if ($site["url"] === $_ftww_SiteName) { + $thisSite = $index; + } + } + + if ($thisSite !== null) { // We check if it has found the site in the list + $next = null; + $previous = null; + $random = $sites[rand(0, count($sites) - 1)]["url"]; // This simply selects a random item from the $sites array + + if (isset($sites[$thisSite - 1])) { // We check if there's a previous site in the list + $previous = $sites[$thisSite - 1]["url"]; + } + + if (isset($sites[$thisSite + 1])) { // We check if there's a next site in the list + $next = $sites[$thisSite + 1]["url"]; + } + + echo(" + + "._ftww("Ftech webring", "Anneau Web Ftech")." + "._ftww("This is ", "Il s'agit de ")."".$sites[$thisSite]["name"].""._ftww(", owned by ", "possédé par ").$sites[$thisSite]["owner"]._ftww(". This website is part of the Ftech webring.", ". Ce site Web fait partie de l'anneau Web Ftech.")." + "); + + if (!is_null($previous)) echo("["._ftww("Prev", "Préc")."]\n"); + if (is_null($previous)) echo("["._ftww("You're on the first site", "Vous êtes sur le premier site")."]\n"); + if (!is_null($next)) echo("["._ftww("Next", "Suiv")."]\n"); + if (is_null($next)) echo("["._ftww("You're on the last site", "Vous êtes sur le dernier site")."]\n"); + if (!is_null($random)) echo("["._ftww("Random", "Aléatoire")."]\n"); + + echo(" + + "._ftww($sites[$thisSite]["owner"]." is warning you that other websites on the webring have their own policies that may or may not be the same as the policies from ".$sites[$thisSite]["name"].".", $sites[$thisSite]["owner"]." vous avertit que les autres sites présents sur l'anneau Web disposent de leurs propres politiques qui peuvent ou non être les mêmes que celles de ".$sites[$thisSite]["name"].".")." + + "); + } else { + // We display an error message + echo(" + + "._ftww("The content that was supposed to appear here cannot be loaded due to an internal error. Please contact the website administrator. Error: ", "Le contenu qui était censé apparaître ici ne peut pas être chargé en raison d'une erreur interne. Merci de contacter l'administrateur de ce site Web. Erreur : ")."no such website"." + + "); + } + } else { + // We display an error message + echo(" + + "._ftww("The content that was supposed to appear here cannot be loaded due to an internal error. Please contact the website administrator. Error: ", "Le contenu qui était censé apparaître ici ne peut pas être chargé en raison d'une erreur interne. Merci de contacter l'administrateur de ce site Web. Erreur : ")."_ftww_SiteName is not defined"." + + "); + } +} else { + // We display an error message + echo(" + + "._ftww("The content that was supposed to appear here cannot be loaded due to an internal error. Please contact the website administrator. Error: ", "Le contenu qui était censé apparaître ici ne peut pas être chargé en raison d'une erreur interne. Merci de contacter l'administrateur de ce site Web. Erreur : ")."file_get_contents returned false"." + + "); } \ No newline at end of file -- cgit