From 0095c9f0126293f0c681153329edadfaa1eee563 Mon Sep 17 00:00:00 2001 From: David Morley Date: Sun, 29 Jan 2017 13:55:55 -0800 Subject: [PATCH] Ownstats (#88) * rebase * features and work * Make software version pull easier to understand and extend. (#91) * Combine related conditions. (#90) * Add helper function for chart display. (#89) Simplify chart data generation. * PR updates * WIP - Nicer domain checks (#92) * Explicitly check passed domain name. * Make domain lowercase. * Use native PHP instead of system exec calls to get IPs. * remove key --- bower.json | 3 +- config.php.example | 4 +- db/add.php | 66 ++++++++++++-------- db/edit.php | 7 +-- db/gettoken.php | 6 +- db/migration00001.sql | 12 +++- db/pull-masterversions.php | 29 +++++++++ db/pull.php | 124 ++++++++++++------------------------- db/pull.sh | 27 ++++---- db/tables.sql | 13 +++- index.php | 9 ++- podcrawler.php | 29 +++++++++ podmin.php | 11 ++-- showfull.php | 2 +- statsview.php | 14 +++++ statsviewjs.php | 40 ++++++++++++ 16 files changed, 254 insertions(+), 142 deletions(-) create mode 100644 db/pull-masterversions.php create mode 100644 podcrawler.php create mode 100644 statsview.php create mode 100644 statsviewjs.php diff --git a/bower.json b/bower.json index b2d3bdd..3781cb8 100644 --- a/bower.json +++ b/bower.json @@ -24,6 +24,7 @@ "tablesorter": "jquery.tablesorter#^2.28.3", "leaflet": "^1.0.2", "leaflet.markercluster": "^1.0.0", - "facebox": "*" + "facebox": "*", + "chart.js": "^2.4.0" } } diff --git a/config.php.example b/config.php.example index 97116c4..a6b61d9 100644 --- a/config.php.example +++ b/config.php.example @@ -16,5 +16,5 @@ $pgdb = ''; $adminemail = ''; //admin key for deleting pods, set this as a cookie on your own $adminkey = ''; -//apikey for public api calls -$apikey = ''; +//DNS server for dnssec testing +$dnsserver = ''; diff --git a/db/add.php b/db/add.php index 0956be8..d54a412 100644 --- a/db/add.php +++ b/db/add.php @@ -4,42 +4,55 @@ require_once __DIR__ . '/../logging.php'; require_once __DIR__ . '/../config.php'; $log = new Logging(); $log->lfile(__DIR__ . '/../' . $log_dir . '/add.log'); -if (!($_domain = $_POST['domain'] ?? null)) { +if (!($_domain = $_GET['domain'] ?? null)) { $log->lwrite('no domain given'); die('no pod domain given'); } -if (!($_stats_apikey = $_POST['stats_apikey'] ?? null)) { - $log->lwrite('no api given ' . $_domain); - die('no API key for your stats'); -} -if (strlen($_stats_apikey) < 14) { - $log->lwrite('api key too short ' . $_domain); - die('API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee'); -} -if (!($_email = $_POST['email'] ?? null)) { - $log->lwrite('no email given ' . $_domain); - die('no email given'); -} -if (!($_terms = $_POST['terms'] ?? null)) { - $log->lwrite('terms link required ' . $_domain); - die('no terms link'); + +$_domain = strtolower($_domain); +if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) { + die('Could not validate the domain name, be sure to enter it as "domain.com" (no caps, no slashes, no extras)'); } $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh || die('Error in connection: ' . pg_last_error()); -$sql = 'SELECT domain, stats_apikey FROM pods'; +$sql = 'SELECT domain, stats_apikey, publickey, email FROM pods'; $result = pg_query($dbh, $sql); $result || die('Error in SQL query: ' . pg_last_error()); while ($row = pg_fetch_array($result)) { - if ($row['domain'] === $_domain) { - $log->lwrite('domain already exists ' . $_domain); - die('domain already exists'); - } - if ($row['stats_apikey'] === $_stats_apikey) { - $log->lwrite('API key already exists ' . $_domain); - die('API key already exists'); + if ($row['domain'] === $_domain ) { + if ($row['email']) { + $log->lwrite('domain already exists and is registered to an owner' . $_domain); + die('domain already exists and is registered to an owner, use the edit function to modify'); + } + + $digtxt = exec(escapeshellcmd('dig ' . $_domain . ' TXT +short')); + if (strpos($digtxt, $row['publickey']) !== false) { + echo 'domain validated, you can now add details '; + $uuid = md5(uniqid($_domain, true)); + $expire = time() + 2700; + $sql = 'UPDATE pods SET token = $1, tokenexpire = $2 WHERE domain = $3'; + $result = pg_query_params($dbh, $sql, [$uuid, date('Y-m-d H:i:s', $expire), $_domain]); + $result || die('Error in SQL query: ' . pg_last_error()); + + echo << + + +
+
+
+ + +EOF; + + die; + } else { + $log->lwrite('domain already exists and can be registered' . $_domain); + die('domain already exists, you can claim the domain by adding a DNS TXT record that states
' . $_domain . ' IN TXT "' . $row['publickey'] . '"'); + } } } @@ -57,8 +70,9 @@ if (stristr($outputssl, 'openRegistrations')) { $log->lwrite('Your pod has ssl and is valid ' . $_domain); echo 'Your pod has ssl and is valid
'; - $sql = 'INSERT INTO pods (domain, stats_apikey, email, terms) VALUES ($1, $2, $3, $4)'; - $result = pg_query_params($dbh, $sql, [$_domain, $_stats_apikey, $_email, $_terms]); + $publickey = md5(uniqid($domain, true)); + $sql = 'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4, $5)'; + $result = pg_query_params($dbh, $sql, [$_domain, $_email, $_terms, $publickey]); $result || die('Error in SQL query: ' . pg_last_error()); $to = $adminemail; diff --git a/db/edit.php b/db/edit.php index bc80e5c..94f4ee1 100644 --- a/db/edit.php +++ b/db/edit.php @@ -16,7 +16,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 domain,email,token,tokenexpire,stats_apikey,weight,terms FROM pods WHERE domain = $1'; +$sql = 'SELECT domain,email,token,tokenexpire,weight,terms FROM pods WHERE domain = $1'; $result = pg_query_params($dbh, $sql, [$_domain]); $result || die('Error in SQL query: ' . pg_last_error()); @@ -37,8 +37,8 @@ while ($row = pg_fetch_array($result)) { if ('save' === $_action) { $_weight <= 10 || die('10 is max weight'); - $sql = 'UPDATE pods SET email = $1, stats_apikey = $2, weight = $3, terms = $4 WHERE domain = $5'; - $result = pg_query_params($dbh, $sql, [$_email, $_stats_apikey, $_weight, $_terms, $_domain]); + $sql = 'UPDATE pods SET email = $1, weight = $2, terms = $3 WHERE domain = $4'; + $result = pg_query_params($dbh, $sql, [$_email, $_weight, $_terms, $_domain]); $result || die('Error in SQL query: ' . pg_last_error()); $to = $_email; @@ -56,7 +56,6 @@ while ($row = pg_fetch_array($result)) {
-



diff --git a/db/gettoken.php b/db/gettoken.php index 85437c1..9811540 100644 --- a/db/gettoken.php +++ b/db/gettoken.php @@ -33,7 +33,9 @@ while ($row = pg_fetch_array($result)) { $headers[] = 'Bcc: ' . $adminemail; $expire = time() + 2700; $output = 'Link sent to your email'; - } else { + } elseif (!$row['email']) { + echo "domain is registered but no email associated, to add an email use the add a pod feature";die; + } else { $to = $adminemail; $subject = 'FORWARD REQUEST: Temporary edit key for ' . $_SERVER['HTTP_HOST']; $message_lines[] = 'User trying to edit pod without email address.'; @@ -43,7 +45,7 @@ while ($row = pg_fetch_array($result)) { } $sql = 'UPDATE pods SET token = $1, tokenexpire = $2 WHERE domain = $3'; - $result = pg_query_params($dbh, $sql, [$uuid, date('Y-m-d H:i:s', $expire), $_domain]); + $result = pg_query_params($dbh, $sql, [$uuid, date('Y-m-d H:i:s', $expire), $_domain]); $result || die('Error in SQL query: ' . pg_last_error()); $message_lines[] = 'Link: ' . $link; diff --git a/db/migration00001.sql b/db/migration00001.sql index 28a3a4d..4fa255e 100644 --- a/db/migration00001.sql +++ b/db/migration00001.sql @@ -1,4 +1,4 @@ -ALTER TABLE pods ADD terms text, ADD sslexpire timestamp, ADD uptime_custom text, ADD dnssec boolean, ADD masterversion text, ADD shortversion text; +ALTER TABLE pods ADD terms text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text; ALTER TABLE pods DROP Hgitdate, DROP Hgitref, DROP Hruntime, DROP Hencoding, DROP longversion, DROP ptr, DROP whois, DROP postalcode, DROP connection, DROP pingdomlast; ALTER TABLE pods RENAME COLUMN pingdomurl TO stats_apikey; @@ -41,5 +41,15 @@ CREATE TABLE checks ( online boolean, error text, ttl numeric(8,6), + total_users int, + local_posts int, + comment_counts int, + shortversion text, + date_checked timestamp DEFAULT current_timestamp +); + +CREATE TABLE masterversions ( + software text, + version text, date_checked timestamp DEFAULT current_timestamp ); diff --git a/db/pull-masterversions.php b/db/pull-masterversions.php new file mode 100644 index 0000000..97ec03d --- /dev/null +++ b/db/pull-masterversions.php @@ -0,0 +1,29 @@ + ['url' => 'https://raw.githubusercontent.com/diaspora/diaspora/master/config/defaults.yml', 'regex' => '/number:.*"(.*)"/'], + 'friendica' => ['url' => 'https://raw.githubusercontent.com/friendica/friendica/master/boot.php', 'regex' => '/define.*\'FRIENDICA_VERSION\'.*\'(.*)\'/'], + 'hubzilla' => ['url' => 'https://raw.githubusercontent.com/redmatrix/hubzilla/master/boot.php', 'regex' => '/define.*\'STD_VERSION\'.*\'(.*)\'/'], +]; + +foreach ($softwares as $software => $details) { + $mv = curl_init(); + curl_setopt($mv, CURLOPT_URL, $details['url']); + curl_setopt($mv, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); + $outputmv = curl_exec($mv); + curl_close($mv); + + if ($masterversion = preg_match($details['regex'], $outputmv, $version) ? $version[1] : '') { + $sql = 'INSERT INTO masterversions (software,version) VALUES ($1,$2)'; + $result = pg_query_params($dbh, $sql, [$software, $masterversion]); + $result || die('Error in SQL query: ' . pg_last_error()); + } + + printf('%s:%s ', $software, $masterversion ?: 'n/a'); +} diff --git a/db/pull.php b/db/pull.php index b876d98..58dbc62 100644 --- a/db/pull.php +++ b/db/pull.php @@ -9,36 +9,6 @@ $_domain = $_GET['domain'] ?? ''; require_once __DIR__ . '/../config.php'; -//get master code version for diaspora pods -$mv = curl_init(); -curl_setopt($mv, CURLOPT_URL, 'https://raw.githubusercontent.com/diaspora/diaspora/master/config/defaults.yml'); -curl_setopt($mv, CURLOPT_CONNECTTIMEOUT, 5); -curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); -$outputmv = curl_exec($mv); -curl_close($mv); -$dmasterversion = preg_match('/number:.*"(.*)"/', $outputmv, $version) ? $version[1] : ''; -_debug('Diaspora Masterversion', $dmasterversion); - -//get master code version for friendica pods -$mv = curl_init(); -curl_setopt($mv, CURLOPT_URL, 'https://raw.githubusercontent.com/friendica/friendica/master/boot.php'); -curl_setopt($mv, CURLOPT_CONNECTTIMEOUT, 5); -curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); -$outputmv = curl_exec($mv); -curl_close($mv); -$fmasterversion = preg_match('/define.*\'FRIENDICA_VERSION\'.*\'(.*)\'/', $outputmv, $version) ? $version[1] : ''; -_debug('Friendica Masterversion', $fmasterversion); - -//get master code version for hubzilla pods -$mv = curl_init(); -curl_setopt($mv, CURLOPT_URL, 'https://raw.githubusercontent.com/redmatrix/hubzilla/master/boot.php'); -curl_setopt($mv, CURLOPT_CONNECTTIMEOUT, 5); -curl_setopt($mv, CURLOPT_RETURNTRANSFER, 1); -$outputmv = curl_exec($mv); -curl_close($mv); -$hmasterversion = preg_match('/define.*\'STD_VERSION\'.*\'(.*)\'/', $outputmv, $version) ? $version[1] : '' ; -_debug('Hubzilla Masterversion', $hmasterversion); - $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh || die('Error in connection: ' . pg_last_error()); @@ -112,10 +82,6 @@ while ($row = pg_fetch_assoc($result)) { } if ($jsonssl !== null) { - $sql_checks = 'INSERT INTO checks (domain, online, ttl) VALUES ($1, $2, $3)'; - $result_checks = pg_query_params($dbh, $sql_checks, [$domain, 1, $ttl]); - $result_checks || die('Error in SQL query: ' . pg_last_error()); - (!$jsonssl->software->version) || $score += 1; $xdver = $jsonssl->software->version ?? 0; $dverr = explode('-', trim($xdver)); @@ -134,6 +100,12 @@ while ($row = pg_fetch_assoc($result)) { $service_tumblr = in_array('tumblr', $jsonssl->services->outbound, true); $service_wordpress = in_array('wordpress', $jsonssl->services->outbound, true); $service_xmpp = $jsonssl->metadata->xmppChat === true ?? false; + $status = 'Up'; + + $sql_checks = 'INSERT INTO checks (domain, online, ttl, total_users, local_posts, comment_counts, shortversion) VALUES ($1, $2, $3, $4, $5, $6, $7)'; + $result_checks = pg_query_params($dbh, $sql_checks, [$domain, 1, $ttl, $total_users, $local_posts, $comment_counts, $shortversion]); + $result_checks || die('Error in SQL query: ' . pg_last_error()); + } else { $score -= 1; $dver = '.connect error'; @@ -141,20 +113,20 @@ while ($row = pg_fetch_assoc($result)) { } _debug('Signup Open', $signup); - $ip6 = exec(escapeshellcmd('dig @74.82.42.42 +nocmd ' . $domain . ' aaaa +noall +short')); + + $ip = dns_get_record($_domain, DNS_A)[0]['ip'] ?? null; + $ipv6 = dns_get_record($_domain, DNS_AAAA)[0]['ipv6'] ?? null; + $iplookup = []; - exec(escapeshellcmd('delv @74.82.42.42 ' . $domain), $iplookup); + exec(escapeshellcmd('delv @' . $dnsserver . ' ' . $domain), $iplookup); if ($iplookup) { _debug('Iplookup', $iplookup, true); - $dnssec = in_array('; fully validated', $iplookup, true) ?? false ; - $getaonly = array_values(preg_grep('/\s+IN\s+A\s+.*/', $iplookup)); - preg_match('/A\s(.*)/', $getaonly[0], $version); - $ip = trim($version[1]); + $dnssec = in_array('; fully validated', $iplookup, true) ?? false; } $ip || $score -= 2; - $ipv6 = strpos($ip6, ':') !== false; - _debug('IP', $ip); - _debug('IPv6', $ip6); + + _debug('IPv4', $ip); + _debug('IPv6', $ipv6); $location = geoip_record_by_name($ip); _debug('Location', $location, true); @@ -166,46 +138,30 @@ while ($row = pg_fetch_assoc($result)) { echo $newline; $statslastdate = date('Y-m-d H:i:s'); - $ping = curl_init(); - curl_setopt($ping, CURLOPT_URL, 'https://api.uptimerobot.com/getMonitors?format=json&noJsonCallback=1&customUptimeRatio=7-30-60-90&responseTimes=1&responseTimesAverage=86400&apiKey=' . $row['stats_apikey']); - curl_setopt($ping, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ping, CURLOPT_CONNECTTIMEOUT, 8); - $uptr = json_decode(curl_exec($ping)); - curl_close($ping); - _debug('Uptime Robot', $uptr, true); - - if ($uptr->stat === 'ok') { - $responsetime = $uptr->monitors->monitor{'0'}->responsetime{'0'}->value ?? 'n/a'; - $uptimerobotstat = $uptr->stat; - $uptime = $uptr->monitors->monitor{'0'}->alltimeuptimeratio; - $uptime_custom = $uptr->monitors->monitor{'0'}->customuptimeratio; + + $diff = (new DateTime())->diff(new DateTime($dateadded)); $months = $diff->m + ($diff->y * 12); - if ($uptr->monitors->monitor{'0'}->status == 2) { - $status = 'Up'; - } - if ($uptr->monitors->monitor{'0'}->status == 0) { - $status = 'Paused'; - } - if ($uptr->monitors->monitor{'0'}->status == 1) { - $status = 'Not Checked Yet'; - } - if ($uptr->monitors->monitor{'0'}->status == 8) { - $status = 'Seems Down'; - } - if ($uptr->monitors->monitor{'0'}->status == 9) { - $status = 'Down'; - } - $statslastdate = date('Y-m-d H:i:s'); - } - - if ($softwarename === 'diaspora') { - $masterversion = $dmasterversion; - } elseif ($softwarename === 'friendica') { - $masterversion = $fmasterversion; - } elseif ($softwarename === 'redmatrix') { - $masterversion = $hmasterversion; - } + + $responsetime = 0; + $sqlttl = 'SELECT round(avg(ttl) * 1000) AS ttl FROM checks WHERE domain = $1'; + $resultttl = pg_query_params($dbh, $sqlttl, [$domain]); + $resultttl || die('Error in SQL query resultchecks: ' . pg_last_error()); + $responsetime = pg_fetch_result($resultttl, 0); + + $uptime = 0; + $sqlonline = 'SELECT round(avg(online::int),2) * 100 AS online FROM checks WHERE domain = $1'; + $resultonline = pg_query_params($dbh, $sqlonline, [$domain]); + $resultonline || die('Error in SQL query resultchecks: ' . pg_last_error()); + $uptime = pg_fetch_result($resultonline, 0); + + $sqlmasters = 'SELECT version FROM masterversions WHERE software = $1 ORDER BY date_checked LIMIT 1'; + $resultmasters = pg_query_params($dbh, $sqlmasters, [$softwarename]); + $resultmasters || die('Error in SQL query: ' . pg_last_error()); + $masterversion = pg_fetch_result($resultmasters, 0); + + _debug('Masterversion', $masterversion); + $hidden = $score <= 70; _debug('Hidden', $hidden ? 'yes' : 'no'); // lets cap the scores or you can go too high or too low to never be effected by them @@ -217,9 +173,9 @@ while ($row = pg_fetch_assoc($result)) { $weightedscore = ($uptime + $score + ($active_users_monthly / 19999) - ((10 - $weight) * .12)); //sql it - $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'; - $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]); + $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, dnssec = $37, sslexpire = $38 WHERE domain = $1'; + $result_set = pg_query_params($dbh, $sql_set, [$domain, 1, (int) $hidden, $ip, (int) ($ipv6 !== null), $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, (int) $dnssec, $sslexpire]); $result_set || die('Error in SQL query3: ' . pg_last_error()); _debug('Score out of 100', $score); diff --git a/db/pull.sh b/db/pull.sh index 1a3287f..3e81f6c 100755 --- a/db/pull.sh +++ b/db/pull.sh @@ -1,24 +1,29 @@ -SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +SCRIPT_DIR = "$( cd "$( dirname "$0" )" && pwd )" +TIME = `date +%k` if [ -s /tmp/index.google ];then - echo "already running die" + echo "already running die" exit; else - echo "Checking for internet"; + echo "Checking for internet"; fi wget -q --tries=2 --timeout=15 http://www.google.com -O /tmp/index.google sleep 2 if [ ! -s /tmp/index.google ];then - echo "could not update pods as no internet" - rm /tmp/index.google + echo "could not update pods as no internet" + rm /tmp/index.google exit; else - echo "Pulling in new pod data"; - cd "$SCRIPT_DIR" - php pull.php - touch last.data - php backup.php - rm /tmp/index.google + cd "$SCRIPT_DIR" + if [ $TIME = 6 ];then + echo "Pulling in master versions"; + php pull-masterversions.php + fi + echo "Pulling in new pod data"; + php pull.php + touch last.data + php backup.php + rm /tmp/index.google fi diff --git a/db/tables.sql b/db/tables.sql index f327734..c8baf11 100644 --- a/db/tables.sql +++ b/db/tables.sql @@ -20,7 +20,6 @@ CREATE TABLE pods ( ipv6 boolean, secure boolean, sslvalid text, - stats_apikey text, monthsmonitored int, signup boolean, total_users int, @@ -28,7 +27,6 @@ CREATE TABLE pods ( active_users_monthly int, local_posts int, uptime_alltime numeric(5,2), - uptime_custom text, status text, responsetime text, service_facebook boolean, @@ -37,6 +35,7 @@ CREATE TABLE pods ( service_wordpress boolean, service_xmpp boolean, token text, + publickey text, tokenexpire timestamp, terms text, sslexpire timestamp, @@ -77,6 +76,16 @@ CREATE TABLE checks ( online boolean, error text, ttl numeric(8,6), + total_users int, + local_posts int, + comment_counts int, + shortversion text, + date_checked timestamp DEFAULT current_timestamp +); + +CREATE TABLE masterversions ( + software text, + version text, date_checked timestamp DEFAULT current_timestamp ); diff --git a/index.php b/index.php index b8b2e47..272477b 100644 --- a/index.php +++ b/index.php @@ -3,9 +3,10 @@ $lastfile = 'db/last.data'; $advancedview = isset($_GET['advancedview']); $mapview = isset($_GET['mapview']); $cleanup = isset($_GET['cleanup']); +$statsview = isset($_GET['statsview']); $podmin = isset($_GET['podmin']); $podminedit = isset($_GET['podminedit']); -$simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedit); +$simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedit || $statsview); ?> @@ -35,6 +36,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi Simple View Advanced View Map View + Network Stats @@ -45,6 +47,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi >Simple View(current)'; ?> >Advanced View(current)'; ?> >Map View(current)'; ?> + >Network Stats(current)'; ?>