X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-del_email.php;h=635b6443e9a8399d987dfd9579420f75d676ad7f;hp=3401751e7de08c4293b6bb5051116882ad164a9d;hb=e79e1454e88271e35086963a0422a51cc243e67a;hpb=55e6ddf528028536b88b1397ef8297655782de69 diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php index 3401751e7d..635b6443e9 100644 --- a/inc/modules/admin/what-del_email.php +++ b/inc/modules/admin/what-del_email.php @@ -75,8 +75,8 @@ if (!empty($_GET['mid'])) { SEND_EMAIL($sender, MEMBER_ORDER_DELETED, $msg_user); // Delete mail from queue - //$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1", - // array(bigintval($_GET['mid'])), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1", + array(bigintval($_GET['mid'])), __FILE__, __LINE__); // Fetch right stats_id from pool $result = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s @@ -87,30 +87,49 @@ WHERE s.pool_id=%d LIMIT 1", if (SQL_NUMROWS($result) == 1) { // Fetch stats id list($stats_id) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - - // Get all user links - $result = SQL_QUERY_ESC("SELECT COUNT(id) AS 'cnt' FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d", - array(bigintval($stats_id)), __FILE__, __LINE__); - - // Get unconfirmed links for calculation of total points - list($links) = SQL_FETCHROW($result); - // Free result + // Free the result SQL_FREERESULT($result); - // Calc total points and pay them back - $totalPoints = $links * $price; - //* DEBUG: */ echo $stats_id.":".$totalPoints."/".$links."/".$price."
\n"; - if ($totalPoints > 0) { - // Pay back points - //* DEBUG: */ echo "PAYBACK:".$sender."
\n"; - ADD_POINTS_REFSYSTEM($sender, $totalPoints, true, "0", false,"direct"); + // Shall we pay the points back to the user? + if ($_CONFIG['repay_deleted_mails'] != "NEVER") { + // Get all user links + $result = SQL_QUERY_ESC("SELECT COUNT(id) AS 'cnt' FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d", + array(bigintval($stats_id)), __FILE__, __LINE__); + + // Get unconfirmed links for calculation of total points + list($links) = SQL_FETCHROW($result); + + // Free result + SQL_FREERESULT($result); + + // Calc total points and pay them back + $totalPoints = $links * $price; + //* DEBUG: */ echo $stats_id.":".$totalPoints."/".$links."/".$price."
\n"; + if ($totalPoints > 0) { + // Shall we payback to user or jackpot? + if ($_CONFIG['repay_deleted_mails'] == "JACKPOT") { + // Set jackpot + $sender = 0; + } + + // Pay back points + //* DEBUG: */ echo "PAYBACK:".$sender."
\n"; + ADD_POINTS_REFSYSTEM($sender, $totalPoints, true, "0", false,"direct"); + + // Output message + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_REPAYED, + number_format($totalPoints, 0, ",", ".") + )); + } else { + // No points repayed! + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_POINTS_REPAYED); + } } // Remove links from DB - //$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d", - // array(bigintval($stats_id)), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d", + array(bigintval($stats_id)), __FILE__, __LINE__); // Output link for manually removing stats entry LOAD_TEMPLATE("admin_settings_saved", false, "".ADMIN_REMOVE_STATS_ENTRY."");