Commit 3856725c authored by Scott's avatar Scott
Browse files

Some SLDs require the presence of admin, billing and tech contacts. Check for...


Some SLDs require the presence of admin, billing and tech contacts. Check for this requirement during the registration process.

Signed-off-by: Scott's avatarScott Barr <scott@barr.co.za>
parent 8bc90889
......@@ -382,9 +382,13 @@ function cozaepp_RegisterDomain($params) {
$AdminCountry = $params["admincountry"];
$AdminEmailAddress = $params["adminemail"];
$AdminPhone = $params["adminphonenumber"];
# Our details
# Registrar contactid hash
$contactid = substr(md5($domain), 0,15);
# Admin/Tech/Billing contactid hash
$additional_contactid = substr(md5($AdminFirstName.$AdminLastName), 0,15);
# Generate XML for namseverss
if ($nameserver1 = $params["ns1"]) {
$add_hosts = '
......@@ -476,7 +480,7 @@ function cozaepp_RegisterDomain($params) {
$values["status"] = $msg;
$request = $client->request($xml = '
$domaincreate = '
<epp:epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns:cozadomain="http://co.za/epp/extensions/cozadomain-1-0"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
......@@ -485,7 +489,67 @@ function cozaepp_RegisterDomain($params) {
<domain:create xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>'.$domain.'</domain:name>
<domain:ns>'.$add_hosts.'</domain:ns>
<domain:registrant>'.$contactid.'</domain:registrant>
<domain:registrant>'.$contactid.'</domain:registrant>';
# Some SLDs require the presence of admin, billing and tech contacts.
# Check if our domain has the requirement and get/create the required contact id.
$_server = _cozaepp_SldLookup($domain);
if ($_server['additional_contacts']) {
$request = $client->request($xml = '
<epp:epp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<epp:command>
<epp:create>
<contact:create xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd">
<contact:id>'.$additional_contactid.'</contact:id>
<contact:postalInfo type="loc">
<contact:name>'.$AdminFirstName.' '.$AdminLastName.'</contact:name>
<contact:addr>
<contact:street>'.$AdminAddress1.'</contact:street>
<contact:street>'.$AdminAddress2.'</contact:street>
<contact:city>'.$AdminCity.'</contact:city>
<contact:sp>'.$AdminStateProvince.'</contact:sp>
<contact:pc>'.$AdminPostalCode.'</contact:pc>
<contact:cc>'.$AdminCountry.'</contact:cc>
</contact:addr>
</contact:postalInfo>
<contact:voice>'.$AdminPhone.'</contact:voice>
<contact:fax></contact:fax>
<contact:email>'.$AdminEmailAddress.'</contact:email>
<contact:authInfo>
<contact:pw>AxA8AjXbAH'.rand().rand().'</contact:pw>
</contact:authInfo>
</contact:create>
</epp:create>
</epp:command>
</epp:epp>
');
# Parse XML result
$doc= new DOMDocument();
$doc->loadXML($request);
logModuleCall('Cozaepp', 'RegisterDomain', $xml, $request);
# Pull off status
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes == '1000') {
$values['contact'] = 'Contact Created';
} else if($coderes == '2302') {
$values['contact'] = 'Contact Already exists';
} else {
$values["error"] = "RegisterDomain/admincontact-create($additional_contactid): Code ($coderes) $msg";
return $values;
}
$domaincreate .= '
<domain:contact type="admin">'.$additional_contactid.'</domain:contact>
<domain:contact type="tech">'.$additional_contactid.'</domain:contact>
<domain:contact type="billing">'.$additional_contactid.'</domain:contact>';
}
$domaincreate .= '
<domain:authInfo>
<domain:pw>coza</domain:pw>
</domain:authInfo>
......@@ -498,10 +562,12 @@ function cozaepp_RegisterDomain($params) {
</epp:extension>
</epp:command>
</epp:epp>
');
';
$request = $client->request($domaincreate);
$doc= new DOMDocument();
$doc->loadXML($request);
logModuleCall('Cozaepp', 'RegisterDomain', $xml, $request);
logModuleCall('Cozaepp', 'RegisterDomain', $domaincreate, $request);
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment