Skip to content

Commit

Permalink
Formatting for easier reading
Browse files Browse the repository at this point in the history
No code changes.
  • Loading branch information
jnew-gh committed Apr 14, 2021
1 parent 45b8686 commit 4c10b11
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 45 deletions.
8 changes: 4 additions & 4 deletions dmarcts-report-viewer-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@

'DMARC_PASS' => array(
'text' => 'Pass',
'status_text' => 'All Passed.',
'status_text' => 'All Passed',
'color' => 'green',
'status_sort_key' => 3,
),
'DMARC_FAIL' => array(
'text' => 'Fail',
'status_text' => 'All Failed.',
'status_text' => 'All Failed',
'color' => 'red',
'status_sort_key' => 0,
),
'DMARC_PASS_AND_FAIL' => array(
'text' => 'Mixed',
'status_text' => 'At least one failed result.',
'status_text' => 'At least one failed result',
'color' => 'orange',
'status_sort_key' => 1,
),
'DMARC_OTHER_CONDITION' => array(
'text' => 'Other',
'status_text' => 'Other condition.',
'status_text' => 'Other condition',
'color' => 'yellow',
'status_sort_key' => 2,
),
Expand Down
26 changes: 15 additions & 11 deletions dmarcts-report-viewer-report-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,38 @@ function tmpl_reportData($reportnumber, $reports, $host_lookup = 1) {

$sql = "
SELECT
*,
(CASE
*,
(CASE
WHEN dkim_align = 'fail' THEN 0
WHEN dkim_align = 'pass' THEN 1
ELSE 3
END)
+
(CASE
END)
+
(CASE
WHEN spf_align = 'fail' THEN 0
WHEN spf_align = 'pass' THEN 1
ELSE 3
END)
END)
AS dmarc_result_min,
(CASE
WHEN dkim_align = 'fail' THEN 0
WHEN dkim_align = 'pass' THEN 1
ELSE 3
END)
+
(CASE
END)
+
(CASE
WHEN spf_align = 'fail' THEN 0
WHEN spf_align = 'pass' THEN 1
ELSE 3
END)
AS dmarc_result_max
FROM
rptrecord
WHERE serial = " . $reportnumber . ( $dmarc_where ? " AND $dmarc_where" : "" ) . " ORDER BY ip ASC";
rptrecord
WHERE
serial = " . $reportnumber . ( $dmarc_where ? " AND $dmarc_where" : "" ) . "
ORDER BY
ip ASC
";

// Debug
// echo "<br><b>sql reportdata =</b> $sql<br>";
Expand Down
35 changes: 19 additions & 16 deletions dmarcts-report-viewer-report-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,20 @@ function tmpl_reportList($reports, $sort) {

$sql = "
SELECT
report.*,
rcount,
dkim_align_min,
spf_align_min,
dkim_result_min,
spf_result_min,
dmarc_result_min,
dmarc_result_max
report.*,
rcount,
dkim_align_min,
spf_align_min,
dkim_result_min,
spf_result_min,
dmarc_result_min,
dmarc_result_max
FROM
report
report
LEFT JOIN
(
SELECT
SUM(rcount) as rcount,
SUM(rcount) AS rcount,
serial,
dkim_align,
spf_align,
Expand Down Expand Up @@ -324,16 +324,19 @@ function tmpl_reportList($reports, $sort) {
AS dmarc_result_max
FROM
rptrecord
GROUP BY serial
GROUP BY
serial
)
AS rptrecord
ON
report.serial = rptrecord.serial
AS rptrecord
ON
report.serial = rptrecord.serial
$where
GROUP BY serial
GROUP BY
serial
ORDER BY
mindate $sort,
org";
org
";

// Debug
// echo "<br />sql where = $where<br />";
Expand Down
35 changes: 21 additions & 14 deletions dmarcts-report-viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@ function html ($default_hostlookup = 1, $default_dmarc_result = undef, $default_

// Get all domains reported
// --------------------------------------------------------------------------
$sql="
SELECT
DISTINCT domain
$sql = "
SELECT DISTINCT
domain
FROM
report
ORDER BY domain";
ORDER BY
domain
";

$query = $mysqli->query($sql) or die("Query failed: ".$mysqli->error." (Error #" .$mysqli->errno.")");

Expand All @@ -209,12 +211,14 @@ function html ($default_hostlookup = 1, $default_dmarc_result = undef, $default_

// Get all organisations
// --------------------------------------------------------------------------
$sql="
SELECT
DISTINCT org
$sql = "
SELECT DISTINCT
org
FROM
report
ORDER BY org";
ORDER BY
org
";

$query = $mysqli->query($sql) or die("Query failed: ".$mysqli->error." (Error #" .$mysqli->errno.")");

Expand All @@ -224,23 +228,26 @@ function html ($default_hostlookup = 1, $default_dmarc_result = undef, $default_

// Get all periods
// --------------------------------------------------------------------------
$sql="
$sql = "
(
SELECT
year(mindate) as year,
month(mindate) as month
YEAR(mindate) AS year,
MONTH(mindate) AS month
FROM
report
)
UNION
(
SELECT
year(maxdate) as year,
month(maxdate) as month
YEAR(maxdate) AS year,
MONTH(maxdate) AS month
FROM
report
)
ORDER BY year desc, month desc";
ORDER BY
year DESC,
month DESC
";

$query = $mysqli->query($sql) or die("Query failed: ".$mysqli->error." (Error #" .$mysqli->errno.")");

Expand Down

0 comments on commit 4c10b11

Please sign in to comment.