showfull.php 7.66 KB
Newer Older
dmorley's avatar
dmorley committed
1
<?php
2

3 4
require_once __DIR__ . '/config.php';

5 6
// Cloudflare country code pull.
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
David Morley's avatar
David Morley committed
7

dmorley's avatar
cleanup  
dmorley committed
8
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
9 10
$dbh || die('Error in connection: ' . pg_last_error());

11
$sql = 'SELECT domain,dnssec,podmin_statement,sslexpire,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,latency,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY weightedscore DESC';
David Morley's avatar
David Morley committed
12

dmorley's avatar
cleanup  
dmorley committed
13
$result = pg_query($dbh, $sql);
14 15
$result || die('Error in SQL query: ' . pg_last_error());

dmorley's avatar
cleanup  
dmorley committed
16
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
17
?>
noplanman's avatar
noplanman committed
18

19
<meta property="og:title" content="<?php echo $numrows; ?> Federated Pods listed, Come see the privacy aware social networks."/>
dmorley's avatar
dmorley committed
20
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
21
<div class="table-responsive">
David Morley's avatar
David Morley committed
22
<table class="table table-striped table-sm tablesorter-bootstrap table-hover tfont">
23 24 25 26
  <thead class="thead-inverse">
  <tr>
    <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>
27
    <th><a data-toggle="tooltip" data-placement="bottom" title="Type of software this pod runs">Software</a></th>
28
    <th><a data-toggle="tooltip" data-placement="bottom" title="Percent of the time the pod is online.">Uptime</a></th>
noplanman's avatar
noplanman committed
29
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this pod offer ipv6 connection.">IPv6</a></th>
30
    <th><a data-toggle="tooltip" data-placement="bottom" title="Average connection latency time in ms from Los Angeles.">Latency</a></th>
noplanman's avatar
noplanman committed
31
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this pod allow new users.">Signups</a></th>
32
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of total users on this pod.">Users</a></th>
David Morley's avatar
David Morley committed
33 34
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 6 months on this pod.">6m</a></th>
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 1 month on this pod.">1m</a></th>
35 36
    <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>
David Morley's avatar
David Morley committed
37
    <th><a data-toggle="tooltip" data-placement="bottom" title="How many months have we been watching this pod.">Months</a></th>
38
    <th><a data-toggle="tooltip" data-placement="bottom" title="User rating for this pod.">Rating</a></th>
dmorley's avatar
dmorley committed
39
    <th><a data-toggle="tooltip" data-placement="bottom" title="System Score on a 100 point scale.">Score</a></th>
40
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this domain use DNSSEC.">DNSSEC</a></th>
dmorley's avatar
dmorley committed
41 42
    <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>
David Morley's avatar
David Morley committed
43
    <th><a data-toggle="tooltip" data-placement="bottom" title="Click for more information about this pod from the pod host (podmin).">Info</a></th>
44 45 46 47 48 49
  </tr>
  </thead>
  <tbody>
  <?php
  while ($row = pg_fetch_array($result)) {
    $pod_name = htmlentities($row['name'], ENT_QUOTES);
David Morley's avatar
David Morley committed
50
    $tip = "\n Over {$row['monthsmonitored']} months uptime is {$row['uptime_alltime']}% and response time is {$row['latency']}ms, last check on {$row['date_updated']}. ";
dmorley's avatar
dmorley committed
51

dmorley's avatar
dmorley committed
52
    echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" target="_self" href="/go.php?domain=' . $row['domain'] . '">' . $row['domain'] . '</a><span class="text-success" " data-toggle="tooltip" title="This site is SSL/TLS encrypted with a cert that expires: ' . $row['sslexpire'] . '"> &#128274;</span></td>';
dmorley's avatar
dmorley committed
53

David Morley's avatar
David Morley committed
54 55
    if ($row['shortversion'] > $row['masterversion']) {
      $version = $row['shortversion'];
56 57
      $pre     = 'This pod runs pre release development code';
    } elseif (!$row['shortversion']) {
David Morley's avatar
David Morley committed
58
      $version = '';
59 60 61 62 63
      $pre     = 'This pod runs unknown code';
    } else {
      $version = $row['shortversion'];
      $pre     = 'This pod runs production code';
    }
David Morley's avatar
David Morley committed
64 65 66 67
    if (version_compare($row['shortversion'], $row['masterversion'], '=')) {
      $classver = 'text-success';
    } elseif (version_compare($row['shortversion'], $row['masterversion'], '<')) {
      $classver = 'text-warning';
68 69 70
    } else {
      $classver = 'black';
    }
David Morley's avatar
David Morley committed
71
    echo '<td class="' . $classver . '"><div title="' . $pre . ' version: ' . $row['shortversion'] . ' master version is: ' . $row['masterversion'] . '" data-toggle="tooltip" data-placement="bottom">' . $version . '</div></td>';
72
    echo '<td>' . $row['softwarename'] . '</td>';
David Morley's avatar
David Morley committed
73
    echo '<td><a rel="facebox" href="podstat.php?domain=' . $row['domain'] . '">' . ($row['uptime_alltime'] > 0 ? $row['uptime_alltime'].'%' : '') . '</a></td>';
74
    echo '<td>' . ($row['ipv6'] === 't' ? '&#10003;' : '') . '</td>';
dmorley's avatar
latent  
dmorley committed
75
    echo '<td>' . ($row['latency'] > 0 ? $row['latency'] : '') . '</td>';
76
    echo '<td>' . ($row['signup'] === 't' ? '&#10003;' : '') . '</td>';
David Morley's avatar
David Morley committed
77 78 79 80 81
    echo '<td>' . ($row['total_users'] > 0 ? $row['total_users'] : '') . '</td>';
    echo '<td>' . ($row['active_users_halfyear'] > 0 ? $row['active_users_halfyear'] : '') . '</td>';
    echo '<td>' . ($row['active_users_monthly'] > 0 ? $row['active_users_monthly'] : '') . '</td>';
    echo '<td>' . ($row['local_posts'] > 0 ? $row['local_posts'] : '') . '</td>';
    echo '<td>' . ($row['comment_counts'] > 0 ? $row['comment_counts'] : '') . '</td>';
David Morley's avatar
David Morley committed
82
    echo '<td><div title="Last Check ' . $row['date_updated'] . '" data-toggle="tooltip" data-placement="bottom">' . $row['monthsmonitored'] . '</div></td>';
83
    echo '<td><a rel="facebox" href="rate.php?domain=' . $row['domain'] . '">' . $row['userrating'];
84
    echo '</a></td>';
85 86
    echo '<td>' . $row['score'] . '</td>';
    echo '<td>' . ($row['dnssec'] === 't' ? '&#10003;' : '') . '</td>';
David Morley's avatar
David Morley committed
87
    if ($country_code === $row['country']) {
noplanman's avatar
noplanman committed
88
      echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="City: ' . ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '"><b>' . $row['country'] . '</b></td>';
David Morley's avatar
David Morley committed
89
    } else {
noplanman's avatar
noplanman committed
90
      echo '<td data-toggle="tooltip" data-placement="bottom" title="City: ' . ($row['city'] ?? 'n/a') . ' State: ' . ($row['state'] ?? 'n/a') . '">' . $row['country'] . '</td>';
David Morley's avatar
David Morley committed
91
    }
noplanman's avatar
noplanman committed
92
    echo '<td>';
noplanman's avatar
noplanman committed
93 94 95 96
    $row['service_facebook'] === 't' && print '<div class="smlogo smlogo-facebook" title="Publish to Facebook"></div>';
    $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>';
dmorley's avatar
dmorley committed
97
    $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>';
98
    echo '</td>';
David Morley's avatar
David Morley committed
99
    
David Morley's avatar
David Morley committed
100
    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) . '">&#128172;</a>' : '&nbsp;') . '</td></tr>';
101 102 103
  }
  ?>
  </tbody>
dmorley's avatar
dmorley committed
104
</table>
105
</div>