summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php176
1 files changed, 176 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100755
index 0000000..7e3915c
--- /dev/null
+++ b/index.php
@@ -0,0 +1,176 @@
+<?php
+
+function timeAgo($time): string {
+ if (!is_numeric($time)) {
+ $time = strtotime($time);
+ }
+
+ $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"];
+ $lengths = array("60", "60", "24", "7", "4.35", "12", "100");
+
+ $now = time();
+
+ $difference = $now - $time;
+ if ($difference <= 10 && $difference >= 0) {
+ return $tense = "today";
+ } elseif ($difference > 0) {
+ $tense = "ago";
+ } else {
+ $tense = "later";
+ }
+
+ for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
+ $difference /= $lengths[$j];
+ }
+
+ $difference = round($difference);
+
+ $period = $periods[$j] . ($difference >1 ? "s" :'');
+ if ($period === "second" || $period === "seconds" || $period === "minute" || $period === "minutes" || $period === "hour" || $period === "hours") {
+ return "today";
+ } else {
+ return "{$difference} {$period} {$tense}";
+ }
+}
+
+?>
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport"
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
+ <title>Foxperson</title>
+ <link href="/style.css" rel="stylesheet">
+</head>
+<body>
+ <div class="mt-4 p-5 bg-dark text-white rounded text-center" id="fxp-banner">
+ <h1>
+ <img src="/banner.png" alt="Foxperson" id="fxp-banner-img">
+ </h1>
+ <h3 id="fxp-banner-tagline">Dodge monsters and catch furballs!</h3>
+ </div>
+
+ <br>
+ <div class="container">
+ <div class="alert alert-warning"><b>Foxperson is now available as a release candidate.</b> You may still encounter bugs or unfinished features. <a href="https://youtrack.minteck.org/issues/FXP" target="_blank">Report bugs.</a></div>
+
+ <br>
+ <?php $versions = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/versions.json"), true); $latest = $versions[0]; ?>
+ <h2><?= $latest["name"] ?><small> (<?= $latest["version"] ?>, #<?= $latest["build"] ?>)</small></h2>
+ <p>Released <?= date("F jS, Y", strtotime($latest["date"])) ?> (<?= timeAgo(strtotime($latest["date"])) ?>)</p>
+
+ <div id="fxp-latest-download" class="list-group">
+ <div class="list-group-item" id="fxp-download-windows">
+ <div class="fxp-download-text" id="fxp-download-windows-text">
+ <img src="/windows.png" id="fxp-download-windows-icon" alt="" class="fxp-platform-icon"> <span id="fxp-download-windows-name" class="fxp-platform-name">Windows<span class="fxp-platform-arch text-muted" id="fxp-download-windows-arch"> (x86 64bit)</span></span>
+ </div>
+ <div class="fxp-download-buttons">
+ <a <?php
+
+ if (!is_null($latest["download"]["windows"])) {
+ echo('href="' . $latest["download"]["windows"] . '" class="fxp-download-button btn btn-primary"');
+ } else {
+ echo('class="fxp-download-button btn btn-primary disabled"');
+ }
+
+ ?> id="fxp-download-windows-button">
+ Download
+ </a>
+ </div>
+ </div>
+
+ <div class="list-group-item" id="fxp-download-linux">
+ <div class="fxp-download-text" id="fxp-download-linux-text">
+ <img src="/linux.png" id="fxp-download-linux-icon" alt="" class="fxp-platform-icon"> <span id="fxp-download-linux-name" class="fxp-platform-name">Linux<span class="fxp-platform-arch text-muted" id="fxp-download-linux-arch"> (x86 64bit)</span></span>
+ </div>
+ <div class="fxp-download-buttons">
+ <a <?php
+
+ if (!is_null($latest["download"]["linux"])) {
+ echo('href="' . $latest["download"]["linux"] . '" class="fxp-download-button btn btn-primary"');
+ } else {
+ echo('class="fxp-download-button btn btn-primary disabled"');
+ }
+
+ ?> id="fxp-download-linux-button">
+ Download
+ </a>
+ </div>
+ </div>
+
+ <div class="list-group-item" id="fxp-download-mac">
+ <div class="fxp-download-text" id="fxp-download-mac-text">
+ <img src="/mac.png" id="fxp-download-mac-icon" alt="" class="fxp-platform-icon"> <span id="fxp-download-mac-name" class="fxp-platform-name">macOS<span class="fxp-platform-arch text-muted" id="fxp-download-mac-arch"> (Universal)</span></span>
+ </div>
+ <div class="fxp-download-buttons">
+ <a <?php
+
+ if (!is_null($latest["download"]["mac"])) {
+ echo('href="' . $latest["download"]["mac"] . '" class="fxp-download-button btn btn-primary"');
+ } else {
+ echo('class="fxp-download-button btn btn-primary disabled"');
+ }
+
+ ?> id="fxp-download-mac-button">
+ Download
+ </a>
+ </div>
+ </div>
+
+ <div class="list-group-item" id="fxp-download-android">
+ <div class="fxp-download-text" id="fxp-download-android-text">
+ <img src="/android.png" id="fxp-download-android-icon" alt="" class="fxp-platform-icon"> <span id="fxp-download-android-name" class="fxp-platform-name">Android</span>
+ </div>
+ <div class="fxp-download-buttons">
+ <a href="https://play.google.com/store/apps/details?id=org.minteck.fluff" target="_blank" class="fxp-download-button btn btn-primary" id="fxp-download-android-button-1">
+ Google Play
+ </a>
+ <a <?php
+
+ if (!is_null($latest["download"]["android"])) {
+ echo('href="' . $latest["download"]["android"] . '" class="fxp-download-button btn btn-primary"');
+ } else {
+ echo('class="fxp-download-button btn btn-primary disabled"');
+ }
+
+ ?> id="fxp-download-android-button-2">
+ Download APK
+ </a>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <h3>Older Releases</h3>
+ <div class="list-group">
+ <?php array_shift($versions); foreach ($versions as $version): ?>
+ <div class="list-group-item">
+ <span style="display:inline-block;vertical-align: middle;margin-top:6px;">
+ <?= $version["name"] ?> <span class="text-muted">(<?= $version["version"] ?>)</span>
+ </span>
+ <div class="btn-group" style="float:right;">
+ <a href="<?= !is_null($version["download"]["windows"]) ? $version["download"]["windows"] : "#" ?>" class="btn btn-primary <?= is_null($version["download"]["windows"]) ? "disabled" : "" ?>">
+ <img src="/windows.png" alt="Windows" style="width:24px;height:24px;filter:invert(1);color:black;">
+ </a>
+ <a href="<?= !is_null($version["download"]["linux"]) ? $version["download"]["linux"] : "#" ?>" class="btn btn-primary <?= is_null($version["download"]["linux"]) ? "disabled" : "" ?>">
+ <img src="/linux.png" alt="Linux" style="width:24px;height:24px;filter:invert(1);color:black;">
+ </a>
+ <a href="<?= !is_null($version["download"]["mac"]) ? $version["download"]["mac"] : "#" ?>" class="btn btn-primary <?= is_null($version["download"]["mac"]) ? "disabled" : "" ?>">
+ <img src="/mac.png" alt="macOS" style="width:24px;height:24px;filter:invert(1);color:black;">
+ </a>
+ <a href="<?= !is_null($version["download"]["android"]) ? $version["download"]["android"] : "#" ?>" class="btn btn-primary <?= is_null($version["download"]["android"]) ? "disabled" : "" ?>">
+ <img src="/android.png" alt="Android" style="width:24px;height:24px;filter:invert(1);color:black;">
+ </a>
+ </div>
+ </div>
+ <?php endforeach; ?>
+ </div>
+
+ <br>
+ <br>
+ </div>
+</body>
+</html> \ No newline at end of file