// List only users with at least one ref!
//* DEBUG: */ debugOutput('*'.$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints.'*');
// List only users with at least one ref!
//* DEBUG: */ debugOutput('*'.$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints.'*');
// Prepare marking of default (maybe current user's) id
$start = ''; $end = '';
if (($DATA['userid'][$idx] == $default) && ($default > 0)) {
// Prepare marking of default (maybe current user's) id
$start = ''; $end = '';
if (($DATA['userid'][$idx] == $default) && ($default > 0)) {
'idx' => ($idx + 1),
'start' => $start,
'end' => $end,
'userid' => $DATA['userid'][$idx],
'ref' => $DATA['ref'][$idx],
'idx' => ($idx + 1),
'start' => $start,
'end' => $end,
'userid' => $DATA['userid'][$idx],
'ref' => $DATA['ref'][$idx],
);
// Load row template and switch color
$OUT .= loadTemplate('guest_rallye_row', true, $content);
);
// Load row template and switch color
$OUT .= loadTemplate('guest_rallye_row', true, $content);
$prices['active'][$key] = $active;
// Allow valid and active users with at least one ref to get points
$prices['active'][$key] = $active;
// Allow valid and active users with at least one ref to get points
// Run array through (by userid is the most important 2nd-level-array)
foreach($prices['userid'] as $key => $userid) {
// Allow valid and active users with at least one ref to get points
// Run array through (by userid is the most important 2nd-level-array)
foreach($prices['userid'] as $key => $userid) {
// Allow valid and active users with at least one ref to get points
// Transfer data to array for the mail template
$DATA['level'] = $prices['level'][$key];
$DATA['points'] = $prices['points'][$key];
// Transfer data to array for the mail template
$DATA['level'] = $prices['level'][$key];
$DATA['points'] = $prices['points'][$key];
- sendEmail($userid, getMaskedMessage('RALLYE_MEMBER_EXPIRED_SUBJ', $DATA['level']), $message);
+ sendEmail($userid, getMaskedMessage('RALLYE_MEMBER_EXPIRED_SUBJECT', $DATA['level']), $message);
- sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_EXPIRED_SUBJ', $title), $templ, $cnt);
+ sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_EXPIRED_SUBJECT', $title), $templ, $cnt);
createNewTask('{--RALLYE_ADMIN_EXPIRED--}: ' . $title, '{--RALLYE_ADMIN_EXPIRED_TEXT--}', 'RALLYE_EXPIRED');
}
createNewTask('{--RALLYE_ADMIN_EXPIRED--}: ' . $title, '{--RALLYE_ADMIN_EXPIRED_TEXT--}', 'RALLYE_EXPIRED');
}
// We only need to check one element in $users, see above while() block
if (isset($users['userid'][$k])) {
$prices['userid'][$k] = $users['userid'][$k];
// We only need to check one element in $users, see above while() block
if (isset($users['userid'][$k])) {
$prices['userid'][$k] = $users['userid'][$k];
- if (empty($prices['userid'][$k])) $prices['userid'][$k] = '---';
- $prices['ref'][$k] = $users['ref'][$k];
- if (empty($prices['ref'][$k])) $prices['ref'][$k] = '---';
+ $prices['ref'][$k] = $users['ref'][$k];
// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
function addReferalRallyeWinners ($rallye, $default=0) {
// First check how many prices are set
// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
function addReferalRallyeWinners ($rallye, $default=0) {
// First check how many prices are set
- $result_prices = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY `price_level` ASC",
- array(bigintval($rallye)), __FUNCTION__, __LINE__);
- $prices = SQL_NUMROWS($result_prices);
- SQL_FREERESULT($result_prices);
+ $prices = countSumTotalData(bigintval($rallye), 'rallye_prices', 'id', 'rallye_id', true);
for ($idx = '0'; $idx < $prices; $idx++) {
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
$active = countSumTotalData($DATA['userid'][$idx], 'user_data', 'userid', 'userid', true, " AND `status`='CONFIRMED'");
for ($idx = '0'; $idx < $prices; $idx++) {
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
$active = countSumTotalData($DATA['userid'][$idx], 'user_data', 'userid', 'userid', true, " AND `status`='CONFIRMED'");
- if (empty($DATA['userid'][$idx])) $DATA['userid'][$idx] = '---';
- if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == '0') || ($active == '0') || ("".round($DATA['cpoints'][$idx])."" == '0') || (empty($DATA['cpoints'][$idx]))) {
+ if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == '0') || ($active == '0') || ('' . round($DATA['cpoints'][$idx]) . '' == '0') || (empty($DATA['cpoints'][$idx]))) {
// Allow valid and active users with at least one ref to get points
$DATA['ref'][$idx] = '---';
$DATA['userid'][$idx] = '---';
// Allow valid and active users with at least one ref to get points
$DATA['ref'][$idx] = '---';
$DATA['userid'][$idx] = '---';
'idx' => ($idx + 1),
'userid' => $DATA['userid'][$idx],
'ref' => $DATA['ref'][$idx],
'idx' => ($idx + 1),
'userid' => $DATA['userid'][$idx],
'ref' => $DATA['ref'][$idx],
- sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_PURGED_SUBJ', $content['title']), 'admin_rallye_purged', $content);
+ sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_PURGED_SUBJECT', $content['title']), 'admin_rallye_purged', $content);
addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1",
array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
createNewTask('{--RALLYE_ADMIN_PURGED--}: ' . $content['title'], '{--RALLYE_ADMIN_PURGED_TEXT--}', 'RALLYE_PURGED');
} // END - while
createNewTask('{--RALLYE_ADMIN_PURGED--}: ' . $content['title'], '{--RALLYE_ADMIN_PURGED_TEXT--}', 'RALLYE_PURGED');
} // END - while