showfull.php 5.95 KB
Newer Older
dmorley's avatar
dmorley committed
1 2
<?php
$tt=0;
3 4
require_once __DIR__ . '/config.php';

dmorley's avatar
cleanup  
dmorley committed
5 6
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
7
  die('Error in connection: ' . pg_last_error());
dmorley's avatar
cleanup  
dmorley committed
8 9
}  
$hidden = isset($_GET['hidden'])?$_GET['hidden']:null;
10
if ($hidden == 'true') {
David Morley's avatar
David Morley committed
11
  $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY uptimelast7 DESC";
dmorley's avatar
cleanup  
dmorley committed
12
} else {
13
  $sql = 'SELECT * FROM pods ORDER BY uptimelast7 DESC';
dmorley's avatar
cleanup  
dmorley committed
14 15 16
}
$result = pg_query($dbh, $sql);
if (!$result) {
17
  die('Error in SQL query: ' . pg_last_error());
dmorley's avatar
cleanup  
dmorley committed
18 19
}   
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
20 21
echo "<meta property='og:title' content='"; 
echo $numrows;
22
echo " federated Pods listed, Come see the privacy aware social networks.' />";
dmorley's avatar
dmorley committed
23 24 25
?>
<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. */ -->
David Morley's avatar
David Morley committed
26 27
<table id="myTable" class="table table-striped table-sm tablesorter table-hover tfont">
<thead class="thead-inverse">
dmorley's avatar
dmorley committed
28
<tr>
David Morley's avatar
David Morley committed
29 30
<th><a data-toggle='tooltip' data-placement='bottom' title="A pod is a site for you to set up your account.">Pod</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Version of software this pod runs">Version</a></th>
31
<th><a data-toggle='tooltip' data-placement='bottom' title="Percent of the time the pod is online for <?php echo date('F') ?>.">Uptime</a></th>
32
<th>IPv6</th>
33
<th>Response Time</th>
dmorley's avatar
dmorley committed
34
<th>Signups</th>
David Morley's avatar
David Morley committed
35 36 37 38 39 40 41 42 43 44
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of total users on this pod.">Users</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of users active last 6 months on this pod.">Active Users 6</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of users active last 1 month on this pod.">Active Users 1</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of total posts on this pod.">Posts</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of total comments on this pod.">Comments</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="How many months has this pod been online? Click number for more history.">Months</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="User rating for this pod.">Rating</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="System Score on a 100 point scale">Score</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="Pod location, based on IP Geolocation">Country</a></th>
<th><a data-toggle='tooltip' data-placement='bottom' title="External Social Networks this pod can post to">Services</a></th>
dmorley's avatar
dmorley committed
45 46 47 48 49 50
</tr>
</thead>
<tbody>
<?php
 while ($row = pg_fetch_array($result)) {
$tt=$tt+1;
51 52 53 54
if ($row['secure'] == 'true') {
  $method = 'https://';
  $class= 'green';
  $tip= 'This pod uses SSL encryption for traffic.';}
dmorley's avatar
dmorley committed
55
else {
56 57 58
  $method = 'http://';
  $class= 'red';
  $tip= 'This pod does not offer SSL';
dmorley's avatar
dmorley committed
59
} 
60 61 62 63
$verdiff = str_replace('.', '', $row['masterversion']) - str_replace('.', '', $row['shortversion']);
$pod_name = htmlentities($row['name'], ENT_QUOTES);
$tip.="\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an uptime of {$row['uptimelast7']}% this month and a response time average today of {$row['responsetimelast7']}ms was last checked on {$row['dateupdated']}. ";
$tip.="On a scale of 100 this pod is a {$row['score']} right now";
dmorley's avatar
dmorley committed
64

65 66
     echo "<tr><td><a title='$tip' data-toggle='tooltip' data-placement='bottom' class='$class' target='new' href='". $method . $row['domain'] . "'>" . $row['domain'] . '</a></td>';
'</div></td>';
dmorley's avatar
dmorley committed
67

68 69 70 71 72
if (stristr($row['shortversion'],'head'))
{$version = '.dev';$pre = 'This pod runs pre release
development code';} elseif (!$row['shortversion'])
{$version = '0';$pre = 'This pod runs
unknown code';}
dmorley's avatar
dmorley committed
73
else 
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
{$version =$row['shortversion'];$pre = 'This pod runs production code';}
if ($row['shortversion'] == $row['masterversion'] && $row['shortversion'] != '') {$classver = 'green';} elseif ($verdiff > 6) {$classver = 'red';} else {$classver = 'black';}
     echo "<td class='$classver'><div title='{$pre} codename: {$row['longversion']} master version is: {$row['masterversion']}' data-toggle='tooltip' data-placement='bottom'>{$version}</div></td>";
     echo '<td>' . $row['uptimelast7'] . '%</td>';
     echo '<td>' . $row['ipv6'] . '</td>';
     echo '<td>' . $row['responsetimelast7'] . '</td>';
if ($row['signup'] == 1) {$signup = 'Open';} else {$signup = 'Closed';}
     echo '<td>' . $signup . '</td>';
     echo '<td>' . $row['total_users'] . '</td>';
     echo '<td>' . $row['active_users_halfyear'] . '</td>';
     echo '<td>' . $row['active_users_monthly'] . '</td>';
     echo '<td>' . $row['local_posts'] . '</td>';
     echo '<td>' . $row['comment_counts'] . '</td>';
if (strpos($row['pingdomurl'],
  'pingdom.com')) {$moreurl = $row['pingdomurl'];} else {$moreurl = '/db/showuptimerobot.php?domain=' . $row['domain'];}
     echo "<td><div title='Last Check ".$row['dateupdated'] . "' data-toggle='tooltip' data-placement='bottom'><a rel='facebox' href='" . $moreurl . "'>" . $row['monthsmonitored'] . '</a></div></td>';
David Morley's avatar
David Morley committed
90

91
     echo "<td><a rel=\"facebox\" href=\"rate.php?domain=".$row['domain'] . "\">" . $row['userrating'] . '/10';
dmorley's avatar
dmorley committed
92

93 94 95
     echo '</a></td>';
     echo '<td>' . $row['score'] . "/100</td>\n";
     echo '<td>' . $row['country'] . "</td>\n";
dmorley's avatar
dmorley committed
96
     echo "<td class='' title=''>";
97 98 99 100 101
     if ($row["service_facebook"] === "t") {echo "<div class='smlogo smlogo-facebook'></div>";}
     if ($row["service_twitter"] === "t") {echo "<div class='smlogo smlogo-twitter'></div>";}
     if ($row["service_tumblr"] === "t") {echo "<div class='smlogo smlogo-tumblr'></div>";}
     if ($row["service_wordpress"] === "t") {echo "<div class='smlogo smlogo-wordpress'></div>";}
     if ($row["xmpp"] === "t") {echo "<div class='smlogo smlogo-xmpp'><img src='/images/icon-xmpp.png' width='16' height='16' title='XMPP chat server' alt='XMPP chat server'></div>";}
dmorley's avatar
dmorley committed
102
     echo "</td></tr>\n";
dmorley's avatar
cleanup  
dmorley committed
103 104 105
}
pg_free_result($result);       
pg_close($dbh);
dmorley's avatar
dmorley committed
106 107 108
?>
</tbody>
</table>