+
+ // Free result
+ SQL_FREERESULT($result);
+} elseif ((isGetRequestParameterSet('nid')) && (isExtensionInstalledAndNewer('bonus', '0.8.7'))) {
+ // Load data from bonus mail
+ $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__);
+
+ // Delete mail only once
+ if (SQL_NUMROWS($result) == 1) {
+ // Load data
+ $content = SQL_FETCHARRAY($result);
+
+ // Init counter for deleted mails
+ $count = '0';
+
+ // Delete bonus mail entirely from database
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__);
+ $count += SQL_AFFECTEDROWS();
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s",
+ array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__);
+ $count += SQL_AFFECTEDROWS();
+
+ // Prepare data for the template
+ $content['timestamp'] = generateDateTime($content['timestamp'], 0);
+ $content['cnt'] = $count;
+
+ // Load template
+ loadTemplate('admin_delete_email_notify', false, $content);
+ } else {
+ // Mail already deleted!
+ displayMessage('{--ADMIN_NOTIFY_MAIL_ALREADY_DELETED--}');
+ }
+
+ // Free result
+ SQL_FREERESULT($result);