Skip to content

Commit

Permalink
fix domains speciallogfile ajax-check/note; improve ajax ip check in …
Browse files Browse the repository at this point in the history
…admin_ipsandports

Signed-off-by: Michael Kaufmann <[email protected]>
  • Loading branch information
d00p committed Mar 27, 2024
1 parent ff4c54a commit 1f4f1d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions admin_ipsandports.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@
}
} elseif ($action == 'jqCheckIP') {
$ip = $_POST['ip'] ?? "";
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE) == false) {
// returns notice if private network detected so we can display it
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {
echo json_encode('<div id="ipnote" class="invalid-feedback">'.lng('error.invalidip', [$ip]).'</div>');
} elseif (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE)) {
// returns notice if private network detected, so we can display it
echo json_encode(lng('admin.ipsandports.ipnote'));
} else {
echo 0;
Expand Down
1 change: 1 addition & 0 deletions templates/Froxlor/assets/js/jquery/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default function () {
id: $('input[name=id]').val(), newval: +$('#speciallogfile').is(':checked')
},
dataType: "json",
async: false,
beforeSend: function (request) {
request.setRequestHeader('X-CSRF-TOKEN', document.querySelector('meta[name="csrf-token"]').getAttribute('content'));
},
Expand Down

0 comments on commit 1f4f1d8

Please sign in to comment.