Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions default.css
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ form {
display: inline-block;
}

.circle_whole {
border-bottom-right-radius: 500px;
border-top-right-radius: 500px;
border-bottom-left-radius: 500px;
border-top-left-radius: 500px;
width: 14px;
height: 14px;
margin-top: 4px;
margin-bottom: 2px;
/* border-right: 0; */
display: inline-block;
}

.circle_yellow {
width: 6px;
height: 12px;
Expand Down
54 changes: 54 additions & 0 deletions dmarcts-report-viewer-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@
),
);

// The order in which the options appear here is the order they appear in the TLS-RPT Report Status dropdown box
$tls_result = array(

'TLS_PASS' => array(
'text' => 'Pass',
'status_text' => 'All Passed',
'color' => 'green',
'status_sort_key' => 3,
'status_sql_where' => " summary_successful > 0 AND summary_failure = 0",
),
'TLS_FAIL' => array(
'text' => 'Fail',
'status_text' => 'All Failed',
'color' => 'red',
'status_sort_key' => 0,
'status_sql_where' => " summary_successful = 0 AND summary_failure > 0",
),
'TLS_PASS_AND_FAIL' => array(
'text' => 'Mixed',
'status_text' => 'Mixed result',
'color' => 'orange',
'status_sort_key' => 1,
'status_sql_where' => " summary_successful > 0 AND summary_failure > 0",
),
);

// Sortable Report List column headers
// --------------------------------------------------------------------------
// Array to be used in 'Default sort column' option in dmarcts-report-viewer-options.php
Expand Down Expand Up @@ -322,6 +348,34 @@ function get_report_status($row) {
return array('color' => $color, 'status_sort_key' => $color_sort_key, 'status_text' => $status_text);
}

// This function sets variables for the TLS-RPT Result in the Report List
function get_tls_result($row) {

global $tls_result;
$color = "";
$color_sort_key = "";
$result_text = "";

if (($row['summary_successful'] == 0) && ($row['summary_failure'] > 0)) {
$color = $tls_result['TLS_FAIL']['color'];
$color_sort_key = $tls_result['TLS_FAIL']['status_sort_key'];
$result_text = $tls_result['TLS_FAIL']['text'];
} elseif (($row['summary_successful'] > 0) && ($row['summary_failure'] > 0)) {
$color = $tls_result['TLS_PASS_AND_FAIL']['color'];
$color_sort_key = $tls_result['TLS_PASS_AND_FAIL']['status_sort_key'];
$result_text = $tls_result['TLS_PASS_AND_FAIL']['text'];
} elseif (($row['summary_successful'] > 0) && ($row['summary_failure'] == 0)) {
$color = $tls_result['TLS_PASS']['color'];
$color_sort_key = $tls_result['TLS_PASS']['status_sort_key'];
$result_text = $tls_result['TLS_PASS']['text'];
} else {
$color = $tls_result['TLS_OTHER_CONDITION']['color'];
$color_sort_key = $tls_result['TLS_OTHER_CONDITION']['status_sort_key'];
$result_text = $tls_result['TLS_OTHER_CONDITION']['text'];
}
return array('color' => $color, 'status_sort_key' => $color_sort_key, 'result' => $result_text);
}

// This function sets variables for individual cells in the Report Data table
function get_status_color($result) {

Expand Down
48 changes: 34 additions & 14 deletions dmarcts-report-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function reset_report_list() {
// Function to refesh the data shown in the report_list_table using the currently selected <select> filters.
function refresh_report_list() {

showReportlist('reportlistTbl');
showReportlist(report_type);
}


Expand Down Expand Up @@ -89,7 +89,7 @@ function sorttable (table_id) {
}
}

function showReportlist(str) { // str is the name of the <div> to be filled
function showReportlist(report_type) { // str is the name of the <div> to be filled

// Clear current reportid because Report List is being reset
current_report = "";
Expand All @@ -99,29 +99,34 @@ function showReportlist(str) { // str is the name of the <div> to be filled
var domain = document.getElementById('selDomain').options[document.getElementById('selDomain').selectedIndex].value;
var org = document.getElementById('selOrganisation').options[document.getElementById('selOrganisation').selectedIndex].value;
var period = document.getElementById('selPeriod').options[document.getElementById('selPeriod').selectedIndex].value;
var dmarc = document.getElementById('selDMARC').options[document.getElementById('selDMARC').selectedIndex].value;
var report_status = document.getElementById('selReportStatus').options[document.getElementById('selReportStatus').selectedIndex].value;

GETstring += "d=" + domain;
GETstring += "&o=" + org;
GETstring += "&p=" + period;
GETstring += "&dmarc=" + dmarc;
GETstring += "&rptstat=" + report_status;

if (report_type == "dmarc") {
var dmarc = document.getElementById('selDMARC').options[document.getElementById('selDMARC').selectedIndex].value;
GETstring += "&dmarc=" + dmarc;
} else if (report_type == "tls") {
// var tls = document.getElementById('selTLS').options[document.getElementById('selTLS').selectedIndex].value;
}

xhttp = new XMLHttpRequest();
xhttp.onreadystatechange =
function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("report_list").innerHTML = this.responseText;
document.getElementById("report_data").innerHTML = "";
set_heights();
sorttable(str);
sorttable('reportlistTbl');
set_title(domain);
makeResizableDiv();
}
};

xhttp.open("GET", "dmarcts-report-viewer-report-list.php" + GETstring, true);
xhttp.open("GET", report_type + "ts-report-viewer-report-list.php" + GETstring, true);
xhttp.send();
}

Expand Down Expand Up @@ -159,7 +164,7 @@ function change_stylesheet() {

function set_title(domain) {

domain == 'all' ? document.getElementById('title').innerText = "DMARC Reports" : document.getElementById('title').innerText = "DMARC Reports for " + domain;
domain == 'all' ? document.getElementById('title').innerText = report_type.toUpperCase() + " Reports" : document.getElementById('title').innerText = report_type.toUpperCase() + " Reports for " + domain;
}

function set_heights() {
Expand Down Expand Up @@ -263,18 +268,29 @@ function set_report_data_widths () {
document.getElementById('report_data_table_div').style.display = 'inline-block';
document.getElementById('report_data_table_div').style.float = 'left';
document.getElementById('xml_html_img').src = 'html.png';
document.getElementById('xml_html_img').title = 'Hide Raw Report XML';
document.getElementById('xml_html_img').alt = 'Hide Raw Report XML';
if (report_type == 'dmarc') {
document.getElementById('xml_html_img').title = 'Hide Raw Report XML';
document.getElementById('xml_html_img').alt = 'Hide Raw Report XML';
} else {
document.getElementById('xml_html_img').title = 'Hide Raw Report JSON';
document.getElementById('xml_html_img').alt = 'Hide Raw Report JSON';
}
document.getElementById('resizer_vertical').style.display = "block";
} else {
report_data_xml_width = 0;
report_data_table_div_width = document.getElementById('report_data').offsetWidth;
document.getElementById('report_data_xml').style.display = 'none';
document.getElementById('report_data_table_div').style.display = 'block';
document.getElementById('report_data_table_div').style.float = '';
document.getElementById('xml_html_img').src = 'xml.png';
document.getElementById('xml_html_img').title = 'Show Raw Report XML';
document.getElementById('xml_html_img').alt = 'Show Raw Report XML';
if (report_type == 'dmarc') {
document.getElementById('xml_html_img').src = 'xml.png';
document.getElementById('xml_html_img').title = 'Show Raw Report XML';
document.getElementById('xml_html_img').alt = 'Show Raw Report XML';
} else {
document.getElementById('xml_html_img').src = 'json.png';
document.getElementById('xml_html_img').title = 'Show Raw Report JSON';
document.getElementById('xml_html_img').alt = 'Show Raw Report JSON';
}
document.getElementById('resizer_vertical').style.display = "none";
}

Expand Down Expand Up @@ -343,7 +359,11 @@ function showReport(str) {
}

GETstring += "&p=" + document.getElementById('selPeriod').value;
GETstring += "&dmarc=" + document.getElementById('selDMARC').options[document.getElementById('selDMARC').selectedIndex].value;
if ( report_type == 'dmarc' ){
GETstring += "&dmarc=" + document.getElementById('selDMARC').options[document.getElementById('selDMARC').selectedIndex].value;
} else if ( report_type == 'tls' ){

}

xhttp = new XMLHttpRequest();
xhttp.onreadystatechange =
Expand All @@ -367,7 +387,7 @@ function showReport(str) {
}
};

xhttp.open("GET", "dmarcts-report-viewer-report-data.php?" + GETstring, true);
xhttp.open("GET", report_type + "ts-report-viewer-report-data.php?" + GETstring, true);
xhttp.send();
}

Expand Down
15 changes: 8 additions & 7 deletions dmarcts-report-viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
$html[] = " var xml_data_open = " . $cookie_options['xml_data_open'] . ";";
$html[] = " var xml_data_highlight = " . $cookie_options['xml_data_highlight'] . ";";
$html[] = " var xml_data_hljs = " . $cookie_options['xml_data_hljs'] . ";";
$html[] = " var report_type = 'dmarc';";
$html[] = " </script>";
$html[] = " <meta charset=\"UTF-8\" />";
$html[] = " <meta name='google' content='notranslate' />";
$html[] = " <meta http-equiv=\"Content-Language\" content=\"en_US\" />";
$html[] = " </head>";

$html[] = " <body id='body' onload=showReportlist('reportlistTbl'); onresize=showResizers();>";
$html[] = " <body id='body' onload=showReportlist('dmarc'); onresize=showResizers();>";
$html[] = "<div id='screen_overlay' onclick=\"hideMenu();\" style=\"top: 0;left: 0;height: 100%;width: 100%;position: absolute;display: none;z-index: 1;\">
";
$html[] = "</div>";
Expand All @@ -91,7 +92,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
// DMARC select
// --------------------------------------------------------------------------
$html[] = "<div class='options'><span class='optionlabel'>DMARC Result:</span><br>";
$html[] = "<select class='x-css' name=\"DMARC\" id=\"selDMARC\" onchange=\"showReportlist('reportlistTbl')\">";
$html[] = "<select class='x-css' name=\"DMARC\" id=\"selDMARC\" onchange=\"showReportlist('dmarc')\">";
$html[] = "<option " . ( $cookie_options['DMARC'] ? "" : "selected=\"selected\" " ) . "value=\"all\">[all]</option>";
foreach($dmarc_result as $key => $value) {
$html[] = sprintf("<option class='" . $value['color'] . "' %s value=\"%s\">%s</option>",
Expand All @@ -107,7 +108,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
// Report Status select
// --------------------------------------------------------------------------
$html[] = "<div class='options'><span class='optionlabel'>Report Status:</span><br>";
$html[] = "<select class='x-css' name=\"ReportStatus\" id=\"selReportStatus\" onchange=\"showReportlist('reportlistTbl')\">";
$html[] = "<select class='x-css' name=\"ReportStatus\" id=\"selReportStatus\" onchange=\"showReportlist('dmarc')\">";
$html[] = "<option " . ( $cookie_options['ReportStatus'] ? "" : "selected=\"selected\" " ) . "value=\"all\">[all]</option>";
foreach($dmarc_result as $key => $value) {
$html[] = sprintf("<option class='color: " . $value['color'] . "' %s value=\"%s\">%s</option>",
Expand All @@ -124,7 +125,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
// --------------------------------------------------------------------------
if ( count( $periods ) > 0 ) {
$html[] = "<div class='options'><span class='optionlabel'>Month:</span><br>";
$html[] = "<select class='x-css' name=\"Period\" id=\"selPeriod\" onchange=\"showReportlist('reportlistTbl')\">";
$html[] = "<select class='x-css' name=\"Period\" id=\"selPeriod\" onchange=\"showReportlist('dmarc')\">";
$html[] = "<option value=\"all\"" . ($cookie_options['Period'] ? "" : " selected=\"selected\"") . ">[all]</option>";

for ($p = 0; $p < sizeof($periods); $p++) {
Expand All @@ -144,7 +145,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
// --------------------------------------------------------------------------
if ( count( $domains ) >= 1 ) {
$html[] = "<div class='options'><span class='optionlabel'>Domain(s):</span><br>";
$html[] = "<select class='x-css' name=\"Domain\" id=\"selDomain\" onchange=\"showReportlist('reportlistTbl')\">";
$html[] = "<select class='x-css' name=\"Domain\" id=\"selDomain\" onchange=\"showReportlist('dmarc')\">";
$html[] = "<option " . ( $cookie_options['Domain'] ? "" : "selected=\"selected\" " ) . "value=\"all\">[all]</option>";

foreach( $domains as $d) {
Expand All @@ -160,7 +161,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {
// --------------------------------------------------------------------------
if ( count( $orgs ) > 0 ) {
$html[] = "<div class='options'><span class='optionlabel'>Reporter(s):</span><br>";
$html[] = "<select class='x-css' name=\"Organisation\" id=\"selOrganisation\" onchange=\"showReportlist('reportlistTbl')\">";
$html[] = "<select class='x-css' name=\"Organisation\" id=\"selOrganisation\" onchange=\"showReportlist('dmarc')\">";
$html[] = "<option " . ( $cookie_options['Organisation'] ? "" : "selected=\"selected\" " ) . "selected=\"selected\" value=\"all\">[all]</option>";

foreach( $orgs as $o) {
Expand Down Expand Up @@ -194,7 +195,7 @@ function html ($domains = array(), $orgs = array(), $periods = array() ) {

// Dropdown menu
// --------------------------------------------------------------------------
$html[] = "<div id='menu' class='menu top'><div class='menu_option' onclick=\"build_cookie();\">&nbsp;&nbsp;&nbsp;Save Current Settings as Initial View</div><div class='menu_option' onclick=\"window.location.href = 'dmarcts-report-viewer-options.php';\">&nbsp;&nbsp;&nbsp;Options...</div></div>";
$html[] = "<div id='menu' class='menu top'><div class='menu_option' style='border-bottom: 1px solid var(--header);' onclick=\"window.location.href = 'tlsts-report-viewer.php';\">&nbsp;&nbsp;&nbsp;Go to TLS Reports</div><div class='menu_option' onclick=\"build_cookie();\">&nbsp;&nbsp;&nbsp;Save Current Settings as Initial View</div><div class='menu_option' onclick=\"window.location.href = 'dmarcts-report-viewer-options.php';\">&nbsp;&nbsp;&nbsp;DMARC Report Options...</div></div>";


// Report divs
Expand Down
Binary file added json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading