showfull.php 7.31 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,terms,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,responsetime,date_updated,ipv6,total_users,local_posts,comment_counts,stats_apikey,userrating FROM pods pods ORDER BY uptime_alltime 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. */ -->
David Morley's avatar
David Morley committed
21
<table id="myTable" class="table table-striped table-sm tablesorter table-hover tfont">
22 23 24 25
  <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>
26
    <th><a data-toggle="tooltip" data-placement="bottom" title="Type of software this pod runs">Software</a></th>
27
    <th><a data-toggle="tooltip" data-placement="bottom" title="Percent of the time the pod is online.">Uptime</a></th>
28 29 30
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this pod offer ipv6 connection.">IPv6</th>
    <th><a data-toggle="tooltip" data-placement="bottom" title="Average response time in ms.">Response Time</th>
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this pod allow new users.">Signups</th>
31
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of total users on this pod.">Users</a></th>
32 33
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 6 months on this pod.">Active 6m</a></th>
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 1 month on this pod.">Active 1m</a></th>
34 35 36 37
    <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>
dmorley's avatar
dmorley committed
38
    <th><a data-toggle="tooltip" data-placement="bottom" title="System Score on a 100 point scale.">Score</a></th>
39
    <th><a data-toggle="tooltip" data-placement="bottom" title="Does this domain use DNSSEC.">DNSSEC</a></th>
dmorley's avatar
dmorley committed
40 41
    <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>
42
    <th><a data-toggle="tooltip" data-placement="bottom" title="Terms page for this pod.">Terms</a></th>
43 44 45 46 47 48
  </tr>
  </thead>
  <tbody>
  <?php
  while ($row = pg_fetch_array($result)) {
    $pod_name = htmlentities($row['name'], ENT_QUOTES);
49
    $tip = "\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an overall uptime of {$row['uptime_alltime']}% and a response time average today of {$row['responsetime']}ms was last checked on {$row['date_updated']}. ";
50
    $tip .= "On a scale of 100 this pod is a {$row['score']} right now";
dmorley's avatar
dmorley committed
51

noplanman's avatar
noplanman committed
52
    echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="text-success" target="_self" href="/go.php?domain=' . $row['domain'] . '">' . $row['domain'] . '</a></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 58 59 60 61 62 63
      $pre     = 'This pod runs pre release development code';
    } elseif (!$row['shortversion']) {
      $version = '0';
      $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>';
dmorley's avatar
dmorley committed
73
    echo '<td>' . $row['uptime_alltime'] . '%</td>';
74
    echo '<td>' . ($row['ipv6'] === 't' ? '&#10003;' : '') . '</td>';
75
    echo '<td>' . $row['responsetime'] . '</td>';
76
    echo '<td>' . ($row['signup'] === 't' ? '&#10003;' : '') . '</td>';
77 78 79 80 81
    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>';
dmorley's avatar
cleanup  
dmorley committed
82
    $moreurl = '/showstats.php?domain=' . $row['domain'];
David Morley's avatar
David Morley committed
83
    echo '<td><div title="Last Check ' . $row['date_updated'] . '" data-toggle="tooltip" data-placement="bottom"><a rel="facebox" href="' . $moreurl . '">' . $row['monthsmonitored'] . '</a></div></td>';
84
    echo '<td><a rel="facebox" href="rate.php?domain=' . $row['domain'] . '">' . $row['userrating'];
85
    echo '</a></td>';
86 87
    echo '<td>' . $row['score'] . '</td>';
    echo '<td>' . ($row['dnssec'] === 't' ? '&#10003;' : '') . '</td>';
David Morley's avatar
David Morley committed
88
    if ($country_code === $row['country']) {
dmorley's avatar
dmorley committed
89
      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
90
    } else {
dmorley's avatar
dmorley committed
91
      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
92
    }
noplanman's avatar
noplanman committed
93
    echo '<td>';
dmorley's avatar
cleanup  
dmorley committed
94 95 96
    $row['service_facebook'] === 't' && print '<div class="smlogo smlogo-facebook" title="Publish to Facebook" alt="Publish to Facebook"></div>';
    $row['service_twitter'] === 't' && print '<div class="smlogo smlogo-twitter" title="Publish to Twitter" alt="Publish to Twitter"></div>';
    $row['service_tumblr'] === 't' && print '<div class="smlogo smlogo-tumblr" title="Publish to Tumblr" alt="Publish to Tumblr"></div>';
dmorley's avatar
dmorley committed
97
    $row['service_wordpress'] === 't' && print '<div class="smlogo smlogo-wordpress"  title="Publish to WordPress" alt="Publish to WordPress"></div>';
dmorley's avatar
dmorley committed
98
    $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>';
99 100
    echo '</td>';
    echo '<td><a href="https://' . $row['domain'] . $row['terms'] . '">&#128279;</a></td></tr>';
101 102 103
  }
  ?>
  </tbody>
dmorley's avatar
dmorley committed
104
</table>