Again fixes for rallye
[mailer.git] / inc / libs / rallye_functions.php
index a1038eb205cfacf51738223d712f8dcded9fc204..331687eb517ebb40f03c6822bddde0c91ee8a56a 100644 (file)
@@ -299,8 +299,7 @@ LIMIT 1",
 }
 
 // Run this function only when a new member has confirmed his email address!
-function addUserToReferalRallye ($userid) {
-       global $DATA;
+function addUserToReferalRallye ($userid, $content = array()) {
        $add = '';
 
        // Updated extension?
@@ -348,24 +347,24 @@ VALUES ('%s','%s',0)",
                SQL_FREERESULT($result);
 
                if ($notify == 'Y') {
-                       // Transfer all neccessary data to the global $DATA array
-                       $DATA['start'] = generateDateTime($start, 2);
-                       $DATA['end']   = generateDateTime($end  , 2);
-                       $DATA['now_t'] = generateDateTime(time(), 2);
-                       $DATA['title'] = $title;
-                       $DATA['id']    = $id;  // id for the rallye details link
-                       $DATA['ref']   = '0';
-                       $DATA['refs']  = countSumTotalData($userid, 'user_data', 'userid', "refid", true);
+                       // Transfer all neccessary data to the global $content array
+                       $content['start'] = generateDateTime($start, 2);
+                       $content['end']   = generateDateTime($end  , 2);
+                       $content['now_t'] = generateDateTime(time(), 2);
+                       $content['title'] = $title;
+                       $content['id']    = $id;  // id for the rallye details link
+                       $content['ref']   = '0';
+                       $content['refs']  = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
 
                        // Load prices
-                       $prices = addReferalRallyePrices($id);
+                       $content['prices'] = addReferalRallyePrices($id);
 
                        // Determine min_users/prices tring
-                       $DATA['min_users']  = determineReferalRallyeMinimumUsers($min_users);
-                       $DATA['min_prices'] = determineReferalRallyeMinimumPrices($min_prices);
+                       $content['min_users']  = determineReferalRallyeMinimumUsers($min_users);
+                       $content['min_prices'] = determineReferalRallyeMinimumPrices($min_prices);
 
                        // Send notification to member
-                       $message = loadEmailTemplate('member_rallye_notify', array('prices' => $prices), $userid);
+                       $message = loadEmailTemplate('member_rallye_notify', $content, $userid);
                        sendEmail($userid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
                } // END - if
        } // END - if