index.php 7.75 KB
Newer Older
1
<?php
2

3 4 5 6 7
/**
 * Main entry point for podupti.me.
 */

declare(strict_types=1);
David Morley's avatar
David Morley committed
8

9
use Carbon\Carbon;
10

11
require_once __DIR__ . '/boot.php';
12

13 14 15 16 17 18 19 20
$input      = isset($_GET['input']) ? substr($_GET['input'], 1) : null;
$mapview    = isset($_GET['mapview']) || $input === 'map';
$statsview  = isset($_GET['statsview']) || $input === 'stats';
$podmin     = isset($_GET['podmin']) || $input === 'podmin';
$podminedit = isset($_GET['podminedit']) || $input === 'podminedit';
$edit       = isset($_GET['edit']) || $input === 'edit';
$add        = isset($_GET['add']) || $input === 'add';
$gettoken   = isset($_GET['gettoken']) || $input === 'gettoken';
21
$status     = isset($_GET['status']) || $input === 'status';
22 23
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$fullview   = false;
24

25
?>
26
<!doctype html>
David Morley's avatar
David Morley committed
27
<html lang="en">
28
<head>
29 30
    <meta charset="utf-8">
    <title>Open Source Social Network Pod Uptime Status</title>
David Morley's avatar
David Morley committed
31 32
    <meta name="keywords" content="diaspora, <?php echo $input ?>, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, fediverse, federated network, friendica, hubzilla, open source social, open source social network"/>
    <meta name="description" content="Federated Pod <?php echo $input ?> Live Status. Find a Federated Network pod to sign up for, rate pods, find one close to you!"/>
33 34
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/poduptime.css"/>
David Morley's avatar
David Morley committed
35 36
    <link rel="stylesheet" href="node_modules/ion-rangeslider/css/ion.rangeSlider.css"/>
    <link rel="stylesheet" href="node_modules/ion-rangeslider/css/ion.rangeSlider.skinHTML5.css"/>
37
    <link rel="stylesheet" href="node_modules/featherlight/release/featherlight.min.css"/>
38
    <link rel="stylesheet" href="node_modules/tablesorter/dist/css/theme.bootstrap_4.min.css"/>
39
    <link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-free/css/all.min.css"/>
David Morley's avatar
David Morley committed
40
    <link rel="stylesheet" href="node_modules/fork-awesome/css/fork-awesome.min.css"/>
David Morley's avatar
David Morley committed
41 42
    <meta property="og:url" content="https://<?php echo $_SERVER['HTTP_HOST'] ?>/<?php echo $input ?>"/>
    <meta property="og:title" content="Social Network Pod <?php echo $input ?> Finder"/>
43
    <meta property="og:type" content="website"/>
David Morley's avatar
David Morley committed
44
    <meta property="og:description" content="Federated Network Pod <?php echo $input ?> Live Status. Find a Federated Network pod to sign up for, rate pods, find one close to you!"/>
45 46
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
David Morley's avatar
David Morley committed
47
</head>
David Morley's avatar
David Morley committed
48
<body>
49 50
<?php
$navs = [
51
    'views' => [
David Morley's avatar
David Morley committed
52 53 54 55 56
        ['text' => 'Table View', 'href' => '/', 'active' => $simpleview],
        ['text' => 'Map View', 'href' => '/map', 'active' => $mapview],
        ['text' => 'Network Stats View', 'href' => '/stats', 'active' => $statsview],
        ['text' => 'Add a pod', 'href' => '/podmin', 'active' => $podmin],
        ['text' => 'Edit a pod', 'href' => '/podminedit', 'active' => $podminedit],
57 58
    ],
    'links' => [
David Morley's avatar
David Morley committed
59
        ['text' => 'Git', 'href' => 'https://git.feneas.org/diasporg/Poduptime', 'active' => false],
60
        ['text' => 'Contact', 'href' => 'https://dia.so/support', 'active' => false],
David Morley's avatar
David Morley committed
61 62 63
        ['text' => 'Wiki/API', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
        ['text' => 'More about the Fediverse', 'href' => 'https://fediverse.party', 'active' => false],
        ['text' => 'Federated Networks Association', 'href' => 'https://feneas.org', 'active' => false],
64
    ],
65 66
];
?>
67
<header>
68
    <div class="collapse bg-grey" id="navbarHeader">
69 70 71
        <div class="container">
            <div class="row">
                <div class="col-sm-8 col-md-7 py-4">
72
                    <h4 class="text-black">About</h4>
David Morley's avatar
David Morley committed
73
                    <p class="text-white">Poduptime helps you find a pod to use and join the Fediverse (Federated Network). </p>
David Morley's avatar
David Morley committed
74
                    <ul class="navbar-nav">
75 76 77 78 79 80 81 82 83 84
                        <?php
                        foreach ($navs['links'] as $nav_item) {
                            printf(
                                '<li class="nav-item"><a href="%1$s">%2$s%3$s</a></li>',
                                $nav_item['href'],
                                $nav_item['text'],
                                $nav_item['active'] ? ' <span class="sr-only">(current)</span>' : ''
                            );
                        }
                        ?>
David Morley's avatar
David Morley committed
85
                    </ul>
86 87
                </div>
                <div class="col-sm-4 offset-md-1 py-4">
88
                    <h4 class="text-black">Views</h4>
89
                    <ul class="navbar-nav">
90 91 92 93 94 95 96 97 98 99 100
                        <?php
                        foreach ($navs['views'] as $nav_item) {
                            printf(
                                '<li class="nav-item"><a class="nav-link%1$s" href="%2$s">%3$s%4$s</a></li>',
                                $nav_item['active'] ? ' active' : '',
                                $nav_item['href'],
                                $nav_item['text'],
                                $nav_item['active'] ? ' <span class="sr-only">(current)</span>' : ''
                            );
                        }
                        ?>
101 102 103 104 105
                    </ul>
                </div>
            </div>
        </div>
    </div>
106
    <div class="navbar navbar-dark bg-blue box-shadow">
107 108 109 110
        <div class="container d-flex justify-content-between">
            <a href="/" class="navbar-brand d-flex align-items-center">
                <strong>Poduptime</strong>
            </a>
David Morley's avatar
David Morley committed
111
            <button class="navbar-toggler navbar-custom" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">
112 113 114
                <span class="navbar-toggler-icon"></span>
            </button>
        </div>
115
    </div>
116 117 118
</header>
<main role="main">
    <div class="main">
David Morley's avatar
David Morley committed
119
        <?php
David Morley's avatar
David Morley committed
120
        if ($mapview) {
121
            include_once __DIR__ . '/showmap.php';
David Morley's avatar
David Morley committed
122
        } elseif ($statsview) {
123
            include_once __DIR__ . '/statsview.php';
David Morley's avatar
David Morley committed
124
        } elseif ($podmin) {
125
            include_once __DIR__ . '/podmin.php';
126 127
        } elseif ($status) {
            include_once __DIR__ . '/status.php';
David Morley's avatar
David Morley committed
128
        } elseif ($podminedit) {
129
            include_once __DIR__ . '/podminedit.php';
David Morley's avatar
David Morley committed
130
        } elseif ($edit) {
131
            include_once __DIR__ . '/db/edit.php';
132 133 134 135
        } elseif ($add) {
            include_once __DIR__ . '/db/add.php';
        } elseif ($gettoken) {
            include_once __DIR__ . '/db/gettoken.php';
David Morley's avatar
David Morley committed
136 137
        } elseif ($input) {
            include_once __DIR__ . '/singleview.php';
dmorley's avatar
dmorley committed
138
        } else {
David Morley's avatar
David Morley committed
139
            include_once __DIR__ . '/showfull.php';
140
            $fullview = true;
David Morley's avatar
David Morley committed
141 142
        }
        ?>
143
    </div>
144
</main>
David Morley's avatar
David Morley committed
145
<footer class="ml-3 text-muted">
146
    <small><a href="/status">Data refreshed <?php echo Carbon::createFromFormat('Y-m-d H:i:s.u', getMeta('pods_updated', 'date_created'))->diffForHumans(); ?></a></small>
147
</footer>
David Morley's avatar
David Morley committed
148
<input type="hidden" name="input" value="<?php echo $input ?>"/>
David Morley's avatar
David Morley committed
149 150
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/tablesorter/dist/js/jquery.tablesorter.combined.min.js"></script>
David Morley's avatar
David Morley committed
151
<script src="node_modules/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js"></script>
David Morley's avatar
David Morley committed
152
<script src="node_modules/tablesorter/dist/js/widgets/widget-columnSelector.min.js"></script>
David Morley's avatar
David Morley committed
153
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
154
<script src="node_modules/featherlight/release/featherlight.min.js"></script>
David Morley's avatar
David Morley committed
155
<script src="node_modules/chart.js/dist/Chart.min.js"></script>
David Morley's avatar
David Morley committed
156 157 158
<script src="node_modules/ion-rangeslider/js/ion.rangeSlider.min.js"></script>
<?php
$statsview && include_once __DIR__ . '/statsviewjs.php';
159
$fullview && printf('<script src="js/podup.js"></script>');
David Morley's avatar
David Morley committed
160
?>
David Morley's avatar
David Morley committed
161 162
</body>
</html>