Skip to content

Commit 919b34a

Browse files
committed
Move @ replacement function to idnividual records that need it. Fix typo in comment
1 parent 59df925 commit 919b34a

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

interface/web/dns/dns_alias_edit.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ protected function checkDuplicate() {
5151
if($tmp['number'] > 0) return true;
5252
return false;
5353
}
54+
55+
function onSubmit() {
56+
global $app, $conf;
57+
// Get the parent soa record of the domain
58+
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]);
59+
// Replace @ to example.com. in data field
60+
if($this->dataRecord["data"] === '@') {
61+
$this->dataRecord["data"] = $soa['origin'];
62+
}
63+
parent::onSubmit();
64+
}
5465
}
5566

5667
$page = new page_action;

interface/web/dns/dns_cname_edit.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ protected function checkDuplicate() {
5353
return false;
5454
}
5555

56+
function onSubmit() {
57+
global $app, $conf;
58+
// Get the parent soa record of the domain
59+
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]);
60+
// Replace @ to example.com. in data field
61+
if($this->dataRecord["data"] === '@') {
62+
$this->dataRecord["data"] = $soa['origin'];
63+
}
64+
parent::onSubmit();
65+
}
5666
}
5767

5868
$page = new page_action;

interface/web/dns/dns_dname_edit.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ protected function checkDuplicate() {
5252
if($tmp['number'] > 0) return true;
5353
return false;
5454
}
55+
56+
function onSubmit() {
57+
global $app, $conf;
58+
// Get the parent soa record of the domain
59+
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]);
60+
// Replace @ to example.com. in data field
61+
if($this->dataRecord["data"] === '@') {
62+
$this->dataRecord["data"] = $soa['origin'];
63+
}
64+
parent::onSubmit();
65+
}
5566
}
5667

5768
$page = new page_action;

interface/web/dns/dns_edit_base.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function onSubmit() {
104104
$client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
105105
$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
106106

107-
// Check if the user may add another mailbox.
107+
// Check if the user may add another record.
108108
if($this->id == 0 && $client["limit_dns_record"] >= 0) {
109109
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = ?", $client_group_id);
110110
if($tmp["number"] >= $client["limit_dns_record"]) {
@@ -117,9 +117,6 @@ function onSubmit() {
117117
if($this->dataRecord["name"] === '@') {
118118
$this->dataRecord["name"] = $soa['origin'];
119119
}
120-
if($this->dataRecord["data"] === '@') {
121-
$this->dataRecord["data"] = $soa['origin'];
122-
}
123120

124121
// Replace * to *.example.com.
125122
if($this->dataRecord["name"] === '*') {

0 commit comments

Comments
 (0)