]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/beg_functions.php
www is out-dated
[mailer.git] / inc / libs / beg_functions.php
index 53acc3a45d3af5a1fe8e9a31db8eeb0d8194570b..f1f333ae439dba0c4904fcef52629b3c4dd45cbb 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2011 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 *
@@ -50,26 +50,28 @@ function addPointsBeg ($userid, $points) {
                // Add points to rallye account
                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1",
                        array($points, $userid), __FUNCTION__, __LINE__);
+
+               // We need to set $add here, two
+               $added = (!SQL_HASZEROAFFECTED());
        } else {
                // Add points to account
-               // @TODO Try to rewrite the following unset()
-               unset($GLOBALS['ref_level']);
-               $added = addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getBegMode()));
+               initReferalSystem();
+               $added = addPointsThroughReferalSystem('beg', $userid, $points);
        }
 
        // Subtract begged points from member account if the admin has selected one
-       if (getBegUserid() > 0) {
+       if (($added === true) && (isValidUserId(getBegUserid()))) {
                // Subtract from this account
-               subtractPoints('beg_payout', getBegUserid(), $points);
+               $added = ($added && subtractPoints('beg_payout', getBegUserid(), $points));
        } // END - if
 
        // Return result
        return $added;
 }
 
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 //                       Wrapper functions for ext-beg
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 
 // "Getter" for beg_new_member_notify
 function getBegNewMemberNotify () {
@@ -215,18 +217,6 @@ function getBegPayMode () {
        return $GLOBALS[__FUNCTION__];
 }
 
-// "Getter" for beg_mode
-function getBegMode () {
-       // Do we have cache?
-       if (!isset($GLOBALS[__FUNCTION__])) {
-               // Determine it
-               $GLOBALS[__FUNCTION__] = getConfig('beg_mode');
-       } // END - if
-
-       // Return cache
-       return $GLOBALS[__FUNCTION__];
-}
-
 // "Getter" for beg_include_own
 function getBegIncludeOwn () {
        // Do we have cache?