]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-del_email.php
Final fixes for deleting emails and shredding points
[mailer.git] / inc / modules / admin / what-del_email.php
index c8ba9bb594d96a0a2562a1101a0ed90f432ec8f8..19816688b55a6ebabdb094889ef16a3bc938914f 100644 (file)
@@ -87,6 +87,8 @@ WHERE s.pool_id=%d LIMIT 1",
                if (SQL_NUMROWS($result) == 1) {
                        // Fetch stats id
                        list($stats_id) = SQL_FETCHROW($result);
+
+                       // Free the result
                        SQL_FREERESULT($result);
 
                        // Get all user links
@@ -101,11 +103,40 @@ WHERE s.pool_id=%d LIMIT 1",
 
                        // Calc total points and pay them back
                        $totalPoints = $links * $price;
-                       //* DEBUG: */ echo $stats_id.":".$totalPoints."/".$links."/".$price."<br />\n";
-                       if ($totalPoints > 0) {
-                               // Pay back points
-                               //* DEBUG: */ echo "PAYBACK:".$sender."<br />\n";
-                               ADD_POINTS_REFSYSTEM($sender, $totalPoints, true, "0", false,"direct");
+
+                       // Shall we pay the points back to the user?
+                       if ($_CONFIG['repay_deleted_mails'] != 'SHRED') {
+                               //* DEBUG: */ echo $stats_id.":".$totalPoints."/".$links."/".$price."<br />\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."<br />\n";
+                                       ADD_POINTS_REFSYSTEM($sender, $totalPoints, true, "0", false,"direct");
+
+                                       // Output message
+                                       if ($_CONFIG['repay_deleted_mails'] == 'REPAY') {
+                                               // Repayed
+                                               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_REPAYED,
+                                                       number_format($totalPoints, 0, ",", ".")
+                                               ));
+                                       } else {
+                                               // To jackpot
+                                               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_TO_JACKPOT,
+                                                       number_format($totalPoints, 0, ",", ".")
+                                               ));
+                                       }
+                               } else {
+                                       // No points repayed!
+                                       LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_POINTS_REPAYED);
+                               }
+                       } else {
+                               // Points shredded!
+                               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_SHREDDED, $totalPoints));
                        }
 
                        // Remove links from DB