Commit 2dcc68fa authored by David Morley's avatar David Morley

use array to support all the other services

parent 79d78010
ALTER TABLE pods ADD services text;
ALTER TABLE pods DROP COLUMN service_facebook, DROP COLUMN service_wordpress, DROP COLUMN service_tumblr, DROP COLUMN service_twitter;
\ No newline at end of file
......@@ -137,17 +137,10 @@ foreach ($pods as $pod) {
$local_posts = $jsonssl->usage->localPosts ?? 0;
$comment_counts = $jsonssl->usage->localComments ?? 0;
$service_xmpp = ($jsonssl->metadata->xmppChat ?? false) === true;
$service_facebook = false;
$service_twitter = false;
$service_tumblr = false;
$service_wordpress = false;
if (json_last_error() === 0) {
(!$jsonssl->software->version) || $score += 1;
if (is_array($jsonssl->services->outbound)) {
$service_facebook = in_array('facebook', $jsonssl->services->outbound, true);
$service_twitter = in_array('twitter', $jsonssl->services->outbound, true);
$service_tumblr = in_array('tumblr', $jsonssl->services->outbound, true);
$service_wordpress = in_array('wordpress', $jsonssl->services->outbound, true);
$services = json_encode($jsonssl->services->outbound);
}
}
......@@ -411,11 +404,8 @@ foreach ($pods as $pod) {
$p['local_posts'] = $local_posts;
$p['name'] = $name;
$p['comment_counts'] = $comment_counts;
$p['service_facebook'] = $service_facebook;
$p['service_tumblr'] = $service_tumblr;
$p['service_twitter'] = $service_twitter;
$p['service_wordpress'] = $service_wordpress;
$p['service_xmpp'] = $service_xmpp;
$p['services'] = $services;
$p['softwarename'] = $softwarename;
}
......
......@@ -30,11 +30,8 @@ CREATE TABLE pods (
uptime_alltime numeric(5,2),
status smallint DEFAULT 1,
latency smallint,
service_facebook boolean,
service_twitter boolean,
service_tumblr boolean,
service_wordpress boolean,
service_xmpp boolean,
services text,
token text,
publickey text,
tokenexpire timestamp,
......
......@@ -16,7 +16,7 @@ $iso = new Matriphe\ISO639\ISO639;
try {
$pods = R::getAll('
SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, daysmonitored, monthsmonitored, score, signup, name, country, countryname, city, state, detectedlanguage, uptime_alltime, active_users_halfyear, active_users_monthly, service_facebook, service_twitter, service_tumblr, service_wordpress, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, userrating, status
SELECT domain, dnssec, podmin_statement, sslexpire, masterversion, shortversion, softwarename, daysmonitored, monthsmonitored, score, signup, name, country, countryname, city, state, detectedlanguage, uptime_alltime, active_users_halfyear, active_users_monthly, services, service_xmpp, latency, date_updated, ipv6, total_users, local_posts, comment_counts, userrating, status
FROM pods
WHERE status < ?
AND score > 0
......@@ -82,16 +82,24 @@ foreach ($pods as $pod) {
echo '<td>' . $pod['state'] . '</td>';
echo '<td data-toggle="tooltip" title="' . ($pod['detectedlanguage'] ? $iso->languageByCode1($pod['detectedlanguage']) : '') . '">' . ($pod['detectedlanguage'] ? strtoupper($pod['detectedlanguage']) : '') . '</td>';
echo '<td class="text-truncate">';
$pod['service_facebook'] && print '<div class="smlogo smlogo-facebook" data-toggle="tooltip" title="Publish to Facebook"></div>';
$pod['service_twitter'] && print '<div class="smlogo smlogo-twitter" data-toggle="tooltip" title="Publish to Twitter"></div>';
$pod['service_tumblr'] && print '<div class="smlogo smlogo-tumblr" data-toggle="tooltip" title="Publish to Tumblr"></div>';
$pod['service_wordpress'] && print '<div class="smlogo smlogo-wordpress" data-toggle="tooltip" title="Publish to WordPress"></div>';
($pod['services'] ? $services = json_decode($pod['services']) : $services = '');
if (is_array($services)) {
$facebook = array_search('facebook', $services, false);
$twitter = array_search('twitter', $services, false);
$tumblr = array_search('tumblr', $services, false);
$wordpress = array_search('wordpress', $services, false);
}
$facebook !== false && print '<div class="smlogo smlogo-facebook" data-toggle="tooltip" title="Publish to Facebook"></div>';
$twitter !== false && print '<div class="smlogo smlogo-twitter" data-toggle="tooltip" title="Publish to Twitter"></div>';
$tumblr !== false && print '<div class="smlogo smlogo-tumblr" data-toggle="tooltip" title="Publish to Tumblr"></div>';
$wordpress !== false && print '<div class="smlogo smlogo-wordpress" data-toggle="tooltip" title="Publish to WordPress"></div>';
$pod['service_xmpp'] && print '<div class="smlogo smlogo-xmpp"><img src="/images/icon-xmpp.png" width="16" height="16" data-toggle="tooltip" title="XMPP chat server" alt="XMPP chat server"></div>';
echo '</td>';
echo '<td>' . ($pod['service_facebook'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_twitter'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_tumblr'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_wordpress'] ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($facebook !== false ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($twitter !== false ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($tumblr !== false ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($wordpress !== false ? 'Yes' : 'No') . '</td>';
echo '<td>' . ($pod['service_xmpp'] ? 'Yes' : 'No') . '</td>';
$podmin_statement = htmlentities($pod['podmin_statement'] ?? '', ENT_QUOTES);
......
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