index.php 7.63 KB
Newer Older
noplanman's avatar
noplanman committed
1
<?php
noplanman's avatar
noplanman committed
2

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

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

9
use Carbon\Carbon;
noplanman's avatar
noplanman committed
10

noplanman's avatar
noplanman committed
11
require_once __DIR__ . '/boot.php';
noplanman's avatar
noplanman committed
12

noplanman's avatar
noplanman committed
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';
dmorley's avatar
dmorley committed
21
$status     = isset($_GET['status']) || $input === 'status';
noplanman's avatar
noplanman committed
22 23
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$fullview   = false;
dmorley's avatar
dmorley committed
24

noplanman's avatar
noplanman committed
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>
dmorley's avatar
dmorley committed
31 32
    <meta name="keywords" content="diaspora, <?php echo $input ?>, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, friendica, hubzilla, open source social, open source social network"/>
    <meta name="description" content="Diaspora Pod <?php echo $input ?> Live Status. Find a Diaspora 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"/>
dmorley's avatar
3.2.1  
dmorley 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"/>
dmorley's avatar
dmorley committed
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"/>
dmorley's avatar
dmorley committed
40 41
    <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"/>
42
    <meta property="og:type" content="website"/>
dmorley's avatar
dmorley committed
43
    <meta property="og:description" content="Diaspora Pod <?php echo $input ?> Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!"/>
44 45
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
dmorley's avatar
dmorley committed
46
</head>
David Morley's avatar
index  
David Morley committed
47
<body>
noplanman's avatar
noplanman committed
48 49
<?php
$navs = [
50
    'views' => [
dmorley's avatar
3.2.1  
dmorley committed
51 52 53 54 55
        ['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],
56 57
    ],
    'links' => [
dmorley's avatar
dmorley committed
58
        ['text' => 'Git', 'href' => 'https://git.feneas.org/diasporg/Poduptime', 'active' => false],
59
        ['text' => 'Contact', 'href' => 'https://dia.so/support', 'active' => false],
dmorley's avatar
dmorley committed
60 61
        ['text' => 'Wiki', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/home', 'active' => false],
        ['text' => 'API', 'href' => 'https://git.feneas.org/diasporg/Poduptime/wikis/API', 'active' => false],
dmorley's avatar
3.2.1  
dmorley committed
62
        ['text' => 'How to host a pod', 'href' => 'https://fediverse.party/', 'active' => false],
63
    ],
noplanman's avatar
noplanman committed
64 65
];
?>
66
<header>
dmorley's avatar
dmorley committed
67
    <div class="collapse bg-grey" id="navbarHeader">
68 69 70
        <div class="container">
            <div class="row">
                <div class="col-sm-8 col-md-7 py-4">
dmorley's avatar
dmorley committed
71
                    <h4 class="text-black">About</h4>
dmorley's avatar
dmorley committed
72
                    <p class="text-white">Poduptime helps you find a diaspora, friendica, hubzilla or socialhome pod to use and join the federated social network.</p>
dmorley's avatar
dmorley committed
73
                    <ul class="navbar-nav">
noplanman's avatar
noplanman committed
74 75 76 77 78 79 80 81 82 83
                        <?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>' : ''
                            );
                        }
                        ?>
dmorley's avatar
dmorley committed
84
                    </ul>
85 86
                </div>
                <div class="col-sm-4 offset-md-1 py-4">
dmorley's avatar
dmorley committed
87
                    <h4 class="text-black">Views</h4>
88
                    <ul class="navbar-nav">
89 90 91 92 93 94 95 96 97 98 99
                        <?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>' : ''
                            );
                        }
                        ?>
100 101 102 103 104
                    </ul>
                </div>
            </div>
        </div>
    </div>
dmorley's avatar
dmorley committed
105
    <div class="navbar navbar-dark bg-blue box-shadow">
106 107 108 109 110 111 112 113
        <div class="container d-flex justify-content-between">
            <a href="/" class="navbar-brand d-flex align-items-center">
                <strong>Poduptime</strong>
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarHeader" aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
        </div>
114
    </div>
115 116 117
</header>
<main role="main">
    <div class="main">
David Morley's avatar
David Morley committed
118
        <?php
dmorley's avatar
3.2.1  
dmorley committed
119
        if ($mapview) {
120
            include_once __DIR__ . '/showmap.php';
David Morley's avatar
David Morley committed
121
        } elseif ($statsview) {
122
            include_once __DIR__ . '/statsview.php';
David Morley's avatar
David Morley committed
123
        } elseif ($podmin) {
124
            include_once __DIR__ . '/podmin.php';
dmorley's avatar
dmorley committed
125 126
        } elseif ($status) {
            include_once __DIR__ . '/status.php';
David Morley's avatar
David Morley committed
127
        } elseif ($podminedit) {
128
            include_once __DIR__ . '/podminedit.php';
dmorley's avatar
dmorley committed
129
        } elseif ($edit) {
130
            include_once __DIR__ . '/db/edit.php';
dmorley's avatar
dmorley committed
131 132 133 134
        } elseif ($add) {
            include_once __DIR__ . '/db/add.php';
        } elseif ($gettoken) {
            include_once __DIR__ . '/db/gettoken.php';
dmorley's avatar
dmorley committed
135 136
        } elseif ($input) {
            include_once __DIR__ . '/singleview.php';
dmorley's avatar
dmorley committed
137
        } else {
dmorley's avatar
3.2.1  
dmorley committed
138
            include_once __DIR__ . '/showfull.php';
noplanman's avatar
noplanman committed
139
            $fullview = true;
David Morley's avatar
David Morley committed
140 141
        }
        ?>
142
    </div>
143
</main>
dmorley's avatar
3.2.1  
dmorley committed
144
<footer class="ml-3 text-muted">
dmorley's avatar
dmorley committed
145
    <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>
146
</footer>
dmorley's avatar
3.2.1  
dmorley committed
147
<input type="hidden" name="input" value="<?php echo $input ?>"/>
dmorley's avatar
dmorley committed
148 149
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/tablesorter/dist/js/jquery.tablesorter.combined.min.js"></script>
dmorley's avatar
dmorley committed
150
<script src="node_modules/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js"></script>
dmorley's avatar
3.2.1  
dmorley committed
151
<script src="node_modules/tablesorter/dist/js/widgets/widget-columnSelector.min.js"></script>
dmorley's avatar
dmorley committed
152
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
dmorley's avatar
dmorley committed
153
<script src="node_modules/featherlight/release/featherlight.min.js"></script>
dmorley's avatar
dmorley committed
154
<script src="node_modules/chart.js/dist/Chart.min.js"></script>
dmorley's avatar
3.2.1  
dmorley committed
155 156 157
<script src="node_modules/ion-rangeslider/js/ion.rangeSlider.min.js"></script>
<?php
$statsview && include_once __DIR__ . '/statsviewjs.php';
noplanman's avatar
noplanman committed
158
$fullview && printf('<script src="js/podup.js"></script>');
dmorley's avatar
3.2.1  
dmorley committed
159
?>
David Morley's avatar
index  
David Morley committed
160 161
</body>
</html>