]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/beg_functions.php
Extension ext-network continued:
[mailer.git] / inc / libs / beg_functions.php
index 12941204e087ab21392c7207b88dd38cd7305bd6..f2702a945bcce7e18c2bd107abdc367059a6c92a 100644 (file)
@@ -17,7 +17,7 @@
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * 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,22 +50,44 @@ 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
-               initReferalSystem();
-               $added = addPointsThroughReferalSystem('beg', $userid, $points);
+               initReferralSystem();
+               $added = addPointsThroughReferralSystem('beg', $userid, $points);
        }
 
        // Subtract begged points from member account if the admin has selected one
-       if (isValidUserId(getBegUserid())) {
+       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;
 }
 
+//-----------------------------------------------------------------------------
+//                            Template functions
+//-----------------------------------------------------------------------------
+
+// Outputs points which a member can get
+function doTemplateOutputBegPoints ($templateName, $clear = false) {
+       // Default is not the same
+       $return = '{--BEG_POINTS_MIN_MAX--}';
+
+       // Is min/max points the same?
+       if (getBegPoints() == getBegPointsMax()) {
+               // Is the same, output different message
+               $return = '{--BEG_POINTS_FIXED--}';
+       } // END - if
+
+       // Return message
+       return $return;
+}
+
 //-----------------------------------------------------------------------------
 //                       Wrapper functions for ext-beg
 //-----------------------------------------------------------------------------