show.php 4.17 KB
Newer Older
dmorley's avatar
dmorley committed
1 2
<?php
$tt=0;
dmorley's avatar
cleanup  
dmorley committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
include('db/config.php');
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
  die("Error in connection: " . pg_last_error());
}  
$hidden = isset($_GET['hidden'])?$_GET['hidden']:null;
if ($hidden == "true") {
  $sql = "SELECT * FROM pods WHERE hidden <> 'no' ORDER BY weightedscore DESC";
} else {
  $sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' AND signup = 1 ORDER BY weightedscore DESC";
}
$result = pg_query($dbh, $sql);
if (!$result) {
  die("Error in SQL query: " . pg_last_error());
}   
$numrows = pg_num_rows($result);
dmorley's avatar
dmorley committed
20 21
echo "<meta property='og:title' content='"; 
echo $numrows;
22
echo " Federated Pods listed, Come see the privacy aware social networks.' />";
dmorley's avatar
dmorley committed
23 24
echo $numrows;
?>
dmorley's avatar
dmorley committed
25 26
 pods that are open for signup now.  
Click column names to sort and find a pod.  
dmorley's avatar
dmorley committed
27
Show as: <a href="?mapview=true">Map</a> | <a href="/">Simple Table</a> | <a href="?advancedview=true">Advanced Table</a>
dmorley's avatar
dmorley committed
28
<meta charset="utf-8">
David Morley's avatar
David Morley committed
29
<!-- /* Copyright (c) 2011, David Morley. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file. */ -->
dmorley's avatar
dmorley committed
30
<table id="myTable" class="tablesorter zebra-striped" style="width:750px; !important">
31 32
<thead>
<tr>
33
<th width="220px">Federated Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
34
<th>Uptime %<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
dmorley's avatar
cleanup  
dmorley committed
35
<th>Active Users<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
36
<th>Location<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
37
<th>Services Offered<a class="tipsy" title="External Social Networks this pod can post to">?</a></th>
38 39 40
</tr>
</thead>
<tbody>
David Morley's avatar
David Morley committed
41
<?php
42 43 44 45 46 47
 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.";} 
root's avatar
root committed
48

49 50 51 52 53 54
else {
$method = "http://";
$class="red";
$tip="This pod does not offer SSL";
} 
$verdiff =  str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
55 56
$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 and was last checked on {$row["dateupdated"]}. ";
57
$tip.="On a scale of 100 this pod is a {$row["score"]} right now";
dmorley's avatar
dmorley committed
58
     echo "<tr><td><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $row["domain"] . "</a> <div title='$tip' class='tipsy morehover'> ?</div></td>";
59
"</div></td>";
60

61
     echo "<td>" . $row["uptimelast7"] . "%</td>";
dmorley's avatar
changes  
dmorley committed
62
     echo "<td class='tipsy' title='active six months: "  . $row["active_users_halfyear"] .  ", active one month: "  . $row["active_users_monthly"] . "'>" . $row["active_users_halfyear"] . "</td>";
63 64 65
	if ($country_code == $row["country"]) {
     echo "<td class='tipsy green' title='".$row["whois"]." '><b>" . $row["country"] . "</b></td>\n";
	} else {
66
     echo "<td class='tipsy' title='".$row["whois"]." '>" . $row["country"] . "</td>\n";
67
	}
68
     echo "<td class='' title=''>";
dmorley's avatar
dmorley committed
69 70 71 72
     if ($row["service_facebook"] == "t") {echo "<div id='facebook' class='smlogo'></div>";}
     if ($row["service_twitter"] == "t") {echo "<div id='twitter' class='smlogo'></div>";}
     if ($row["service_tumblr"] == "t") {echo "<div id='tumblr' class='smlogo'></div>";}
     if ($row["service_wordpress"] == "t") {echo "<div id='wordpress' class='smlogo'></div>";}
73
     if ($row["xmpp"] == "t") {echo "<div id='xmpp'><img src='/images/icon-xmpp.png' width='16px' height='16px' title='XMPP chat server' alt='XMPP chat server'></div>";}
74
     echo "</td></tr>\n";
75
if ($tt == 4) {
dmorley's avatar
dmorley committed
76
echo <<<EOF
dmorley's avatar
dmorley committed
77
<td colspan='12'>
dmorley's avatar
dmorley committed
78 79 80
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- podup2015 -->
<ins class="adsbygoogle"
dmorley's avatar
cleanup  
dmorley committed
81 82 83
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-3662181805557062"
data-ad-slot="2218925437"></ins>
dmorley's avatar
dmorley committed
84 85 86 87 88 89
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</td>
EOF;
}
dmorley's avatar
cleanup  
dmorley committed
90 91 92
}
pg_free_result($result);       
pg_close($dbh);
David Morley's avatar
David Morley committed
93 94
?>
</tbody>
95
</table>