- // Check if line is already included...
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_rallye_users WHERE rallye_id=%s AND userid=%s LIMIT 1",
- array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
-
- // Is this user added?
- if (SQL_NUMROWS($result) == 0) {
- // Add userid and his ref count to table
- SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_rallye_users (rallye_id, userid, refs)
-VALUES ('%s','%s','0')",
- array(bigintval($id), bigintval($uid)), __FILE__, __LINE__);
- } else {
- // Free memory
- SQL_FREERESULT($result);
- }
-
- if ($notify == "Y") {
- // Transfer all neccessary data to the global $DATA array
- $DATA['start'] = MAKE_DATETIME($start, "2");
- $DATA['end'] = MAKE_DATETIME($end , "2");
- $DATA['now_t'] = MAKE_DATETIME(time(), "2");
- $DATA['title'] = $title;
- $DATA['id'] = $id; // ID for the rallye details link
- $DATA['ref'] = 0;
- $DATA['refs'] = GET_TOTAL_DATA($uid, "user_data", "userid", "refid", true);
+ if ($notify == 'Y') {
+ // Transfer all neccessary data to $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);