show.php 4.04 KB
Newer Older
dmorley's avatar
dmorley committed
1
<?php
2

noplanman's avatar
noplanman committed
3
use RedBeanPHP\R;
4

noplanman's avatar
noplanman committed
5
defined('PODUPTIME') || die();
6

noplanman's avatar
noplanman committed
7 8 9 10 11 12 13 14 15 16 17
try {
  $pods = R::getAll('
    SELECT domain, masterversion, shortversion, softwarename, monthsmonitored, podmin_statement, score, signup, name, country, city, state, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp
    FROM pods
    WHERE NOT hidden
      AND signup
    ORDER BY weightedscore DESC
  ');
} catch (\RedBeanPHP\RedException $e) {
  die('Error in SQL query: ' . $e->getMessage());
}
18

dmorley's avatar
dmorley committed
19
?>
noplanman's avatar
noplanman committed
20

noplanman's avatar
noplanman committed
21
<meta property="og:title" content="<?php echo count($pods); ?> Federated Pods listed, Come see the privacy aware social networks."/>
David Morley's avatar
David Morley committed
22
<div class="hidden-sm-up">Scroll right or rotate device for more</div>
23
<div class="table-responsive">
David Morley's avatar
David Morley committed
24
<table class="table table-striped table-sm tablesorter-bootstrap table-hover">
25 26 27
  <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>
28
    <th><a data-toggle="tooltip" data-placement="bottom" title="Percent of the time the pod is online.">Uptime %</a></th>
29
    <th><a data-toggle="tooltip" data-placement="bottom" title="Number of users active last 6 months on this pod.">Active Users</a></th>
dmorley's avatar
dmorley committed
30 31
    <th><a data-toggle="tooltip" data-placement="bottom" title="Pod location, based on IP Geolocation.">Location</a></th>
    <th><a data-toggle="tooltip" data-placement="bottom" title="External Social Networks this pod can post to.">Services Offered</a></th>
32
    <th><a data-toggle="tooltip" data-placement="bottom" title="More information from the host of this pod.">Info</a></th>
33 34 35
  </tr>
  </thead>
  <tbody>
David Morley's avatar
David Morley committed
36

37
  <?php
noplanman's avatar
noplanman committed
38 39 40
  foreach ($pods as $pod) {
    $verdiff  = str_replace('.', '', $pod['masterversion']) - str_replace('.', '', $pod['shortversion']);
    $pod_name = htmlentities($pod['name'], ENT_QUOTES);
41
    $tip      = sprintf(
42
      'Uptime %2$s%% over %1$s months.',
noplanman's avatar
noplanman committed
43
      $pod['monthsmonitored'],
44
      $pod['uptime_alltime']
45
    );
noplanman's avatar
noplanman committed
46
    echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="text-success url" target="_self" href="/go.php?domain=' . $pod['domain'] . '">' . $pod['domain'] . '</a></div></td>';
47

noplanman's avatar
noplanman committed
48 49 50
    echo '<td>' . $pod['uptime_alltime'] . '%</td>';
    if ($pod['active_users_halfyear'] > 0) {
    echo '<td data-toggle="tooltip" data-placement="bottom" title="Active users six months: ' . $pod['active_users_halfyear'] . ', Active users one month: ' . $pod['active_users_monthly'] . '">' . $pod['active_users_halfyear'] . '</td>';
dmorley's avatar
dmorley committed
51 52 53
    } else {
    echo '<td data-toggle="tooltip" data-placement="bottom" title="Pod does not share user data."></td>';
    }
noplanman's avatar
noplanman committed
54 55
    if ($country_code === $pod['country']) {
      echo '<td class="text-success" data-toggle="tooltip" data-placement="bottom" title="City: ' . ($pod['city'] ?? 'n/a') . ', State: ' . ($pod['state'] ?? 'n/a') . '"><b>' . $pod['country'] . '</b></td>';
56
    } else {
noplanman's avatar
noplanman committed
57
      echo '<td data-toggle="tooltip" data-placement="bottom" title="City: ' . ($pod['city'] ?? 'n/a') . ', State: ' . ($pod['state'] ?? 'n/a') . '">' . $pod['country'] . '</td>';
58 59
    }
    echo '<td>';
noplanman's avatar
noplanman committed
60 61 62 63 64 65
    $pod['service_facebook'] && print '<div class="smlogo smlogo-facebook" title="Publish to Facebook"></div>';
    $pod['service_twitter'] && print '<div class="smlogo smlogo-twitter" title="Publish to Twitter"></div>';
    $pod['service_tumblr'] && print '<div class="smlogo smlogo-tumblr" title="Publish to Tumblr"></div>';
    $pod['service_wordpress'] && print '<div class="smlogo smlogo-wordpress"  title="Publish to WordPress"></div>';
    $pod['service_xmpp'] && 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></td>';
    echo '<td>' . ($pod['podmin_statement'] ? '<a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="left" title="Podmin Statement" data-html="true" data-content="' . htmlentities($pod['podmin_statement'], ENT_QUOTES) . '">&#128172;</a>' : '&nbsp;') . '</td></tr>';
66 67 68
  }
  ?>
  </tbody>
69
</table>
70
</div>