diff --git a/css/dashboard.css b/css/dashboard.css index 126afd9df05725dd47c1d987fe28695e7d7ce8f0..07a85d3aa6dfb78eee2610ddaaa77430e7da5f92 100644 --- a/css/dashboard.css +++ b/css/dashboard.css @@ -77,7 +77,7 @@ body { @media (min-width: 768px) { .main { padding-right: 40px; - padding-left: 40px; + padding-left: 80px; } } diff --git a/css/newstyle.css b/css/newstyle.css index a90eaa5305f3be99506d413ff2f231948a00bd78..d8dd01e300e2e1cbd42c01d6ff47b42d9125a36f 100644 --- a/css/newstyle.css +++ b/css/newstyle.css @@ -1,19 +1,9 @@ -.db-wrapper { -vertical-align: top; -} .rating { font-size:9px; } -.content { -margin-left: 2px !important; -width: 99%; -} .tfont { font-size:12px; } -#results { -width: 750px; -} .smlogo { width: 16px; height: 16px; @@ -39,10 +29,6 @@ background: none; .smlogo-xmpp img { vertical-align: unset; } -.morehover { -display: inline-block; -vertical-align: super; -} #map { height: 580px; } .mycluster { width: 35px; @@ -59,4 +45,9 @@ color: red; table { empty-cells: show; } - +#facebox { +z-index: 1000 !important; +} +#facebox .content { +width: 800px !important; +} diff --git a/db/add.php b/db/add.php index d8574510fce4f1bb8e92e9e23a41ce8e998aca35..01ada4850a87f287fe95219fa480d879fce4a92f 100644 --- a/db/add.php +++ b/db/add.php @@ -11,6 +11,7 @@ if (!($_domain = $_GET['domain'] ?? null)) { $_email = $_GET['email'] ?? ''; $_podmin_statement = $_GET['podmin_statement'] ?? ''; +$_podmin_notify = $_GET['podmin_notify'] ?? ''; $_domain = strtolower($_domain); if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) { @@ -74,8 +75,8 @@ if (stristr($outputssl, 'openRegistrations')) { echo 'Your pod has ssl and is valid
'; $publickey = md5(uniqid($domain, true)); - $sql = 'INSERT INTO pods (domain, email, podmin_statement, publickey) VALUES ($1, $2, $3, $4)'; - $result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $publickey]); + $sql = 'INSERT INTO pods (domain, email, podmin_statement, $podmin_notify, publickey) VALUES ($1, $2, $3, $4, $5)'; + $result = pg_query_params($dbh, $sql, [$_domain, $_email, $_podmin_statement, $_podmin_notify, $publickey]); $result || die('Error in SQL query: ' . pg_last_error()); if ($_email) { diff --git a/db/edit.php b/db/edit.php index fb939b2352cb03d9f543153806d2f3404154fe58..56f4bc1cca091e577f839d17f12db105d53371b5 100644 --- a/db/edit.php +++ b/db/edit.php @@ -36,8 +36,8 @@ while ($row = pg_fetch_array($result)) { if ('save' === $_action) { $_weight <= 10 || die('10 is max weight'); - $sql = 'UPDATE pods SET email = $1, weight = $2, podmin_statement = $3 WHERE domain = $4'; - $result = pg_query_params($dbh, $sql, [$_email, $_weight, $_podmin_statement, $_domain]); + $sql = 'UPDATE pods SET email = $1, weight = $2, podmin_statement = $3, podmin_notify = $4 WHERE domain = $5'; + $result = pg_query_params($dbh, $sql, [$_email, $_weight, $_podmin_statement, $_podmin_notify, $_domain]); $result || die('Error in SQL query: ' . pg_last_error()); $to = $_email; @@ -56,8 +56,9 @@ while ($row = pg_fetch_array($result)) {
-
+

+

diff --git a/db/migration00001.sql b/db/migration00001.sql index be77e2c46ce59ea0e38607c607e622dff28a2738..6f30264abf9194b18e6ca97331a309fdefbbaf58 100644 --- a/db/migration00001.sql +++ b/db/migration00001.sql @@ -1,4 +1,4 @@ -ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text; +ALTER TABLE pods ADD podmin_statement text, ADD sslexpire timestamp, ADD dnssec boolean, ADD masterversion text, ADD shortversion text, ADD publickey text, ADD podmin_notify boolean; 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; diff --git a/db/pods_apiv1.sql b/db/pods_apiv1.sql index a6275a0edb34f426feb3913f572af54cc731497d..8ccacbc4073cc88d5635981bd1265e55df43815f 100644 --- a/db/pods_apiv1.sql +++ b/db/pods_apiv1.sql @@ -21,6 +21,6 @@ ALTER TABLE pods_apiv1 ALTER COLUMN signup TYPE text USING signup::text; ALTER TABLE pods_apiv1 ADD Hgitdate text, ADD Hgitref text, ADD Hruntime text, ADD Hencoding text, ADD longversion text, ADD ptr text, ADD whois text, ADD postalcode text, ADD connection text, ADD pingdomlast text; -ALTER TABLE pods_apiv1 DROP terms, DROP sslexpire, DROP dnssec, DROP masterversion, DROP shortversion, DROP publickey; +ALTER TABLE pods_apiv1 DROP podmin_statement, DROP sslexpire, DROP dnssec, DROP publickey, DROP podmin_notify; UPDATE pods_apiv1 SET hgitdate = 'unsupported'; diff --git a/db/pull.php b/db/pull.php index 691dc502f22dbfcb2a69a806108318d1b97c5997..2211077acbdaee9a607edb1d4c842474f4c2c220 100644 --- a/db/pull.php +++ b/db/pull.php @@ -13,10 +13,10 @@ $dbh || die('Error in connection: ' . pg_last_error()); //foreach pod check it and update db if ($_domain) { - $sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods WHERE domain = $1'; + $sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods WHERE domain = $1'; $result = pg_query_params($dbh, $sql, [$_domain]); } elseif (PHP_SAPI === 'cli') { - $sql = 'SELECT domain,stats_apikey,score,date_created,adminrating,weight FROM pods'; + $sql = 'SELECT domain,score,date_created,adminrating,weight,hidden,podmin_notify,email FROM pods'; $result = pg_query($dbh, $sql); } else { die('No valid input'); @@ -29,6 +29,9 @@ while ($row = pg_fetch_assoc($result)) { $dateadded = $row['date_created']; $admindb = (int) $row['adminrating']; $weight = $row['weight']; + $hiddennow = $row['hidden']; + $email = $row['email']; + $notify = $row['podmin_notify']; $sqlforr = 'SELECT admin,rating FROM rating_comments WHERE domain = $1'; $ratings = pg_query_params($dbh, $sqlforr, [$domain]); $ratings || die('Error in SQL query2: ' . pg_last_error()); @@ -158,10 +161,12 @@ while ($row = pg_fetch_assoc($result)) { $responsetime = pg_fetch_result($resultttl, 0); $uptime = 0; - $sqlonline = 'SELECT round(avg(online::int),2) * 100 AS online FROM checks WHERE domain = $1'; + $sqlonline = 'SELECT avg(online::int) * 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); + $uptime = round(pg_fetch_result($resultonline, 0),2); + + _debug('Uptime', $uptime); $sqlmasters = 'SELECT version FROM masterversions WHERE software = $1 ORDER BY date_checked LIMIT 1'; $resultmasters = pg_query_params($dbh, $sqlmasters, [$softwarename]); @@ -172,6 +177,15 @@ while ($row = pg_fetch_assoc($result)) { $hidden = $score <= 70; _debug('Hidden', $hidden ? 'yes' : 'no'); + + if ($hiddennow === 'f' && $hidden && $notify === 't') { + $to = $email; + $headers = ['From: ' . $adminemail, 'Bcc: ' . $adminemail]; + $subject = 'Monitoring notice from poduptime'; + $message = 'Notice for ' . $domain . '. Your score fell to ' . $score . ' and your pod is now marked as hidden.'; + @mail($to, $subject, $message, implode("\r\n", $headers)); + _debug('Mail Notice', 'sent to '.$email); + } if ($score > 100) { $score = 100; } elseif ($score < 0) { diff --git a/db/tables.sql b/db/tables.sql index 1a592666c6cff4998b8ac5bfe6cb3f3a83be5200..7aa6aab1864f77d0f6d156348a3bde2af309aaaf 100644 --- a/db/tables.sql +++ b/db/tables.sql @@ -38,6 +38,7 @@ CREATE TABLE pods ( publickey text, tokenexpire timestamp, podmin_statement text, + podmin_notify boolean, sslexpire timestamp, dnssec boolean, comment_counts int, diff --git a/index.php b/index.php index 272477b4681cd8d0196ffa179c9e535eec1182d9..6972991f682913115580584a18cdd67f7c34ac8d 100644 --- a/index.php +++ b/index.php @@ -1,19 +1,19 @@ - Diaspora Pod Uptime Status - Find your new social home on a hosted pod - + Open Source Social Network Pod Uptime Status + @@ -21,7 +21,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi - + @@ -34,7 +34,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi