]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/yoomedia_functions.php
- remove triplle extension (.tpl.cache.php)
[mailer.git] / inc / libs / yoomedia_functions.php
index 952d538623b5ba0bf854a5d7872e3a9d5fcdfa2c..3c7ce1d13bfdc7f790ba8ce0b190c45eaf19b78a 100644 (file)
@@ -111,14 +111,14 @@ function YOOMEDIA_TEST_CONFIG ($data) {
        $errorCode = YOOMEDIA_GET_ERRORCODE_FROM_RESULT($response);
 
        // Log the response if failed
-       if ((count($response) == 0) && ($errorCode > 0)) {
+       if ((!isFilledArray($response)) && (isValidNumber($errorCode))) {
                // Queries depleted (as we count here!)
                logDebugMessage(__FUNCTION__, __LINE__, 'Requested depleted. Maxmimum was: ' . getConfig('yoomedia_requests_total') . ',errorCode=' . $errorCode);
                $errorCode = -1;
-       } elseif ((($errorCode <= 4) && ($errorCode > 0)) || ($errorCode >= 8)) {
+       } elseif ((($errorCode <= 4) && (isValidNumber($errorCode))) || ($errorCode >= 8)) {
                // An error has returned from the account
                logDebugMessage(__FUNCTION__, __LINE__, 'Unexpected error code ' . $errorCode . ' received.');
-       } elseif ((count($response) > 0) && ($errorCode != 0)) {
+       } elseif ((isFilledArray($response)) && (isValidNumber($errorCode))) {
                // Log serialized raw response
                logDebugMessage(__FUNCTION__, __LINE__, 'errorCode=' . $errorCode . ',response=' . base64_encode(serialize($response)));
                $errorCode = -1;
@@ -141,7 +141,7 @@ function YOOMEDIA_GET_PARSED_RESULT_TEXTMAILS () {
        $result = array();
 
        // Parse the response
-       if (count($response) > 0) {
+       if (isFilledArray($response)) {
                $result = YOOMEDIA_PARSE_RESPONSE($response, 'textmail');
        } // END - if
 
@@ -158,7 +158,7 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) {
        $dummy = removeHttpHeaderFromResponse($response);
 
        // If there is no result, abort here
-       if (count($dummy) == 0) {
+       if (!isFilledArray($dummy)) {
                // Empty response from API
                reportBug(__FUNCTION__, __LINE__, 'Empty result from API received. response()=' . count($response) . ',type=' . $type);
                return array();
@@ -264,7 +264,7 @@ function YOOMEDIA_EXCLUDE_MAIL ($data, $mailMode) {
                $mailMode = YOOMEDIA_CONVERT_MODE($mailMode);
 
                // Add the entry
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`, `inserted`) VALUES ('%s',%s,%s,'0000-00-00 00:00')",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`, `inserted`) VALUES ('%s',%s,%s,'0000-00-00 00:00')",
                        array(
                                $mailMode,
                                bigintval($data['id']),
@@ -279,7 +279,7 @@ function YOOMEDIA_UNLIST_MAIL ($data, $mailMode) {
        $mailMode = YOOMEDIA_CONVERT_MODE($mailMode);
 
        // Add the entry
-       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1",
+       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1",
                array($mailMode, bigintval($data['id'])), __FUNCTION__, __LINE__);
 }
 
@@ -325,18 +325,18 @@ function YOOMEDIA_CHECK_RELOAD ($id, $reload, $type) {
        $reloaded = FALSE;
 
        // Query database
-       $result = SQL_QUERY_ESC("SELECT `id`, UNIX_TIMESTAMP(`inserted`) AS `inserted` FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1",
+       $result = sqlQueryEscaped("SELECT `id`, UNIX_TIMESTAMP(`inserted`) AS `inserted` FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `type`='%s' AND `y_id`=%s LIMIT 1",
                array($type, bigintval($id)), __FUNCTION__, __LINE__);
 
        // Entry found?
-       if (SQL_NUMROWS($result) == 1) {
+       if (sqlNumRows($result) == 1) {
                // Load time
-               list($id, $time) = SQL_FETCHROW($result);
+               list($id, $time) = sqlFetchRow($result);
 
                // Are we ready to sent again?
                if (((time() - $time) >= ($reload * 60*60)) && ($time > 0)) {
                        // Remove entry
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `id`=%s LIMIT 1",
+                       sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_yoomedia_reload` WHERE `id`=%s LIMIT 1",
                                array($id), __FUNCTION__, __LINE__);
                } else {
                        // Dont' sent again this mail
@@ -345,7 +345,7 @@ function YOOMEDIA_CHECK_RELOAD ($id, $reload, $type) {
        } // END - if
 
        // Free result
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Return result
        return $reloaded;
@@ -359,7 +359,7 @@ function YOOMEDIA_RELOAD_LOCK ($data, $mailMode) {
                $mailMode = YOOMEDIA_CONVERT_MODE($mailMode);
 
                // Add the entry
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`) VALUES ('%s',%s,%s)",
+               sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_yoomedia_reload` (`type`, `y_id`, `y_reload`) VALUES ('%s',%s,%s)",
                        array($mailMode, bigintval($data['id']), bigintval($data['reload'])), __FUNCTION__, __LINE__);
        } // END - if
 }
@@ -426,7 +426,7 @@ function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) {
                                $code = -999;
                        } // END - if
                }
-       } elseif (count($response) == 0) {
+       } elseif (!isFilledArray($response)) {
                // All fine, but empty result
                $code = '0';
        } else {