diff --git a/admin/queries.php b/admin/queries.php
index da68b19..f40a54b 100644
--- a/admin/queries.php
+++ b/admin/queries.php
@@ -50,9 +50,9 @@
}
else if(isset($_GET["forwarddest"]))
{
- if($_GET["forwarddest"] === "blocklist")
- $showing .= " queries answered from blocklists";
- elseif($_GET["forwarddest"] === "cache")
+ if($_GET["forwarddest"] === "blocked")
+ $showing .= " queries blocked by Pi-hole";
+ elseif($_GET["forwarddest"] === "cached")
$showing .= " queries answered from cache";
else
$showing .= " queries for upstream destination ".htmlentities($_GET["forwarddest"]);
diff --git a/admin/scripts/pi-hole/js/footer.js b/admin/scripts/pi-hole/js/footer.js
index 763e8ae..5e38662 100644
--- a/admin/scripts/pi-hole/js/footer.js
+++ b/admin/scripts/pi-hole/js/footer.js
@@ -58,7 +58,9 @@ function countDown() {
} else {
ena.text("Enable");
piholeChanged("enabled");
- localStorage.removeItem("countDownTarget");
+ if (localStorage) {
+ localStorage.removeItem("countDownTarget");
+ }
}
}
@@ -148,7 +150,7 @@ function initCheckboxRadioStyle() {
}
// Read from local storage, initialize if needed
- var chkboxStyle = localStorage.getItem("theme_icheck");
+ var chkboxStyle = localStorage ? localStorage.getItem("theme_icheck") : null;
if (chkboxStyle === null) {
chkboxStyle = "primary";
}
@@ -172,7 +174,10 @@ function initCheckboxRadioStyle() {
function initCPUtemp() {
function setCPUtemp(unit) {
- localStorage.setItem("tempunit", tempunit);
+ if (localStorage) {
+ localStorage.setItem("tempunit", tempunit);
+ }
+
var temperature = parseFloat($("#rawtemp").text());
var displaytemp = $("#tempdisplay");
if (!isNaN(temperature)) {
@@ -195,7 +200,7 @@ function initCPUtemp() {
}
// Read from local storage, initialize if needed
- var tempunit = localStorage.getItem("tempunit");
+ var tempunit = localStorage ? localStorage.getItem("tempunit") : null;
if (tempunit === null) {
tempunit = "C";
}
diff --git a/admin/scripts/pi-hole/js/groups-adlists.js b/admin/scripts/pi-hole/js/groups-adlists.js
index 501ec2f..1ff87a0 100644
--- a/admin/scripts/pi-hole/js/groups-adlists.js
+++ b/admin/scripts/pi-hole/js/groups-adlists.js
@@ -122,7 +122,7 @@ function initTable() {
{ data: "enabled", searchable: false },
{ data: "comment" },
{ data: "groups", searchable: false },
- { data: null, width: "80px", orderable: false },
+ { data: null, width: "22px", orderable: false },
],
columnDefs: [
{
@@ -291,7 +291,8 @@ function initTable() {
$("td:eq(5)", row).html(button);
},
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
diff --git a/admin/scripts/pi-hole/js/groups-clients.js b/admin/scripts/pi-hole/js/groups-clients.js
index 171a939..a290742 100644
--- a/admin/scripts/pi-hole/js/groups-clients.js
+++ b/admin/scripts/pi-hole/js/groups-clients.js
@@ -95,7 +95,7 @@ function initTable() {
{ data: "ip", type: "ip-address" },
{ data: "comment" },
{ data: "groups", searchable: false },
- { data: "name", width: "80px", orderable: false },
+ { data: "name", width: "22px", orderable: false },
],
columnDefs: [
{
@@ -215,7 +215,8 @@ function initTable() {
$("td:eq(3)", row).html(button);
},
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
diff --git a/admin/scripts/pi-hole/js/groups-domains.js b/admin/scripts/pi-hole/js/groups-domains.js
index e70286d..2faa9a8 100644
--- a/admin/scripts/pi-hole/js/groups-domains.js
+++ b/admin/scripts/pi-hole/js/groups-domains.js
@@ -74,7 +74,7 @@ function initTable() {
{ data: "enabled", searchable: false },
{ data: "comment" },
{ data: "groups", searchable: false, visible: showtype === "all" },
- { data: null, width: "80px", orderable: false },
+ { data: null, width: "22px", orderable: false },
],
columnDefs: [
{
@@ -244,7 +244,8 @@ function initTable() {
}
},
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
diff --git a/admin/scripts/pi-hole/js/groups.js b/admin/scripts/pi-hole/js/groups.js
index 417dd9f..8b7e3b6 100644
--- a/admin/scripts/pi-hole/js/groups.js
+++ b/admin/scripts/pi-hole/js/groups.js
@@ -25,7 +25,7 @@ $(function () {
{ data: "name" },
{ data: "enabled", searchable: false },
{ data: "description" },
- { data: null, width: "60px", orderable: false },
+ { data: null, width: "22px", orderable: false },
],
columnDefs: [
{
@@ -84,7 +84,8 @@ $(function () {
}
},
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
diff --git a/admin/scripts/pi-hole/js/index.js b/admin/scripts/pi-hole/js/index.js
index d0f5d96..d7cce8e 100644
--- a/admin/scripts/pi-hole/js/index.js
+++ b/admin/scripts/pi-hole/js/index.js
@@ -319,24 +319,71 @@ function updateQueryTypesPie() {
queryTypePieChart.update();
// Don't use rotation animation for further updates
queryTypePieChart.options.animation.duration = 0;
+ queryTypePieChart.options.legendCallback = customLegend;
+
// Generate legend in separate div
$("#query-types-legend").html(queryTypePieChart.generateLegend());
- $("#query-types-legend > ul > li").prepend(createEyeConElement());
$("#query-types-legend > ul > li").click(function (e) {
- if (isEyeCon(e.target)) {
+ if (iscolorBox(e.target)) {
return false;
}
window.location.href = "queries.php?querytype=" + querytypeids[$(this).index()];
});
+ $("#query-types-legend .colorBoxWrapper").click(function (e) {
+ hidePieSlice(e);
+ });
}).done(function () {
// Reload graph after minute
setTimeout(updateQueryTypesPie, 60000);
});
}
+function customLegend(chart) {
+ var text = [];
+ var data = chart.data;
+ var datasets = data.datasets;
+ var labels = data.labels;
+
+ text.push('
');
+
+ if (datasets.length > 0) {
+ for (var i = 0; i < datasets[0].data.length; ++i) {
+ var color = datasets[0].backgroundColor[i];
+
+ var txt = "";
+
+ // legend box icon
+ txt =
+ '' +
+ '' +
+ "";
+
+ // color block
+ txt += '';
+
+ // label
+ if (labels[i]) {
+ txt +=
+ '' +
+ labels[i] +
+ "";
+ }
+
+ text.push("- " + txt + "
");
+ }
+ }
+
+ text.push("
");
+ return text.join("");
+}
+
function hidePieSlice(event) {
- toggleEyeCon(event.target);
+ togglecolorBox(event.target);
var legendID = $(event.target).closest(".chart-legend").attr("id");
var ci =
@@ -360,19 +407,19 @@ function hidePieSlice(event) {
ci.update();
}
-function toggleEyeCon(target) {
+function togglecolorBox(target) {
var parentListItem = $(target).closest("li");
- var eyeCon = $(parentListItem).find(".fa-eye, .fa-eye-slash");
+ var colorBox = $(parentListItem).find(".fa-check-square, .fa-square");
- if (eyeCon) {
- $(eyeCon).toggleClass("fa-eye");
- $(eyeCon).toggleClass("fa-eye-slash");
+ if (colorBox) {
+ $(colorBox).toggleClass("fa-check-square");
+ $(colorBox).toggleClass("fa-square");
}
}
-function isEyeCon(target) {
- // See if click happened on eyeConWrapper or child SVG
- if ($(target).closest(".eyeConWrapper")[0]) {
+function iscolorBox(target) {
+ // See if click happened on colorBoxWrapper or child SVG
+ if ($(target).closest(".colorBoxWrapper")[0]) {
return true;
}
@@ -468,16 +515,6 @@ function updateClientsOverTime() {
});
}
-function createEyeConElement() {
- var eyeConWrapper = $("
")
- .addClass("eyeConWrapper")
- .click(function (e) {
- hidePieSlice(e);
- });
- eyeConWrapper.append($("
"));
- return eyeConWrapper;
-}
-
function updateForwardDestinationsPie() {
$.getJSON("api.php?getForwardDestinations", function (data) {
if ("FTLnotrunning" in data) {
@@ -519,11 +556,12 @@ function updateForwardDestinationsPie() {
forwardDestinationPieChart.update();
// Don't use rotation animation for further updates
forwardDestinationPieChart.options.animation.duration = 0;
+ forwardDestinationPieChart.options.legendCallback = customLegend;
+
// Generate legend in separate div
$("#forward-destinations-legend").html(forwardDestinationPieChart.generateLegend());
- $("#forward-destinations-legend > ul > li").prepend(createEyeConElement());
$("#forward-destinations-legend > ul > li").click(function (e) {
- if (isEyeCon(e.target)) {
+ if (iscolorBox(e.target)) {
return false;
}
@@ -532,6 +570,9 @@ function updateForwardDestinationsPie() {
window.location.href = "queries.php?forwarddest=" + obj;
}
});
+ $("#forward-destinations-legend .colorBoxWrapper").click(function (e) {
+ hidePieSlice(e);
+ });
}).done(function () {
// Reload graph after one minute
setTimeout(updateForwardDestinationsPie, 60000);
@@ -723,7 +764,7 @@ function updateSummaryData(runOnce) {
}
};
- $.getJSON("api.php?summary", function (data) {
+ $.getJSON("api.php?summaryRaw", function (data) {
updateSessionTimer();
if ("FTLnotrunning" in data) {
@@ -795,7 +836,7 @@ function updateSummaryData(runOnce) {
function doughnutTooltip(tooltipItems, data) {
var dataset = data.datasets[tooltipItems.datasetIndex];
- var label = data.labels[tooltipItems.index];
+ var label = " " + data.labels[tooltipItems.index];
// Compute share of total and of displayed
var scale = 0,
total = 0;
@@ -813,16 +854,28 @@ function doughnutTooltip(tooltipItems, data) {
return label + ": " + dataset.data[tooltipItems.index].toFixed(1) + "%";
return (
label +
- ":
- " +
+ ":
• " +
dataset.data[tooltipItems.index].toFixed(1) +
- "% of all queries
- " +
+ "% of all queries
• " +
((dataset.data[tooltipItems.index] * 100) / (total - scale)).toFixed(1) +
"% of shown items"
);
}
+var maxlogage = "24";
+function getMaxlogage() {
+ $.getJSON("api.php?getMaxlogage", function (data) {
+ if (!("FTLnotrunning" in data)) {
+ maxlogage = data.maxlogage;
+ }
+ }).done(function () {
+ $(".maxlogage-interval").html(maxlogage);
+ });
+}
+
$(function () {
// Pull in data via AJAX
+ getMaxlogage();
updateSummaryData();
var gridColor = $(".graphs-grid").css("background-color");
diff --git a/admin/scripts/pi-hole/js/messages.js b/admin/scripts/pi-hole/js/messages.js
index bd0f01f..fead56f 100644
--- a/admin/scripts/pi-hole/js/messages.js
+++ b/admin/scripts/pi-hole/js/messages.js
@@ -174,7 +174,8 @@ $(function () {
$("td:eq(3)", row).html(button);
},
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
diff --git a/admin/scripts/pi-hole/js/settings.js b/admin/scripts/pi-hole/js/settings.js
index 3733a7e..d0d7a1e 100644
--- a/admin/scripts/pi-hole/js/settings.js
+++ b/admin/scripts/pi-hole/js/settings.js
@@ -213,9 +213,15 @@ function loadCacheInfo() {
var cachelivefreed = parseInt(data.cacheinfo["cache-live-freed"], 10);
$("#cache-live-freed").text(cachelivefreed);
if (cachelivefreed > 0) {
- $("#cache-live-freed").parent("tr").addClass("lookatme");
+ $("#cache-live-freed").parent("tr").children("th").children("span").addClass("lookatme");
+ $("#cache-live-freed").parent("tr").children("td").addClass("lookatme");
+ $("#cache-live-freed")
+ .parent("tr")
+ .children("td")
+ .attr("lookatme-text", cachelivefreed.toString());
} else {
- $("#cache-live-freed").parent("tr").removeClass("lookatme");
+ $("#cache-live-freed").parent("tr").children("th").children("span").removeClass("lookatme");
+ $("#cache-live-freed").parent("tr").children("td").removeClass("lookatme");
}
// Update cache info every 10 seconds
@@ -228,7 +234,8 @@ $(function () {
if (document.getElementById("DHCPLeasesTable")) {
leasetable = $("#DHCPLeasesTable").DataTable({
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
@@ -238,9 +245,23 @@ $(function () {
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
- targets: [0, 1, 2],
+ targets: [0, 1],
render: $.fn.dataTable.render.text(),
},
+ {
+ targets: 2,
+ render: function (data) {
+ // Show "unknown", when host is "*"
+ var str;
+ if (data === "*") {
+ str = "
unknown";
+ } else {
+ str = typeof data === "string" ? utils.escapeHtml(data) : data;
+ }
+
+ return str;
+ },
+ },
],
paging: true,
order: [[2, "asc"]],
@@ -258,7 +279,8 @@ $(function () {
if (document.getElementById("DHCPStaticLeasesTable")) {
staticleasetable = $("#DHCPStaticLeasesTable").DataTable({
dom:
- "<'row'<'col-sm-4'l><'col-sm-8'f>>" +
+ "<'row'<'col-sm-12'f>>" +
+ "<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
lengthMenu: [
@@ -342,7 +364,7 @@ $(".nav-tabs a").on("shown.bs.tab", function (e) {
// Bar/Smooth chart toggle
$(function () {
var bargraphs = $("#bargraphs");
- var chkboxData = localStorage.getItem("barchart_chkbox");
+ var chkboxData = localStorage ? localStorage.getItem("barchart_chkbox") : null;
if (chkboxData !== null) {
// Restore checkbox state
@@ -350,7 +372,9 @@ $(function () {
} else {
// Initialize checkbox
bargraphs.prop("checked", true);
- localStorage.setItem("barchart_chkbox", true);
+ if (localStorage) {
+ localStorage.setItem("barchart_chkbox", true);
+ }
}
bargraphs.click(function () {
@@ -360,15 +384,17 @@ $(function () {
$(function () {
var colorfulQueryLog = $("#colorfulQueryLog");
- var chkboxData = localStorage.getItem("colorfulQueryLog_chkbox");
+ var chkboxData = localStorage ? localStorage.getItem("colorfulQueryLog_chkbox") : null;
if (chkboxData !== null) {
// Restore checkbox state
colorfulQueryLog.prop("checked", chkboxData === "true");
} else {
// Initialize checkbox
- colorfulQueryLog.prop("checked", true);
- localStorage.setItem("colorfulQueryLog_chkbox", true);
+ colorfulQueryLog.prop("checked", false);
+ if (localStorage) {
+ localStorage.setItem("colorfulQueryLog_chkbox", true);
+ }
}
colorfulQueryLog.click(function () {
diff --git a/admin/scripts/pi-hole/js/utils.js b/admin/scripts/pi-hole/js/utils.js
index 7229231..b9e1a57 100644
--- a/admin/scripts/pi-hole/js/utils.js
+++ b/admin/scripts/pi-hole/js/utils.js
@@ -229,13 +229,25 @@ function setBsSelectDefaults() {
};
}
+var backupStorage = {};
function stateSaveCallback(itemName, data) {
- localStorage.setItem(itemName, JSON.stringify(data));
+ if (localStorage === null) {
+ backupStorage[itemName] = JSON.stringify(data);
+ } else {
+ localStorage.setItem(itemName, JSON.stringify(data));
+ }
}
function stateLoadCallback(itemName) {
+ var data;
// Receive previous state from client's local storage area
- var data = localStorage.getItem(itemName);
+ if (localStorage === null) {
+ var item = backupStorage[itemName];
+ data = typeof item === "undefined" ? null : item;
+ } else {
+ data = localStorage.getItem(itemName);
+ }
+
// Return if not available
if (data === null) {
return null;
@@ -259,7 +271,7 @@ function stateLoadCallback(itemName) {
function getGraphType() {
// Only return line if `barchart_chkbox` is explicitly set to false. Else return bar
- return localStorage.getItem("barchart_chkbox") === "false" ? "line" : "bar";
+ return localStorage && localStorage.getItem("barchart_chkbox") === "false" ? "line" : "bar";
}
function addFromQueryLog(domain, list) {
diff --git a/admin/scripts/pi-hole/php/auth.php b/admin/scripts/pi-hole/php/auth.php
index 673bd48..fbf6b76 100644
--- a/admin/scripts/pi-hole/php/auth.php
+++ b/admin/scripts/pi-hole/php/auth.php
@@ -73,7 +73,7 @@ function check_cors() {
$server_host = str_replace(array("[","]"), array("",""), $server_host);
if(isset($_SERVER['HTTP_HOST']) && !in_array($server_host, $AUTHORIZED_HOSTNAMES)) {
- log_and_die("Failed Host Check: " . $server_host .' vs '. join(', ', $AUTHORIZED_HOSTNAMES));
+ log_and_die("Failed Host Check: " . $server_host .' vs '. htmlspecialchars(join(', ', $AUTHORIZED_HOSTNAMES)));
}
if(isset($_SERVER['HTTP_ORIGIN'])) {
@@ -88,7 +88,7 @@ function check_cors() {
$server_origin = str_replace(array("[","]","http://","https://"), array("","","",""), $server_origin);
if(!in_array($server_origin, $AUTHORIZED_HOSTNAMES)) {
- log_and_die("Failed CORS: " . htmlspecialchars($server_origin) .' vs '. join(', ', $AUTHORIZED_HOSTNAMES));
+ log_and_die("Failed CORS: " . htmlspecialchars($server_origin) .' vs '. htmlspecialchars(join(', ', $AUTHORIZED_HOSTNAMES)));
}
header("Access-Control-Allow-Origin: ${_SERVER['HTTP_ORIGIN']}");
}
diff --git a/admin/scripts/pi-hole/php/customcname.php b/admin/scripts/pi-hole/php/customcname.php
index 060799e..a34a891 100644
--- a/admin/scripts/pi-hole/php/customcname.php
+++ b/admin/scripts/pi-hole/php/customcname.php
@@ -5,11 +5,13 @@
require_once('auth.php');
// Authentication checks
- if (isset($_POST['token'])) {
- check_cors();
- check_csrf($_POST['token']);
- } else {
- log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!');
+ if (!isset($api)) {
+ if (isset($_POST['token'])) {
+ check_cors();
+ check_csrf($_POST['token']);
+ } else {
+ log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!');
+ }
}
diff --git a/admin/scripts/pi-hole/php/customdns.php b/admin/scripts/pi-hole/php/customdns.php
index 196ca28..bfa2fd8 100644
--- a/admin/scripts/pi-hole/php/customdns.php
+++ b/admin/scripts/pi-hole/php/customdns.php
@@ -5,11 +5,13 @@
require_once('auth.php');
// Authentication checks
- if (isset($_POST['token'])) {
- check_cors();
- check_csrf($_POST['token']);
- } else {
- log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!');
+ if (!isset($api)) {
+ if (isset($_POST['token'])) {
+ check_cors();
+ check_csrf($_POST['token']);
+ } else {
+ log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!');
+ }
}
diff --git a/admin/scripts/pi-hole/php/footer.php b/admin/scripts/pi-hole/php/footer.php
index 34ee322..6a5aef5 100644
--- a/admin/scripts/pi-hole/php/footer.php
+++ b/admin/scripts/pi-hole/php/footer.php
@@ -41,7 +41,7 @@
diff --git a/admin/scripts/pi-hole/php/queryads.php b/admin/scripts/pi-hole/php/queryads.php
index 38d4e8d..535dc14 100644
--- a/admin/scripts/pi-hole/php/queryads.php
+++ b/admin/scripts/pi-hole/php/queryads.php
@@ -17,7 +17,7 @@
function echoEvent($datatext) {
if(!isset($_GET["IE"]))
- echo "data: ".implode("\ndata: ", explode("\n", $datatext))."\n\n";
+ echo "data:".implode("\ndata:", explode("\n", $datatext))."\n\n";
else
echo $datatext;
}
diff --git a/admin/scripts/pi-hole/php/teleporter.php b/admin/scripts/pi-hole/php/teleporter.php
index d25f050..774d10c 100644
--- a/admin/scripts/pi-hole/php/teleporter.php
+++ b/admin/scripts/pi-hole/php/teleporter.php
@@ -84,11 +84,15 @@ function archive_restore_table($file, $table, $flush=false)
if(is_null($contents))
return 0;
- // Flush table if requested, only flush each table once
+ // Flush table if requested. Only flush each table once, and only if it exists
if($flush && !in_array($table, $flushed_tables))
{
- $db->exec("DELETE FROM \"".$table."\"");
- array_push($flushed_tables, $table);
+ $tableExists = $db->querySingle("SELECT name FROM sqlite_master WHERE type='table' AND name='".$table."';");
+ if ($tableExists)
+ {
+ $db->exec("DELETE FROM \"".$table."\"");
+ array_push($flushed_tables, $table);
+ }
}
// Prepare fields depending on the table we restore to
@@ -337,18 +341,15 @@ function noun($num)
$source = $_FILES["zip_file"]["tmp_name"];
$type = mime_content_type($source);
- $name = explode(".", $filename);
+ // verify the file mime type
$accepted_types = array('application/gzip', 'application/tar', 'application/x-compressed', 'application/x-gzip');
- $okay = false;
- foreach($accepted_types as $mime_type) {
- if($mime_type == $type) {
- $okay = true;
- break;
- }
- }
+ $mime_valid = in_array($type, $accepted_types);
+
+ // verify the file extension (Looking for ".tar.gz" at the end of the file name)
+ $ext = array_slice(explode(".", $filename), -2, 2);
+ $ext_valid = strtolower($ext[0]) == "tar" && strtolower($ext[1]) == "gz" ? true : false;
- $continue = strtolower($name[1]) == 'tar' && strtolower($name[2]) == 'gz' ? true : false;
- if(!$continue || !$okay) {
+ if(!$ext_valid || !$mime_valid) {
die("The file you are trying to upload is not a .tar.gz file (filename: ".htmlentities($filename).", type: ".htmlentities($type)."). Please try again.");
}
diff --git a/admin/settings.php b/admin/settings.php
index 13018ea..e59b135 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -19,6 +19,12 @@
$error .= "There was a problem applying your settings.
PHP error (".htmlspecialchars($last_error["type"])."): ".htmlspecialchars($last_error["message"])." in ".htmlspecialchars($last_error["file"]).":".htmlspecialchars($last_error["line"]);
}
+# Timezone is set in docker via ENV otherwise get it from commandline
+$timezone=htmlspecialchars(getenv("TZ"));
+if (empty($timezone)) {
+ $timezone=shell_exec("date +'%Z'");
+}
+
?>