list($cpoints) = SQL_FETCHROW($result_ref);
SQL_FREERESULT($result_ref);
- if (empty($cpoints)) $cpoints = "0.00000";
+ if (empty($cpoints)) $cpoints = '0.00000';
// Add info line
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_rallye_users` (rallye_id, userid, refs, curr_points)
// Init userid for list
$_uid = '---';
// List only users with at least one ref!
- //* DEBUG: */ echo "*".$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints."*<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("*".$cnt.'/'.$content['userid'].'/'.$content['curr_points'].'/'.$refpoints."*<br />");
if (($cnt > 0) && ($refpoints > $content['curr_points'])) { $_uid = $content['userid']; } else { $cnt = ''; }
// Save values to array
array_pk_sort($DATA, array('ref', 'cpoints'), 0, 1, true);
// Generate table
- $OUT = LOAD_TEMPLATE("guest_rallye_header", true);
+ $OUT = LOAD_TEMPLATE('guest_rallye_header', true);
$SW = 2;
for ($idx = 0; $idx < $prices; $idx++) {
if (empty($DATA['uid'][$idx])) $DATA['uid'][$idx] = '---';
//
function RALLYE_LOAD_USERS_ARRAY ($rallye) {
// Fix zero points to 0.00000
- if (getConfig('ref_payout') == '0') setConfigEntry('ref_payout', "0.00000");
+ if (getConfig('ref_payout') == '0') setConfigEntry('ref_payout', '0.00000');
// Init multi array
$users = array(
//
function RALLYE_LIST_WINNERS ($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",
- array(bigintval($rallye)), __FUNCTION__, __LINE__);
+ $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);
$DATA = RALLYE_LOAD_USERS_ARRAY($rallye);
// Generate table
- $OUT = LOAD_TEMPLATE("guest_rallye_expired_header", true);
+ $OUT = LOAD_TEMPLATE('guest_rallye_expired_header', true);
$SW = 2;
for ($idx = 0; $idx < $prices; $idx++) {
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
- $result_active = SQL_QUERY_ESC("SELECT COUNT(userid) FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array(bigintval($DATA['uid'][$idx])), __FUNCTION__, __LINE__);
- list($active) = SQL_FETCHROW($result_active);
- SQL_FREERESULT($result_active);
+ $active = GET_TOTAL_DATA($DATA['uid'][$idx], 'user_data', 'userid', 'userid', true, " AND `status`='CONFIRMED'");
if (empty($DATA['uid'][$idx])) $DATA['uid'][$idx] = '---';
if ((empty($DATA['ref'][$idx])) || ($DATA['ref'][$idx] == 0) || ($active == 0) || ("".round($DATA['cpoints'][$idx])."" == '0') || (empty($DATA['cpoints'][$idx]))) {
$DATA['infos'][$idx] = $DATA['info'][$idx];
} else {
// Take ppints
- $DATA['infos'][$idx] = $DATA['points'][$idx]." {!POINTS!}";
+ $DATA['infos'][$idx] = $DATA['points'][$idx] . ' {!POINTS!}';
}
// Add row
$cnt = 0;
foreach ($GLOBALS['cache_array']['refsystem']['userid'] as $id => $uid) {
// Do we have a ref for this user?
- //* DEBUG: */ echo "id={$id},uid={$uid},uid={$uid},old={$old},level={$GLOBALS['cache_array']['refsystem']['level'][$id]}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("id={$id},uid={$uid},uid={$uid},old={$old},level={$GLOBALS['cache_array']['refsystem']['level'][$id]}<br />");
if (($uid == $uid) && ($GLOBALS['cache_array']['refsystem']['level'][$id] == 1)) {
- //* DEBUG: */ echo "uid matches!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("uid matches!<br />");
foreach ($GLOBALS['cache_array']['ref_depths']['level'] as $level) {
if (($level == $GLOBALS['cache_array']['refsystem']['level'][$id]) && ($level == 1)) {
// Level does exist so abort here
$cnt = $GLOBALS['cache_array']['refsystem']['counter'][$id];
- //* DEBUG: */ echo "*".$uid.'/'.$cnt."*<br />";
+ //* DEBUG: */ OUTPUT_HTML("*".$uid.'/'.$cnt."*<br />");
break;
} elseif ($level > 1) {
// Not interesting here...
} // END - if
} // END - foreach
- //* DEBUG: */ echo "<pre>";
- //* DEBUG: */ print_r($GLOBALS['cache_array']['refsystem']);
- //* DEBUG: */ echo "</pre>";
- //* DEBUG: */ die();
+ //* DEBUG: */ OUTPUT_HTML("<pre>");
+ //* DEBUG: */ OUTPUT_HTML(print_r($GLOBALS['cache_array']['refsystem'], true));
+ //* DEBUG: */ OUTPUT_HTML("</pre>");
+ //* DEBUG: */ shutdown();
if ($cnt > 0) {
// Count cache hits
incrementConfigEntry('cache_hits');
// Remove old refs
- //* DEBUG: */ echo '+'.$cnt.'/'.$old."+<br />";
+ //* DEBUG: */ OUTPUT_HTML('+'.$cnt.'/'.$old."+<br />");
$cnt -= $old;
} // END - if
} else {
}
// Return count
- //* DEBUG: */ echo "*".$uid.'/'.$old.'/'.$cnt."*<br />";
+ //* DEBUG: */ OUTPUT_HTML("*".$uid.'/'.$old.'/'.$cnt."*<br />");
return $cnt;
}