- $result = SQL_QUERY($sql, __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // Mail order / bonus mail found!
- // @TODO Rewrite this to $content = SQL_FETCHARRAY(), look some lines above for two differrent queries
- list($stats_id, $sender, $subj, $text, $url, $stamp, $max) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Transfer data to constants for the template
- if (($stats_id > 0) && ($ID == "-1")) $ID = $stats_id;
- if ($col == "bonus_id") $sender = 0;
-
- // @TODO Rewrite these constants
- define('__LIST_UNCON_SENDER' , $sender);
- define('__LIST_UNCON_SUBJECT', COMPILE_CODE($subj));
- define('__LIST_UNCON_TEXT' , COMPILE_CODE($text));
- define('__LIST_UNCON_URL' , encodeString($url));
- define('__LIST_UNCON_STAMP' , MAKE_DATETIME($stamp, "2"));
+ $result_master = sqlQuery($sql, __FILE__, __LINE__);
+
+ // Is there an entry?
+ if (sqlNumRows($result_master) == 1) {
+ // Mail order / bonus mail found
+ $poolData = sqlFetchArray($result_master);
+
+ // If there is a pool id and $ID is not set, we take it
+ if (($poolData['id'] > 0) && ($ID == '-1')) {
+ $ID = $poolData['id'];
+ } // END - if
+
+ // Bonus mails do always have a sender 'NULL'
+ if ($col == 'bonus_id') {
+ $poolData['sender'] = NULL;
+ } // END - if