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

dmorley's avatar
cleanup  
dmorley committed
5 6
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
7
  die('Error in connection: ' . pg_last_error());
8 9
}
$hidden = isset($_GET['hidden']) ? $_GET['hidden'] : null;
10
if ($hidden == 'true') {
David Morley's avatar
David Morley committed
11
  $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY uptimelast7 DESC";
dmorley's avatar
cleanup  
dmorley committed
12
} else {
13
  $sql = 'SELECT * FROM pods ORDER BY uptimelast7 DESC';
dmorley's avatar
cleanup  
dmorley committed
14 15 16
}
$result = pg_query($dbh, $sql);
if (!$result) {
17
  die('Error in SQL query: ' . pg_last_error());
18
}
dmorley's avatar
cleanup  
dmorley committed
19
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
20
?>
noplanman's avatar
noplanman committed
21

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

64
    echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="' . $class . '" target="_self" href="' . $method . $row['domain'] . '">' . $row['domain'] . '</a></td>';
dmorley's avatar
dmorley committed
65

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
    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';
    }
    if ($row['shortversion'] == $row['masterversion'] && $row['shortversion'] != '') {
      $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>';
    if ($row['signup'] == 1) {
      $signup = 'Open';
    } else {
      $signup = 'Closed';
    }
    echo '<td>' . $signup . '</td>';
    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>';
    if (strpos($row['pingdomurl'],
      'pingdom.com')) {
      $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
105

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

108 109 110
    echo '</a></td>';
    echo '<td>' . $row['score'] . '/100</td>';
    echo '<td>' . $row['country'] . '</td>';
noplanman's avatar
noplanman committed
111 112

    echo '<td>';
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    if ($row['service_facebook'] === 't') {
      echo '<div class="smlogo smlogo-facebook"></div>';
    }
    if ($row['service_twitter'] === 't') {
      echo '<div class="smlogo smlogo-twitter"></div>';
    }
    if ($row['service_tumblr'] === 't') {
      echo '<div class="smlogo smlogo-tumblr"></div>';
    }
    if ($row['service_wordpress'] === 't') {
      echo '<div class="smlogo smlogo-wordpress"></div>';
    }
    if ($row['xmpp'] === 't') {
      echo '<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
128
    echo '</td></tr>';
129 130 131 132 133
  }
  pg_free_result($result);
  pg_close($dbh);
  ?>
  </tbody>
dmorley's avatar
dmorley committed
134
</table>