X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Fyoomedia_functions.php;h=9ec49a7aa66f438ede9cd5f2402c32b3765bcf69;hb=79cab07c8937729e73bfacd4977bd5a203a7d950;hp=588eea1ab419f5b739ce298867d6098bfba648ac;hpb=32ba4a68eaacd2719df4674836ff54942cd6d3ca;p=mailer.git diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 588eea1ab4..9ec49a7aa6 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -67,7 +67,7 @@ function YOOMEDIA_TEST_CONFIG ($data) { $errorCode = YOOMEDIA_GET_ERRORCODE_FROM_RESULT($response); // Log the response if failed - if (count($response) == 0) { + if (count($response) == '0') { // Queries depleted (as we count here!) logDebugMessage(__FUNCTION__, __LINE__, 'Requested depleted. Maxmimum was: ' . getConfig('yoomedia_requests_total')); $errorCode = -1; @@ -84,11 +84,11 @@ function YOOMEDIA_TEST_CONFIG ($data) { $errorCode = -1; } else { // This is fine, because the result array is okay and the response code on element 8 is fine - $errorCode = 0; + $errorCode = '0'; } // Do we have some data there? - return ($errorCode == 0); + return ($errorCode == '0'); } // Queries the given Yoo!Media API 2.0 script @@ -116,7 +116,15 @@ function YOOMEDIA_QUERY_API ($script, $countQuery = true) { // Convert from ISO to UTF-8 foreach ($response as $k => $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';