show.php 4.01 KB
Newer Older
dmorley's avatar
dmorley committed
1 2 3 4 5 6 7 8 9 10 11
<?php
$tt=0;
 include('db/config.php');
 $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 active_users_halfyear DESC NULLS LAST, uptimelast7 DESC NULLS LAST";
 } else {
12
 $sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' AND signup = 1 ORDER BY active_users_halfyear DESC NULLS LAST, uptimelast7 DESC NULLS LAST";
dmorley's avatar
dmorley committed
13 14 15 16 17 18 19 20 21 22 23
 }
 $result = pg_query($dbh, $sql);
 if (!$result) {
     die("Error in SQL query: " . pg_last_error());
 }   
 $numrows = pg_num_rows($result);
echo "<meta property='og:title' content='"; 
echo $numrows;
echo " #Diaspora Pods listed, Come see the privacy aware social network.' />";
echo $numrows;
?>
dmorley's avatar
dmorley committed
24 25 26
 pods that are open for signup now.  
Click column names to sort and find a pod.  
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
27
<meta charset="utf-8">
David Morley's avatar
David Morley committed
28
<!-- /* 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
29
<table id="myTable" class="tablesorter zebra-striped" width="98%">
30 31 32
<thead>
<tr>
<th width="220px">Diaspora Pod<a class="tipsy" title="A pod is a site for you to set up your account.">?</a></th>
33
<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
34
<th>Active Users<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
35
<th>Location<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
36
<th>Services Offered<a class="tipsy" title="External Social Networks this pod can post to">?</a></th>
37 38 39
</tr>
</thead>
<tbody>
David Morley's avatar
David Morley committed
40
<?php
41 42 43 44 45 46
 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
47

48 49 50 51 52 53
else {
$method = "http://";
$class="red";
$tip="This pod does not offer SSL";
} 
$verdiff =  str_replace(".", "", $row["masterversion"]) - str_replace('.', '', $row["shortversion"]);
root's avatar
root committed
54 55


56
$tip.="\n This pod {$row["name"]} has been watched for {$row["monthsmonitored"]} months and its average ping time is {$row["responsetimelast7"]} with uptime of {$row["uptimelast7"]}% this month and was last checked on {$row["dateupdated"]}. "; 
dmorley's avatar
dmorley committed
57
$tip.="On a score of -20 to +20 this pod is a {$row["score"]} right now";
root's avatar
root committed
58

dmorley's avatar
cleanup  
dmorley committed
59
     echo "<tr><td><a class='$class' target='new' href='". $method . $row["domain"] ."'>" . $row["domain"] . " <div title='$tip' class='tipsy' style='display: inline-block'>?</div></a></td>";
60
"</div></td>";
61

62
     echo "<td>" . $row["uptimelast7"] . "%</td>";
dmorley's avatar
changes  
dmorley committed
63
     echo "<td class='tipsy' title='active six months: "  . $row["active_users_halfyear"] .  ", active one month: "  . $row["active_users_monthly"] . "'>" . $row["active_users_halfyear"] . "</td>";
64 65
     echo "<td class='tipsy' title='".$row["whois"]." '>" . $row["country"] . "</td>\n";
     echo "<td class='' title=''>";
dmorley's avatar
dmorley committed
66 67 68 69
     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>";}
70
     echo "</td></tr>\n";
dmorley's avatar
dmorley committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
if ($tt == 5) {
echo <<<EOF
<td colspan='12' style='padding-left:200px;'>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- podup2015 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-3662181805557062"
     data-ad-slot="2218925437"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</td>
EOF;
}
86 87 88
 }
 pg_free_result($result);       
 pg_close($dbh);
dmorley's avatar
dmorley committed
89 90
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
//echo $country_code;
David Morley's avatar
David Morley committed
91 92
?>
</tbody>
93
</table>