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

dmorley's avatar
dmorley committed
5
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
6 7
$dbh || die('Error in connection: ' . pg_last_error());

8 9
$sql = 'SELECT * FROM pods ORDER BY uptimelast7 DESC';

dmorley's avatar
dmorley committed
10
$result = pg_query($dbh, $sql);
11 12
$result || die('Error in SQL query: ' . pg_last_error());

dmorley's avatar
dmorley committed
13
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
14
?>
15

16
<meta property="og:title" content="<?php echo $numrows; ?> Federated Pods listed, Come see the privacy aware social networks."/>
dmorley's avatar
dmorley committed
17
<!-- /* 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
18
<table id="myTable" class="table table-striped table-sm tablesorter table-hover tfont">
19 20 21 22
  <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>
23
    <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>
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    <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)) {
42 43 44
    $tt++;
    if ($row['secure'] === 'true') {
      $scheme = 'https://';
45 46 47
      $class  = 'green';
      $tip    = 'This pod uses SSL encryption for traffic.';
    } else {
48
      $scheme = 'http://';
49 50 51 52 53 54 55
      $class  = 'red';
      $tip    = 'This pod does not offer SSL';
    }
    $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
56

57
    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
58

59 60 61 62 63 64 65 66 67 68
    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';
    } else {
      $version = $row['shortversion'];
      $pre     = 'This pod runs production code';
    }
69
    if ($row['shortversion'] === $row['masterversion'] && $row['shortversion'] !== '') {
70 71 72 73 74 75 76 77 78 79
      $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>';
80
    echo '<td>' . ($row['signup'] === '1' ? 'Open' : 'Closed') . '</td>';
81 82 83 84 85
    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>';
86
    if (strpos($row['pingdomurl'], 'pingdom.com')) {
87 88 89 90 91
      $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
92

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

95 96 97
    echo '</a></td>';
    echo '<td>' . $row['score'] . '/100</td>';
    echo '<td>' . $row['country'] . '</td>';
98 99

    echo '<td>';
100 101 102 103 104
    $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>';
    $row['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>';
105
    echo '</td></tr>';
106 107 108 109 110
  }
  pg_free_result($result);
  pg_close($dbh);
  ?>
  </tbody>
dmorley's avatar
dmorley committed
111
</table>