public function addHostObj($host) { if (!Validator::isHostname($host)) { throw new Exception(sprintf('%s is not a valid host name', $host)); } $this->set('domain:ns/domain:hostObj[]', $host); }
public function changeHost($host) { if (!Validator::isHostname($host)) { throw new Exception(sprintf('%s is not a valid host name', $host)); } $this->set('host:chg/host:name', $host); }
public function setDomain($domain) { if (!Validator::isHostname($domain)) { throw new Exception(sprintf('%s is not a valid domain name')); } $this->set('domain:name', $domain); }
public function setHost($hostname) { // validate hostname if (!Validator::isHostname($hostname)) { throw new Exception(sprintf('not a valid Hostname: %s', $hostname)); } $this->set('host:name', $hostname); }
public function setDomain($domain, $return = 'all') { if (!Validator::isHostname($domain)) { throw new Exception(sprintf('%s is not a valid domain name', $domain)); } if (!in_array($return, ['all', 'del', 'sub', 'none'])) { throw new Exception(sprintf('%s is not a known return value', $return)); } $this->set(sprintf('domain:name[@hosts=\'%s\']', $return), $domain); }
public function addHostObj($host, $remove = false) { if (!Validator::isHostname($host)) { throw new Exception(sprintf('%s is not a valid host name', $host)); } if ($remove) { $key = 'rem'; } else { $key = 'add'; } $this->set(sprintf('domain:%s/domain:ns/domain:hostObj[]', $key), $host); }
protected function appendHostAttr($base_path, $host, $ips = null) { if (!Validator::isHostname($host)) { throw new Exception(sprintf('%s is not a valid host name', $host)); } $base_path = sprintf($base_path, $this->host_attr_index); $this->set($base_path . '/domain:hostName', $host); if (!empty($ips) && is_array($ips)) { foreach ($ips as $ip) { $ip_type = Validator::getIPType($ip); if ($ip_type === false) { throw new Exception(sprintf('%s is not a valid IP address', $ip)); } elseif ($ip_type === Validator::TYPE_IPV4) { $this->set($base_path . '/domain:hostAddr[@ip=\'v4\']', $ip); } elseif ($ip_type === Validator::TYPE_IPV6) { $this->set($base_path . '/domain:hostAddr[@ip=\'v6\']', $ip); } } } ++$this->host_attr_index; }
public function appendEmail($path, $email) { if (!Validator::isEmail($email)) { throw new Exception(sprintf('%s is not a valid email', $email)); } $this->set($path, $email); }