Commit 563c63fb authored by David Morley's avatar David Morley Committed by GitHub

some responsiveness cleanup & few features (#98)

* some responsiveness cleanup

* few sql ones

* basic email ping on bad pod

* cleanup

* fix facebox
parent a9231c9c
......@@ -77,7 +77,7 @@ body {
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
padding-left: 80px;
}
}
......
.db-wrapper {
vertical-align: top;
}
.rating {
font-size:9px;
}
.content {
margin-left: 2px !important;
width: 99%;
}
.tfont {
font-size:12px;
}
#results {
width: 750px;
}
.smlogo {
width: 16px;
height: 16px;
......@@ -39,10 +29,6 @@ background: none;
.smlogo-xmpp img {
vertical-align: unset;
}
.morehover {
display: inline-block;
vertical-align: super;
}
#map { height: 580px; }
.mycluster {
width: 35px;
......@@ -59,4 +45,9 @@ color: red;
table {
empty-cells: show;
}
#facebox {
z-index: 1000 !important;
}
#facebox .content {
width: 800px !important;
}
......@@ -11,6 +11,7 @@ if (!($_domain = $_GET['domain'] ?? null)) {
$_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? '';
$_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
......@@ -74,8 +75,8 @@ if (stristr($outputssl, 'openRegistrations')) {
echo 'Your pod has ssl and is valid<br>';
$publickey = md5(uniqid($domain, true));
$sql = 'INSERT INTO pods (domain, email, podmin_statement, publickey) VALUES ($1, $2, $3, $4)';
$result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $publickey]);
$sql = 'INSERT INTO pods (domain, email, podmin_statement, $podmin_notify, publickey) VALUES ($1, $2, $3, $4, $5)';
$result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $_podmin_notify, $publickey]);
$result || die('Error in SQL query: ' . pg_last_error());
if ($_email) {
......
......@@ -36,8 +36,8 @@ while ($row = pg_fetch_array($result)) {
if ('save' === $_action) {
$_weight <= 10 || die('10 is max weight');
$sql = 'UPDATE pods SET email = $1, weight = $2, podmin_statement = $3 WHERE domain = $4';
$result = pg_query_params($dbh, $sql, [$_email, $_weight, $_podmin_statement, $_domain]);
$sql = 'UPDATE pods SET email = $1, weight = $2, podmin_statement = $3, podmin_notify = $4 WHERE domain = $5';
$result = pg_query_params($dbh, $sql, [$_email, $_weight, $_podmin_statement, $_podmin_notify, $_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
$to = $_email;
......@@ -56,8 +56,9 @@ while ($row = pg_fetch_array($result)) {
<input type="hidden" name="domain" value="<?php echo $_domain; ?>">
<input type="hidden" name="token" value="<?php echo $_token; ?>">
<label>Email <input type="text" size="20" name="email" value="<?php echo $row['email']; ?>"></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <textbox cols="100" rows="7" name="podmin_statement"><?php echo $row['podmin_statement']; ?></textbox></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"><?php echo $row['podmin_statement']; ?></textarea></label><br>
<label>Weight <input type="text" size="2" name="weight" value="<?php echo $row['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify if pod falls to hidden status? <input type="checkbox" name="podmin_notify" <?php $row['podmin_notify'] ?? 'CHECKED' ?> ></label><br>
<input type="submit" name="action" value="save">
</form>
<br>
......
ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text;
ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text, ADD podmin_notify boolean;
ALTER TABLE pods DROP Hgitdate, DROP Hgitref, DROP Hruntime, DROP Hencoding, DROP longversion, DROP ptr, DROP whois, DROP postalcode, DROP connection, DROP pingdomlast;
ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey;
......
......@@ -21,6 +21,6 @@ ALTER TABLE pods_apiv1 ALTER COLUMN signup TYPE text USING signup::text;
ALTER TABLE pods_apiv1 ADD Hgitdate text, ADD Hgitref text, ADD Hruntime text, ADD Hencoding text, ADD longversion text, ADD ptr text, ADD whois text, ADD postalcode text, ADD connection text, ADD pingdomlast text;
ALTER TABLE pods_apiv1 DROP terms, DROP sslexpire, DROP dnssec, DROP masterversion, DROP shortversion, DROP publickey;
ALTER TABLE pods_apiv1 DROP podmin_statement, DROP sslexpire, DROP dnssec, DROP publickey, DROP podmin_notify;
UPDATE pods_apiv1 SET hgitdate = 'unsupported';
......@@ -13,10 +13,10 @@ $dbh || die('Error in connection: ' . pg_last_error());
//foreach pod check it and update db
if ($_domain) {
$sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods WHERE domain = $1';
$sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
} elseif (PHP_SAPI === 'cli') {
$sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods';
$sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods';
$result = pg_query($dbh, $sql);
} else {
die('No valid input');
......@@ -29,6 +29,9 @@ while ($row = pg_fetch_assoc($result)) {
$dateadded = $row['date_created'];
$admindb = (int) $row['adminrating'];
$weight = $row['weight'];
$hiddennow = $row['hidden'];
$email = $row['email'];
$notify = $row['podmin_notify'];
$sqlforr = 'SELECT admin,rating FROM rating_comments WHERE domain = $1';
$ratings = pg_query_params($dbh, $sqlforr, [$domain]);
$ratings || die('Error in SQL query2: ' . pg_last_error());
......@@ -158,10 +161,12 @@ while ($row = pg_fetch_assoc($result)) {
$responsetime = pg_fetch_result($resultttl, 0);
$uptime = 0;
$sqlonline = 'SELECT round(avg(online::int),2) * 100 AS online FROM checks WHERE domain = $1';
$sqlonline = 'SELECT avg(online::int) * 100 AS online FROM checks WHERE domain = $1';
$resultonline = pg_query_params($dbh, $sqlonline, [$domain]);
$resultonline || die('Error in SQL query resultchecks: ' . pg_last_error());
$uptime = pg_fetch_result($resultonline, 0);
$uptime = round(pg_fetch_result($resultonline, 0),2);
_debug('Uptime', $uptime);
$sqlmasters = 'SELECT version FROM masterversions WHERE software = $1 ORDER BY date_checked LIMIT 1';
$resultmasters = pg_query_params($dbh, $sqlmasters, [$softwarename]);
......@@ -172,6 +177,15 @@ while ($row = pg_fetch_assoc($result)) {
$hidden = $score <= 70;
_debug('Hidden', $hidden ? 'yes' : 'no');
if ($hiddennow === 'f' && $hidden && $notify === 't') {
$to = $email;
$headers = ['From: ' . $adminemail, 'Bcc: ' . $adminemail];
$subject = 'Monitoring notice from poduptime';
$message = 'Notice for ' . $domain . '. Your score fell to ' . $score . ' and your pod is now marked as hidden.';
@mail($to, $subject, $message, implode("\r\n", $headers));
_debug('Mail Notice', 'sent to '.$email);
}
if ($score > 100) {
$score = 100;
} elseif ($score < 0) {
......
......@@ -38,6 +38,7 @@ CREATE TABLE pods (
publickey text,
tokenexpire timestamp,
podmin_statement text,
podmin_notify boolean,
sslexpire timestamp,
dnssec boolean,
comment_counts int,
......
<?php
$lastfile = 'db/last.data';
$advancedview = isset($_GET['advancedview']);
$detailedview = isset($_GET['detailedview']);
$mapview = isset($_GET['mapview']);
$cleanup = isset($_GET['cleanup']);
$statsview = isset($_GET['statsview']);
$podmin = isset($_GET['podmin']);
$podminedit = isset($_GET['podminedit']);
$simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedit || $statsview);
$simpleview = !($detailedview || $mapview || $cleanup || $podmin || $podminedit || $statsview);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Diaspora Pod Uptime Status - Find your new social home on a hosted pod</title>
<meta name="keywords" content="diaspora, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, open source social, open source social network"/>
<title>Open Source Social Network Pod Uptime Status</title>
<meta name="keywords" content="diaspora, federated pods, <?php echo $_SERVER['HTTP_HOST'] ?>, friendica, hubzilla, open source social, open source social network"/>
<meta name="description" content="Diaspora Pod Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!"/>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="css/newstyle.css"/>
......@@ -21,7 +21,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
<link rel="stylesheet" href="css/dashboard.css"/>
<link rel="stylesheet" href="bower_components/jquery-ui/themes/base/jquery-ui.min.css"/>
<meta property="og:url" content="https://<?php echo $_SERVER['HTTP_HOST'] ?>"/>
<meta property="og:title" content="Diaspora Pod Finder"/>
<meta property="og:title" content="Social Network Pod Finder"/>
<meta property="og:type" content="website"/>
<meta property="og:description" content="Diaspora Pod Live Status. Find a Diaspora pod to sign up for, rate pods, find one close to you!"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
......@@ -34,7 +34,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
<div id="navbar" class="text-muted collapse">
<nav class="nav navbar-nav float-xs-left">
<a class="nav-item nav-link<?php $simpleview && print ' active'; ?>" href="/">Simple View</a>
<a class="nav-item nav-link<?php $advancedview && print ' active'; ?>" href="/?advancedview">Advanced View</a>
<a class="nav-item nav-link<?php $detailedview && print ' active'; ?>" href="/?detailedview">Detailed View</a>
<a class="nav-item nav-link<?php $mapview && print ' active'; ?>" href="/?mapview">Map View</a>
<a class="nav-item nav-link<?php $statsview && print ' active'; ?>" href="/?statsview">Network Stats</a>
</nav>
......@@ -42,10 +42,10 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<div class="sidebar">
<ul class="nav nav-sidebar">
<li<?php $simpleview && print ' class="active"'; ?>><a href="/">Simple View<?php $simpleview && print ' <span class="sr-only bg-dark">(current)</span>'; ?></a></li>
<li<?php $advancedview && print ' class="active"'; ?>><a href="/?advancedview">Advanced View<?php $advancedview && print ' <span class="sr-only bg-dark">(current)</span>'; ?></a></li>
<li<?php $detailedview && print ' class="active"'; ?>><a href="/?detailedview">Detailed View<?php $detailedview && print ' <span class="sr-only bg-dark">(current)</span>'; ?></a></li>
<li<?php $mapview && print ' class="active"'; ?>><a href="/?mapview">Map View<?php $mapview && print ' <span class="sr-only bg-dark">(current)</span>'; ?></a></li>
<li<?php $statsview && print ' class="active"'; ?>><a href="/?statsview">Network Stats<?php $statsview && print ' <span class="sr-only bg-dark">(current)</span>'; ?></a></li>
</ul>
......@@ -60,21 +60,20 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
<li><a href="https://github.com/diasporg/Poduptime/wiki">Wiki</a></li>
<li><a href="https://github.com/diasporg/Poduptime/wiki/API">API</a></li>
</ul>
<p><small>Data refreshed: <br><?php echo date('M d y H:i', filemtime($lastfile)); ?> EST</small></p><br>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3662181805557062" data-ad-slot="2195215834" data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<br>
Data last refreshed: <br><?php echo date('F d Y H:i:s.', filemtime($lastfile)); ?> EST
</div>
<div class="main col-md-10 offset-md-2">
<div class="main offset-md-1">
<a href="go.php" class="btn btn-sm btn-success">Confused? Auto pick a pod for you.</a>
<div class="row placeholders">
</div>
<div class="table-responsive">
<?php
if ($advancedview) {
if ($detailedview) {
include_once __DIR__ . '/showfull.php';
} elseif ($mapview) {
include_once __DIR__ . '/showmap.php';
......
......@@ -5,5 +5,6 @@ Want your pod listed? Or to claim a listed pod?<br>
<label>Pod Domain Name: <input type="text" name="domain" class="xlarge span4 required" placeholder="domain.com"></label>*<br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users. HTML is ok.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Your Email: <input type="text" name="email" class="xlarge span4" placeholder="user@domain.com"></label><br>
<label>Notify if pod falls to hidden status? <input type="checkbox" name="podmin_notify" CHECKED ></label><br>
<input type="submit" value="submit">
</form>
......@@ -8,7 +8,7 @@ $country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,score,signup,name,country,city,state,lat,long,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND signup ORDER BY uptime_alltime DESC";
$sql = "SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,podmin_statement,score,signup,name,country,city,state,uptime_alltime,active_users_halfyear,active_users_monthly,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden AND signup ORDER BY uptime_alltime DESC";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -26,6 +26,7 @@ $numrows = pg_num_rows($result);
<th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 6 months on this pod.">Active Users</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="Pod location, based on IP Geolocation.">Location</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="External Social Networks this pod can post to.">Services Offered</a></th>
<th><a data-toggle="tooltip" data-placement="bottom" title="More information from the host of this pod.">Info</a></th>
</tr>
</thead>
<tbody>
......@@ -56,8 +57,8 @@ $numrows = pg_num_rows($result);
$row['service_twitter'] === 't' && print '<div class="smlogo smlogo-twitter" title="Publish to Twitter"></div>';
$row['service_tumblr'] === 't' && print '<div class="smlogo smlogo-tumblr" title="Publish to Tumblr"></div>';
$row['service_wordpress'] === 't' && print '<div class="smlogo smlogo-wordpress" title="Publish to WordPress"></div>';
$row['service_xmpp'] === 't' && print '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" title="XMPP chat server" alt="XMPP chat server"></div>';
echo '</td></tr>';
$row['service_xmpp'] === 't' && print '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" title="XMPP chat server" alt="XMPP chat server"></div></td>';
echo '<td>' . ($row['podmin_statement'] ? '<a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="left" title="Podmin Statement" data-html="true" data-content="' . htmlentities($row['podmin_statement'], ENT_QUOTES) . '">&#8505;</a>' : '&nbsp;') . '</td></tr>';
}
?>
</tbody>
......
......@@ -18,7 +18,6 @@ foreach ($csv as $cords) {
<script src="bower_components/leaflet/dist/leaflet.js"></script>
<script type="text/javascript" src="bower_components/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<div id="map"></div>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<script type="text/javascript">
var geoJsonData = {
'type': 'FeatureCollection',
......@@ -29,7 +28,7 @@ foreach ($csv as $cords) {
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT domain,signup,name,lat,long,uptime_alltime,active_users_halfyear,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden";
$sql = "SELECT domain,signup,name,lat,long,softwarename,uptime_alltime,active_users_halfyear,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods WHERE NOT hidden";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -53,7 +52,7 @@ foreach ($csv as $cords) {
'type': 'Feature',
'id': '1',
'properties' : {
'html': '{$pod_name}<br><a href="/go.php?domain={$row['domain']}">Visit</a><br> Open Signup: {$signup}<br> Users: {$row['active_users_halfyear']}<br> Uptime: {$row['uptime_alltime']}%<br> Services:{$feat}'
'html': '<a href="/go.php?domain={$row['domain']}">{$pod_name}</a><br>Software: {$row['softwarename']}<br> Open Signup: {$signup}<br> Users: {$row['active_users_halfyear']}<br> Uptime: {$row['uptime_alltime']}%<br> Services:{$feat}'
},
'geometry': {
'type': 'Point',
......
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