show.php 4.64 KB
Newer Older
David Morley's avatar
David Morley committed
1 2 3 4 5 6 7 8 9
<meta charset="utf-8"> 
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
<table id="myTable" class="tablesorter" width="98%">
<thead>
<tr>
<th width="220px">Diaspora Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
<th>Live Status<a class="tipsy" title="Up or Down according to Pingdom">?</a></th>
<th>Last Code Pull<a class="tipsy" title="Because the alpha is updated everyday pods with old software will not work correcly with pods with new software. This is the date the p
od last updated from the main Diaspora code.">?</a></th>
10
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
David Morley's avatar
David Morley committed
11 12 13 14 15
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
<th>Months<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a></th>
<th>Rating<a class="tipsy" title="User and Admin rating for this pod.">?</a></th>
<th>Response Time<a class="tipsy" title="Average response time for <?php echo date("F") ?>.">?</a></th>
<th>Ipv6<a class="tipsy" title="Does this pod look to have ipv6">?</a></th>
16
<th>Location<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
David Morley's avatar
David Morley committed
17 18 19 20
</tr>
</thead>
<tbody>
<?php
David Morley's avatar
cleanup  
David Morley committed
21
$tt=0;
David Morley's avatar
David Morley committed
22 23 24 25 26 27
 include('db/config.php');
 $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
 if (!$dbh) {
     die("Error in connection: " . pg_last_error());
 }  
 if ($_GET['hidden'] == "true") {
28
 $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY Hgitdate DESC, uptimelast7 DESC";
David Morley's avatar
David Morley committed
29
 } else {
30
 $sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' ORDER BY Hgitdate DESC, uptimelast7 DESC";
David Morley's avatar
David Morley committed
31 32 33 34 35
 }
 $result = pg_query($dbh, $sql);
 if (!$result) {
     die("Error in SQL query: " . pg_last_error());
 }   
David Morley's avatar
cleanup  
David Morley committed
36
 $numrows = pg_num_rows($result);
David Morley's avatar
David Morley committed
37
 while ($row = pg_fetch_array($result)) {
David Morley's avatar
cleanup  
David Morley committed
38
$tt=$tt+1;
David Morley's avatar
David Morley committed
39
if ($row["secure"] == "true") {$method = "https://";$class="green";$tip="This pod uses SSL encryption for traffic.";} else {$method = "http://";$class="red";$tip="This pod does not offer SSL";} 
David Morley's avatar
cleanup  
David Morley committed
40
//if ($tt == "3") {echo "<tr rowspan=9><td></td></tr>";}
David Morley's avatar
David Morley committed
41 42
     echo "<tr><td><div title='$tip' class='tipsy'><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $method . $row["domain"] . "</a></div></td>";
     echo "<td>" . $row["status"] . "</td>";
43 44 45 46 47 48 49 50 51 52
     echo "<td><div id='".$row["hgitdate"]."' class='utc-timestamp'>" . strtotime($row["hgitdate"]) . 
"</div></td>";

if (stristr($row["shortversion"],'pre')) {$version=$row["shortversion"];$pre = "This pod runs pre release development code";} elseif (!$row["shortversion"]) 
{$version="unknown";$pre = "This pod runs 
unknown code";} 
else 
{$version=$row["shortversion"];$pre="This pod runs production code";}
if ($row["shortversion"] == $row["masterversion"] && $row["shortversion"] != "") {$classver = "green";} else {$classver = "black";}
     echo "<td class='$classver'><div title='{$pre} codename: {$row["longversion"]} master version is: {$row["masterversion"]}' class='tipsy'>{$version}</div></td>";
David Morley's avatar
David Morley committed
53
     echo "<td>" . $row["uptimelast7"] . "</td>";
54 55
if (strpos($row["pingdomurl"], "pingdom.com")) {$moreurl = $row["pingdomurl"];} else {$moreurl = "http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=".$row["pingdomurl"];}
     echo "<td><div title='Last Check ".$row["dateupdated"]."' class='tipsy'><a target='new' href='".$moreurl."'>" . $row["monthsmonitored"] . "</a></div></td>";
David Morley's avatar
David Morley committed
56
if ($row["userrating"] >6) {$userratingclass="green";} elseif ($row["userrating"] <7) {$userratingclass="yellow";} elseif ($row["userrating"] <3) {$userratingclass="red";}
David Morley's avatar
David Morley committed
57
     echo "<td><a rel=\"facebox\" href=\"rate.php?domain=".$row["domain"]."\"><div class='tipsy rating ".$userratingclass."' title='User rating is ".$row["userrating"]."'>";
58
if ($row["userrating"] == 0) {echo "no rating yet";}
David Morley's avatar
David Morley committed
59 60 61 62
for ($i = 0; $i < $row["userrating"]; $i++) { 
echo "✪";
}
if ($row["adminrating"] >6) {$adminratingclass="green";} elseif ($row["adminrating"] <7) {$adminratingclass="yellow";} elseif ($row["adminrating"] <3) {$adminratingclass="red";}
63
     echo "</div><br><div class='tipsy rating ".$adminratingclass."' backendscore='".$row["score"]."' title='Poduptime Approved rating is ".$row["adminrating"]."'>";
David Morley's avatar
David Morley committed
64
for ($iw = 0; $iw < $row["adminrating"]; $iw++) {
David Morley's avatar
David Morley committed
65 66 67
echo "✪";
}

68
     echo "</div></a></td>";
David Morley's avatar
David Morley committed
69
     echo "<td>" . $row["responsetimelast7"] . "</td>";
David Morley's avatar
David Morley committed
70
     echo "<td>" . $row["ipv6"] . "</td>\n";
David Morley's avatar
David Morley committed
71
     echo "<td class='tipsy' title='".$row["whois"]." '>" . $row["country"] . "</td></tr>\n";
David Morley's avatar
cleanup  
David Morley committed
72

David Morley's avatar
David Morley committed
73 74 75 76 77
 }
 pg_free_result($result);       
 pg_close($dbh);
?>
</tbody>
78
</table>