Commit d872d4f6 authored by dmorley's avatar dmorley

admin cleanup view for dead pods

parent 4fbe51ba
<?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());
}
$sql = "SELECT * FROM pods WHERE hidden <> 'no' AND score < -15 ORDER BY weightedscore DESC";
$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;
?>
<style>
.content {
width: 99%;
}
</style>
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>
<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. */ -->
<table id="myTable" class="tablesorter zebra-striped" width="98%">
<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>
<th>Version<a class="tipsy" title="Version of Diaspora this pod runs">?</a></th>
<th>Uptime<a class="tipsy" title="Percent of the time the pod is online for <?php echo date("F") ?>.">?</a></th>
<th>Responsetime</th>
<th>Signups</th>
<th>Total Users<a class="tipsy" title="Number of total users on this pod.">?</a></th>
<th>Active Last 6<a class="tipsy" title="Number of users active last 6 months on this pod.">?</a></th>
<th>Active Last 1<a class="tipsy" title="Number of users active last 1 month on this pod.">?</a></th>
<th>Posts<a class="tipsy" title="Number of total posts on this pod.">?</a></th>
<th>Comments<a class="tipsy" title="Number of total comments on this pod.">?</a></th>
<th>Months<a class="tipsy" title="How many months has this pod been online? Click number for more history.">?</a></th>
<th>Rating<a class="tipsy" title="User and Admin rating for this pod.">?</a></th>
<th>Score<a class="tipsy" title="System Score on a -20 to +20 scale">?</a></th>
<th>Country<a class="tipsy" title="Pod location, based on IP Geolocation">?</a></th>
<th>Delete?<a class="tipsy" title="Delete this pod from DB?">?</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"]);
$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"]}. ";
$tip.="On a score of -20 to +20 this pod is a {$row["score"]} right now";
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>";
"</div></td>";
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"]}' class='tipsy'>{$version}</div></td>";
echo "<td>" . $row["uptimelast7"] . "%</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 = "http://api.uptimerobot.com/getMonitors?format=json&customUptimeRatio=7-30-60-90&apiKey=".$row["pingdomurl"];}
echo "<td><div title='Last Check ".$row["dateupdated"]."' class='tipsy'><a target='new' href='".$moreurl."'>" . $row["monthsmonitored"] . "</a></div></td>";
if ($row["userrating"] >6) {$userratingclass="green";} elseif ($row["userrating"] <7) {$userratingclass="yellow";} elseif ($row["userrating"] <3) {$userratingclass="red";}
echo "<td><a rel=\"facebox\" href=\"rate.php?domain=".$row["domain"]."\"><div class='tipsy rating ".$userratingclass."' title='User rating is ".$row["userrating"]."/10 Auto Score is: " .$row["score"]. "/20'>";
if ($row["userrating"] == 0) {echo "no rating yet";}
for ($i = 0; $i < $row["userrating"]; $i++) {
echo "✪";
}
if ($row["adminrating"] >6) {$adminratingclass="green";} elseif ($row["adminrating"] <7) {$adminratingclass="yellow";} elseif ($row["adminrating"] <3) {$adminratingclass="red";}
echo "</div><br><div class='tipsy rating ".$adminratingclass."' backendscore='".$row["score"]."' title='Poduptime Approved rating is ".$row["adminrating"]."'>";
for ($iw = 0; $iw < $row["adminrating"]; $iw++) {
echo "✪";
}
echo "</div></a></td>";
echo "<td>" . $row["score"] . "</td>\n";
echo "<td>" . $row["country"] . "</td>\n";
?>
<td>
<form method="post" action="db/kill.php">
<input name="domain" value="<?php echo $row["domain"] ?>" type="hidden">
<input name="adminkey" value="<?php echo $_COOKIE["adminkey"] ?>" type="hidden">
<input type="submit" value="Delete">
</form>
</td>
<?php
echo "</td></tr>\n";
}
pg_free_result($result);
pg_close($dbh);
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
//echo $country_code;
?>
</tbody>
</table>
......@@ -19,6 +19,17 @@ font-size:9px;
margin-left: 2px !important;
width: 99%;
}
#results {
width: 750px;
}
#ad {
margin: 55px 0 0 800px;
position: fixed;
}
#adadv {
margin: 55px 0 0 1300px;
position: fixed;
}
.smlogo {
width: 16px;
height: 16px;
......
<?php
include('config.php');
if (!$_POST['domain']){
echo "no pod domain given";
die;
}
if (!$_POST['adminkey']){
echo "no token given";
die;
}
$domain = $_POST['domain'];
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
die("Error in connection: " . pg_last_error());
}
$sql = "SELECT email FROM pods WHERE domain = '$domain'";
$result = pg_query($dbh, $sql);
if (!$result) {
die("one Error in SQL query: " . pg_last_error());
}
while ($row = pg_fetch_array($result)) {
if ($adminkey <> $_POST['adminkey']) {
echo "admin key fail";die;
}
//save and exit
$sql = "DELETE from pods WHERE domain = $1";
$result = pg_query_params($dbh, $sql, array($domain));
if (!$result) {
die("two Error in SQL query: " . pg_last_error());
}
if ($row["email"]) {
$to = $row["email"];
$subject = "Pod deleted from poduptime ";
$message = "Pod " . $_GET["domain"] . " Was deleted as it was dead on the list. Feel free to add back at any time. \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $row["email"] ."\r\n";
@mail( $to, $subject, $message, $headers );
}
pg_free_result($result);
pg_close($dbh);
header( 'Location: https://podupti.me/?cleanup=true' ) ;
}
?>
......@@ -224,7 +224,9 @@ $ipv6="no";
} else {
$ipv6="yes";
}
if ($debug) {echo "IP: ".$ipnum."<br>";}
$location = geoip_record_by_name($ipnum);
if ($debug) {echo "Location: "; var_dump($location); echo "<br>";}
if ($location) {
$ipdata = "Country: ".$location["country_name"]."\n";
$whois = "Country: ".$location["country_name"]."\n Lat:".$location["latitude"]." Long:".$location["longitude"];
......
......@@ -17,6 +17,9 @@
<?php
$hidden = isset($_GET['hidden'])?$_GET['hidden']:null;
$lastfile = 'db/last.data';
$advancedview = isset($_GET['advancedview'])?$_GET['advancedview']:null;
$mapview = isset($_GET['mapview'])?$_GET['mapview']:null;
$cleanup = isset($_GET['cleanup'])?$_GET['cleanup']:null;
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
<script type="text/javascript">
......@@ -64,15 +67,47 @@ $lastfile = 'db/last.data';
</header>
<div class="container-fluid">
<div class="content">
<?php
if ($advancedview) {
echo <<<EOF
<div id="adadv">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- poduptimenew -->
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-3662181805557062"
data-ad-slot="3969028081"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
EOF;
} elseif ($cleanup) {echo "";
} else {
echo <<<EOF
<div id="ad">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- poduptimenew -->
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-3662181805557062"
data-ad-slot="3969028081"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
EOF;
}
?>
<div id="results">
<?php
$advancedview = isset($_GET['advancedview'])?$_GET['advancedview']:null;
$mapview = isset($_GET['mapview'])?$_GET['mapview']:null;
if ($advancedview) {
echo "<a href='http://podupti.me' class='btn danger large'>NOTICE: This view shows all pods in all states, some offline, click here to go to list of pods open for signup</a><br>";
include("showfull.php");
} elseif ($mapview) {
include("showmap.php");
} elseif ($cleanup) {
include("cleanup.php");
} else {
echo "<a href='random.php' class='btn danger large'>Confused and just want to sign up?? Click Here</a><br>";
include("show.php");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment