X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-del_email.php;h=2651db4b79215d083b2e2afe29551bfd4189e206;hb=2df8c1757b41f35e7c5b6a92c52ca96ab1b0bcb8;hp=b5a463a6e6bbe2961d6ab6cf1f2f484aaed9237e;hpb=e5fe5afb17a5c8106f4c890234dfa39419e70f5d;p=mailer.git
diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php
index b5a463a6e6..2651db4b79 100644
--- a/inc/modules/admin/what-del_email.php
+++ b/inc/modules/admin/what-del_email.php
@@ -1,22 +1,23 @@
");
- if ($totalPoints > 0) {
- // Shall we payback to user or jackpot?
- if (getConfig('repay_deleted_mails') == 'JACKPOT') {
- // Set jackpot
- $sender = '0';
- } // END - if
-
- // Pay back points
- //* DEBUG: */ outputHtml("PAYBACK:".$sender."
");
- addPointsThroughReferalSystem('mail_deleted', $sender, $totalPoints, true, 0, false,'direct');
-
- // Output message
- if (getConfig('repay_deleted_mails') == 'REPAY') {
- // Repayed
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_REPAYED'),
- translateComma($totalPoints)
- ));
- } else {
- // To jackpot
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_TO_JACKPOT'),
- translateComma($totalPoints)
- ));
- }
+ if ($totalPoints == 0) {
+ // No points repayed!
+ displayMessage('{--ADMIN_NO_POINTS_REPAYED--}');
+ } elseif (getConfig('repay_deleted_mails') != 'SHRED') {
+ //* DEBUG: */ debugOutput($stats_id . ':' . $totalPoints . '/' . $links . '/' . $content['price']);
+ // Shall we payback to user or jackpot?
+ if (getConfig('repay_deleted_mails') == 'JACKPOT') {
+ // Set jackpot
+ $content['sender'] = '0';
+ } // END - if
+
+ // Pay back points
+ initReferralSystem();
+ addPointsThroughReferralSystem('mail_deleted', $content['sender'], $totalPoints);
+
+ // Output message
+ if (getConfig('repay_deleted_mails') == 'REPAY') {
+ // Repayed
+ displayMessage('{%message,ADMIN_POINTS_REPAYED=' . $totalPoints . '%}');
} else {
- // No points repayed!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED'));
+ // To jackpot
+ displayMessage('{%message,ADMIN_POINTS_TO_JACKPOT=' . $totalPoints . '%}');
}
} else {
// Points shredded!
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_SHREDDED'), $totalPoints));
+ displayMessage('{%message,ADMIN_POINTS_SHREDDED=' . $totalPoints . '%}');
}
// Remove links from DB
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s",
- array(bigintval($stats_id)), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ array(bigintval($stats_id)), __FILE__, __LINE__);
+ $count += SQL_AFFECTEDROWS();
// Load template for link
- loadTemplate('admin_settings_saved', false, "{--ADMIN_REMOVE_STATS_ENTRY--}");
+ displayMessage('{--ADMIN_REMOVE_STATS_ENTRY--}');
} // END - if
// Free the result
@@ -150,102 +140,99 @@ LIMIT 1",
// Delete mail from queue
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ $count += SQL_AFFECTEDROWS();
// Output link for manually removing stats entry
- outputHtml(sprintf(getMessage('ADMIN_DELETED_MAILS_COUNT'), $cnt));
+ outputHtml('{%message,ADMIN_DELETED_MAILS_COUNT=' . $count . '%}');
} else {
// Mail already deleted!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED'));
+ displayMessage('{--ADMIN_NORMAL_MAIL_ALREADY_DELETED--}');
}
+
+ // Free result
+ SQL_FREERESULT($result);
} elseif (isGetRequestElementSet('pid')) {
// Remove stats entries
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__);
// Output message
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED'));
+ displayMessage('{--ADMIN_USER_STATS_REMOVED--}');
} elseif ((isGetRequestElementSet('bid')) && (isExtensionActive('bonus'))) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp`, `mails_sent` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s",
+ $result = SQL_QUERY_ESC("SELECT `id`,`subject`,`url`,`timestamp`,`mails_sent` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
// Load data
- list($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
+ $content = SQL_FETCHARRAY($result);
// Reset sent mails for recipient(s)
- reduceRecipientReceivedMails('bonus_id', getRequestElement('bid'), $sent);
+ reduceRecipientReceivedMails('bonus_id', getRequestElement('bid'), $content['mails_sent']);
// Init counter for deleted mails
- $cnt = '0';
+ $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(getRequestElement('bid'))), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ $count += SQL_AFFECTEDROWS();
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s",
array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ $count += SQL_AFFECTEDROWS();
// Prepare data for the template
- $content['id'] = $id;
- $content['subject'] = $subject;
- $content['url'] = generateDerefererUrl($url);
- $content['timestamp'] = generateDateTime($timestamp, 0);
- $content['cnt'] = $cnt;
+ $content['timestamp'] = generateDateTime($content['timestamp'], '0');
+ $content['count'] = $count;
// Load template
- loadTemplate('admin_del_email_bonus', false, $content);
+ loadTemplate('admin_delete_email_bonus', false, $content);
} else {
// Mail already deleted!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_BONUS_MAIL_ALREADY_DELETED'));
+ displayMessage('{--ADMIN_BONUS_MAIL_ALREADY_DELETED--}');
}
// Free result
SQL_FREERESULT($result);
-} elseif ((isGetRequestElementSet('nid')) && (getExtensionVersion('bonus') >= '0.8.7')) {
+} elseif ((isGetRequestElementSet('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",
+ $result = SQL_QUERY_ESC("SELECT `id`,`subject`,`url`,`timestamp` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
// Load data
- list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result);
+ $content = SQL_FETCHARRAY($result);
// Init counter for deleted mails
- $cnt = '0';
+ $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(getRequestElement('nid'))), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ $count += SQL_AFFECTEDROWS();
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s",
array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__);
- $cnt += SQL_AFFECTEDROWS();
+ $count += SQL_AFFECTEDROWS();
// Prepare data for the template
- $content['id'] = $id;
- $content['subject'] = $subject;
- $content['url'] = generateDerefererUrl($url);
- $content['timestamp'] = generateDateTime($timestamp, 0);
- $content['cnt'] = $cnt;
+ $content['timestamp'] = generateDateTime($content['timestamp'], '0');
+ $content['count'] = $count;
// Load template
- loadTemplate('admin_del_email_notify', false, $content);
+ loadTemplate('admin_delete_email_notify', false, $content);
} else {
// Mail already deleted!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NOTIFY_MAIL_ALREADY_DELETED'));
+ displayMessage('{--ADMIN_NOTIFY_MAIL_ALREADY_DELETED--}');
}
// Free result
SQL_FREERESULT($result);
} else {
// No mail orders fond
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_WRONG_CALL'));
+ displayMessage('{--ADMIN_WRONG_CALL--}');
}
-//
+// [EOF]
?>