+ // Free result
+ SQL_FREERESULT($result_data);
+} elseif (isGetRequestElementSet('mailid')) {
+ // Display regular member mail by loading its full data
+ $result_data = SQL_QUERY_ESC("SELECT
+ `s`.`id`,
+ `s`.`subject`,
+ `p`.`text`,
+ `s`.`timestamp_ordered` AS `timestamp`,
+ `s`.`cat_id`,
+ `p`.`payment_id`,
+ `p`.`sender`,
+ `p`.`data_type`
+FROM
+ `{?_MYSQL_PREFIX?}_user_stats` AS `s`
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_pool` AS `p`
+ON
+ s.pool_id=p.id
+WHERE
+ `s`.`id`=%s
+LIMIT 1",
+ array(bigintval(getRequestElement('mailid'))), __FILE__, __LINE__);
+
+ // Load data
+ $content = SQL_FETCHARRAY($result_data);
+
+ // Get price/time to avoid one JOIN
+ $content['price'] = getPaymentPrice($content['payment_id']);
+ $content['time'] = getPaymentData($content['payment_id'], 'time');
+
+ // Translate some data
+ $content['timestamp'] = generateDateTime($content['timestamp'], '2');
+ $content['userid'] = getMemberId();
+ $content['user_mail_status'] = '{%message,MEMBER_MAIL_NORMAL_CONFIRMED_UNKNOWN=' . $content['id'] . '%}';
+
+ // Is ext-user active?
+ if (isExtensionActive('user')) {
+ // Default is never confirmed
+ $content['user_mail_status'] = '{%message,MEMBER_MAIL_NORMAL_NEVER_CONFIRMED=' . $content['id'] . '%}';
+
+ // Get the timestamp from the mail
+ $confirmedStamp = getEpocheTimeFromUserStats('mailid', $content['id']);
+
+ // Have confirmed it?
+ if ($confirmedStamp > 0) {
+ // Get timestamp from insert
+ $content['user_mail_status'] = '{%message,MEMBER_MAIL_NORMAL_CONFIRMED_ON=' . generateDateTime($confirmedStamp, '2') . '%}';
+ } // END - if
+ } // END - if
+
+ // Display it depending on mail (data) type
+ loadTemplate('member_mail_normal_' . strtolower($content['data_type']), FALSE, $content);
+
+ // Free result
+ SQL_FREERESULT($result_data);
+}
+
+if (isExtensionActive('bonus')) {
+ // Load bonus id
+ $result = SQL_QUERY_ESC("SELECT `stats_id`, `bonus_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `bonus_id` DESC, stats_id DESC",
+ array(getMemberId()), __FILE__, __LINE__);