Commit b58b667f authored by David Morley's avatar David Morley

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
- 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
......
......@@ -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) {
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
$("#weight").ionRangeSlider();
}
</script>
<form action="/">
......@@ -70,6 +72,7 @@ foreach ($pods as $pod) {
<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>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">
</form>
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) {
......
......@@ -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) {
<script>
window.onload = function() {
$("#weight").ionRangeSlider();
$("#podmin_notify_level").ionRangeSlider();
}
</script>
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
<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>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">
</form>
<br>
......
ALTER TABLE pods ADD podmin_notify_level int;
......@@ -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,
......
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