Commit fe96a650 authored by David Morley's avatar David Morley

us date format db version to live

parent dd61fa6a
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
#!/usr/bin/php
<?php
//* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */
include('config.php');
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
......@@ -42,6 +43,7 @@ if (stristr($outputssl, 'Set-Cookie: _diaspora_session=')) {
$secure="true";$hidden="no";
preg_match('/X-Git-Update: (.*?)\n/',$outputssl,$xgitdate);
$gitdate = trim($xgitdate[1]);
//$gitdate = strtotime($gitdate);
preg_match('/X-Git-Revision: (.*?)\n/',$outputssl,$xgitrev);
$gitrev = trim($xgitrev[1]);
preg_match('/X-Runtime: (.*?)\n/',$outputssl,$xruntime);
......@@ -56,6 +58,7 @@ $encoding = trim($xencoding[1]);
//parse header data
preg_match('/X-Git-Update: (.*?)\n/',$output,$xgitdate);
$gitdate = trim($xgitdate[1]);
//$gitdate = strtotime($gitdate);
preg_match('/X-Git-Revision: (.*?)\n/',$output,$xgitrev);
$gitrev = trim($xgitrev[1]);
preg_match('/X-Runtime: (.*?)\n/',$output,$xruntime);
......@@ -113,18 +116,26 @@ $uptime = preg_replace("/,/", ".", $matchper[1][0]);
//last check
preg_match_all('/<h3>Last checked<\/h3>
<p>(.*?)</',$pingdom,$matchdate);
$pingdom_timestamp = $matchdate[1][0];
if ($pingdom_timestamp) {
$Date_parts = preg_split("/[\s-]+/", $pingdom_timestamp);
if (strlen($Date_parts[0]) == "2") {
//echo $pingdom_timestamp;
$pingdomdate = $pingdom_timestamp;
}
else {
$splitdate = explode(" ",$matchdate[1][0]);
$newtimestamp = $splitdate[0];
#$dateTime = DateTime::createFromFormat('d/m/Y H:i:s', $matchdate[1][0]);
#$newunpin = strtotime($dateTime->format('Y-m-d h:i:s a'));
//echo $splitdate[0];
$pingdomdate = $splitdate[0];
//$splitdate = explode(" ",$matchdate[1][0]);
//echo $row[$i]['pingdomurl'].$thismonth;
//$newtimestamp = $splitdate[0];
//$matchdate[1][0] = preg_replace("/./", "/", $matchdate[1][0]);
//echo $matchdate[1][0];
//$dateTime = DateTime::createFromFormat('d/m/Y H:i:s', $matchdate[1][0]);
//$dateTime = DateTime::createFromFormat('m.d.Y. H:i:s', $matchdate[1][0]);
//$newunpin = strtotime($dateTime->format('Y-m-d h:i:s a'));
//fuck it so many date formats from pingdom
$pingdomdate = date('Y-m-d H:i:s');
//echo $dateTime->format('Y-m-d h:i:s a');
//$pingdomdate = $splitdate[0];
}
//status
......@@ -146,8 +157,8 @@ else {$live="error";}
//end foreach
sleep(20);
}
}
pg_free_result($result);
......
......@@ -19,16 +19,20 @@ od last updated from the main Diaspora code.">?</a></th>
if (!$dbh) {
die("Error in connection: " . pg_last_error());
}
if ($_GET['hidden'] == "true") {
$sql = "SELECT * FROM pods WHERE hidden <> 'no'";
} else {
$sql = "SELECT * FROM pods WHERE hidden <> 'yes'";
}
$result = pg_query($dbh, $sql);
if (!$result) {
die("Error in SQL query: " . pg_last_error());
}
while ($row = pg_fetch_array($result)) {
if ($row["secure"] == "true") {$method = "https://";$class="green";} else {$method = "http://";$class="red";}
echo "<tr><td class='tipsy' title='SSL Cert ".$row["sslvalid"]."'><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $method . $row["domain"] . "</a></td>";
echo "<tr><td><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $method . $row["domain"] . "</a></td>";
echo "<td>" . $row["status"] . "</td>";
echo "<td class='tipsy' title='Git Revision ".$row["hgitref"]."'>" . $row["hgitdate"] . "</td>";
echo "<td class='tipsy' title='Git Revision ".$row["hgitref"]."'><div id='".$row["hgitdate"]."' class='utc-timestamp'>" . strtotime($row["hgitdate"]) . "</div></td>";
echo "<td>" . $row["uptimelast7"] . "</td>";
echo "<td class='tipsy' title='Last Check ".$row["dateupdated"]." '><a target='new' href='".$row["pingdomurl"]."'>" . $row["monthsmonitored"] . "</a></td>";
echo "<td>" . $row["responsetimelast7"] . "</td>";
......
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
<!DOCTYPE HTML>
<html><head><title>Diaspora Pod uptime - Find your new social home</title>
<meta name="keywords" content="diaspora, podupti.me, diasp, diasporg, diasp.org, facebook, open source social, open source facebook, open source social network" />
<meta name="description" content="Diaspora Pod Live Status. diasp.org pod uptime monitor for Diaspora pods" />
......@@ -22,33 +20,16 @@ s1.parentNode.insertBefore(s, s1);
<body>
<header>
<div class="page-header">
<h1>
<h1 id="title">
DIASPORA* POD UPTIME
<small>
<?php $filename = 'data/pingdom.txt'; echo "Stats were updated: " . date ("F d Y H:i:s", filemtime($filename)) . " Seattle Time | Next Update in: "; $timetill = (10-date ("i"));
if ($timetill < 0) {echo (60 + $timetill);} else {echo (10 - $timetill);}echo " minutes.";?>
</small>
</h1>
<div class="row" id="buttonsy" style="display:none;">
<div class="span32">
<div class="span2">
<a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://podupti.me"></a>
</div>
</header>
<div class="container-fluid">
<div class="sidebar">
<script type="text/javascript">
<!--
google_ad_client = "ca-pub-3662181805557062";
/* podup2 */
google_ad_slot = "3334221511";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Tip:<br><a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://podupti.me"></a>
<noscript><a href="http://flattr.com/thing/170048/Diaspora-Pod-Live-Uptime-watch" target="_blank">
<img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript><br>
<br>Share:<br>
<img src="http://iliketoast.net/img/diasporaWebBadge80x15_3.png" border="0" onClick="dshare();">
<div class="span2">
<img src="http://iliketoast.net/img/diasporaWebBadge80x15_3.png" border="0" onClick="dshare();">
<script type="text/javascript">
function dshare() {
var url = window.location.href;
......@@ -56,14 +37,26 @@ s1.parentNode.insertBefore(s, s1);
window.open('http://iliketoast.net/dshare.html?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(title),'dshare','location=no,links=no,scrollbars=no,toolbar=no,width=620,height=400');
return false;
}
</script><br>
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://podupti.me" data-text="Pod Uptime - Find a Diaspora Pod!" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><br>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fpodupti.me&amp;layout=button_count&amp;show_faces=false&amp;width=150&amp;action=recommend&amp;font&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:21px;" allowTransparency="true"></iframe><Br>
<a class="DiggThisButton DiggCompact"></a><Br>
<img src="http://l.yimg.com/hr/img/delicious.small.gif" height="10" width="10" alt="Delicious" />
<a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"> Bookmark this on Delicious</a>
<br>
<g:plusone></g:plusone>
</script>
</div>
<div class="span2">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://podupti.me" data-text="Pod Uptime - Find a Diaspora Pod!" data-count="horizontal">Tweet</a
><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
<div class="span2">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fpodupti.me&amp;layout=button_count&amp;show_faces=false&amp;width=150&amp;action=recommend&amp;font
&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:21px;" allowTransparency="true"></iframe>
</div>
<div class="span2">
<a class="DiggThisButton DiggCompact"></a>
</div>
<div class="span2">
<img src="http://l.yimg.com/hr/img/delicious.small.gif" height="10" width="10" alt="Delicious" />
<a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURI
Component(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">Delicious</a>
</div>
<div class="span2">
<g:plusone></g:plusone>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
......@@ -71,34 +64,54 @@ s1.parentNode.insertBefore(s, s1);
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<br>
<script src="http://www.stumbleupon.com/hostedbadge.php?s=1"></script>
<br><br>Android App:<br>
</div>
<div class="span2">
<script src="http://www.stumbleupon.com/hostedbadge.php?s=1"></script>
</div>
<div class="span4">
This site is a service of <a href="https://diasp.org">Diasp.org Pod</a><br>
</div>
</div>
</div>
</div>
</header>
<div class="container-fluid">
<div class="sidebar">
<script type="text/javascript">
<!--
google_ad_client = "ca-pub-3662181805557062";
/* podup2 */
google_ad_slot = "3334221511";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<a href="https://market.android.com/details?id=appinventor.ai_david_morley.DiasporaPoduptime"><img src="/images/android-dude128.png"></a>
</div>
<div class="content">
<div id="results">
<?php include("/var/www/podup/showpods.php"); ?>
<?php include("/var/www/podup/db/show.php"); ?>
</div>
<div id="add" style="display:none;">
Hosting your own Diaspora* pod? <u style="cursor: pointer; cursor: hand;">Click here</u> to add to this list.<br>
</div>
<div id="others" style="display:none;">
This site is a service of <a href="https://diasp.org">Diasp.org Pod</a><br>
Pod Host? <u style="cursor: pointer; cursor: hand;">Click here</u> to manage your listing.<br>
</div>
<div id="howto" style="display:none; margin-left:50px">
<br>
Want your pod listed?<br>
Its easy start monitoring on your pod with a free <a href="http://www.pingdom.com" target="new">www.pingdom.com</a> account. Make the "Name of check:" the domain of your pod as the system will link to that name.<br>
Its easy start monitoring on your pod with a free <a href="http://www.pingdom.com" target="new">www.pingdom.com</a> account.<br>
<br>Make a public report public and then enter your URL below (note its the one you view after you goto it)<br><br>
Pingdom shows me http://stats.pingdom.com/b4gasnh1c176 when I click it to goes to http://stats.pingdom.com/b4gasnh1c176/240588
<br> So URL should look very close to this: http://stats.pingdom.com/b4gasnh1c176/240588<br>
<br><form action="add.php" method="post">
<br><form action="db/add.php" method="post">
Stats URL:<input type="text" name="url" size="100"><br>
Pod domainname:<input type="text" name="domain" size="100"><br>
Your Email:<input type="text" name="email" size="50"><br>
<input type="submit" value="submit">
</form>
<br>Is your pod missing? If the server can not get a diaspora session its on the hidden list <a href="http://podupti.me/?hidden=true">Show</a>. This
is mostly because of selfsigned or openca certs, if you need a free ssl cert get one from startssl.com.
<br>Need help? <a href="http://frodointernet.com/support">Support</a>
<br>
</div>
......
function get_date(timestamp) {
var date = new Date(timestamp * 1000);
return [date.getDate(),date.getMonth() + 1, date.getFullYear()].join('/');
return [date.getMonth()+1,date.getDate(), date.getFullYear()].join('/');
}
$(document).ready(function(){
$('.tipsy').tipsy();
$('#add').click(function() {
$('#howto').show('slow'); $('#add').hide('slow');$('#content').hide('slow');
$('#howto').show('slow'); $('#add').hide('slow');$('#results').hide('slow');
});
$("#myTable").tablesorter( {sortList: [[3,1], [4,1]]} );
$("#myTable").tablesorter( {sortList: [[2,1], [3,1]]} );
$('#add').delay(8000).fadeIn(2000);
$('#others').delay(8000).fadeIn(2000);
$('#buttonsy').delay(5550).slideDown(3330);
......
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