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 - 2011 by Mailer Developer Team *
20 * For more information visit: http://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 // We need to set $add here, two
55 $added = (!SQL_HASZEROAFFECTED());
57 // Add points to account
59 $added = addPointsThroughReferalSystem('beg', $userid, $points);
62 // Subtract begged points from member account if the admin has selected one
63 if (($added === true) && (isValidUserId(getBegUserid()))) {
64 // Subtract from this account
65 $added = ($added && subtractPoints('beg_payout', getBegUserid(), $points));
72 //-----------------------------------------------------------------------------
73 // Wrapper functions for ext-beg
74 //-----------------------------------------------------------------------------
76 // "Getter" for beg_new_member_notify
77 function getBegNewMemberNotify () {
79 if (!isset($GLOBALS[__FUNCTION__])) {
81 $GLOBALS[__FUNCTION__] = getConfig('beg_new_member_notify');
85 return $GLOBALS[__FUNCTION__];
88 // Checks wether beg_new_member_notify is enabled
89 function isBegNewMemberNotifyEnabled () {
91 if (!isset($GLOBALS[__FUNCTION__])) {
93 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y'));
97 return $GLOBALS[__FUNCTION__];
100 // "Getter" for beg_userid
101 function getBegUserid () {
103 if (!isset($GLOBALS[__FUNCTION__])) {
105 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
109 return $GLOBALS[__FUNCTION__];
112 // "Getter" for beg_timeout
113 function getBegTimeout () {
115 if (!isset($GLOBALS[__FUNCTION__])) {
117 $GLOBALS[__FUNCTION__] = getConfig('beg_timeout');
121 return $GLOBALS[__FUNCTION__];
124 // "Getter" for beg_userid_timeout
125 function getBegUseridTimeout () {
127 if (!isset($GLOBALS[__FUNCTION__])) {
129 $GLOBALS[__FUNCTION__] = getConfig('beg_userid_timeout');
133 return $GLOBALS[__FUNCTION__];
136 // "Getter" for beg_ip_timeout
137 function getBegIpTimeout () {
139 if (!isset($GLOBALS[__FUNCTION__])) {
141 $GLOBALS[__FUNCTION__] = getConfig('beg_ip_timeout');
145 return $GLOBALS[__FUNCTION__];
148 // "Getter" for beg_ranks
149 function getBegRanks () {
151 if (!isset($GLOBALS[__FUNCTION__])) {
153 $GLOBALS[__FUNCTION__] = getConfig('beg_ranks');
157 return $GLOBALS[__FUNCTION__];
160 // "Getter" for beg_points_max
161 function getBegPointsMax () {
163 if (!isset($GLOBALS[__FUNCTION__])) {
165 $GLOBALS[__FUNCTION__] = getConfig('beg_points_max');
169 return $GLOBALS[__FUNCTION__];
172 // "Getter" for beg_points
173 function getBegPoints () {
175 if (!isset($GLOBALS[__FUNCTION__])) {
177 $GLOBALS[__FUNCTION__] = getConfig('beg_points');
181 return $GLOBALS[__FUNCTION__];
184 // "Getter" for beg_notify_bonus
185 function getBegNotifyBonus () {
187 if (!isset($GLOBALS[__FUNCTION__])) {
189 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_bonus');
193 return $GLOBALS[__FUNCTION__];
196 // "Getter" for beg_notify_wait
197 function getBegNotifyWait () {
199 if (!isset($GLOBALS[__FUNCTION__])) {
201 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_wait');
205 return $GLOBALS[__FUNCTION__];
208 // "Getter" for beg_pay_mode
209 function getBegPayMode () {
211 if (!isset($GLOBALS[__FUNCTION__])) {
213 $GLOBALS[__FUNCTION__] = getConfig('beg_pay_mode');
217 return $GLOBALS[__FUNCTION__];
220 // "Getter" for beg_include_own
221 function getBegIncludeOwn () {
223 if (!isset($GLOBALS[__FUNCTION__])) {
225 $GLOBALS[__FUNCTION__] = getConfig('beg_include_own');
229 return $GLOBALS[__FUNCTION__];
232 // Checks wether beg_include_own is "Y"
233 function isBegIncludeOwnEnabled () {
235 if (!isset($GLOBALS[__FUNCTION__])) {
237 $GLOBALS[__FUNCTION__] = (getBegIncludeOwn() == 'Y');
241 return $GLOBALS[__FUNCTION__];
244 // "Getter" for beg_active
245 function getBegActive () {
247 if (!isset($GLOBALS[__FUNCTION__])) {
249 $GLOBALS[__FUNCTION__] = getConfig('beg_active');
253 return $GLOBALS[__FUNCTION__];
256 // Checks wether beg_active is "Y"
257 function isBegActiveEnabled () {
259 if (!isset($GLOBALS[__FUNCTION__])) {
261 $GLOBALS[__FUNCTION__] = (getBegActive() == 'Y');
265 return $GLOBALS[__FUNCTION__];
268 // "Getter" for beg_rallye
269 function getBegRallye () {
271 if (!isset($GLOBALS[__FUNCTION__])) {
273 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye');
277 return $GLOBALS[__FUNCTION__];
280 // Checks wether beg_rallye is "Y"
281 function isBegRallyeEnabled () {
283 if (!isset($GLOBALS[__FUNCTION__])) {
285 $GLOBALS[__FUNCTION__] = (getBegRallye() == 'Y');
289 return $GLOBALS[__FUNCTION__];
292 // "Getter" for beg_rallye_enable_notify
293 function getBegRallyeEnableNotify () {
295 if (!isset($GLOBALS[__FUNCTION__])) {
297 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_enable_notify');
301 return $GLOBALS[__FUNCTION__];
304 // Checks wether beg_rallye_enable_notify is "Y"
305 function isBegRallyeEnableNotifyEnabled () {
307 if (!isset($GLOBALS[__FUNCTION__])) {
309 $GLOBALS[__FUNCTION__] = (getBegRallyeEnableNotify() == 'Y');
313 return $GLOBALS[__FUNCTION__];
316 // "Getter" for beg_rallye_disable_notify
317 function getBegRallyeDisableNotify () {
319 if (!isset($GLOBALS[__FUNCTION__])) {
321 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_disable_notify');
325 return $GLOBALS[__FUNCTION__];
328 // Checks wether beg_rallye_disable_notify is "Y"
329 function isBegRallyeDisableNotifyEnabled () {
331 if (!isset($GLOBALS[__FUNCTION__])) {
333 $GLOBALS[__FUNCTION__] = (getBegRallyeDisableNotify() == 'Y');
337 return $GLOBALS[__FUNCTION__];