X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fyoomedia_functions.php;h=1f67e9ba00dcc591630cd00b5a206c4ecd7fe9fa;hb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;hp=6bd9c4e52538561111639bb350eccbe8f7992d59;hpb=64c8349613addc3da2242c5cd6b99d64e3fb5f8e;p=mailer.git diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 6bd9c4e525..1f67e9ba00 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -1,7 +1,7 @@ $v) { - $response[$k] = iconv('ISO-8859-1', 'UTF-8//TRANSLIT',$v); + $response[$k] = iconv('windows-1252', 'UTF-8//TRANSLIT', $v); + /* + // iconv()-less ISO-8859-1 -> UTF-8 + $response[$k] = preg_replace( + "/([\x80-\xFF])/e", + "chr(0xC0|ord('\\1')>>6).chr(0x80|ord('\\1')&0x3F)", + $v + ); + */ } // END - if // Shall we count the query as used? @@ -171,7 +179,7 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) { $dataArray = explode('|', $responseLine); // Now make the result array with two dimensions - $cnt = 0; $entry = 0; + $cnt = '0'; $entry = '0'; foreach ($dataArray as $line) { // Add the line $result[$entry][yoomediaTranslateIndex($type, $cnt)] = $line; @@ -180,7 +188,7 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) { if ($cnt == 6) { // Then advance to next entry and reset counter $entry++; - $cnt = 0; + $cnt = '0'; } else { // Count up $cnt++; @@ -221,7 +229,7 @@ function YOOMEDIA_PREPARE_MAIL_DELIVERY ($data) { $data['categories'] = generateCategoryOptionsList('normal'); // Decode entities - $data['text'] = (decodeEntities($data['text'])); + $data['text'] = decodeEntities($data['text']); // Load template loadTemplate('admin_send_yoomedia', false, $data); @@ -239,7 +247,7 @@ function YOOMEDIA_SEND_BONUS_MAIL ($data, $mode) { } // Add dummy receiver to avoid notice - $data['receiver'] = 0; + $data['receiver'] = '0'; // HTML or normal? (normal is default...) $type = 't'; @@ -315,10 +323,7 @@ function translateYooMediaError ($errorCode) { $return = $GLOBALS['translation_tables']['yoomedia']['error_codes'][$errorCode]; } else { // Log missing entries - logDebugMessage(__FUNCTION__, __LINE__, "errorCode={$errorCode}"); - print('
');
-		debug_print_backtrace();
-		die('
'); + debug_report_bug(sprintf("Unknown error code %s detected.", $errorCode)); } // Return value @@ -388,18 +393,18 @@ function YOOMEDIA_CONVERT_MODE ($mode) { } // Extract code from response -function YOOMEDIA_GET_ERRORCODE_FROM_RESULT (array $response) { +function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) { // Bad code as default $code = -999; // Which response should we parse? - if (isset($response[8])) { + if ((isset($response[8])) && (count($response) == 9)) { // Use error code from element 8 (mostly API errors) $codeArray = explode("
", $response[8]); // Use only the first element $code = bigintval($codeArray[0]); - } elseif (isset($response[0]['id'])) { + } elseif ((is_array($response[0])) && (isset($response[0]['id']))) { // Begin with extraction $codeArray = explode(" ", $response[0]['id']); $code = $codeArray[0];