Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/techsneeze/dmarcts-report-viewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmarcts-report-viewer-common.php9
-rw-r--r--dmarcts-report-viewer-report-data.php2
-rw-r--r--dmarcts-report-viewer-report-list.php2
3 files changed, 11 insertions, 2 deletions
diff --git a/dmarcts-report-viewer-common.php b/dmarcts-report-viewer-common.php
index 57811a1..6d5be4c 100644
--- a/dmarcts-report-viewer-common.php
+++ b/dmarcts-report-viewer-common.php
@@ -349,6 +349,15 @@ function format_date($date, $format) {
return $answer;
};
+// null-safe version of htmlspecialchars for PHP 8+ compatibility
+// --------------------------------------------------------------------------
+function html_escape($str) {
+ if ($str == null) {
+ return null;
+ }
+ return htmlspecialchars($str);
+}
+
// Get all configuration options
// --------------------------------------------------------------------------
function configure() {
diff --git a/dmarcts-report-viewer-report-data.php b/dmarcts-report-viewer-report-data.php
index 09ea80e..00f1a68 100644
--- a/dmarcts-report-viewer-report-data.php
+++ b/dmarcts-report-viewer-report-data.php
@@ -148,7 +148,7 @@ ORDER BY
}
/* escape html characters after exploring binary values, which will be messed up */
- $row = array_map('htmlspecialchars', $row);
+ $row = array_map('html_escape', $row);
$reportdata[] = " <tr id='line" . $row['id'] . "' class='" . get_dmarc_result($row)['color'] . "' title='DMARC Result: " . get_dmarc_result($row)['result'] . "' onmouseover='highlight(this);' onmouseout='unhighlight(this);' onclick='pin(this);'>";
$reportdata[] = " <td>". $ip. "</td>";
diff --git a/dmarcts-report-viewer-report-list.php b/dmarcts-report-viewer-report-list.php
index 806ed8c..ff9a236 100644
--- a/dmarcts-report-viewer-report-list.php
+++ b/dmarcts-report-viewer-report-list.php
@@ -73,7 +73,7 @@ function tmpl_reportList($reports, $sort) {
$reportsum = 0;
foreach ($reports as $row) {
- $row = array_map('htmlspecialchars', $row);
+ $row = array_map('html_escape', $row);
$reportlist[] = " <tr class='linkable' onclick=\"showReport('" . $row['serial'] . "')\" id='report" . $row['serial'] . "' title='" . $title_message_tr . "'>";
$reportlist[] = " <td class='circle_container'><span class='status_sort_key'>" . get_dmarc_result($row)['status_sort_key'] . "</span></td>"; // Col 0