X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmodules%2Fadmin%2Fwhat-del_email.php;h=f367fb9a017e9b13b08f374de965d080375cfad6;hb=c0c6d5d58bdecd22bdcf7dfe5b24bec69e1810c7;hp=b0022bd6cf889dd83a4cbf3026fbd32d2cbeea0b;hpb=2379934be6a196a54f4155bb8e24c49b20736969;p=mailer.git diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index b0022bd6cf..f367fb9a01 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -46,25 +46,18 @@ addYouAreHereLink('admin', __FILE__); // Init counter for deleted mails $count = '0'; -if (isGetRequestElementSet('mid')) { +if ((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) { // Load email data - $result = SQL_QUERY_ESC("SELECT `id`,`sender`,`subject`,`url`,`timestamp`,`cat_id`,`payment_id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", - array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__); + // @TODO Unused: cat_id + $content getPoolDataFromId(getRequestElement('id')); // Delete mail only once - if (SQL_NUMROWS($result) == 1) { - // Load data - $content = SQL_FETCHARRAY($result); - - // Get points we shall pay back per mail - $content['price'] = getPaymentPoints($content['payment_id'], 'price'); - // @TODO Unused: cat_id, payment_id - + if (count($content) > 0) { // Prepare data for the template $content['timestamp'] = generateDateTime($content['timestamp'], 0); // Load template - loadTemplate('admin_delete_email_normal', false, $content); + loadTemplate('admin_delete_email_normal', FALSE, $content); // Load email template and send the email away $message_user = loadEmailTemplate('member_order_deleted', $content, $content['sender']); @@ -72,26 +65,26 @@ if (isGetRequestElementSet('mid')) { // Fetch right stats_id from pool $result_pool = SQL_QUERY_ESC("SELECT - s.id + `s`.`id` FROM - `{?_MYSQL_PREFIX?}_user_stats` AS s + `{?_MYSQL_PREFIX?}_user_stats` AS `s` LEFT JOIN - `{?_MYSQL_PREFIX?}_pool` AS p + `{?_MYSQL_PREFIX?}_pool` AS `p` ON - s.pool_id=p.id + `s`.`pool_id`=`p`.`id` WHERE - s.`pool_id`=%s + `s`.`pool_id`=%s LIMIT 1", - array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__); + array(bigintval(getRequestElement('id'))), __FILE__, __LINE__); if (SQL_NUMROWS($result_pool) == 1) { // Fetch stats id list($stats_id) = SQL_FETCHROW($result_pool); // Get all user links - $links = countSumTotalData($stats_id, 'user_links', 'userid', 'stats_id', true); + $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', getRequestElement('id'), $links); // Calc total points and pay them back $totalPoints = $links * $content['price']; @@ -109,8 +102,8 @@ LIMIT 1", } // END - if // Pay back points - initReferalSystem(); - addPointsThroughReferalSystem('mail_deleted', $content['sender'], $totalPoints); + initReferralSystem(); + addPointsThroughReferralSystem('mail_deleted', $content['sender'], $totalPoints); // Output message if (getConfig('repay_deleted_mails') == 'REPAY') { @@ -131,7 +124,7 @@ LIMIT 1", $count += SQL_AFFECTEDROWS(); // Load template for link - displayMessage('{--ADMIN_REMOVE_STATS_ENTRY--}'); + displayMessage('{--ADMIN_REMOVE_STATS_ENTRY--}'); } // END - if // Free the result @@ -139,7 +132,7 @@ 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(getRequestElement('id'))), __FILE__, __LINE__); $count += SQL_AFFECTEDROWS(); // Output link for manually removing stats entry @@ -158,10 +151,10 @@ LIMIT 1", // Output message displayMessage('{--ADMIN_USER_STATS_REMOVED--}'); -} elseif ((isGetRequestElementSet('bid')) && (isExtensionActive('bonus'))) { +} elseif (((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'bonus')) && (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 LIMIT 1", - array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp`, `mails_sent` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1", + array(bigintval(getRequestElement('id'))), __FILE__, __LINE__); // Delete mail only once if (SQL_NUMROWS($result) == 1) { @@ -169,17 +162,17 @@ LIMIT 1", $content = SQL_FETCHARRAY($result); // Reset sent mails for recipient(s) - reduceRecipientReceivedMails('bonus_id', getRequestElement('bid'), $content['mails_sent']); + reduceRecipientReceivedMails('bonus_id', getRequestElement('id'), $content['mails_sent']); // 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(getRequestElement('bid'))), __FILE__, __LINE__); + array(bigintval(getRequestElement('id'))), __FILE__, __LINE__); $count += 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(getRequestElement('id'))), __FILE__, __LINE__); $count += SQL_AFFECTEDROWS(); // Prepare data for the template @@ -187,17 +180,14 @@ LIMIT 1", $content['count'] = $count; // Load template - loadTemplate('admin_delete_email_bonus', false, $content); + loadTemplate('admin_delete_email_bonus', FALSE, $content); } else { // Mail already deleted! displayMessage('{--ADMIN_BONUS_MAIL_ALREADY_DELETED--}'); } - - // Free result - SQL_FREERESULT($result); } 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 LIMIT 1", + $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 @@ -221,7 +211,7 @@ LIMIT 1", $content['count'] = $count; // Load template - loadTemplate('admin_delete_email_notify', false, $content); + loadTemplate('admin_delete_email_notify', FALSE, $content); } else { // Mail already deleted! displayMessage('{--ADMIN_NOTIFY_MAIL_ALREADY_DELETED--}');