show.php 5.23 KB
Newer Older
David Morley's avatar
David Morley committed
1 2 3 4 5 6
<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>
7 8
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
dmorley's avatar
dmorley committed
9
<th>Signups<a class="tipsy" title="Open to public or Closed/Invite only.">?</a></th>
10 11
<th>Users<a class="tipsy" title="Number of total users on this pod.">?</a></th>
<th>Posts<a class="tipsy" title="Number of total posts on this pod.">?</a></th>
David Morley's avatar
David Morley committed
12 13
<th>Months Online<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a></th>
<th>User Rating<a class="tipsy" title="User and Admin rating for this pod.">?</a></th>
14
<th>Location<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
David Morley's avatar
David Morley committed
15 16 17 18
</tr>
</thead>
<tbody>
<?php
David Morley's avatar
cleanup  
David Morley committed
19
$tt=0;
David Morley's avatar
David Morley committed
20 21 22 23 24
 include('db/config.php');
 $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
 if (!$dbh) {
     die("Error in connection: " . pg_last_error());
 }  
root's avatar
root committed
25 26
 $hidden = isset($_GET['hidden'])?$_GET['hidden']:null;
 if ($hidden == "true") {
27
 $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY Hgitdate DESC, uptimelast7 DESC";
David Morley's avatar
David Morley committed
28
 } else {
29
 $sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' ORDER BY Hgitdate DESC, uptimelast7 DESC";
David Morley's avatar
David Morley committed
30 31 32 33 34
 }
 $result = pg_query($dbh, $sql);
 if (!$result) {
     die("Error in SQL query: " . pg_last_error());
 }   
David Morley's avatar
cleanup  
David Morley committed
35
 $numrows = pg_num_rows($result);
David Morley's avatar
David Morley committed
36
 while ($row = pg_fetch_array($result)) {
David Morley's avatar
cleanup  
David Morley committed
37
$tt=$tt+1;
root's avatar
root committed
38 39 40 41 42 43 44 45 46 47 48 49 50
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";
} 
$verdiff =  str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);


51
$tip.="\n This pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. "; 
root's avatar
root committed
52
$tip.="Code base is {$row["shortversion"]} and the current github base is {$row["masterversion"]}. ";
53
$tip.="This pod is {$verdiff} versions behind the current code. This pods IP {$row["ip"]} ". ($row["ipv6"] == "yes" ? "has" : "does not have") ." IPv6 and is located in {$row["country"]}. On a score of -20 to +20 this pod is a {$row["score"]} right now, all data is checked every hour. Pod " . ($row["signup"] == "1" ? "does" : "does not") . " allow new users.";
root's avatar
root committed
54

David Morley's avatar
David Morley committed
55
     echo "<tr><td><div title='$tip' class='tipsy'><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $method . $row["domain"] . "</a></div></td>";
56 57
"</div></td>";

root's avatar
root committed
58
if (stristr($row["shortversion"],'head')) 
59
{$version=".dev code";$pre = "This pod runs pre release 
David Morley's avatar
David Morley committed
60 61
development code";} elseif (!$row["shortversion"]) 
{$version="0";$pre = "This pod runs 
62 63 64
unknown code";} 
else 
{$version=$row["shortversion"];$pre="This pod runs production code";}
root's avatar
root committed
65
if ($row["shortversion"] == $row["masterversion"] && $row["shortversion"] != "") {$classver = "green";} elseif ($verdiff > 6) {$classver = "red";} else {$classver = "black";}
66
     echo "<td class='$classver'><div title='{$pre} codename: {$row["longversion"]} master version is: {$row["masterversion"]}' class='tipsy'>{$version}</div></td>";
67
     echo "<td>" . $row["uptimelast7"] . "%</td>";
dmorley's avatar
dmorley committed
68 69
if ($row["signup"] == 1) {$signup="Open";} else {$signup="Closed";}
     echo "<td>" . $signup . "</td>";
70 71
     echo "<td>" . $row["total_users"] . "</td>";
     echo "<td>" . $row["local_posts"] . "</td>";
72 73
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
74
if ($row["userrating"] >6) {$userratingclass="green";} elseif ($row["userrating"] <7) {$userratingclass="yellow";} elseif ($row["userrating"] <3) {$userratingclass="red";}
75
     echo "<td><a rel=\"facebox\" href=\"rate.php?domain=".$row["domain"]."\"><div class='tipsy rating ".$userratingclass."' title='User rating is ".$row["userrating"]."/10 Auto Score is: " .$row["score"]. "/20'>";
76
if ($row["userrating"] == 0) {echo "no rating yet";}
David Morley's avatar
David Morley committed
77 78 79 80
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";}
81
     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
82
for ($iw = 0; $iw < $row["adminrating"]; $iw++) {
David Morley's avatar
David Morley committed
83 84 85
echo "✪";
}

86
     echo "</div></a></td>";
David Morley's avatar
David Morley committed
87
     echo "<td class='tipsy' title='".$row["whois"]." '>" . $row["country"] . "</td></tr>\n";
David Morley's avatar
cleanup  
David Morley committed
88

David Morley's avatar
David Morley committed
89 90 91 92 93
 }
 pg_free_result($result);       
 pg_close($dbh);
?>
</tbody>
94
</table>