// Get total points of the doubler itself
$totalPoints = getDoublerTotalPointsLeft();
if ($totalPoints == '0') {
- // Exit here to prevent some SQL errors (SQL_QUERY_ESC doen't insert zeros! We need to fix this...)
+ // Exit here to prevent some SQL errors (sqlQueryEscaped doen't insert zeros! We need to fix this...)
return;
} // END - if
} // END - if
// Check for doubles which we can pay out
-$result_total = SQL_QUERY_ESC("SELECT
+$result_total = sqlQueryEscaped("SELECT
COUNT(`do`.`id`) AS `cnt`,
FROM
`{?_MYSQL_PREFIX?}_doubler` AS `do`
), __FILE__, __LINE__);
// Get total count
-list($totalCount) = SQL_FETCHROW($result_total);
+list($totalCount) = sqlFetchRow($result_total);
// Free memory
-SQL_FREERESULT($result_total);
+sqlFreeResult($result_total);
// Check for accounts with limitation
-$result_main = SQL_QUERY_ESC("SELECT
+$result_main = sqlQueryEscaped("SELECT
`do`.`id`,
`do`.`userid`,
`do`.`points`,
), __FILE__, __LINE__);
// Are there entries found?
-if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((SQL_NUMROWS($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != 'Y'))) {
+if ((($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) || ((sqlNumRows($result_main) == getConfig('doubler_group_sent')) && (getConfig('doubler_sent_all') != 'Y'))) {
// Switch to matching SQL resource
$result_load = $result_main;
if (($totalCount > 0) && (getConfig('doubler_sent_all') == 'Y')) {
} // END - if
// At least one account was found
- while ($content = SQL_FETCHARRAY($result_load)) {
+ while ($content = sqlFetchArray($result_load)) {
// Only double when points are enougth!
if ($totalPoints >= $content['points']) {
// Check for his ref points
if (($refPoints > 0) && ($GLOBALS['local_doubler_userid'] == $content['userid']) && (!empty($refPoints))) {
// Referral points found so add them and set line(s) to completed='Y'
$content['points'] += $refPoints;
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `refid`=%s AND `completed`='N' AND `is_ref`='Y'",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `refid`=%s AND `completed`='N' AND `is_ref`='Y'",
array(bigintval($content['userid'])), __FILE__, __LINE__);
} else {
// No referral points found
} // END - if
// Set entry as "payed"
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_doubler` SET `completed`='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__);
$okay = FALSE;
} // END - if
// Free memory
-SQL_FREERESULT($result_total);
-SQL_FREERESULT($result_main);
+sqlFreeResult($result_total);
+sqlFreeResult($result_main);
// [EOF]
?>