From d452439a089d89c2f11db6a4f6840a1d88381411 Mon Sep 17 00:00:00 2001 From: donal72 Date: Wed, 7 Feb 2007 12:43:08 +0000 Subject: [PATCH] MNet: Standardise format of the mnet_client->error array --- enrol/mnet/enrol.php | 3 ++- mnet/xmlrpc/client.php | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/enrol/mnet/enrol.php b/enrol/mnet/enrol.php index 22dcad7de2..113b14a795 100644 --- a/enrol/mnet/enrol.php +++ b/enrol/mnet/enrol.php @@ -493,7 +493,8 @@ class enrolment_plugin_mnet { return $courses; } else { - foreach ($mnetrequest->error as $code => $errormessage) { + foreach ($mnetrequest->error as $message) { + list($code, $errormessage) = array_map('trim',explode(':', $errormessage, 2)); $message .= "ERROR $code:
$errormessage
"; } error("RPC enrol/mnet/available_courses:
$message"); diff --git a/mnet/xmlrpc/client.php b/mnet/xmlrpc/client.php index e765762b02..ddae4b9d80 100644 --- a/mnet/xmlrpc/client.php +++ b/mnet/xmlrpc/client.php @@ -165,10 +165,10 @@ class mnet_xmlrpc_client { $permission = get_record_sql($sql); if ($permission == false) { global $USER; - $this->error[] = array(7, 'User with ID '. $USER->id . - ' attempted to call unauthorised method '. - $this->method.' on host '. - $mnet_peer->wwwroot); + $this->error[] = '7:User with ID '. $USER->id . + ' attempted to call unauthorised method '. + $this->method.' on host '. + $mnet_peer->wwwroot; return false; } @@ -192,7 +192,7 @@ class mnet_xmlrpc_client { $timestamp_receive = time(); if ($this->rawresponse == false) { - $this->error[] = array(curl_errno($ch), curl_error($ch)); + $this->error[] = curl_errno($ch) .':'. curl_error($ch); return false; } @@ -269,7 +269,7 @@ class mnet_xmlrpc_client { $threshold = 15; } if ($time_offset > $threshold) { - $this->error[] = 'Time gap with '.$mnet_peer->name.' ('.$time_offset.' seconds) is greater than the permitted maximum of '.$threshold.' seconds'; + $this->error[] = '6:Time gap with '.$mnet_peer->name.' ('.$time_offset.' seconds) is greater than the permitted maximum of '.$threshold.' seconds'; return false; } } -- 2.39.5