From 71e8eb2026c1ed8a7146e01a04ead39d57e83f47 Mon Sep 17 00:00:00 2001
From: Scott Barr <scott@barr.co.za>
Date: Tue, 19 Feb 2013 12:16:13 +0200
Subject: [PATCH] Added the WHMCS logModuleCall at EPP requests for some
 debugging info

Signed-off-by: Scott Barr <scott@barr.co.za>
Change-Id: I12e3cbdc296c932ad0aa11fe09fcf508980f82f1
---
 modules/registrars/cozaepp/cozaepp.php | 29 +++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/modules/registrars/cozaepp/cozaepp.php b/modules/registrars/cozaepp/cozaepp.php
index 5877546..73785db 100644
--- a/modules/registrars/cozaepp/cozaepp.php
+++ b/modules/registrars/cozaepp/cozaepp.php
@@ -68,7 +68,7 @@ function cozaepp_GetNameservers($params) {
 	}
 
 	# Get list of nameservers for domain
-	$result = $client->request('
+	$result = $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:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
 	<epp:command>
 		<epp:info>
@@ -83,6 +83,8 @@ function cozaepp_GetNameservers($params) {
 	$doc = new DOMDocument();
 	$doc->preserveWhiteSpace = false;
 	$doc->loadXML($result);
+	logModuleCall('Cozaepp', 'GetNameservers', $xml, $result);
+
 	# Pull off status
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
@@ -195,7 +197,7 @@ function cozaepp_SaveNameservers($params) {
 	}
 
 	# Build request
-	$request = $client->request('
+	$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: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">
@@ -222,6 +224,8 @@ function cozaepp_SaveNameservers($params) {
 	# Parse XML result
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'SaveNameservers', $xml, $request);
+
 	# Pull off status
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
@@ -388,7 +392,7 @@ function cozaepp_RegisterDomain($params) {
 
 	$values["status"] = $msg;
 
-	$request = $client->request('
+	$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: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">
@@ -413,6 +417,8 @@ function cozaepp_RegisterDomain($params) {
 ');
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'RegisterDomain', $xml, $request);
+
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
 	if($coderes != '1000') {
@@ -498,7 +504,7 @@ function cozaepp_TransferDomain($params) {
 	$values["status"] = $msg;
 
 	# Create contact details
-	$request = $client->request('
+	$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>
@@ -530,6 +536,8 @@ function cozaepp_TransferDomain($params) {
 	# Parse XML result
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'TransferDomain', $xml, $request);
+
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
 	if($coderes == '1000') {
@@ -599,7 +607,7 @@ function cozaepp_RenewDomain($params) {
 	}
 
 	# Send request to renew
-	$request = $client->request('
+	$request = $client->request($xml = '
 <epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
 	<epp:command>
 		<epp:renew>
@@ -615,6 +623,8 @@ function cozaepp_RenewDomain($params) {
 	# Parse XML result
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'RenewDomain', $xml, $request);
+
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
 	if($coderes != '1000') {
@@ -677,7 +687,7 @@ function cozaepp_GetContactDetails($params) {
 	}
 
 	# Grab contact info
-	$request = $client->request('
+	$request = $client->request($xml = '
 <epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
 	<epp:command>
 		<epp:info>
@@ -691,6 +701,8 @@ function cozaepp_GetContactDetails($params) {
 	# Parse XML result
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'GetContactDetails', $xml, $request);
+
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
 	# Check result
@@ -803,6 +815,8 @@ function cozaepp_SaveContactDetails($params) {
 	# Parse XML result
 	$doc= new DOMDocument();
 	$doc->loadXML($request);
+	logModuleCall('Cozaepp', 'SaveContactDetails', $xml, $request);
+
 	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
 	$msg = $doc->getElementsByTagName('msg')->item(0)->nodeValue;
 	if($coderes != '1001') {
@@ -1084,7 +1098,7 @@ function _cozaepp_Client() {
 	}
 
 	# Perform login
-	$request = $client->request('
+	$request = $client->request($xml = '
 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
 	<command>
 		<login>
@@ -1102,6 +1116,7 @@ function _cozaepp_Client() {
 	</command>
 </epp>
 ');
+	logModuleCall('Cozaepp', 'Connect', $xml, $request);
 
 	return $client;
 }
-- 
GitLab