X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fyoomedia_functions.php;h=75a0362ebc9b8350c9342ea5cd2b754d57bff618;hb=5a8c537bc2633402ca515964c9a3a2674f37edc2;hp=1f67e9ba00dcc591630cd00b5a206c4ecd7fe9fa;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 1f67e9ba00..75a0362ebc 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -169,6 +169,13 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) { } // END - if } // END - foreach + // If we have no result, abort here + if (count($dummy) == 0) { + // Empty response from API + logDebugMessage(__FUNCTION__, __LINE__, 'Empy result from API received.'); + return array(); + } // END - if + // The result is now still raw, so we must split it up and trim spaces away $responseLine = trim(implode("\n", $dummy)); @@ -380,11 +387,11 @@ function YOOMEDIA_CONVERT_MODE ($mode) { // Convert mode for normal/html switch ($mode) { case 'normal': - $mode = "textmail"; + $mode = 'textmail'; break; case 'html': - $mode = "htmlmail"; + $mode = 'htmlmail'; break; } // END - switch @@ -400,17 +407,17 @@ function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) { // Which response should we parse? if ((isset($response[8])) && (count($response) == 9)) { // Use error code from element 8 (mostly API errors) - $codeArray = explode("
", $response[8]); + $codeArray = explode('
', $response[8]); // Use only the first element $code = bigintval($codeArray[0]); } elseif ((is_array($response[0])) && (isset($response[0]['id']))) { // Begin with extraction - $codeArray = explode(" ", $response[0]['id']); + $codeArray = explode(' ', $response[0]['id']); $code = $codeArray[0]; - $codeArray = explode("
", $code); + $codeArray = explode('
', $code); $code = $codeArray[0]; - $codeArray = explode("
", $code); + $codeArray = explode('
', $code); $code = $codeArray[0]; // Remove all new-line characters @@ -421,7 +428,7 @@ function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) { $code = str_replace("\n", '', $code); } else { // Should not happen! - logDebugMessage(__FUNCTION__, __LINE__, "Cannot parse response. Raw response=" . base64_encode(serialize($response))); + logDebugMessage(__FUNCTION__, __LINE__, 'Cannot parse response. Raw response=' . base64_encode(serialize($response))); } // Return error code