Fixes for login bonus, some minor rewrites
[mailer.git] / inc / libs / bonus_functions.php
index 3d3a648ebc49bc03874a3bf6242aded6e87fdbd3..bbb2a32388383cdfd06a3fee591600179c76596b 100644 (file)
@@ -181,23 +181,25 @@ function BONUS_MAKE_RANK_ROWS($data, $type, $uid)
        return $OUT;
 }
 //
-function BONUS_POINTS_HANDLER($MODE)
-{
+function BONUS_POINTS_HANDLER($MODE) {
        global $_CONFIG;
 
        // Shall we add bonus points?
        if ($_CONFIG['bonus_active'] == "N") return;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
-       if (($_CONFIG['bonus_mode'] == "UID") && ($_CONFIG['bonus_uid'] == "0")) $_CONFIG['bonus_mode'] = "JACKPOT";
+       if (($_CONFIG['bonus_mode'] == "UID") && ($_CONFIG['bonus_uid'] == "0")) {
+               // Update database
+               UPDATE_CONFIG(array('bonus_mode'), array("JACKPOT"));
 
-       if ($MODE == "login_bonus")
-       {
+               // Update configuration
+               $_CONFIG['bonus_mode'] = "JACKPOT";
+       } // END - if
+
+       if ($MODE == "login_bonus") {
                // Login bonus detected
                $points = $_CONFIG['login_bonus'];
-       }
-        else
-       {
+       } else {
                // Direct points supplied
                $points = $MODE;
        }