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

5
//Cloudflare country code pull
6
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'];
7

dmorley's avatar
cleanup  
dmorley committed
8 9
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
10
  die('Error in connection: ' . pg_last_error());
dmorley's avatar
cleanup  
dmorley committed
11 12
}  
$hidden = isset($_GET['hidden'])?$_GET['hidden']:null;
13
if ($hidden == 'true') {
David Morley's avatar
David Morley committed
14
  $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY uptimelast7 DESC";
dmorley's avatar
cleanup  
dmorley committed
15
} else {
David Morley's avatar
David Morley committed
16
  $sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' AND signup = 1 ORDER BY uptimelast7 DESC";
dmorley's avatar
cleanup  
dmorley committed
17 18 19
}
$result = pg_query($dbh, $sql);
if (!$result) {
20
  die('Error in SQL query: ' . pg_last_error());
dmorley's avatar
cleanup  
dmorley committed
21 22
}   
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
23 24
echo "<meta property='og:title' content='"; 
echo $numrows;
25
echo " Federated Pods listed, Come see the privacy aware social networks.' />";
dmorley's avatar
dmorley committed
26
?>
David Morley's avatar
David Morley committed
27
<div class="hidden-sm-up">Scroll right or rotate device for more</div>
David Morley's avatar
David Morley committed
28
            <table class="table table-striped table-sm tablesorter table-hover" id="myTable">
David Morley's avatar
David Morley committed
29 30 31
              <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>
32
<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>
David Morley's avatar
David Morley committed
33 34 35 36 37 38 39 40
<th><a data-toggle='tooltip' data-placement='bottom' title="Number of users active last 6 months on this pod.">Active Users</a></th>
<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>
                </tr>
              </thead>
              <tbody>


David Morley's avatar
David Morley committed
41
<?php
42 43
 while ($row = pg_fetch_array($result)) {
$tt=$tt+1;
44 45 46 47
$tip= '';
if ($row['secure'] == 'true') {
$method = 'https://';
$class= 'text-success';
David Morley's avatar
David Morley committed
48 49
//$tip="This pod uses SSL encryption for traffic.";
} 
root's avatar
root committed
50

51
else {
52 53
$method = 'http://';
$class= 'red';
David Morley's avatar
David Morley committed
54
//$tip="This pod does not offer SSL";
55
} 
56 57 58 59 60 61
$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 and with an uptime of {$row['uptimelast7']}% this month. ";
$tip.="On a scale of 100 this pod is a {$row['score']} right now";
     echo "<tr><td><div title='$tip' data-toggle='tooltip' data-placement='bottom'><a class='$class url' target='new' href='". $method . $row['domain'] . "'>" . $row['domain'] . '</a></div></td>';
'</div></td>';
62

63 64 65 66
     echo '<td>' . $row['uptimelast7'] . '%</td>';
     echo "<td data-toggle='tooltip' data-placement='bottom' title='active six months: "  . $row['active_users_halfyear'] . ', active one month: ' . $row['active_users_monthly'] . "'>" . $row['active_users_halfyear'] . '</td>';
	if ($country_code == $row['country']) {
     echo "<td class='text-success' data-toggle='tooltip' data-placement='bottom' title='".$row['whois'] . " '><b>" . $row['country'] . "</b></td>\n";
67
	} else {
68
     echo "<td data-toggle='tooltip' data-placement='bottom' title='".$row['whois'] . " '>" . $row['country'] . "</td>\n";
69
	}
70
     echo "<td class='' title=''>";
71 72 73 74 75
     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>";}
76
     echo "</td></tr>\n";
dmorley's avatar
cleanup  
dmorley committed
77 78 79
}
pg_free_result($result);       
pg_close($dbh);
David Morley's avatar
David Morley committed
80 81
?>
</tbody>
82
</table>