Commit b58b667f authored by dmorley's avatar dmorley

Podmin decides notify score level

parent f267bd8f
...@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic ...@@ -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) - Config syntax has changed to array style (#155)
- Added `pghost` config to set database port - Added `pghost` config to set database port
- Added `CONTRIBUTING.md` - Added `CONTRIBUTING.md`
- Podmin can choose at what fail score to send the notice out
### Changed ### Changed
- Introduce proper changelog format (#189) - Introduce proper changelog format (#189)
- Moved DB migration scripts into `db` folder - Moved DB migration scripts into `db` folder
......
...@@ -16,6 +16,7 @@ require_once __DIR__ . '/../boot.php'; ...@@ -16,6 +16,7 @@ require_once __DIR__ . '/../boot.php';
$_email = $_GET['email'] ?? ''; $_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? ''; $_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0; $_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
$_domain = strtolower($_domain); $_domain = strtolower($_domain);
if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) { if (!filter_var(gethostbyname($_domain), FILTER_VALIDATE_IP)) {
...@@ -61,6 +62,7 @@ foreach ($pods as $pod) { ...@@ -61,6 +62,7 @@ foreach ($pods as $pod) {
<script> <script>
window.onload = function() { window.onload = function() {
$("#weight").ionRangeSlider(); $("#weight").ionRangeSlider();
$("#weight").ionRangeSlider();
} }
</script> </script>
<form action="/"> <form action="/">
...@@ -70,6 +72,7 @@ foreach ($pods as $pod) { ...@@ -70,6 +72,7 @@ foreach ($pods as $pod) {
<label>Email <input type="text" size="20" name="email"></label><br> <label>Email <input type="text" size="20" name="email"></label><br>
<label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br> <label>Podmin Statement (You can include links to your terms and policies and information about your pod you wish to share with users.) <br><textarea cols="100" rows="7" name="podmin_statement"></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br> <label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" data-from="50" name="podmin_notify_level" id="podmin_notify_level"></label><br>
<input type="submit" name="action" value="save"> <input type="submit" name="action" value="save">
</form> </form>
EOF; EOF;
...@@ -106,6 +109,7 @@ if (!$stop) { ...@@ -106,6 +109,7 @@ if (!$stop) {
$p['email'] = $_email; $p['email'] = $_email;
$p['podmin_statement'] = $_podmin_statement; $p['podmin_statement'] = $_podmin_statement;
$p['podmin_notify'] = $_podmin_notify; $p['podmin_notify'] = $_podmin_notify;
$p['podmin_notify_level'] = $_podmin_notify_level;
$p['publickey'] = $publickey; $p['publickey'] = $publickey;
R::store($p); R::store($p);
......
...@@ -21,6 +21,7 @@ $_weight = $_GET['weight'] ?? 10; ...@@ -21,6 +21,7 @@ $_weight = $_GET['weight'] ?? 10;
$_email = $_GET['email'] ?? ''; $_email = $_GET['email'] ?? '';
$_podmin_statement = $_GET['podmin_statement'] ?? ''; $_podmin_statement = $_GET['podmin_statement'] ?? '';
$_podmin_notify = $_GET['podmin_notify'] ?? 0; $_podmin_notify = $_GET['podmin_notify'] ?? 0;
$_podmin_notify_level = $_GET['podmin_notify_level'] ?? 50;
require_once __DIR__ . '/../boot.php'; require_once __DIR__ . '/../boot.php';
...@@ -76,6 +77,8 @@ if ('save' === $_action) { ...@@ -76,6 +77,8 @@ if ('save' === $_action) {
$pod['weight'] = $_weight; $pod['weight'] = $_weight;
$pod['podmin_statement'] = $_podmin_statement; $pod['podmin_statement'] = $_podmin_statement;
$pod['podmin_notify'] = $_podmin_notify; $pod['podmin_notify'] = $_podmin_notify;
$pod['podmin_notify_level'] = $_podmin_notify_level;
R::store($pod); R::store($pod);
} catch (\RedBeanPHP\RedException $e) { } catch (\RedBeanPHP\RedException $e) {
...@@ -97,6 +100,7 @@ if ('save' === $_action) { ...@@ -97,6 +100,7 @@ if ('save' === $_action) {
<script> <script>
window.onload = function() { window.onload = function() {
$("#weight").ionRangeSlider(); $("#weight").ionRangeSlider();
$("#podmin_notify_level").ionRangeSlider();
} }
</script> </script>
Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($pod['tokenexpire']))->diffForHumans(null, true); ?><br> Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($pod['tokenexpire']))->diffForHumans(null, true); ?><br>
...@@ -108,6 +112,8 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po ...@@ -108,6 +112,8 @@ Authorized to edit <b><?php echo $_domain; ?></b> for <?php echo (new Carbon($po
<label>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.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br> <label>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.) <br><textarea cols="150" rows="10" name="podmin_statement"><?php echo $pod['podmin_statement']; ?></textarea></label><br>
<label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight" data-from="<?php echo $pod['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br> <label>Weight <input type="text" data-min="0" data-step="1" data-max="10" name="weight" id="weight" data-from="<?php echo $pod['weight']; ?>"> This lets you weight your pod lower on the list if you have too much traffic coming in, 10 is the norm use lower to move down the list.</label><br>
<label>Notify if pod falls off the list? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br> <label>Notify if pod falls off the list? <input type="checkbox" name="podmin_notify" <?php echo $pod['podmin_notify'] ? 'checked' : ''; ?> ></label><br>
<label>Notify when your score falls to <input type="text" data-min="1" data-step="1" data-max="99" name="podmin_notify_level" id="podmin_notify_level" data-from="<?php echo $pod['podmin_notify_level']; ?>"></label><br>
<input type="submit" name="action" value="save"> <input type="submit" name="action" value="save">
</form> </form>
<br> <br>
......
ALTER TABLE pods ADD podmin_notify_level int;
...@@ -40,6 +40,7 @@ CREATE TABLE pods ( ...@@ -40,6 +40,7 @@ CREATE TABLE pods (
tokenexpire timestamp, tokenexpire timestamp,
podmin_statement text, podmin_statement text,
podmin_notify boolean, podmin_notify boolean,
podmin_notify_level int,
sslexpire timestamp, sslexpire timestamp,
dnssec boolean, dnssec boolean,
comment_counts int, comment_counts int,
......
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