static function add($parent, $class, $param) { $param['nname'] = strtolower($param['nname']); if (exists_in_db(null, 'domain', $param['nname'])) { throw new lxException('domain_already_exists_as_virtual', 'nname', $param['nname']); } validate_domain_name($param['nname']); if ($parent->isClient()) { } else { $param['real_clparent_f'] = $parent->nname; } return $param; }
function postAdd() { $web = $this->getParentO(); $domain = $web->getParentO(); $dns = $domain->getObject('dns'); $dns->addRec("cn", $this->nname, "__base__"); try { $dns->was(); } catch (exception $e) { throw new lxException("subdomain_not_added_due_to_dns_conflict", 'nname', $this->nname); } validate_domain_name("{$this->nname}.{$web->nname}"); }
function verify_record($name, $type, $address, $distance, $weight, $port, $ttl) { // convert type to single character format $type = set_type($type); // Make sure name was given for non A and MX records if ($type != 'A' && $type != 'M' && $name == "") { return "no Hostname supplied"; } // verify A record if ($type == 'A') { if (validate_ip($address) == FALSE) { return "\"{$address}\" is not a valid A record address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid A record name"; } } if ($type == '=') { if (validate_ip($address) == FALSE) { return "\"{$address}\" is not a valid A+PTR record address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid A+PTR record name"; } } // verify AAAA record if ($type == '3') { if (validate_ipv6($address) == FALSE) { return "\"{$address}\" is not a valid AAAA record address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid AAAA record name"; } } // verify AAAA+PTR record if ($type == '6') { if (validate_ipv6($address) == FALSE) { return "\"{$address}\" is not a valid AAAA+PTR record address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid AAAA+PTR record name"; } } // verify NS record if ($type == 'N') { if (validate_ip($address) != FALSE) { return "\"{$address}\" should not be an IP address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid NS record name"; } } // verify MX record if ($type == 'M') { if (validate_ip($name)) { return "MX records can not be an IP address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid MX record name"; } if (!preg_match('/^([0-9])+$/i', $distance)) { return "\"{$distance}\" is not a valid MX distance"; } } // verify PTR if ($type == 'P') { if (!preg_match('/^.*\\.in-addr.arpa\\.*$/i', $name) && !preg_match('/^.*\\.ip6.arpa\\.*$/i', $name)) { return "PTR \"{$name}\" does not end in .in-addr.arpa or ip6.arpa."; } } // verify CNAME record if ($type == 'C') { if (validate_ip($address)) { return "CNAME records can not point to an IP address"; } if (check_domain_name_format($name) == FALSE) { return "\"{$name}\" is not a valid CNAME record name"; } if (validate_domain_name($address) == FALSE) { return "\"{$address}\" is not a valid CNAME record address"; } } // verify SRV record if ($type == 'V') { if (!preg_match('/^_.*\\._.*$/i', $name)) { return "SRV \"{$name}\" should be in the format _service._protocol"; } if ($distance > 65535 || !preg_match('/^([0-9])+$/i', $distance)) { return "SRV distance must be a numeric value between 0 and 65535"; } if ($weight > 65535 || !preg_match('/^([0-9])+$/i', $weight)) { return "SRV weight must be a numeric value between 0 and 65535"; } if ($port > 65535 || !preg_match('/^([0-9])+$/i', $port)) { return "SRV port must be a numeric value between 0 and 65535"; } } // make sure a TTL was given if ($ttl == "") { return "no TTL given"; } return 'OK'; }
static function add($parent, $class, $param) { global $gbl, $sgbl, $login, $ghtml; $revc = $login->getObject('general')->reversedns_b; validate_domain_name($param['nname']); $param['nameserver_f'] = $revc->primarydns; $param['secnameserver_f'] = $revc->secondarydns; return $param; }
static function continueForm($parent, $class, $param, $continueaction) { global $gbl, $sgbl, $login, $ghtml; $param['nname'] = strtolower($param['nname']); validate_domain_name($param['nname']); /* if (!preg_match("/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+]/i", $param['nname'])) { throw new lxException('domain_name_invalid', 'nname'); } */ if ($continueaction === 'server') { if ($param['resourceplan_f'] === 'continue_without_plan') { $ret = self::continueFormlistpriv($parent, $class, $param, $continueaction); } else { $template = getFromAny(array($login, $parent), 'resourceplan', $param['resourceplan_f']); $param['use_resourceplan_f'] = 'on'; if (!$template) { throw new lxexception("the_resource_plan_doesnt_exist", 'resourceplan_f', $param['resourceplan_f']); } $ret['action'] = 'addnow'; $ret['param'] = $param; return $ret; } } else { $ret = self::continueFormFinish($parent, $class, $param, $continueaction); } return $ret; }