mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge branch 'release/v5.0' into new/unify_domain_pages
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@
|
||||
<!-- Alerts -->
|
||||
<div id="alInfo" class="alert alert-info alert-dismissible fade in" role="alert" hidden="true">
|
||||
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
Updating...
|
||||
Updating...this may take a while. <strong>Please do not navigate away from or close this page.</strong>
|
||||
</div>
|
||||
<div id="alSuccess" class="alert alert-success alert-dismissible fade in" role="alert" hidden="true">
|
||||
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer clearfix">
|
||||
<strong>Hint:</strong> Please run <code>pihole -g</code> or update your gravity list <a href="gravity.php">online</a> after modifying your adlists.
|
||||
<button id="btnAdd" class="btn btn-primary pull-right">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +170,8 @@ $(document).ready(function() {
|
||||
fieldtext,
|
||||
buttontext,
|
||||
colorClass,
|
||||
isCNAME = false;
|
||||
isCNAME = false,
|
||||
regexLink = false;
|
||||
|
||||
switch (data[4]) {
|
||||
case "1":
|
||||
@@ -199,15 +200,8 @@ $(document).ready(function() {
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist)";
|
||||
|
||||
if (data.length > 9 && data[9] > -1) {
|
||||
fieldtext =
|
||||
"<a href='groups-domains.php?domainid=" +
|
||||
data[9] +
|
||||
"' class=" +
|
||||
colorClass +
|
||||
">" +
|
||||
fieldtext +
|
||||
' <i class="fas fa-link"></i></a>';
|
||||
if (data.length > 9 && data[9] > 0) {
|
||||
regexLink = true;
|
||||
}
|
||||
|
||||
buttontext =
|
||||
@@ -250,6 +244,11 @@ $(document).ready(function() {
|
||||
blocked = true;
|
||||
colorClass = "text-red";
|
||||
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist, CNAME)";
|
||||
|
||||
if (data.length > 9 && data[9] > 0) {
|
||||
regexLink = true;
|
||||
}
|
||||
|
||||
buttontext =
|
||||
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
|
||||
isCNAME = true;
|
||||
@@ -273,6 +272,26 @@ $(document).ready(function() {
|
||||
$("td:eq(4)", row).html(fieldtext);
|
||||
$("td:eq(6)", row).html(buttontext);
|
||||
|
||||
if (regexLink) {
|
||||
$("td:eq(4)", row).hover(
|
||||
function() {
|
||||
this.title = "Click to show matching regex filter";
|
||||
this.style.color = "#72afd2";
|
||||
},
|
||||
function() {
|
||||
this.style.color = "";
|
||||
}
|
||||
);
|
||||
$("td:eq(4)", row).click(function() {
|
||||
var new_tab = window.open("groups-domains.php?domainid=" + data[9], "_blank");
|
||||
if (new_tab) {
|
||||
new_tab.focus();
|
||||
}
|
||||
});
|
||||
$("td:eq(4)", row).addClass("underline");
|
||||
$("td:eq(4)", row).addClass("pointer");
|
||||
}
|
||||
|
||||
// Add domain in CNAME chain causing the query to have been blocked
|
||||
var domain = data[2];
|
||||
var CNAME_domain = data[8];
|
||||
@@ -478,10 +497,10 @@ $(document).ready(function() {
|
||||
|
||||
$("#all-queries tbody").on("click", "button", function() {
|
||||
var data = tableApi.row($(this).parents("tr")).data();
|
||||
if (data[4] === "1" || data[4] === "4" || data[4] === "5") {
|
||||
add(data[2], "white");
|
||||
} else {
|
||||
if (data[4] === "2" || data[4] === "3") {
|
||||
add(data[2], "black");
|
||||
} else {
|
||||
add(data[2], "white");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@ $domains = preg_split('/\s+/', trim($_POST['domain']));
|
||||
$comment = trim($_POST['comment']);
|
||||
|
||||
// Convert domain name to IDNA ASCII form for international domains
|
||||
foreach($domains as &$domain)
|
||||
{
|
||||
$domain = idn_to_ascii($domain);
|
||||
// Do this only for exact domains, not for regex filters
|
||||
if ($list === "white" || $list === "black") {
|
||||
foreach($domains as &$domain)
|
||||
{
|
||||
$domain = idn_to_ascii($domain);
|
||||
}
|
||||
}
|
||||
|
||||
// Only check domains we add to the exact lists.
|
||||
|
||||
@@ -352,12 +352,14 @@ if ($_POST['action'] == 'get_groups') {
|
||||
array_push($groups, $gres['group_id']);
|
||||
}
|
||||
$res['groups'] = $groups;
|
||||
$utf8_domain = idn_to_utf8($res['domain']);
|
||||
// Convert domain name to international form
|
||||
// if applicable
|
||||
if($res['domain'] !== $utf8_domain)
|
||||
{
|
||||
$res['domain'] = $utf8_domain.' ('.$res['domain'].')';
|
||||
if ($res['type'] === ListType::whitelist || $res['type'] === ListType::blacklist) {
|
||||
$utf8_domain = idn_to_utf8($res['domain']);
|
||||
// Convert domain name to international form
|
||||
// if applicable
|
||||
if($res['domain'] !== $utf8_domain)
|
||||
{
|
||||
$res['domain'] = $utf8_domain.' ('.$res['domain'].')';
|
||||
}
|
||||
}
|
||||
array_push($data, $res);
|
||||
}
|
||||
@@ -375,7 +377,7 @@ if ($_POST['action'] == 'get_groups') {
|
||||
throw new Exception('While preparing statement: ' . $db->lastErrorMsg());
|
||||
}
|
||||
|
||||
$type = intval($_POST['type'][0]);
|
||||
$type = intval($_POST['type']);
|
||||
$domain = $_POST['domain'];
|
||||
|
||||
if(strlen($_POST['type']) === 2 && $_POST['type'][1] === 'W')
|
||||
@@ -384,12 +386,12 @@ if ($_POST['action'] == 'get_groups') {
|
||||
$domain = "(\\.|^)".str_replace(".","\\.",$domain)."$";
|
||||
}
|
||||
|
||||
if($type === ListType::whitelist || $type === ListType::blacklist)
|
||||
{
|
||||
// Convert domain name to IDNA ASCII form for international domains
|
||||
$domain = idn_to_ascii($domain);
|
||||
// If adding to the exact lists, we convert the domain lower case and check whether it is valid
|
||||
$domain = strtolower($domain);
|
||||
if ($type === ListType::whitelist || $type === ListType::blacklist) {
|
||||
// Convert domain name to IDNA ASCII form for international
|
||||
// domains and convert the domain to lower case
|
||||
$domain = strtolower(idn_to_ascii($domain));
|
||||
|
||||
// Check validity of domain
|
||||
if(filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false)
|
||||
{
|
||||
throw new Exception('Domain ' . htmlentities(utf8_encode($domain)) . 'is not a valid domain.');
|
||||
|
||||
@@ -253,3 +253,11 @@ code.breakall
|
||||
word-break: break-all;
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user