Commit 7b01935a authored by dmorley's avatar dmorley

fixes again

parent ecdd79b6
...@@ -53,7 +53,7 @@ EOF; ...@@ -53,7 +53,7 @@ EOF;
} }
echo '</feed>'; echo '</feed>';
} elseif ($_format === 'json') { } elseif ($_format === 'json') {
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,stats_apikey,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,date_created,date_updated,date_laststats,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,signup,userrating,adminrating,city,state,country,lat,long,ip,ipv6,stats_apikey,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,date_created,date_updated,date_laststats,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 = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error()); $result || die('Error in SQL query: ' . pg_last_error());
......
...@@ -19,7 +19,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); ...@@ -19,7 +19,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0); curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv); $outputmv = curl_exec($mv);
curl_close($mv); curl_close($mv);
preg_match('/number: "(.*?)"/', $outputmv, $version); preg_match('/number:.*"(.*)"/', $outputmv, $version);
$dmasterversion = trim($version[1], '"'); $dmasterversion = trim($version[1], '"');
_debug('Diaspora Masterversion', $dmasterversion); _debug('Diaspora Masterversion', $dmasterversion);
...@@ -33,7 +33,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); ...@@ -33,7 +33,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0); curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv); $outputmv = curl_exec($mv);
curl_close($mv); curl_close($mv);
preg_match('/FRIENDICA_VERSION\', \'(.*?)\'/', $outputmv, $version); preg_match('/define.*\'FRIENDICA_VERSION\'.*\'(.*)\'/', $outputmv, $version);
$fmasterversion = trim($version[1], '"'); $fmasterversion = trim($version[1], '"');
_debug('Friendica Masterversion: ' . $fmasterversion); _debug('Friendica Masterversion: ' . $fmasterversion);
...@@ -47,7 +47,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); ...@@ -47,7 +47,7 @@ curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($mv, CURLOPT_NOBODY, 0); curl_setopt($mv, CURLOPT_NOBODY, 0);
$outputmv = curl_exec($mv); $outputmv = curl_exec($mv);
curl_close($mv); curl_close($mv);
preg_match('/STD_VERSION\', \'(.*?)\'/', $outputmv, $version); preg_match('/define.*\'STD_VERSION\'.*\'(.*)\'/', $outputmv, $version);
$hmasterversion = trim($version[1], '"'); $hmasterversion = trim($version[1], '"');
_debug('Hubzilla Masterversion: ' . $hmasterversion); _debug('Hubzilla Masterversion: ' . $hmasterversion);
...@@ -120,13 +120,13 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -120,13 +120,13 @@ while ($row = pg_fetch_assoc($result)) {
_debug('Connection', 'Can not connect to pod'); _debug('Connection', 'Can not connect to pod');
$sql_errors = 'INSERT INTO checks (domain, online, error) VALUES ($1, $2, $3)'; $sql_errors = 'INSERT INTO checks (domain, online, error) VALUES ($1, $2, $3)';
$result_errors = pg_query_params($dbh, $sql_errors, [$domain, 'f', $outputsslerror]); $result_errors = pg_query_params($dbh, $sql_errors, [$domain, (int) false, $outputsslerror]);
$result_errors || die('Error in SQL query: ' . pg_last_error()); $result_errors || die('Error in SQL query: ' . pg_last_error());
} }
if ($jsonssl !== null) { if ($jsonssl !== null) {
$sql_checks = 'INSERT INTO checks (domain, online) VALUES ($1, $2)'; $sql_checks = 'INSERT INTO checks (domain, online) VALUES ($1, $2)';
$result_checks = pg_query_params($dbh, $sql_checks, [$domain, 't']); $result_checks = pg_query_params($dbh, $sql_checks, [$domain, (int) true]);
$result_checks || die('Error in SQL query: ' . pg_last_error()); $result_checks || die('Error in SQL query: ' . pg_last_error());
(!$jsonssl->software->version) || $score += 1; (!$jsonssl->software->version) || $score += 1;
...@@ -134,7 +134,7 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -134,7 +134,7 @@ while ($row = pg_fetch_assoc($result)) {
$dverr = explode('-', trim($xdver)); $dverr = explode('-', trim($xdver));
$shortversion = $dverr[0]; $shortversion = $dverr[0];
_debug('Version code', $shortversion); _debug('Version code', $shortversion);
$signup = ($jsonssl->openRegistrations === true) ? 't' : 'f'; $signup = ($jsonssl->openRegistrations === true) ? true : false;
$softwarename = $jsonssl->software->name ?? 'null'; $softwarename = $jsonssl->software->name ?? 'null';
$name = $jsonssl->metadata->nodeName ?? 'null'; $name = $jsonssl->metadata->nodeName ?? 'null';
$total_users = $jsonssl->usage->users->total ?? 0; $total_users = $jsonssl->usage->users->total ?? 0;
...@@ -158,6 +158,7 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -158,6 +158,7 @@ while ($row = pg_fetch_assoc($result)) {
$iplookup = []; $iplookup = [];
exec(escapeshellcmd('delv @4.2.2.2 ' . $domain), $iplookup); exec(escapeshellcmd('delv @4.2.2.2 ' . $domain), $iplookup);
if ($iplookup) { if ($iplookup) {
_debug('Iplookup', $iplookup, true);
$dnssec = in_array('; fully validated', $iplookup) ?? false ; $dnssec = in_array('; fully validated', $iplookup) ?? false ;
preg_match('/A(.*)/', $iplookup[1], $version); preg_match('/A(.*)/', $iplookup[1], $version);
$ip = trim($version[1]); $ip = trim($version[1]);
...@@ -237,7 +238,7 @@ while ($row = pg_fetch_assoc($result)) { ...@@ -237,7 +238,7 @@ while ($row = pg_fetch_assoc($result)) {
$timenow = date('Y-m-d H:i:s'); $timenow = date('Y-m-d H:i:s');
$sql_set = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, date_laststats = $9, date_updated = $10, responsetime = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, uptime_custom = $37, dnssec = $38, sslexpire = $39 WHERE domain = $1'; $sql_set = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, date_laststats = $9, date_updated = $10, responsetime = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, uptime_custom = $37, dnssec = $38, sslexpire = $39 WHERE domain = $1';
$result_set = pg_query_params($dbh, $sql_set, [$domain, 1, (int) $hidden, $ip, (int) $ipv6, $months, $uptime, $status, $statslastdate, $timenow, $responsetime, $score, $admin_rating, $country, $city, $state, $lat, $long, $user_rating, $shortversion, $masterversion, $signup, $total_users, $active_users_halfyear, $active_users_monthly, $local_posts, $name, $comment_counts, (int) $service_facebook, (int) $service_tumblr, (int) $service_twitter, (int) $service_wordpress, $weightedscore, (int) $service_xmpp, $softwarename, $outputsslerror, $uptime_custom, (int) $dnssec, $sslexpire]); $result_set = pg_query_params($dbh, $sql_set, [$domain, 1, (int) $hidden, $ip, (int) $ipv6, $months, $uptime, $status, $statslastdate, $timenow, $responsetime, $score, $admin_rating, $country, $city, $state, $lat, $long, $user_rating, $shortversion, $masterversion, (int) $signup, $total_users, $active_users_halfyear, $active_users_monthly, $local_posts, $name, $comment_counts, (int) $service_facebook, (int) $service_tumblr, (int) $service_twitter, (int) $service_wordpress, $weightedscore, (int) $service_xmpp, $softwarename, $outputsslerror, $uptime_custom, (int) $dnssec, $sslexpire]);
$result_set || die('Error in SQL query3: ' . pg_last_error()); $result_set || die('Error in SQL query3: ' . pg_last_error());
_debug('Score out of 100', $score); _debug('Score out of 100', $score);
......
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