New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / libs / bonus_functions.php
index 4f66122397515b5008fe7a95a2ec55c8ff9c0c31..109e740f1dfaed1f7a84b420c44fcf3d0677537a 100644 (file)
@@ -121,26 +121,26 @@ function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) {
        $ranks = count(explode(';', getConfig('turbo_rates'))) + 1;
 
        // Load current user's data
-       $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND userid=%s LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT level, points, timemark FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s AND `userid`=%s LIMIT 1",
                array($type, $data, $uid), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Load data
                list($rank, $points, $mark) = SQL_FETCHROW($result);
 
                // Remember all values for later use
-               $self  = true; $points = TRANSLATE_COMMA($points);
+               $self  = true; $points = translateComma($points);
 
                // Transfer data to template
                define('__YR_LEVEL' , $rank);
                define('__YR_POINTS', $points);
-               define('__YR_TMARK' , MAKE_DATETIME($mark, "1"));
+               define('__YR_TMARK' , generateDateTime($mark, "1"));
 
                // Load template
                define('__YOUR_RANKING_LINE', LOAD_TEMPLATE("show_bonus_yr", true));
        } // END - if
 
        // Load rankings
-       $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s ORDER BY level LIMIT %s",
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE %s=%s ORDER BY level LIMIT %s",
                array($type, $data, getConfig('bonus_lines')), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Start generating the ranking list
@@ -161,7 +161,7 @@ function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) {
                                list($userid, $points, $mark) = SQL_FETCHROW($result_users);
 
                                // Translate comma
-                               $points = TRANSLATE_COMMA($points);
+                               $points = translateComma($points);
                        } // END - if
 
                        // Output row
@@ -194,9 +194,9 @@ function BONUS_POINTS_HANDLER ($mode) {
        if (getConfig('bonus_active') != 'Y') return;
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
-       if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == "0")) {
+       if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == '0')) {
                // Update database & config
-               UPDATE_CONFIG('bonus_mode', "JACKPOT");
+               updateConfiguration('bonus_mode', 'JACKPOT');
        } // END - if
 
        if ($mode == "login_bonus") {
@@ -210,7 +210,7 @@ function BONUS_POINTS_HANDLER ($mode) {
        // Subtract points from...
        switch (getConfig('bonus_mode'))
        {
-       case "JACKPOT": // ... jackpot
+       case 'JACKPOT': // ... jackpot
                if ((SUB_JACKPOT($points) == -1) && (getConfig('bonus_uid') > 0)) {
                        // Check points amount first...
                        $total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points");
@@ -241,7 +241,7 @@ function BONUS_PURGE_EXPIRED_TURBO_BONUS() {
        $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE timemark < (UNIX_TIMESTAMP() - ".getConfig('bonus_timeout').")", __FUNCTION__, __LINE__);
        if (SQL_AFFECTEDROWS() > 0) {
                // Send out email to admin
-               SEND_ADMIN_NOTIFICATION(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", SQL_AFFECTEDROWS(), '');
+               sendAdminNotification(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", SQL_AFFECTEDROWS(), '');
        }
 }
 //