public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] Fix download link for dns zone file
4a8edd5b
data/web/inc/ajax/dns_diagnostics.php | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
Diff
diff --git a/data/web/inc/ajax/dns_diagnostics.php b/data/web/inc/ajax/dns_diagnostics.php
index b84d01b4..218876b3 100644
--- a/data/web/inc/ajax/dns_diagnostics.php
+++ b/data/web/inc/ajax/dns_diagnostics.php
@@ -292,6 +292,7 @@ $data_field = array(
'TLSA' => 'data',
'TXT' => 'txt',
);
+
?>
<div class="table-responsive" id="dnstable">
<table class="table table-striped">
@@ -419,39 +420,48 @@ foreach ($records as &$record) {
$record[3] = explode('<br />', $state);
}
unset($record);
-?>
- </table>
-<?php
-$data = sprintf("\$ORIGIN %s.\n", $domain);
+
+$dns_data = sprintf("\$ORIGIN %s.\n", $domain);
foreach ($records as $record) {
if ($domain == substr($record[0], -strlen($domain))) {
$label = substr($record[0], 0, -strlen($domain)-1);
$val = $record[2];
- if (strlen($label) == 0)
+ if (strlen($label) == 0) {
$label = "@";
+ }
$vals = array();
- if(strpos($val, "<a") !== FALSE) {
- if(is_array($record[3]) && count($record[3]) == 1 && $record[3][0] == state_optional)
- {
+ if (strpos($val, "<a") !== FALSE) {
+ if(is_array($record[3]) && count($record[3]) == 1 && $record[3][0] == state_optional) {
$record[3][0] = "**TODO**";
$label = ';' . $label;
}
foreach ($record[3] as $val) {
$val = str_replace(state_optional, '', $val);
$val = str_replace(state_good, '', $val);
- if (strlen($val) > 0)
+ if (strlen($val) > 0) {
$vals[] = sprintf("%s\tIN\t%s\t%s\n", $label, $record[1], $val);
+ }
}
- } else {
+ }
+ else {
$vals[] = sprintf("%s\tIN\t%s\t%s\n", $label, $record[1], $val);
}
foreach ($vals as $val) {
- $data .= str_replace($domain, $domain . '.', $val);
+ $dns_data .= str_replace($domain, $domain . '.', $val);
}
}
}
-echo '<a target="_blank" href="data:text/plain;base64,' . base64_encode($data) .'">Download</a>';
+
?>
+ </table>
+ <a id='download-zonefile' data-zonefile="<?=base64_encode($dns_data);?>" download='<?=$_GET['domain'];?>.txt' type='text/csv'>Download</a>
+ <script>
+ var zonefile_dl_link = document.getElementById('download-zonefile');
+ var zonefile = atob(zonefile_dl_link.getAttribute('data-zonefile'));
+ var data = new Blob([zonefile]);
+ var download_zonefile_link = document.getElementById('download-zonefile');
+ download_zonefile_link.href = URL.createObjectURL(data);
+ </script>
</div>
<p class="help-block">
<sup>1</sup> <?=$lang['diagnostics']['cname_from_a'];?><br />