Skip to content

Commit

Permalink
Added links to mxtoolbox for dmarc #28
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed Jan 8, 2024
1 parent 21e9965 commit 1f4e22b
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions dkim.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@
}

$dkimdir = $CFG->dataroot . '/dkim/';
$domains = scandir($dkimdir, SCANDIR_SORT_DESCENDING);
$domains = [];
if (is_dir($dkimdir)) {
scandir($dkimdir, SCANDIR_SORT_DESCENDING);
}

$domaincount = 0;
$noreplydomain = substr($CFG->noreplyaddress, strpos($CFG->noreplyaddress, '@') + 1);

// Always make sure the noreply domain is included even if nothing has been setup yet.
$domains = array_merge($domains, [$noreplydomain]);

print $OUTPUT->header();
print $OUTPUT->heading(get_string('dkimmanager', 'tool_emailutils'));

Expand All @@ -85,7 +92,7 @@
if (substr($domain, 0, 1) == '.') {
continue;
}
if (!is_dir($dkimdir . $domain)) {
if (!is_dir($dkimdir . $domain) && $domain != $noreplydomain) {
continue;
}

Expand All @@ -110,10 +117,20 @@
$url = new moodle_url('https://mxtoolbox.com/SuperTool.aspx', ['action' => "txt:$domain"]);
print "<li><a href='$url' target='_blank'>Raw TXT</a>";

$url = new moodle_url('https://mxtoolbox.com/SuperTool.aspx', ['action' => "dmarc:$domain", 'run' => 'toolpage']);
print "<li><a href='$url' target='_blank'>DMARC</a>";

$url = new moodle_url('https://mxtoolbox.com/SuperTool.aspx', ['action' => "txt:_dmarc.$domain"]);
print "<li><a href='$url' target='_blank'>DARMC TXT</a>";

print '</th></tr>';


$selectors = scandir($dkimdir . $domain);
$selectors = [];
$selectordir = $dkimdir . $domain;
if (is_dir($selectordir)) {
$selectors = scandir($selectordir);
}

// We want newer date based selectors to be at the top.
natsort($selectors);
Expand Down

0 comments on commit 1f4e22b

Please sign in to comment.