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:
authorTechSneeze <dave@techsneeze.com>2021-06-18 21:21:57 +0300
committerGitHub <noreply@github.com>2021-06-18 21:21:57 +0300
commit608f9fe3de9af929bb535498ca79f27e5c3b7367 (patch)
tree7328633722c0de7d8eac14a6db5a0a77a5ae92dc
parent22b1c5769a42ca244dc74675d47ddf6517b2776f (diff)
parent559e94749373c1f9c4451f8389b8d6e68bcc1199 (diff)
Merge pull request #72 from jnew-gh/options_page
Add date format to Options page
-rw-r--r--dmarcts-report-viewer-common.php9
-rw-r--r--dmarcts-report-viewer-options.php2
-rw-r--r--dmarcts-report-viewer-report-data.php2
-rw-r--r--dmarcts-report-viewer-report-list.php5
4 files changed, 12 insertions, 6 deletions
diff --git a/dmarcts-report-viewer-common.php b/dmarcts-report-viewer-common.php
index f554b68..7fdc542 100644
--- a/dmarcts-report-viewer-common.php
+++ b/dmarcts-report-viewer-common.php
@@ -107,7 +107,14 @@ $options = array(
"option_value" => "default.css",
"option_description" => "Name of the css file to be used.<br>The dropdown list is automatically generated from any css files in the main dmarcts-report-viewer directory. The css is immediately applied to this page when selected.",
),
- "option_group_2_heading" => array(
+ "date_format" => array(
+ "option_type" => "text",
+ "option_label" => "Date Format",
+ "option_values" => "",
+ "option_value" => "Y-m-d G:i:s T",
+ "option_description" => "String to format the dates in the Report List and the Report Description.<br>The default format string is Y-m-d G:i:s T which shows, for example, 2020-01-01 00:00:00 UTC.<br>For the allowable options in the format string, see <a href='https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters' target='_blank'>the documentation</a>.",
+ ),
+"option_group_2_heading" => array(
"option_type" => "heading",
"option_label" => "Filters",
"option_values" => "",
diff --git a/dmarcts-report-viewer-options.php b/dmarcts-report-viewer-options.php
index f33cba0..eb5a9aa 100644
--- a/dmarcts-report-viewer-options.php
+++ b/dmarcts-report-viewer-options.php
@@ -140,7 +140,7 @@ function create_input_text($option_name, $option = array()) {
$values = $option["option_values"];
if (isset($cookie_options[$option_name]) ) {
- $value = "value='" . $cookie_options[$option_name] . "'";
+ $value = "value='" . preg_replace("/'/", "&#39;", $cookie_options[$option_name]). "'";
} else {
$value = "";
}
diff --git a/dmarcts-report-viewer-report-data.php b/dmarcts-report-viewer-report-data.php
index 5c862cd..aa04bc7 100644
--- a/dmarcts-report-viewer-report-data.php
+++ b/dmarcts-report-viewer-report-data.php
@@ -59,7 +59,7 @@ function tmpl_reportData($reportnumber, $reports, $host_lookup = 1) {
$row['raw_xml'] = formatXML($row['raw_xml'], $reportnumber);
$reportdata[] = "<div id='report_desc_container' class='center reportdesc_container'>";
- $reportdata[] = "<div id='report_desc' class='center reportdesc' class='hilighted' onmouseover='highlight(this);' onmouseout='unhighlight(this);' onclick='pin(this)'>Report from ".$row['org']." for ".$row['domain']."<br>(". format_date($row['mindate'], "r" ). " - ".format_date($row['maxdate'], "r" ).")<br> Policies: adkim=" . $row['policy_adkim'] . ", aspf=" . $row['policy_aspf'] . ", p=" . $row['policy_p'] . ", sp=" . $row['policy_sp'] . ", pct=" . $row['policy_pct'] . "</div>";
+ $reportdata[] = "<div id='report_desc' class='center reportdesc' class='hilighted' onmouseover='highlight(this);' onmouseout='unhighlight(this);' onclick='pin(this)'>Report from ".$row['org']." for ".$row['domain']."<br>". format_date($row['mindate'], $cookie_options['date_format']). " to ".format_date($row['maxdate'], $cookie_options['date_format'])."<br> Policies: adkim=" . $row['policy_adkim'] . ", aspf=" . $row['policy_aspf'] . ", p=" . $row['policy_p'] . ", sp=" . $row['policy_sp'] . ", pct=" . $row['policy_pct'] . "</div>";
$reportdata[] = "<div style='display:inline-block;margin-left:20px;'><img src='xml.png' id='xml_html_img' width='30px' alt='Show Raw Report XML' title='Show Raw Report XML' onclick='report_data_xml_display_toggle()'></div>";
diff --git a/dmarcts-report-viewer-report-list.php b/dmarcts-report-viewer-report-list.php
index 1136af7..d07b107 100644
--- a/dmarcts-report-viewer-report-list.php
+++ b/dmarcts-report-viewer-report-list.php
@@ -74,14 +74,13 @@ function tmpl_reportList($reports, $sort) {
foreach ($reports as $row) {
$row = array_map('htmlspecialchars', $row);
- $date_output_format = "Y-m-d G:i:s T";
$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
$reportlist[] = " <td class='circle_container'><div style='white-space: nowrap;' title='DMARC: " . get_dmarc_result($row)['result'] . "\nSPF/DKIM/DMARC: " . get_report_status($row)['status_text'] . "\n" . $title_message_tr . "'><div class='circle circle_left circle_" . get_dmarc_result($row)['color'] . "'></div><div class='circle circle_right circle_" . get_report_status($row)['color'] . "'></div></div></td>"; // Col 0
$reportlist[] = " <td class='circle_container'><span class='status_sort_key'>" . get_report_status($row)['status_sort_key'] . "</span></span></td>"; // Col 0
- $reportlist[] = " <td class='right'>". format_date($row['mindate'], $date_output_format). "</td>"; // Col 1
- $reportlist[] = " <td class='right'>". format_date($row['maxdate'], $date_output_format). "</td>"; // Col 3
+ $reportlist[] = " <td class='right'>". format_date($row['mindate'], $cookie_options['date_format']). "</td>"; // Col 1
+ $reportlist[] = " <td class='right'>". format_date($row['maxdate'], $cookie_options['date_format']). "</td>"; // Col 3
$reportlist[] = " <td class='center'>". $row['domain']. "</td>"; // Col 5
$reportlist[] = " <td class='center'>". $row['org']. "</td>"; // Col 6
$reportlist[] = " <td class='center'>". $row['reportid'] . "</td>";