|
|
@@ -81,7 +81,7 @@ class ServeradminParser {
|
|
|
public function dnsAddIpAddress($domain, $host, $ip, $replace = 0) {
|
|
|
// Weryfikacja argumentow funkcji (TODO nalezy upsrawnic)
|
|
|
if (!strlen($domain)) throw new Exception("Bad domain.");
|
|
|
- if (!strlen($ip)) throw new Exception("Bad IP address.");
|
|
|
+ if (!filter_var($ip, FILTER_VALIDATE_IP) === true) throw new Exception("Bad IP address.");
|
|
|
|
|
|
// Pobranie danych z serverconfig
|
|
|
$this->getData("dns:views:_array_id:com.apple.ServerAdmin.DNS.public:primaryZones:_array_id:".$domain.":machines");
|
|
|
@@ -130,10 +130,10 @@ class ServeradminParser {
|
|
|
}
|
|
|
|
|
|
// Funkcja usuwajaca wpis A (adres IP) z konfiguracji DNS
|
|
|
- public function dnsDelIpAddress($domain, $host, $ip, $replace = false) {
|
|
|
+ public function dnsDelIpAddress($domain, $host, $ip = "") {
|
|
|
// Weryfikacja argumentow funkcji (TODO nalezy upsrawnic)
|
|
|
if (!strlen($domain)) throw new Exception("Bad domain.");
|
|
|
- if (!strlen($ip)) throw new Exception("Bad IP address.");
|
|
|
+ if (strlen($ip) && (!filter_var($ip, FILTER_VALIDATE_IP) === true)) throw new Exception("Bad IP address.");
|
|
|
|
|
|
// Pobranie danych z serverconfig
|
|
|
$this->getData("dns:views:_array_id:com.apple.ServerAdmin.DNS.public:primaryZones:_array_id:".$domain.":machines");
|