show.php 3.81 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
?>
David Morley's avatar
David Morley committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37
<div class="hidden-sm-up">Scroll right or rotate device for more</div>
            <table class="table table-striped table-sm tablesorter table-hover tfont" id="myTable">
              <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="Percent of the time the pod is online for <?php echo date("F") ?>.">Uptime %</a></th>
<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
38
<?php
39 40
 while ($row = pg_fetch_array($result)) {
$tt=$tt+1;
David Morley's avatar
David Morley committed
41
$tip="";
42 43
if ($row["secure"] == "true") {
$method = "https://";
David Morley's avatar
David Morley committed
44 45 46
$class="text-success";
//$tip="This pod uses SSL encryption for traffic.";
} 
root's avatar
root committed
47

48 49 50
else {
$method = "http://";
$class="red";
David Morley's avatar
David Morley committed
51
//$tip="This pod does not offer SSL";
52 53
} 
$verdiff =  str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
54
$pod_name = htmlentities($row["name"], ENT_QUOTES);
David Morley's avatar
David Morley committed
55
$tip.="\n This {$row["softwarename"]} pod {$pod_name} has been watched for {$row["monthsmonitored"]} months and with an uptime of {$row["uptimelast7"]}% this month. ";
56
$tip.="On a scale of 100 this pod is a {$row["score"]} right now";
David Morley's avatar
David Morley committed
57
     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>";
58
"</div></td>";
59

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