X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fbeg_functions.php;h=f1f333ae439dba0c4904fcef52629b3c4dd45cbb;hp=e7faa39850f1d5d08bb08421aec1d69673afda1d;hb=20741b93fd58620af677a7f1039ffd16ea6ec689;hpb=64dbf5402e03d03a39d668cccc838caf036adb2d diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index e7faa39850..f1f333ae43 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -14,12 +14,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * 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 * + * 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 * @@ -44,51 +42,299 @@ if (!defined('__SECURITY')) { // Add points to user or begging rallye account function addPointsBeg ($userid, $points) { + // Default is not added + $added = false; + // Is begging rallye active? 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; + // 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']); - addPointsThroughReferalSystem('beg', $userid, $points, false, 0, $locked, strtolower(getConfig('beg_mode'))); + initReferalSystem(); + $added = addPointsThroughReferalSystem('beg', $userid, $points); } // Subtract begged points from member account if the admin has selected one - if (getConfig('beg_userid') > 0) { + if (($added === true) && (isValidUserId(getBegUserid()))) { // Subtract from this account - subtractPoints('beg_payout', getConfig('beg_userid'), $points); + $added = ($added && subtractPoints('beg_payout', getBegUserid(), $points)); } // END - if + + // Return result + return $added; } -// Checks wether beg_rallye is enabled -function isBegRallyeEnabled () { +//----------------------------------------------------------------------------- +// Wrapper functions for ext-beg +//----------------------------------------------------------------------------- + +// "Getter" for beg_new_member_notify +function getBegNewMemberNotify () { // Do we have cache? - if (!isset($GLOBALS['is_beg_rallye_enabled'])) { + 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['is_beg_rallye_enabled'] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y')); + $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y')); } // END - if // Return cache - return $GLOBALS['is_beg_rallye_enabled']; + return $GLOBALS[__FUNCTION__]; } // "Getter" for beg_userid function getBegUserid () { // Do we have cache? - if (!isset($GLOBALS['beg_userid'])) { + if (!isset($GLOBALS[__FUNCTION__])) { // Get it - $GLOBALS['beg_userid'] = getConfig('beg_userid'); + $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_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['beg_userid']; + return $GLOBALS[__FUNCTION__]; } // [EOF]