]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/doubler_functions.php
Added more config wrappers
[mailer.git] / inc / libs / doubler_functions.php
index 94148e21bc63f7d3976ee259e5692a9e4afb209e..6ca451b69a3fe7d4e567e502d5edf9ba693bb061 100644 (file)
@@ -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 *
@@ -42,7 +42,7 @@ if (!defined('__SECURITY')) {
 
 // Generates a HTML table based on given data
 // @TODO Lame description
-function generateDoublerTable ($userid = '0', $done = 'N', $ref = 'N', $sort = 'ASC') {
+function generateDoublerTable ($userid = NULL, $done = 'N', $ref = 'N', $sort = 'ASC') {
        $add = ''; $DT_MODE = '0';
        if (isValidUserId($userid)) {
                // Load entries only from a single user
@@ -68,11 +68,16 @@ function generateDoublerTable ($userid = '0', $done = 'N', $ref = 'N', $sort = '
 
        // List entries
        $result = SQL_QUERY_ESC("SELECT
-       `userid`, `refid`, `points`, `timemark`
+       `userid`,
+       `refid`,
+       `points`,
+       `timemark`
 FROM
        `{?_MYSQL_PREFIX?}_doubler`
 WHERE
-       `completed`='%s' AND `is_ref`='%s'" . $add . "
+       `completed`='%s' AND
+       `is_ref`='%s'
+       " . $add . "
 ORDER BY
        `timemark` %s
 LIMIT %s",
@@ -103,7 +108,7 @@ LIMIT %s",
                        $content['timemark'] = generateDateTime($content['timemark'], $DT_MODE);
 
                        // Load template and switch color
-                       $OUT .= loadTemplate($mode . '_doubler_list_rows', true, $content);
+                       $OUT .= loadTemplate($mode . '_doubler_list_rows', TRUE, $content);
                } // END - while
 
                // Free memory
@@ -112,13 +117,13 @@ LIMIT %s",
                // List no entries
                $OUT = '<tr>
   <td colspan="' . $COLS . '" align="center" class="bottom">
-    ' . displayMessage($message, true) . '
+    ' . displayMessage($message, TRUE) . '
   </td>
 </tr>';
        }
 
        // Return template
-       return loadTemplate($mode . '_doubler_list', true, $OUT);
+       return loadTemplate($mode . '_doubler_list', TRUE, $OUT);
 }
 
 // Get total points left in doubler pot
@@ -128,7 +133,7 @@ function getDoublerTotalPointsLeft() {
 
        if (getConfig('doubler_own') == 'Y') {
                // Take points from doubler's own account
-               $points += getConfig('doubler_points') - getConfig('doubler_used');
+               $points += getDoublerPoints() - getConfig('doubler_used');
        } // END - if
 
        if ((getConfig('doubler_jackpot') == 'Y') && (isExtensionActive('jackpot'))) {
@@ -138,9 +143,9 @@ function getDoublerTotalPointsLeft() {
                if (!empty($jackpot)) $points += $jackpot;
        } // END - if
 
-       if (isValidUserId(getConfig('doubler_userid'))) {
+       if (isValidUserId(getDoublerUserid())) {
                // Get user's points
-               $user = getTotalPoints(getConfig('doubler_userid'));
+               $user = getTotalPoints(getDoublerUserid());
                $points += $user;
        } // END - if
 
@@ -166,7 +171,7 @@ function getDoublerUserid () {
 
 // "Getter" for doubler_timeout
 function getDoublerTimeout () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_timeout');
@@ -178,7 +183,7 @@ function getDoublerTimeout () {
 
 // "Getter" for doubler_send_mode
 function getDoublerSendMode () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_send_mode');
@@ -190,7 +195,7 @@ function getDoublerSendMode () {
 
 // "Getter" for doubler_ref
 function getDoublerRef () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_ref');
@@ -202,7 +207,7 @@ function getDoublerRef () {
 
 // "Getter" for doubler_points
 function getDoublerPoints () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_points');
@@ -214,7 +219,7 @@ function getDoublerPoints () {
 
 // "Getter" for doubler_min
 function getDoublerMin () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_min');
@@ -226,7 +231,7 @@ function getDoublerMin () {
 
 // "Getter" for doubler_max
 function getDoublerMax () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_max');
@@ -238,7 +243,7 @@ function getDoublerMax () {
 
 // "Getter" for doubler_counter
 function getDoublerCounter () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_counter');
@@ -250,7 +255,7 @@ function getDoublerCounter () {
 
 // "Getter" for doubler_charge
 function getDoublerCharge () {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Determine it
                $GLOBALS[__FUNCTION__] = getConfig('doubler_charge');
@@ -260,5 +265,17 @@ function getDoublerCharge () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// "Getter" for doubler_max_sent
+function getDoublerMaxSent () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('doubler_max_sent');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // [EOF]
 ?>