// Get sender's data
$result_sender = SQL_QUERY_ESC("SELECT surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array(bigintval($DATA[1])), __FILE__, __LINE__);
+ array(bigintval($DATA[1])), __FILE__, __LINE__);
+
+ // Is the sender found?
if (SQL_NUMROWS($result_sender) == 1) {
// Load data and prepare mail
list($sname, $fname, $email) = SQL_FETCHROW($result_sender);
// Send it also waway
SEND_EMAIL($email, MEMBER_SUBJ_SEND_DONE, $msg);
- }
+ } // END - if
// Set status to SEND because we completely send it away
$result_done = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='SEND', target_send='0', receivers='' WHERE id=%s LIMIT 1",
$cnt2 += $cnt;
// Update mediadata if version is 0.0.4 or higher
- if (GET_EXT_VERSION("mediadata") >= "0.0.4")
- {
+ if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update entry (or add missing)
//* DEBUG: */ echo "*MEDIA/L:".__LINE__."*<br />";
MEDIA_UPDATE_ENTRY(array("total_orders", "normal_orders"), "add", 1);
- }
+ } // END - if
//* DEBUG: */ echo"*EXIT/L:".__LINE__."/".$P."<br />";
break;
}
// Do we have send maximum mails?
- elseif (($cnt >= $_CONFIG['max_send']) || ($cnt2 >= $_CONFIG['max_send']))
- {
+ elseif (($cnt >= $_CONFIG['max_send']) || ($cnt2 >= $_CONFIG['max_send'])) {
// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
$ADD = "";
if ($cnt <= $DATA[8]) $ADD = ", target_send=target_send-".$cnt;
//* DEBUG: */ echo"*EXIT/L:".__LINE__."*<br />";
break;
}
- }
- else
- {
+ } else {
// User does not exists so we have add the sender's points back to sender's account
- if (($RECEIVERS[0] == "0") || (empty($RECEIVERS[0])))
- {
+ if (($RECEIVERS[0] == "0") || (empty($RECEIVERS[0]))) {
// List was empty
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='SEND' WHERE id=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
- }
- else
- {
- if ($uid > 0)
- {
+ } else {
+ // Is the userid set?
+ if ($uid > 0) {
// User does not exists, pay points back
$points = GET_PAY_POINTS($DATA[5]);
ADD_POINTS_REFSYSTEM($DATA[1], $points, false, "0", false, "direct");
// Add points together and remove user
$points_BACK[$DATA[1]] += $points;
- }
+ } // END - if
+
+ // Count up
$cnt_back[$DATA[1]]++;
}
+
// Remove entry from list
unset($dummy[$key]);
}
}
}
+
+ // Do we have points to "pay back"?
if ((sizeof($points_BACK) > 0) && (!empty($points_BACK[0]))) {
+ // Walk through all points
foreach ($points_BACK as $uid => $PB) {
// Add points only when we have points left to add and a valid user ID
if (($PB > 0) && ($uid > 0)) {
$result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
array(bigintval($uid)), __FILE__, __LINE__);
$DATA[10] = $PB; $DATA[11] = $cnt_back[$uid];
+
+ // User found?
if (SQL_NUMROWS($result) == 1) {
list($email) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Send mail out to admin
SEND_ADMIN_NOTIFICATION(ADMIN_BACK_JACKPOT." (".$uid.")", "back-admin", $content, "admin");
}
- }
- }
- }
+ } // END - if
+ } // END - foreach
+ } // END - if
}
// Free memory