$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;
$result = array();
// Parse the response
- if (count($response) > 0) {
+ if (isFilledArray($response)) {
$result = YOOMEDIA_PARSE_RESPONSE($response, 'textmail');
} // END - if
$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();
$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']),
$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__);
}
$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
} // END - if
// Free result
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Return result
return $reloaded;
$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
}
$code = -999;
} // END - if
}
- } elseif (count($response) == 0) {
+ } elseif (!isFilledArray($response)) {
// All fine, but empty result
$code = '0';
} else {