X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fbeg_functions.php;h=49b4beb6e62481a501b88e9a0130154491263a41;hb=a6f2207cfc7ea047d53a4da7c6b218fae66c1801;hp=8ab5bf13a12fedfe3ab2c1cd6a6e571f63c1db7e;hpb=6c763653e88b9d10627e651ca59c7201d4b7d62b;p=mailer.git diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 8ab5bf13a1..49b4beb6e6 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -1,7 +1,7 @@ 0) && ($_CONFIG['allow_direct_pay'] == "N")) $locked = true; +function addPointsBeg ($userid, $points) { + // Default is not added + $added = false; // Is begging rallye active? - if ($_CONFIG['beg_rallye'] == "Y") { + if (isBegRallyeEnabled()) { // 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, $uid), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1", + array($points, $userid), __FUNCTION__, __LINE__); } else { // Add points to account - unset($DEPTH); - ADD_POINTS_REFSYSTEM("beg", $uid, $points, false, "0", $locked, strtolower($_CONFIG['beg_mode'])); + // @TODO Try to rewrite the following unset() + unset($GLOBALS['ref_level']); + $added = addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getBegMode())); } // Subtract begged points from member account if the admin has selected one - if ($_CONFIG['beg_uid'] > 0) { + if (getBegUserid() > 0) { // Subtract from this account - SUB_POINTS("beg_payout", $_CONFIG['beg_uid'], $points); + subtractPoints('beg_payout', getBegUserid(), $points); } // END - if + + // Return result + return $added; +} + +// ---------------------------------------------------------------------------- +// Wrapper functions for ext-beg +// ---------------------------------------------------------------------------- + +// "Getter" for beg_new_member_notify +function getBegNewMemberNotify () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Get it + $GLOBALS[__FUNCTION__] = getConfig('beg_new_member_notify'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_new_member_notify is enabled +function isBegNewMemberNotifyEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y')); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_userid +function getBegUserid () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Get it + $GLOBALS[__FUNCTION__] = getConfig('beg_userid'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_timeout +function getBegTimeout () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_timeout'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_userid_timeout +function getBegUseridTimeout () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_userid_timeout'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_ip_timeout +function getBegIpTimeout () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_ip_timeout'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_ranks +function getBegRanks () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_ranks'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_points_max +function getBegPointsMax () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_points_max'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_points +function getBegPoints () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_points'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_notify_bonus +function getBegNotifyBonus () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_notify_bonus'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_notify_wait +function getBegNotifyWait () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_notify_wait'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_pay_mode +function getBegPayMode () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_pay_mode'); + } // END - if + + // Return cache + 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? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_include_own'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_include_own is "Y" +function isBegIncludeOwnEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getBegIncludeOwn() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_active +function getBegActive () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_active'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_active is "Y" +function isBegActiveEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getBegActive() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_rallye +function getBegRallye () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_rallye'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_rallye is "Y" +function isBegRallyeEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getBegRallye() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_rallye_enable_notify +function getBegRallyeEnableNotify () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_enable_notify'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_rallye_enable_notify is "Y" +function isBegRallyeEnableNotifyEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getBegRallyeEnableNotify() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for beg_rallye_disable_notify +function getBegRallyeDisableNotify () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_disable_notify'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks wether beg_rallye_disable_notify is "Y" +function isBegRallyeDisableNotifyEnabled () { + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getBegRallyeDisableNotify() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; } // [EOF]