Skip to content

Commit 5cbbea4

Browse files
author
Marius Cramer
committed
Merge branch 'master' of /home/git/repositories/florian030/ispconfig3
2 parents c54948f + 5d75c17 commit 5cbbea4

File tree

6 files changed

+65
-64
lines changed

6 files changed

+65
-64
lines changed

interface/web/dns/dns_dkim_edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function onSubmit() {
9797
$this->dataRecord["server_id"] = $soa["server_id"];
9898

9999
// add dkim-settings to the public-key in the txt-record
100-
$this->dataRecord['data']='v=DKIM1; t=s; p='.$this->dataRecord['data'];
100+
if (!empty($this->dataRecord['data'])) $this->dataRecord['data']='v=DKIM1; t=s; p='.$this->dataRecord['data'];
101101
$this->dataRecord['name']='default._domainkey.'.$this->dataRecord['name'];
102102

103103
// Update the serial number and timestamp of the RR record
@@ -108,7 +108,7 @@ function onSubmit() {
108108
// check for duplicate entry
109109
$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']."'");
110110
if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
111-
111+
if (empty($this->dataRecord['data'])) $app->tform->errorMessage .= $app->tform->wordbook["dkim_disabled_txt"];
112112
parent::onSubmit();
113113
}
114114

interface/web/dns/dns_dkim_get.php

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
<?php
22
/**
3-
Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
4-
Copyright (c) 2013, Florian Schaal, info@schaal-24.de
5-
All rights reserved.
6-
7-
Redistribution and use in source and binary forms, with or without modification,
8-
are permitted provided that the following conditions are met:
9-
10-
* Redistributions of source code must retain the above copyright notice,
11-
this list of conditions and the following disclaimer.
12-
* Redistributions in binary form must reproduce the above copyright notice,
13-
this list of conditions and the following disclaimer in the documentation
14-
and/or other materials provided with the distribution.
15-
* Neither the name of ISPConfig nor the names of its contributors
16-
may be used to endorse or promote products derived from this software without
17-
specific prior written permission.
18-
19-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22-
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24-
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29-
*/
30-
3+
Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
4+
Copyright (c) 2013, Florian Schaal, info@schaal-24.de
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
* Neither the name of ISPConfig nor the names of its contributors
16+
may be used to endorse or promote products derived from this software without
17+
specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
3130

3231
/**
33-
* This script is invoked by interface/web/dns/templates/dns_dkim_edit.htm
34-
* when generating the DKIM Private-key.
35-
*
36-
* return DKIM Public-Key for the DNS-record
37-
*/
38-
require_once '../../lib/config.inc.php';
39-
require_once '../../lib/app.inc.php';
32+
* This script is invoked by interface/web/dns/templates/dns_dkim_edit.htm
33+
* when generating the DKIM Private-key.
34+
*
35+
* return DKIM Public-Key for the DNS-record
36+
*/
37+
38+
require_once('../../lib/config.inc.php');
39+
require_once('../../lib/app.inc.php');
4040

4141
//* Check permissions for module
4242
$app->auth->check_module_permissions('dns');
@@ -49,34 +49,33 @@
4949
header('Content-Type: text/xml; charset=utf-8');
5050
header('Cache-Control: must-revalidate, pre-check=0, no-store, no-cache, max-age=0, post-check=0');
5151

52-
5352
/**
54-
* This function fix PHP's messing up POST input containing characters space, dot,
55-
* open square bracket and others to be compatible with with the deprecated register_globals
56-
* @return array POST
57-
*/
53+
* This function fix PHP's messing up POST input containing characters space, dot,
54+
* open square bracket and others to be compatible with with the deprecated register_globals
55+
* @return array POST
56+
*/
57+
5858
function getRealPOST() {
59-
$pairs = explode("&", file_get_contents("php://input"));
60-
$vars = array();
61-
foreach ($pairs as $pair) {
62-
$nv = explode("=", $pair, 2);
63-
$name = urldecode($nv[0]);
64-
$value = $nv[1];
65-
$vars[$name] = $value;
66-
}
67-
return $vars;
59+
$pairs = explode("&", file_get_contents("php://input"));
60+
$vars = array();
61+
foreach ($pairs as $pair) {
62+
$nv = explode("=", $pair, 2);
63+
$name = urldecode($nv[0]);
64+
$value = $nv[1];
65+
$vars[$name] = $value;
66+
}
67+
return $vars;
6868
}
6969

70-
7170
/**
72-
* This function formats the public-key
73-
* @param array $pubkey
74-
* @return string public-key
75-
*/
71+
* This function formats the public-key
72+
* @param array $pubkey
73+
* @return string public-key
74+
*/
7675
function pub_key($pubkey) {
77-
$public_key='';
78-
foreach($pubkey as $values) $public_key=$public_key.$values;
79-
return $public_key;
76+
$public_key='';
77+
foreach($pubkey as $values) $public_key=$public_key.$values;
78+
return $public_key;
8079
}
8180

8281
$_POST=getRealPost();
@@ -85,11 +84,11 @@ function pub_key($pubkey) {
8584
// Get the parent soa record of the domain
8685
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->db->quote($_POST['zone'])."' AND ".$app->tform->getAuthSQL('r'));
8786

88-
$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".substr_replace($soa['origin'], '', -1)."' AND ".$app->tform->getAuthSQL('r'));
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'));
8988

9089
$public_key=pub_key($public_key);
9190

92-
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', "\r", "\n"), '', $public_key);
91+
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$public_key);
9392

9493
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
9594
echo "<formatname>\n";

interface/web/dns/dns_wizard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
$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'));
246246
if ($public_key!='') {
247247
$dns_record=str_replace(array("\r\n", "\n", "\r", "-----BEGIN PUBLIC KEY-----", "-----END PUBLIC KEY-----"), '', $public_key['dkim_public']);
248-
$tpl_content = str_replace('{DKIM}', 'TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record, $tpl_content);
248+
$tpl_content = str_replace('TXT|'.$_POST['domain'].'.|{DKIM}', 'TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record, $tpl_content);
249249
}
250250
}
251251

@@ -348,4 +348,4 @@
348348
$app->tpl->pparse();
349349

350350

351-
?>
351+
?>

interface/web/dns/form/dns_template.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
'formtype' => 'CHECKBOXARRAY',
7575
'default' => '',
7676
'separator' => ',',
77-
'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM (use {DKIM}|0|3600 in your Template)'),
77+
'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM (use TXT|{DOMAIN}.|{DKIM} in your Template)'),
7878
'validators' => array ( 0 => array ('type' => 'CUSTOM',
7979
'class' => 'validate_dkim',
8080
'function' => 'check_template',

interface/web/dns/lib/lang/de_dns_dkim.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ $wb["public_key_txt"] = 'Public-Key';
33
$wb["ttl_txt"] = 'TTL';
44
$wb["active_txt"] = 'Aktiv';
55
$wb["record_exists_txt"] = 'DNS-Eintrag bereits vorhanden';
6+
$wb["dkim_disabled_txt"] = 'DKIM st fuer diese Domain nicht aktiv.';
67
$wb["limit_dns_record_txt"] = 'Die max. Anzahl von DNS Eintraegen fuer den Account ist erreicht.';
78
$wb["no_zone_perm"] = 'Fehlende Berechtigung zum Hinzufuegen eines Eintrags zur DNS-Zone.';
89
?>

interface/web/dns/lib/lang/en_dns_dkim.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ $wb["public_key_txt"] = 'Public-Key';
33
$wb["ttl_txt"] = 'TTL';
44
$wb["active_txt"] = 'Active';
55
$wb["record_exists_txt"] = 'DNS-Record already exists';
6+
$wb["dkim_disabled_txt"] = 'DKIM disabled for this mail-domain';
67
$wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account is reached.';
78
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
89
?>

0 commit comments

Comments
 (0)