X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-del_email.php;h=e3e3146bce9d8a89b8bee47337fa40d87a6afc49;hp=48ec07db39fa1ea46bfecb5799eeac9c1850e1b4;hb=48b01b793f8953018586b10eeb3d7b0a762af765;hpb=3c8df4406f9247182f4dbe4494d62ac229a7bd28 diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 48ec07db39..e3e3146bce 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -1,7 +1,7 @@ $url, 'subject' => $subject); - // Load email template and send the email away - $message_user = loadEmailTemplate('order-deleted', array(), $sender); + $message_user = loadEmailTemplate('order-deleted', $content, $sender); sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $message_user); // Fetch right stats_id from pool @@ -88,7 +87,7 @@ ON WHERE s.`pool_id`=%s LIMIT 1", - array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('mid'))), __FILE__, __LINE__); if (SQL_NUMROWS($result_pool) == 1) { // Fetch stats id list($stats_id) = SQL_FETCHROW($result_pool); @@ -97,53 +96,51 @@ LIMIT 1", $links = countSumTotalData($stats_id, 'user_links', 'userid', 'stats_id', true); // Reset sent mails for recipient(s) - reduceRecipientReceivedMails('stats_id', getRequestElement('mid'), $links); + reduceRecipientReceivedMails('stats_id', getRequestParameter('mid'), $links); // Calc total points and pay them back $totalPoints = $links * $price; // Shall we pay the points back to the user? - if (getConfig('repay_deleted_mails') != 'SHRED') { + if ($totalPoints == 0) { + // No points repayed! + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED')); + } elseif (getConfig('repay_deleted_mails') != 'SHRED') { //* DEBUG: */ outputHtml($stats_id.':'.$totalPoints.'/'.$links.'/'.$price."
"); - 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) - )); - } + // 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, getMaskedMessage('ADMIN_POINTS_REPAYED', + translateComma($totalPoints) + )); } else { - // No points repayed! - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED')); + // To jackpot + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_POINTS_TO_JACKPOT', + translateComma($totalPoints) + )); } } else { // Points shredded! - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_SHREDDED'), $totalPoints)); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_POINTS_SHREDDED', translateComma($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__); + array(bigintval($stats_id)), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); // Load template for link - loadTemplate('admin_settings_saved', false, "{--ADMIN_REMOVE_STATS_ENTRY--}"); + loadTemplate('admin_settings_saved', false, '{--ADMIN_REMOVE_STATS_ENTRY--}'); } // END - if // Free the result @@ -151,52 +148,50 @@ 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__); + array(bigintval(getRequestParameter('mid'))), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); // Output link for manually removing stats entry - outputHtml(sprintf(getMessage('ADMIN_DELETED_MAILS_COUNT'), $cnt)); + outputHtml(getMaskedMessage('ADMIN_DELETED_MAILS_COUNT', $cnt)); } else { // Mail already deleted! loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED')); } -} elseif (isGetRequestElementSet('pid')) { +} elseif (isGetRequestParameterSet('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__); + array(bigintval(getRequestParameter('pid'))), __FILE__, __LINE__); // Output message loadTemplate('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED')); -} elseif ((isGetRequestElementSet('bid')) && (isExtensionActive('bonus'))) { +} elseif ((isGetRequestParameterSet('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", - array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('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', getRequestParameter('bid'), $content['mails_sent']); // Init counter for deleted mails - $cnt = 0; + $cnt = '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__); + array(bigintval(getRequestParameter('bid'))), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s", - array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('bid'))), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); // Prepare data for the template - $content['id'] = $id; - $content['subject'] = $subject; - $content['url'] = generateDerefererUrl($url); - $content['ordered'] = generateDateTime($timestamp, '0'); - $content['cnt'] = $cnt; + $content['url'] = generateDerefererUrl($content['url']); + $content['timestamp'] = generateDateTime($content['timestamp'], 0); + $content['cnt'] = $cnt; // Load template loadTemplate('admin_del_email_bonus', false, $content); @@ -207,33 +202,31 @@ LIMIT 1", // Free result SQL_FREERESULT($result); -} elseif ((isGetRequestElementSet('nid')) && (getExtensionVersion('bonus') >= '0.8.7')) { +} elseif ((isGetRequestParameterSet('nid')) && (getExtensionVersion('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", - array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('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; + $cnt = '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__); + array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s", - array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__); + array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__); $cnt += SQL_AFFECTEDROWS(); // Prepare data for the template - $content['id'] = $id; - $content['subject'] = $subject; - $content['url'] = generateDerefererUrl($url); - $content['ordered'] = generateDateTime($timestamp, '0'); - $content['cnt'] = $cnt; + $content['url'] = generateDerefererUrl($content['url']); + $content['timestamp'] = generateDateTime($content['timestamp'], 0); + $content['cnt'] = $cnt; // Load template loadTemplate('admin_del_email_notify', false, $content);