2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/15/2008 *
4 * =================== Last change: 10/15/2008 *
6 * -------------------------------------------------------------------- *
7 * File : beg_functions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Beg link functions *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Funktionen fuer den Bettel-Link *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add points to user or begging rallye account
44 function addPointsBeg ($userid, $points) {
45 // Default is not added
48 // Is begging rallye active?
49 if (isBegRallyeEnabled()) {
50 // Add points to rallye account
51 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1",
52 array($points, $userid), __FUNCTION__, __LINE__);
54 // Add points to account
55 // @TODO Try to rewrite the following unset()
56 unset($GLOBALS['ref_level']);
57 $added = addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getConfig('beg_mode')));
60 // Subtract begged points from member account if the admin has selected one
61 if (getConfig('beg_userid') > 0) {
62 // Subtract from this account
63 subtractPoints('beg_payout', getConfig('beg_userid'), $points);
70 // Checks wether beg_rallye is enabled
71 function isBegRallyeEnabled () {
73 if (!isset($GLOBALS[__FUNCTION__])) {
75 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y'));
79 return $GLOBALS[__FUNCTION__];
82 // Checks wether beg_rallye is enabled
83 function isBegNewMemberNotifyEnabled () {
85 if (!isset($GLOBALS[__FUNCTION__])) {
87 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getConfig('beg_new_member_notify') == 'Y'));
91 return $GLOBALS[__FUNCTION__];
94 // "Getter" for beg_userid
95 function getBegUserid () {
97 if (!isset($GLOBALS[__FUNCTION__])) {
99 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
103 return $GLOBALS[__FUNCTION__];