From b58b667f31a2905cfd41c158c26bfac195e4345d Mon Sep 17 00:00:00 2001 From: david Date: Mon, 13 Aug 2018 19:37:15 -0700 Subject: [PATCH] Podmin decides notify score level --- CHANGELOG.md | 1 + db/add.php | 22 +++++++++++++--------- db/edit.php | 24 +++++++++++++++--------- db/migrations/2.3.0-2.4.0.sql | 1 + db/tables.sql | 1 + 5 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 db/migrations/2.3.0-2.4.0.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d8f0a..c78de60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic - Config syntax has changed to array style (#155) - Added `pghost` config to set database port - Added `CONTRIBUTING.md` +- Podmin can choose at what fail score to send the notice out ### Changed - Introduce proper changelog format (#189) - Moved DB migration scripts into `db` folder diff --git a/db/add.php b/db/add.php index 21e4973..bcb2618 100644 --- a/db/add.php +++ b/db/add.php @@ -13,9 +13,10 @@ require_once __DIR__ . '/../boot.php'; ($_domain = $_GET['domain'] ?? null) || die('no pod domain given'); // Other parameters. -$_email = $_GET['email'] ?? ''; -$_podmin_statement = $_GET['podmin_statement'] ?? ''; -$_podmin_notify = $_GET['podmin_notify'] ?? 0; +$_email = $_GET['email'] ?? ''; +$_podmin_statement = $_GET['podmin_statement'] ?? ''; +$_podmin_notify = $_GET['podmin_notify'] ?? 0; +$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50; $_domain = strtolower($_domain); if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) { @@ -61,6 +62,7 @@ foreach ($pods as $pod) {
@@ -70,6 +72,7 @@ foreach ($pods as $pod) {


+
EOF; @@ -101,12 +104,13 @@ if (!$stop) { $publickey = md5(uniqid($_domain, true)); try { - $p = R::dispense('pods'); - $p['domain'] = $_domain; - $p['email'] = $_email; - $p['podmin_statement'] = $_podmin_statement; - $p['podmin_notify'] = $_podmin_notify; - $p['publickey'] = $publickey; + $p = R::dispense('pods'); + $p['domain'] = $_domain; + $p['email'] = $_email; + $p['podmin_statement'] = $_podmin_statement; + $p['podmin_notify'] = $_podmin_notify; + $p['podmin_notify_level'] = $_podmin_notify_level; + $p['publickey'] = $publickey; R::store($p); } catch (\RedBeanPHP\RedException $e) { diff --git a/db/edit.php b/db/edit.php index 5b22180..002d121 100644 --- a/db/edit.php +++ b/db/edit.php @@ -16,11 +16,12 @@ use RedBeanPHP\R; strlen($_token) > 6 || die('bad token'); // Other parameters. -$_action = $_GET['action'] ?? ''; -$_weight = $_GET['weight'] ?? 10; -$_email = $_GET['email'] ?? ''; -$_podmin_statement = $_GET['podmin_statement'] ?? ''; -$_podmin_notify = $_GET['podmin_notify'] ?? 0; +$_action = $_GET['action'] ?? ''; +$_weight = $_GET['weight'] ?? 10; +$_email = $_GET['email'] ?? ''; +$_podmin_statement = $_GET['podmin_statement'] ?? ''; +$_podmin_notify = $_GET['podmin_notify'] ?? 0; +$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50; require_once __DIR__ . '/../boot.php'; @@ -72,10 +73,12 @@ if ('save' === $_action) { $_weight <= 10 || die('10 is max weight'); try { - $pod['email'] = $_email; - $pod['weight'] = $_weight; - $pod['podmin_statement'] = $_podmin_statement; - $pod['podmin_notify'] = $_podmin_notify; + $pod['email'] = $_email; + $pod['weight'] = $_weight; + $pod['podmin_statement'] = $_podmin_statement; + $pod['podmin_notify'] = $_podmin_notify; + $pod['podmin_notify_level'] = $_podmin_notify_level; + R::store($pod); } catch (\RedBeanPHP\RedException $e) { @@ -97,6 +100,7 @@ if ('save' === $_action) { Authorized to edit for diffForHumans(null, true); ?>
@@ -108,6 +112,8 @@ Authorized to edit for Podmin Statement (You can use HTML to include links to your terms and policies and information about your pod you wish to share with users.)



+
+
diff --git a/db/migrations/2.3.0-2.4.0.sql b/db/migrations/2.3.0-2.4.0.sql new file mode 100644 index 0000000..9203b32 --- /dev/null +++ b/db/migrations/2.3.0-2.4.0.sql @@ -0,0 +1 @@ +ALTER TABLE pods ADD podmin_notify_level int; diff --git a/db/tables.sql b/db/tables.sql index b413514..82a296f 100644 --- a/db/tables.sql +++ b/db/tables.sql @@ -40,6 +40,7 @@ CREATE TABLE pods ( tokenexpire timestamp, podmin_statement text, podmin_notify boolean, + podmin_notify_level int, sslexpire timestamp, dnssec boolean, comment_counts int, -- GitLab