Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory-plugins
Commits
d4df85c0
Commit
d4df85c0
authored
Jan 20, 2016
by
Côme Chilliet
Browse files
Fixes
#1217
Fixed problems in DNSRecordsAttribute linked to DNS tab
parent
aea571e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
dns/admin/dns/class_dnsZone.inc
View file @
d4df85c0
...
...
@@ -43,9 +43,10 @@ class DnsRecordPlugin extends simplePlugin
* $value can be an array containing:
* relativeSubdomainName, recordType, recordValue, reverseZone
* */
function
__construct
(
&
$config
,
$dn
=
NULL
,
$parent
=
NULL
,
$value
=
NULL
)
function
__construct
(
$parent
,
$attribute
,
$value
=
NULL
)
{
parent
::
__construct
(
$config
,
$dn
,
$parent
);
global
$config
;
parent
::
__construct
(
$config
,
$parent
->
dn
,
$parent
);
$this
->
attributesAccess
[
'relativeSubdomainName'
]
->
setInLdap
(
FALSE
);
$this
->
attributesAccess
[
'dnsRecord'
]
->
setInLdap
(
FALSE
);
...
...
@@ -62,7 +63,7 @@ class DnsRecordPlugin extends simplePlugin
array_filter
(
$ips
,
'tests::is_ipv6'
)
);
}
$this
->
attributesAccess
[
'dnsRecord'
]
->
attributes
[
2
]
->
setChoices
(
$
parent
->
r
everseZones
);
$this
->
attributesAccess
[
'dnsRecord'
]
->
attributes
[
2
]
->
setChoices
(
$
attribute
->
getR
everseZones
()
);
}
function
save
()
...
...
@@ -82,7 +83,7 @@ class DnsRecordDialog extends GenericDialog
{
$this
->
attribute
=
$attribute
;
$this
->
plugin
=
$simplePlugin
;
$this
->
dialog
=
new
$this
->
dialogClass
(
$simplePlugin
->
config
,
$simplePlugin
->
dn
,
$simplePlugin
,
$value
);
$this
->
dialog
=
new
$this
->
dialogClass
(
$simplePlugin
,
$attribute
,
$value
);
if
(
!
empty
(
$value
))
{
$this
->
initialDialogValue
=
$value
;
}
...
...
@@ -127,7 +128,18 @@ class DnsRecordDialog extends GenericDialog
class
DnsRecordsAttribute
extends
DialogOrderedArrayAttribute
{
protected
$dialogClass
=
'DnsRecordDialog'
;
protected
$dialogClass
=
'DnsRecordDialog'
;
protected
$reverseZones
=
array
();
protected
$sOARecord
=
''
;
function
getReverseZones
()
{
if
(
$this
->
plugin
instanceof
dnsZone
)
{
return
$this
->
plugin
->
reverseZones
;
}
else
{
return
$this
->
reverseZones
;
}
}
protected
function
getAttributeArrayValue
(
$key
,
$value
)
{
...
...
@@ -183,7 +195,12 @@ class DnsRecordsAttribute extends DialogOrderedArrayAttribute
while
(
$subattrs
=
$ldap
->
fetch
())
{
$reverseZones
[
$subattrs
[
'dn'
]]
=
$subattrs
[
'zoneName'
][
0
];
}
$this
->
plugin
->
reverseZones
=
array_values
(
$reverseZones
);
if
(
$this
->
plugin
instanceof
dnsZone
)
{
$this
->
plugin
->
reverseZones
=
array_values
(
$reverseZones
);
}
else
{
$this
->
reverseZones
=
array_values
(
$reverseZones
);
$this
->
sOARecord
=
$attrs
[
'sOARecord'
][
0
];
}
foreach
(
$reverseZones
as
$reverseZoneDn
=>
$reverseZoneName
)
{
$ipv6
=
preg_match
(
'/ip6/'
,
$reverseZoneName
);
$ldap
->
ls
(
'(objectClass=dNSZone)'
,
$reverseZoneDn
,
array
(
'relativeDomainName'
,
'pTRRecord'
));
...
...
@@ -275,7 +292,11 @@ class DnsRecordsAttribute extends DialogOrderedArrayAttribute
}
}
foreach
(
$this
->
plugin
->
reverseZones
as
$reverseZone
)
{
if
(
$this
->
plugin
instanceof
dnsZone
)
{
$this
->
reverseZones
=
$this
->
plugin
->
reverseZones
;
$this
->
sOARecord
=
$this
->
plugin
->
sOARecord
;
}
foreach
(
$this
->
reverseZones
as
$reverseZone
)
{
/* Write this reverse under the zone dn */
$reverseDn
=
'zoneName='
.
$reverseZone
.
','
.
$zoneDn
;
$node
=
array
(
...
...
@@ -283,7 +304,7 @@ class DnsRecordsAttribute extends DialogOrderedArrayAttribute
'zoneName'
=>
$reverseZone
,
'relativeDomainName'
=>
'@'
,
'dNSClass'
=>
'IN'
,
'sOARecord'
=>
$this
->
plugin
->
sOARecord
,
'sOARecord'
=>
$this
->
sOARecord
,
);
$ldap
->
cd
(
$reverseDn
);
$ldap
->
add
(
$node
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment