+addMenuDescription('member', __FILE__);
+
+// Shall we display a mail?
+if ((isGetRequestElementSet('bonusid')) && (isExtensionActive('bonus'))) {
+ // Display bonus mail by loading it's full data
+ $result_data = SQL_QUERY_ESC("SELECT
+ `id`, `subject`, `timestamp`, `cat_id`, `points`, `text`, `is_notify`, `data_type`, `time`, `url`
+FROM
+ `{?_MYSQL_PREFIX?}_bonus`
+WHERE
+ `id`=%s
+LIMIT 1",
+ array(bigintval(getRequestElement('bonusid'))), __FILE__, __LINE__);
+
+ // Load data
+ $content = SQL_FETCHARRAY($result_data);
+
+ // Translate some data
+ $content['timestamp'] = generateDateTime($content['timestamp'], 2);
+ $content['category'] = getCategory($content['cat_id']);
+ $content['points'] = translateComma($content['points']);
+ $content['is_notify'] = translateYesNo($content['is_notify']);
+ $content['sender'] = getMessage('USERNAME_ADMIN_SHORT');
+ $content['time'] = createFancyTime($content['time']);
+ $content['userid'] = getUserId();
+
+ // Get timestamp from insert
+ $content['user_status'] = sprintf(getMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON'),
+ generateDateTime(getTimestampFromUserStats('bonusid', $content['id']), 2)
+ );
+
+ // Display it depending on mail (data) type
+ loadTemplate('member_mail_bonus_'.strtolower($content['data_type']), false, $content);
+
+ // 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, pay.price AS points, p.sender, pay.time, p.data_type
+FROM
+ `{?_MYSQL_PREFIX?}_user_stats` AS s
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_pool` AS p
+ON
+ s.pool_id=p.id
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_payments` AS pay
+ON
+ p.payment_id=pay.id
+WHERE
+ s.id=%s
+LIMIT 1",
+ array(bigintval(getRequestElement('mailid'))), __FILE__, __LINE__);
+
+ // Load data
+ $content = SQL_FETCHARRAY($result_data);