Commit 6705599c authored by dmorley's avatar dmorley

few bugs and cleanup api to be consistant

parent 1b5eace5
......@@ -13,7 +13,7 @@ require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetimems,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden FROM pods WHERE domain = $1';
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -25,7 +25,7 @@ while ($row = pg_fetch_array($result)) {
echo 'Last Git Pull: ' . $row['hgitdate'] . '<br>';
echo 'Uptime This Month ' . $row['uptime_alltime'] . '<br>';
echo 'Months Monitored: ' . $row['monthsmonitored'] . '<br>';
echo 'Response Time: ' . $row['responsetimems'] . '<br>';
echo 'Response Time: ' . $row['responsetime'] . '<br>';
echo 'User Rating: ' . $row['userrating'] . '<br>';
echo 'Server Location: ' . $row['country'] . '<br>';
echo 'Latitude: ' . $row['lat'] . '<br>';
......
......@@ -21,7 +21,7 @@ if ($_format === 'georss') {
<link href="https://{$_SERVER['HTTP_HOST']}/"/>
EOF;
$sql = "SELECT * FROM pods WHERE NOT hidden";
$sql = "SELECT name,monthsmonitored,responsetime,uptime_alltime,dateupdated,score,secure,domain,country,lat,long FROM pods";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -32,7 +32,7 @@ EOF;
'This pod %1$s has been watched for %2$s months and its average ping time is %3$s with uptime of %4$s%% this month and was last checked on %5$s. On a score of 100 this pod is a %6$s right now',
$pod_name,
$row['monthsmonitored'],
$row['responsetimems'],
$row['responsetime'],
$row['uptime_alltime'],
$row['dateupdated'],
$row['score']
......@@ -54,7 +54,7 @@ EOF;
}
echo '</feed>';
} elseif ($_format === 'json') {
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetimems,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden,terms,sslexpire,uptime_custom,dnssec,softwarename,total_users,local_posts,comment_counts,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods';
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden,terms,sslexpire,uptime_custom,dnssec,softwarename,total_users,local_posts,comment_counts,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods';
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -74,7 +74,7 @@ EOF;
}
} else {
$i = 0;
$sql = "SELECT domain,uptime_alltime,country FROM pods WHERE NOT hidden ORDER BY uptime_alltime DESC";
$sql = "SELECT domain,uptime_alltime,country,status FROM pods";
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -83,8 +83,9 @@ EOF;
$i++ > 0 && print ',';
printf(
'%1$s Up %2$s%% This Month - Located in: %3$s',
'%1$s is %2$s now - online %3$s%% This Month - Located in: %4$s',
$row['domain'],
$row['status'],
$row['uptime_alltime'],
$row['country']
);
......
......@@ -55,7 +55,7 @@ $numrows = pg_num_rows($result);
"\n" . 'This pod %1$s has been watched for %2$s months and its average ping time is %3$s with uptime of %4$s%% this month and was last checked on %5$s. On a score of -20 to +20 this pod is a %6$s right now',
$pod_name,
$row['monthsmonitored'],
$row['responsetimems'],
$row['responsetime'],
$row['uptime_alltime'],
$row['dateupdated'],
$row['score']
......@@ -82,7 +82,7 @@ $numrows = pg_num_rows($result);
}
echo '<td class="' . $classver . '"><div title="' . $pre . ' codename: ' . $row['shortversion'] . ' master version is: ' . $row['masterversion'] . '" class="tipsy">' . $version . '</div></td>';
echo '<td>' . $row['uptime_alltime'] . '</td>';
echo '<td>' . $row['responsetimems'] . '</td>';
echo '<td>' . $row['responsetime'] . '</td>';
echo '<td>' . ($row['signup'] === 't' ? 'Open' : 'Closed') . '</td>';
echo '<td>' . $row['total_users'] . '</td>';
echo '<td>' . $row['active_users_halfyear'] . '</td>';
......
<?php
$systemTimeZone = system('date +%Z');
$systemTimeZone = exec('date +%Z');
// Required parameters.
($_domain = $_POST['domain'] ?? null) || die('no pod domain given');
......
......@@ -52,7 +52,7 @@ $numrows = pg_num_rows($result);
$tip = 'This pod does not offer SSL';
}
$pod_name = htmlentities($row['name'], ENT_QUOTES);
$tip .= "\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an overall uptime of {$row['uptime_alltime']}% and a response time average today of {$row['responsetimems']}ms was last checked on {$row['dateupdated']}. ";
$tip .= "\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an overall uptime of {$row['uptime_alltime']}% and a response time average today of {$row['responsetime']}ms was last checked on {$row['dateupdated']}. ";
$tip .= "On a scale of 100 this pod is a {$row['score']} right now";
echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="' . $class . '" target="_self" href="/go.php?url=' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></td>';
......@@ -77,7 +77,7 @@ $numrows = pg_num_rows($result);
echo '<td class="' . $classver . '"><div title="' . $pre . ' version: ' . $row['shortversion'] . ' master version is: ' . $row['masterversion'] . '" data-toggle="tooltip" data-placement="bottom">' . $version . '</div></td>';
echo '<td>' . $row['uptime_alltime'] . '%</td>';
echo '<td>' . ($row['ipv6'] === 't' ? 'Yes' : 'No') . '</td>';
echo '<td>' . $row['responsetimems'] . '</td>';
echo '<td>' . $row['responsetime'] . '</td>';
echo '<td>' . ($row['signup'] === 't' ? 'Open' : 'Closed') . '</td>';
echo '<td>' . $row['total_users'] . '</td>';
echo '<td>' . $row['active_users_halfyear'] . '</td>';
......
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