Commit 20c71670 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Merge branch 'willo' into 'master'

Willo

- Lowercase all domain names
- Fixed </domain:update> closing tag

See merge request !25
parents e7a63de7 ff42ca27
......@@ -67,7 +67,7 @@ function cozaepp_GetNameservers($params) {
# Grab variables
$sld = $params["sld"];
$tld = $params["tld"];
$domain = "$sld.$tld";
$domain = strtolower("$sld.$tld");
# Get client instance
......@@ -129,7 +129,7 @@ function cozaepp_SaveNameservers($params) {
# Grab variables
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
# Generate XML for nameservers
if ($nameserver1 = $params["ns1"]) {
......@@ -177,7 +177,7 @@ function cozaepp_SaveNameservers($params) {
<epp:command>
<epp:info>
<domain:info xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name hosts="all">'.$sld.'.'.$tld.'</domain:name>
<domain:name hosts="all">'.$domain.'</domain:name>
</domain:info>
</epp:info>
</epp:command>
......@@ -193,7 +193,7 @@ function cozaepp_SaveNameservers($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# Check if result is ok
if($coderes != '1000') {
$values["error"] = "SaveNameservers/domain-info($sld.$tld): Code ($coderes) $msg";
$values["error"] = "SaveNameservers/domain-info($domain): Code ($coderes) $msg";
return $values;
}
......@@ -217,7 +217,7 @@ function cozaepp_SaveNameservers($params) {
<epp:command>
<epp:update>
<domain:update>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:add>
<domain:ns>'.$add_hosts.' </domain:ns>
</domain:add>
......@@ -244,7 +244,7 @@ function cozaepp_SaveNameservers($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# Check if result is ok
if($coderes != '1001') {
$values["error"] = "SaveNameservers/domain-update($sld.$tld): Code ($coderes) $msg";
$values["error"] = "SaveNameservers/domain-update($domain): Code ($coderes) $msg";
return $values;
}
......@@ -265,7 +265,7 @@ function cozaepp_GetRegistrarLock($params) {
# Grab variables
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
# Get lock status
$lock = 0;
......@@ -358,6 +358,7 @@ function cozaepp_RegisterDomain($params) {
# Grab varaibles
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
$regperiod = $params["regperiod"];
# Get registrant details
......@@ -383,7 +384,7 @@ function cozaepp_RegisterDomain($params) {
$AdminEmailAddress = $params["adminemail"];
$AdminPhone = $params["adminphonenumber"];
# Our details
$contactid = substr(md5($sld . '.' . $tld), 0,15);
$contactid = substr(md5($domain), 0,15);
# Generate XML for namseverss
if ($nameserver1 = $params["ns1"]) {
......@@ -483,7 +484,7 @@ function cozaepp_RegisterDomain($params) {
<epp:command>
<epp:create>
<domain:create xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:ns>'.$add_hosts.'</domain:ns>
<domain:registrant>'.$contactid.'</domain:registrant>
<domain:authInfo>
......@@ -506,7 +507,7 @@ function cozaepp_RegisterDomain($params) {
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes != '1000') {
$values["error"] = "RegisterDomain/domain-create($sld.$tld): Code ($coderes) $msg";
$values["error"] = "RegisterDomain/domain-create($domain): Code ($coderes) $msg";
return $values;
}
......@@ -527,6 +528,7 @@ function cozaepp_TransferDomain($params) {
$testmode = $params["TestMode"];
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
# Domain info
$regperiod = $params["regperiod"];
......@@ -556,7 +558,7 @@ function cozaepp_TransferDomain($params) {
$AdminEmailAddress = $params["adminemail"];
$AdminPhone = $params["adminphonenumber"];
# Our details
$contactid = substr(md5($sld . '.' . $tld), 0,15);
$contactid = substr(md5($domain), 0,15);
# Get client instance
try {
......@@ -568,7 +570,7 @@ function cozaepp_TransferDomain($params) {
<epp:command>
<epp:transfer op="request">
<domain:transfer>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
</domain:transfer>
</epp:transfer>
</epp:command>
......@@ -584,7 +586,7 @@ function cozaepp_TransferDomain($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# We should get a 1001 back
if($coderes != '1001') {
$values["error"] = "TransferDomain/domain-transfer($sld.$tld): Code ($coderes) $msg";
$values["error"] = "TransferDomain/domain-transfer($domain): Code ($coderes) $msg";
return $values;
}
......@@ -654,6 +656,7 @@ function cozaepp_RenewDomain($params) {
$sld = $params["sld"];
$tld = $params["tld"];
$regperiod = $params["regperiod"];
$domain = strtolower("$sld.$tld");
# Get client instance
......@@ -667,7 +670,7 @@ function cozaepp_RenewDomain($params) {
<epp:command>
<epp:info>
<domain:info xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name hosts="all">'.$sld.'.'.$tld.'</domain:name>
<domain:name hosts="all">'.$domain.'</domain:name>
</domain:info>
</epp:info>
</epp:command>
......@@ -682,7 +685,7 @@ function cozaepp_RenewDomain($params) {
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes != '1000') {
$values["error"] = "RenewDomain/domain-info($sld.$tld)): Code ($coderes) $msg";
$values["error"] = "RenewDomain/domain-info($domain)): Code ($coderes) $msg";
return $values;
}
......@@ -691,7 +694,7 @@ function cozaepp_RenewDomain($params) {
# Sanitize expiry date
$expdate = substr($doc->getElementsByTagName('exDate')->item(0)->nodeValue,0,10);
if (empty($expdate)) {
$values["error"] = "RenewDomain/domain-info($sld.$tld): Domain info not available";
$values["error"] = "RenewDomain/domain-info($domain): Domain info not available";
return $values;
}
......@@ -701,7 +704,7 @@ function cozaepp_RenewDomain($params) {
<epp:command>
<epp:renew>
<domain:renew>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:curExpDate>'.$expdate.'</domain:curExpDate>
</domain:renew>
</epp:renew>
......@@ -717,7 +720,7 @@ function cozaepp_RenewDomain($params) {
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes != '1000') {
$values["error"] = "RenewDomain/domain-renew($sld.$tld,$expdate): Code (".$coderes.") ".$msg;
$values["error"] = "RenewDomain/domain-renew($domain,$expdate): Code (".$coderes.") ".$msg;
return $values;
}
......@@ -829,9 +832,10 @@ function cozaepp_GetContactDetails($params) {
# Grab variables
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
# Fetching contact details
$results = _getContactDetails($sld . '.' . $tld);
$results = _getContactDetails($domain);
# If there was an error return it
if (isset($results["error"])) {
......@@ -938,6 +942,7 @@ function cozaepp_SaveContactDetails($params) {
# Grab variables
$tld = $params["tld"];
$sld = $params["sld"];
$domain = strtolower("$sld.$tld");
# Registrant details
$contactDetails = _getContactDetailsFromParams($params);
......@@ -965,7 +970,7 @@ function cozaepp_SaveContactDetails($params) {
<epp:command>
<epp:info>
<domain:info xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name hosts="all">'.$sld.'.'.$tld.'</domain:name>
<domain:name hosts="all">'.$domain.'</domain:name>
</domain:info>
</epp:info>
</epp:command>
......@@ -979,7 +984,7 @@ function cozaepp_SaveContactDetails($params) {
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes != '1000') {
$values["error"] = "SaveContactDetails/domain-info($sld.$tld): Code (".$coderes.") ".$msg;
$values["error"] = "SaveContactDetails/domain-info($domain): Code (".$coderes.") ".$msg;
return $values;
}
......@@ -1050,6 +1055,7 @@ function cozaepp_GetEPPCode($params) {
$testmode = $params["TestMode"];
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
$values["eppcode"] = '';
......@@ -1068,6 +1074,7 @@ function cozaepp_RegisterNameserver($params) {
$testmode = $params["TestMode"];
$sld = $params["sld"];
$tld = $params["tld"];
$domain = strtolower("$sld.$tld");
$nameserver = $params["nameserver"];
$ipaddress = $params["ipaddress"];
......@@ -1082,7 +1089,7 @@ function cozaepp_RegisterNameserver($params) {
<epp:command>
<epp:update>
<domain:update>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:add>
<domain:ns>
<domain:hostAttr>
......@@ -1106,7 +1113,7 @@ function cozaepp_RegisterNameserver($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# Check if result is ok
if($coderes != '1001') {
$values["error"] = "RegisterNameserver/domain-update($sld.$tld): Code ($coderes) $msg";
$values["error"] = "RegisterNameserver/domain-update($domain): Code ($coderes) $msg";
return $values;
}
......@@ -1131,6 +1138,7 @@ function cozaepp_ModifyNameserver($params) {
$testmode = $params["TestMode"];
$tld = $params["tld"];
$sld = $params["sld"];
$domain = strtolower("$sld.$tld");
$nameserver = $params["nameserver"];
$currentipaddress = $params["currentipaddress"];
$newipaddress = $params["newipaddress"];
......@@ -1146,7 +1154,7 @@ function cozaepp_ModifyNameserver($params) {
<epp:command>
<epp:update>
<domain:update>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:add>
<domain:ns>
<domain:hostAttr>
......@@ -1170,7 +1178,7 @@ function cozaepp_ModifyNameserver($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# Check if result is ok
if($coderes != '1001') {
$values["error"] = "ModifyNameserver/domain-update($sld.$tld): Code ($coderes) $msg";
$values["error"] = "ModifyNameserver/domain-update($domain): Code ($coderes) $msg";
return $values;
}
......@@ -1193,6 +1201,7 @@ function cozaepp_DeleteNameserver($params) {
$testmode = $params["TestMode"];
$tld = $params["tld"];
$sld = $params["sld"];
$domain = strtolower("$sld.$tld");
$nameserver = $params["nameserver"];
......@@ -1209,7 +1218,7 @@ function cozaepp_DeleteNameserver($params) {
<epp:command>
<epp:update>
<domain:update>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:rem>
<domain:ns>
<domain:hostAttr>
......@@ -1232,7 +1241,7 @@ function cozaepp_DeleteNameserver($params) {
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
# Check if result is ok
if($coderes != '1001') {
$values["error"] = "DeleteNameserver/domain-update($sld.$tld): Code ($coderes) $msg";
$values["error"] = "DeleteNameserver/domain-update($domain): Code ($coderes) $msg";
return $values;
}
......@@ -1350,6 +1359,7 @@ function cozaepp_TransferSync($params) {
$domain = $params['domain'];
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
$registrar = $params['registrar'];
$regperiod = $params['regperiod'];
$status = $params['status'];
......@@ -1425,12 +1435,14 @@ function cozaepp_RecreateContact($params) {
# Grab variables
$tld = $params["tld"];
$sld = $params["sld"];
$domain = strtolower("$sld.$tld");
# Get client instance
try {
$client = _cozaepp_Client();
# Fetching contact details
$contact = _getContactDetails($sld . '.' . $tld, $client);
$contact = _getContactDetails($domain, $client);
# If there was an error return it
if (isset($contact["error"])) {
......@@ -1438,7 +1450,7 @@ function cozaepp_RecreateContact($params) {
}
# Check for available contact id
$registrant = _cozaepp_CheckContact($sld . '.' . $tld);
$registrant = _cozaepp_CheckContact($domain);
# Recreate contact
$request = $client->request($xml = '
......@@ -1492,7 +1504,7 @@ function cozaepp_RecreateContact($params) {
<epp:command>
<epp:update>
<domain:update>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
<domain:chg>
<domain:registrant>'.$registrant.'</domain:registrant>
</domain:chg>
......@@ -1509,7 +1521,7 @@ function cozaepp_RecreateContact($params) {
$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
if($coderes != '1001') {
$values["error"] = "RecreateContact/domain-info($sld.$tld): Code (".$coderes.") ".$msg;
$values["error"] = "RecreateContact/domain-info($domain): Code (".$coderes.") ".$msg;
return $values;
}
......@@ -1528,6 +1540,7 @@ function cozaepp_Sync($params) {
$domain = $params['domain'];
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
$registrar = $params['registrar'];
$regperiod = $params['regperiod'];
$status = $params['status'];
......@@ -1628,6 +1641,7 @@ function cozaepp_Sync($params) {
function cozaepp_RequestDelete($params) {
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
# Grab domain info
try {
......@@ -1640,7 +1654,7 @@ function cozaepp_RequestDelete($params) {
<epp:command>
<epp:delete>
<domain:delete xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
</domain:delete>
</epp:delete>
</epp:command>
......@@ -1657,7 +1671,7 @@ function cozaepp_RequestDelete($params) {
# Check result
if($coderes != '1001') {
$values['error'] = 'RequestDelete/domain-info('.$sld.'.'.$tld.'): Code('._cozaepp_message($coderes).") $msg";
$values['error'] = 'RequestDelete/domain-info('.$domain.'): Code('._cozaepp_message($coderes).") $msg";
return $values;
}
......@@ -1674,6 +1688,7 @@ function cozaepp_RequestDelete($params) {
function cozaepp_ApproveTransfer($params) {
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
# Grab domain info
try {
......@@ -1685,7 +1700,7 @@ function cozaepp_ApproveTransfer($params) {
<epp:command>
<epp:transfer op="approve">
<domain:transfer>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
</domain:transfer>
</epp:transfer>
</epp:command>
......@@ -1702,7 +1717,7 @@ function cozaepp_ApproveTransfer($params) {
# Check result
if($coderes != '1000') {
$values['error'] = 'ApproveTransfer/domain-info('.$sld.'.'.$tld.'): Code('._cozaepp_message($coderes).") $msg";
$values['error'] = 'ApproveTransfer/domain-info('.$domain.'): Code('._cozaepp_message($coderes).") $msg";
return $values;
}
......@@ -1720,6 +1735,7 @@ function cozaepp_ApproveTransfer($params) {
function cozaepp_CancelTransferRequest($params) {
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
# Grab domain info
try {
......@@ -1731,7 +1747,7 @@ function cozaepp_CancelTransferRequest($params) {
<epp:command>
<epp:transfer op="cancel">
<domain:transfer>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
</domain:transfer>
</epp:transfer>
</epp:command>
......@@ -1748,7 +1764,7 @@ function cozaepp_CancelTransferRequest($params) {
# Check result
if($coderes != '1000') {
$values['error'] = 'CancelTransferRequest/domain-info('.$sld.'.'.$tld.'): Code('._cozaepp_message($coderes).") $msg";
$values['error'] = 'CancelTransferRequest/domain-info('.$domain.'): Code('._cozaepp_message($coderes).") $msg";
return $values;
}
......@@ -1766,6 +1782,7 @@ function cozaepp_CancelTransferRequest($params) {
function cozaepp_RejectTransfer($params) {
$sld = $params['sld'];
$tld = $params['tld'];
$domain = strtolower("$sld.$tld");
# Grab domain info
try {
......@@ -1777,7 +1794,7 @@ function cozaepp_RejectTransfer($params) {
<epp:command>
<epp:transfer op="reject">
<domain:transfer>
<domain:name>'.$sld.'.'.$tld.'</domain:name>
<domain:name>'.$domain.'</domain:name>
</domain:transfer>
</epp:transfer>
</epp:command>
......@@ -1794,7 +1811,7 @@ function cozaepp_RejectTransfer($params) {
# Check result
if($coderes != '1000') {
$values['error'] = 'RejectTransfer/domain-info('.$sld.'.'.$tld.'): Code('._cozaepp_message($coderes).") $msg";
$values['error'] = 'RejectTransfer/domain-info('.$domain.'): Code('._cozaepp_message($coderes).") $msg";
return $values;
}
......
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