showfull.php 6.73 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());

dmorley's avatar
dmorley committed
11
$sql = 'SELECT domain,masterversion,shortversion,softwarename,monthsmonitored,score,signup,secure,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,dateupdated,ipv6,total_users,local_posts,comment_counts,statsurl,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="Percent of the time the pod is online.">Uptime</a></th>
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    <th>IPv6</th>
    <th>Response Time</th>
    <th>Signups</th>
    <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>
  </tr>
  </thead>
  <tbody>
  <?php
  while ($row = pg_fetch_array($result)) {
dmorley's avatar
dmorley committed
45
    if ($row['secure'] === 't') {
noplanman's avatar
noplanman committed
46
      $scheme = 'https://';
47 48 49
      $class  = 'green';
      $tip    = 'This pod uses SSL encryption for traffic.';
    } else {
noplanman's avatar
noplanman committed
50
      $scheme = 'http://';
51 52 53 54
      $class  = 'red';
      $tip    = 'This pod does not offer SSL';
    }
    $pod_name = htmlentities($row['name'], ENT_QUOTES);
55
    $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['dateupdated']}. ";
56
    $tip .= "On a scale of 100 this pod is a {$row['score']} right now";
dmorley's avatar
dmorley committed
57

58
    echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="' . $class . '" target="_self" href="/go.php?url=' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></td>';
dmorley's avatar
dmorley committed
59

David Morley's avatar
David Morley committed
60 61
    if ($row['shortversion'] > $row['masterversion']) {
      $version = $row['shortversion'];
62 63 64 65 66 67 68 69
      $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
70 71 72 73
    if (version_compare($row['shortversion'], $row['masterversion'], '=')) {
      $classver = 'text-success';
    } elseif (version_compare($row['shortversion'], $row['masterversion'], '<')) {
      $classver = 'text-warning';
74 75 76
    } else {
      $classver = 'black';
    }
David Morley's avatar
David Morley committed
77
    echo '<td class="' . $classver . '"><div title="' . $pre . ' version: ' . $row['shortversion'] . ' master version is: ' . $row['masterversion'] . '" data-toggle="tooltip" data-placement="bottom">' . $version . '</div></td>';
dmorley's avatar
dmorley committed
78
    echo '<td>' . $row['uptime_alltime'] . '%</td>';
dmorley's avatar
dmorley committed
79
    echo '<td>' . ($row['ipv6'] === 't' ? 'Yes' : 'No') . '</td>';
80
    echo '<td>' . $row['responsetime'] . '</td>';
81
    echo '<td>' . ($row['signup'] === 't' ? 'Open' : 'Closed') . '</td>';
82 83 84 85 86
    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
dmorley committed
87 88
    if (strpos($row['statsurl'], 'pingdom.com')) {
      $moreurl = $row['statsurl'];
89
    } else {
90
      $moreurl = '/showstats.php?domain=' . $row['domain'];
91 92
    }
    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
93

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

96 97
    echo '</a></td>';
    echo '<td>' . $row['score'] . '/100</td>';
David Morley's avatar
David Morley committed
98
    if ($country_code === $row['country']) {
dmorley's avatar
dmorley committed
99
      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
100
    } else {
dmorley's avatar
dmorley committed
101
      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
102
    }
noplanman's avatar
noplanman committed
103 104

    echo '<td>';
noplanman's avatar
noplanman committed
105 106 107 108
    $row['service_facebook'] === 't' && print '<div class="smlogo smlogo-facebook"></div>';
    $row['service_twitter'] === 't' && print '<div class="smlogo smlogo-twitter"></div>';
    $row['service_tumblr'] === 't' && print '<div class="smlogo smlogo-tumblr"></div>';
    $row['service_wordpress'] === 't' && print '<div class="smlogo smlogo-wordpress"></div>';
dmorley's avatar
dmorley committed
109
    $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>';
noplanman's avatar
noplanman committed
110
    echo '</td></tr>';
111 112 113 114 115
  }
  pg_free_result($result);
  pg_close($dbh);
  ?>
  </tbody>
dmorley's avatar
dmorley committed
116
</table>