X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fbeg_functions.php;h=e7faa39850f1d5d08bb08421aec1d69673afda1d;hb=46aeda7c31aefbe313f5c4bcf7cdbef4f1826fcc;hp=8269062de04fac698463427569fe72b6576ff29c;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index 8269062de0..e7faa39850 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -18,6 +18,7 @@ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -39,20 +40,20 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // Add points to user or begging rallye account function addPointsBeg ($userid, $points) { - // Set mode depending on how many mails the member has to confirm - $locked = false; - if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; - // Is begging rallye active? - if (getConfig('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, $userid), __FUNCTION__, __LINE__); } else { + // Set mode depending on how many mails the member has to confirm + $locked = false; + if ((getConfig('ref_payout') > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; + // Add points to account // @TODO Try to rewrite the following unset() unset($GLOBALS['ref_level']); @@ -66,5 +67,29 @@ function addPointsBeg ($userid, $points) { } // END - if } +// Checks wether beg_rallye is enabled +function isBegRallyeEnabled () { + // Do we have cache? + if (!isset($GLOBALS['is_beg_rallye_enabled'])) { + // Determine it + $GLOBALS['is_beg_rallye_enabled'] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y')); + } // END - if + + // Return cache + return $GLOBALS['is_beg_rallye_enabled']; +} + +// "Getter" for beg_userid +function getBegUserid () { + // Do we have cache? + if (!isset($GLOBALS['beg_userid'])) { + // Get it + $GLOBALS['beg_userid'] = getConfig('beg_userid'); + } // END - if + + // Return cache + return $GLOBALS['beg_userid']; +} + // [EOF] ?>