Skip to content

Commit 6c57e7f

Browse files
author
Florian Schaal
committed
changed sql-queries for dkim to new syntax
1 parent 1c58c1a commit 6c57e7f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

interface/web/dns/dns_dkim_edit.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ function onShowNew() {
5858

5959
// Get the limits of the client
6060
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
61-
$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");
61+
$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);
6262

6363
// Check if the user may add another record.
6464
if($client["limit_dns_record"] >= 0) {
65-
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
65+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = ?", $client_group_id);
6666
if($tmp["number"] >= $client["limit_dns_record"]) {
6767
$app->error($app->tform->wordbook["limit_dns_record_txt"]);
6868
}
@@ -75,18 +75,18 @@ function onShowNew() {
7575
function onSubmit() {
7676
global $app, $conf;
7777
// Get the parent soa record of the domain
78-
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
78+
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->intval($_POST["zone"]));
7979
// Check if Domain belongs to user
8080
if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
8181

8282
// Check the client limits, if user is not the admin
8383
if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
8484
// Get the limits of the client
8585
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
86-
$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");
86+
$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);
8787
// Check if the user may add another record.
8888
if($this->id == 0 && $client["limit_dns_record"] >= 0) {
89-
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
89+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = ?", $client_group_id);
9090
if($tmp["number"] >= $client["limit_dns_record"]) {
9191
$app->error($app->tform->wordbook["limit_dns_record_txt"]);
9292
}
@@ -101,12 +101,12 @@ function onSubmit() {
101101
$this->dataRecord['name']='default._domainkey.'.$this->dataRecord['name'];
102102

103103
// Update the serial number and timestamp of the RR record
104-
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
104+
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ?", $this->id);
105105
$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
106106
$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
107107

108108
// check for duplicate entry
109-
$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord["zone"]." AND type = '".$this->dataRecord["type"]."' AND data ='".$this->dataRecord["data"]."' AND name = '".$this->dataRecord['name']."'");
109+
$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND type = ? AND data = ? AND name = ?", $this->dataRecord['zone'], $this->dataRecord['type'], $this->dataRecord['data'], $this->dataRecord['name']);
110110
if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
111111
if (empty($this->dataRecord['data'])) $app->tform->errorMessage .= $app->tform->wordbook["dkim_disabled_txt"];
112112
parent::onSubmit();
@@ -116,7 +116,7 @@ function onAfterInsert() {
116116
global $app, $conf;
117117

118118
//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
119-
$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
119+
$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->intval($this->dataRecord['zone']));
120120
$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
121121

122122
//* Update the serial number of the SOA record
@@ -129,7 +129,7 @@ function onAfterUpdate() {
129129
global $app, $conf;
130130

131131
//* Update the serial number of the SOA record
132-
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
132+
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ? AND ".$app->tform->getAuthSQL('r'), $app->functions->intval($this->dataRecord["zone"]));
133133
$soa_id = $app->functions->intval($_POST["zone"]);
134134
$serial = $app->validate_dns->increase_serial($soa["serial"]);
135135
$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);

interface/web/dns/dns_dkim_get.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function pub_key($pubkey) {
8282

8383
if (ctype_digit($_POST['zone'])) {
8484
// Get the parent soa record of the domain
85-
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->db->quote($_POST['zone'])."' AND ".$app->tform->getAuthSQL('r'));
85+
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND ".$app->tform->getAuthSQL('r'), $_POST['zone']);
8686

87-
$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".substr_replace($soa['origin'],'',-1)."' AND dkim = 'Y' AND ".$app->tform->getAuthSQL('r'));
87+
$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = ? AND dkim = 'Y' AND ".$app->tform->getAuthSQL('r'), substr_replace($soa['origin'],'',-1));
8888

8989
$public_key=pub_key($public_key);
9090

interface/web/dns/dns_wizard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".$app->db->quote($_POST['domain'])."' AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'));
249249
if ($public_key!='') {
250250
$dns_record=str_replace(array("\r\n", "\n", "\r", "-----BEGIN PUBLIC KEY-----", "-----END PUBLIC KEY-----"), '', $public_key['dkim_public']);
251-
$tpl_content = str_replace('TXT|'.$_POST['domain'].'.|{DKIM}', 'TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record, $tpl_content);
251+
$tpl_content = str_replace('TXT|'.$_POST['domain'].'|{DKIM}', 'TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record, $tpl_content);
252252
}
253253
}
254254

0 commit comments

Comments
 (0)