better detect zones
This commit is contained in:
parent
fd19960591
commit
a47e2be3dd
|
@ -92,19 +92,19 @@ class ddns extends baseModule {
|
||||||
"Text" => _("Please enter the IP address of your DNS server.")
|
"Text" => _("Please enter the IP address of your DNS server.")
|
||||||
),
|
),
|
||||||
'zone' => array(
|
'zone' => array(
|
||||||
"Headline" => _("Zone names"),
|
"Headline" => _("Zone name"),
|
||||||
"Text" => _("Zone names for the DNS server (e.g. company.local).")
|
"Text" => _("Zone name for the DNS server (e.g. company.local).")
|
||||||
),
|
),
|
||||||
'zone_reverse' => array(
|
'zone_reverse' => array(
|
||||||
"Headline" => _("Reverse zone names"),
|
"Headline" => _("Reverse zone name"),
|
||||||
"Text" => ("Name of the reverse zones of the DNS server (e.g. 0.168.192.in-addr.arpa).")
|
"Text" => ("Name of the reverse zone of the DNS server (e.g. 0.168.192.in-addr.arpa).")
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// available PDF fields
|
// available PDF fields
|
||||||
$return['PDF_fields'] = array(
|
$return['PDF_fields'] = array(
|
||||||
'DNSserver' => _('IP address of the DNS server'),
|
'DNSserver' => _('IP address of the DNS server'),
|
||||||
'zone' => _('Zone names'),
|
'zone' => _('Zone name'),
|
||||||
'reverseZone' => _('Reverse zone names'),
|
'reverseZone' => _('Reverse zone name'),
|
||||||
);
|
);
|
||||||
// upload fields
|
// upload fields
|
||||||
if (isset($_SESSION['loggedIn']) && $this->check_if_ddns_is_enable()) {
|
if (isset($_SESSION['loggedIn']) && $this->check_if_ddns_is_enable()) {
|
||||||
|
@ -118,14 +118,14 @@ class ddns extends baseModule {
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'ddns_zone',
|
'name' => 'ddns_zone',
|
||||||
'description' => _('Zone names'),
|
'description' => _('Zone name'),
|
||||||
'help' => 'zone',
|
'help' => 'zone',
|
||||||
'example' => 'company.local',
|
'example' => 'company.local',
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'ddns_reverseZone',
|
'name' => 'ddns_reverseZone',
|
||||||
'description' => _('Reverse zone names'),
|
'description' => _('Reverse zone name'),
|
||||||
'help' => 'zone_reverse',
|
'help' => 'zone_reverse',
|
||||||
'example' => '0.168.192.in-addr.arpa',
|
'example' => '0.168.192.in-addr.arpa',
|
||||||
'required' => true
|
'required' => true
|
||||||
|
@ -392,11 +392,11 @@ class ddns extends baseModule {
|
||||||
if (isset($zones[1])) {
|
if (isset($zones[1])) {
|
||||||
$revzone = $zones[1];
|
$revzone = $zones[1];
|
||||||
}
|
}
|
||||||
// zone names
|
// zone name
|
||||||
$zoneInput = new htmlTableExtendedInputField(_('Zone names'), 'zone', $zone, 'zone');
|
$zoneInput = new htmlTableExtendedInputField(_('Zone name'), 'zone', $zone, 'zone');
|
||||||
$return->addElement($zoneInput, true);
|
$return->addElement($zoneInput, true);
|
||||||
// reverse zone names
|
// reverse zone name
|
||||||
$revZoneInput = new htmlTableExtendedInputField(_('Reverse zone names'), 'zone_reverse', $revzone, 'zone_reverse');
|
$revZoneInput = new htmlTableExtendedInputField(_('Reverse zone name'), 'zone_reverse', $revzone, 'zone_reverse');
|
||||||
$return->addElement($revZoneInput);
|
$return->addElement($revZoneInput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,8 +424,8 @@ class ddns extends baseModule {
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
get_class($this) . '_DNSserver' => array('<block><key>' . _('IP address of the DNS server') . '</key><value>' . $this->getDNSServer() . '</value></block>'),
|
get_class($this) . '_DNSserver' => array('<block><key>' . _('IP address of the DNS server') . '</key><value>' . $this->getDNSServer() . '</value></block>'),
|
||||||
get_class($this) . '_zone' => array('<block><key>' . _('Zone names') . '</key><value>' . $zone . '</value></block>'),
|
get_class($this) . '_zone' => array('<block><key>' . _('Zone name') . '</key><value>' . $zone . '</value></block>'),
|
||||||
get_class($this) . '_reverseZone' => array('<block><key>' . _('Reverse zone names') . '</key><value>' . $revzone . '</value></block>'),
|
get_class($this) . '_reverseZone' => array('<block><key>' . _('Reverse zone name') . '</key><value>' . $revzone . '</value></block>'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,18 +455,28 @@ class ddns extends baseModule {
|
||||||
/**
|
/**
|
||||||
* Returns the zone names.
|
* Returns the zone names.
|
||||||
*
|
*
|
||||||
* @return array zone names
|
* @return array zone names array(zone, reverse zone)
|
||||||
*/
|
*/
|
||||||
private function getZoneNames() {
|
private function getZoneNames() {
|
||||||
$return = array();
|
$return = array();
|
||||||
|
$zone = '';
|
||||||
|
$revZone = '';
|
||||||
if (is_array($this->attributes['dhcpStatements'])) {
|
if (is_array($this->attributes['dhcpStatements'])) {
|
||||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||||
if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') {
|
if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') {
|
||||||
$parts = explode(" ",substr($this->attributes['dhcpStatements'][$i],5));
|
$parts = explode(" ",substr($this->attributes['dhcpStatements'][$i],5));
|
||||||
$return[] = substr(array_shift($parts),0,-1);
|
$value = substr(array_shift($parts),0,-1);
|
||||||
|
if (strpos($value, 'in-addr.arpa') === false) {
|
||||||
|
$zone = $value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$revZone = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$return[0] = $zone;
|
||||||
|
$return[1] = $revZone;
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue