Commit dfcb51f9 authored by Armando Luescher's avatar Armando Luescher

Small code improvements and warning fixes.

parent 27b4991b
......@@ -10,9 +10,7 @@ use RedBeanPHP\R;
require_once __DIR__ . '/../boot.php';
if (!($_domain = $_GET['domain'] ?? null)) {
die('no pod domain given');
}
($_domain = $_GET['domain'] ?? null) || die('no pod domain given');
// Other parameters.
$_email = $_GET['email'] ?? '';
......@@ -33,6 +31,7 @@ try {
die('Error in SQL query: ' . $e->getMessage());
}
$stop = false;
foreach ($pods as $pod) {
if ($pod['domain'] === $_domain) {
if ($pod['email']) {
......@@ -75,12 +74,11 @@ foreach ($pods as $pod) {
</form>
EOF;
$stop = 1;
$stop = true;
}
}
if (!$stop) {
$link = 'https://' . $_domain . '/nodeinfo/1.0';
if ($infos = file_get_contents('https://' . $_domain . '/.well-known/nodeinfo')) {
$info = json_decode($infos, true);
......@@ -103,12 +101,12 @@ if (!$stop) {
$publickey = md5(uniqid($_domain, true));
try {
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p = R::dispense('pods');
$p['domain'] = $_domain;
$p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
$p['podmin_notify'] = $_podmin_notify;
$p['publickey'] = $publickey;
R::store($p);
} catch (\RedBeanPHP\RedException $e) {
......
......@@ -143,4 +143,4 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po
<input value="debug" type="button" aria-describedby="debug" data-featherlight="/db/pull.php?debug=1&nowrite=1&domain=<?php echo $_domain; ?>"/>
<small id="debug" class="form-text text-muted">
Do a debug pull of your pod. Won't update the database just show what it would look like on a pass.
</small>
\ No newline at end of file
</small>
......@@ -5,20 +5,22 @@
*/
declare(strict_types=1);
use Carbon\Carbon;
require_once __DIR__ . '/boot.php';
$lastfile = 'db/last.data';
$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';
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$lastfile = 'db/last.data';
$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';
$simpleview = !($mapview || $podmin || $podminedit || $statsview);
$fullview = false;
?>
<!doctype html>
<html lang="en">
......@@ -67,16 +69,16 @@ $navs = [
<h4 class="text-white">About</h4>
<p class="text-muted">Poduptime helps you find a diaspora, friendica, hubzilla or socialhome pod to use and join the federated social network.</p>
<ul class="navbar-nav">
<?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>' : ''
);
}
?>
<?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>' : ''
);
}
?>
</ul>
</div>
<div class="col-sm-4 offset-md-1 py-4">
......@@ -128,7 +130,7 @@ $navs = [
include_once __DIR__ . '/db/gettoken.php';
} else {
include_once __DIR__ . '/showfull.php';
$fullview = 1;
$fullview = true;
}
?>
</div>
......@@ -147,9 +149,7 @@ $navs = [
<script src="node_modules/ion-rangeslider/js/ion.rangeSlider.min.js"></script>
<?php
$statsview && include_once __DIR__ . '/statsviewjs.php';
if ($fullview) {
echo '<script src="js/podup.js"></script>';
}
$fullview && printf('<script src="js/podup.js"></script>');
?>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment