summaryrefslogtreecommitdiff
path: root/index.php
blob: 7e3915cfc6e4effa12db85ec66b497c25f2b226d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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>