X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fbeg_functions.php;h=120333bf97b708e21424fa031f9b0ebe9c11ad94;hb=ca11996eb52fa0a1ec45d6ab10f5331c4a54a116;hp=49b4beb6e62481a501b88e9a0130154491263a41;hpb=c3b4eaf29946349ff058691db2dcb615a5379bb2;p=mailer.git diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 49b4beb6e6..120333bf97 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -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 * @@ -50,26 +50,47 @@ 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())); + initReferralSystem(); + $added = addPointsThroughReferralSystem('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; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// 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 -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // "Getter" for beg_new_member_notify function getBegNewMemberNotify () { @@ -83,7 +104,7 @@ function getBegNewMemberNotify () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_new_member_notify is enabled +// Checks whether beg_new_member_notify is enabled function isBegNewMemberNotifyEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) { @@ -215,18 +236,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? @@ -239,7 +248,7 @@ function getBegIncludeOwn () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_include_own is "Y" +// Checks whether beg_include_own is "Y" function isBegIncludeOwnEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) { @@ -263,7 +272,7 @@ function getBegActive () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_active is "Y" +// Checks whether beg_active is "Y" function isBegActiveEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) { @@ -287,7 +296,7 @@ function getBegRallye () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_rallye is "Y" +// Checks whether beg_rallye is "Y" function isBegRallyeEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) { @@ -311,7 +320,7 @@ function getBegRallyeEnableNotify () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_rallye_enable_notify is "Y" +// Checks whether beg_rallye_enable_notify is "Y" function isBegRallyeEnableNotifyEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) { @@ -335,7 +344,7 @@ function getBegRallyeDisableNotify () { return $GLOBALS[__FUNCTION__]; } -// Checks wether beg_rallye_disable_notify is "Y" +// Checks whether beg_rallye_disable_notify is "Y" function isBegRallyeDisableNotifyEnabled () { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__])) {