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(getBegMode()));
60 // Subtract begged points from member account if the admin has selected one
61 if (getBegUserid() > 0) {
62 // Subtract from this account
63 subtractPoints('beg_payout', getBegUserid(), $points);
70 // ----------------------------------------------------------------------------
71 // Wrapper functions for ext-beg
72 // ----------------------------------------------------------------------------
74 // "Getter" for beg_new_member_notify
75 function getBegNewMemberNotify () {
77 if (!isset($GLOBALS[__FUNCTION__])) {
79 $GLOBALS[__FUNCTION__] = getConfig('beg_new_member_notify');
83 return $GLOBALS[__FUNCTION__];
86 // Checks wether beg_new_member_notify is enabled
87 function isBegNewMemberNotifyEnabled () {
89 if (!isset($GLOBALS[__FUNCTION__])) {
91 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y'));
95 return $GLOBALS[__FUNCTION__];
98 // "Getter" for beg_userid
99 function getBegUserid () {
101 if (!isset($GLOBALS[__FUNCTION__])) {
103 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
107 return $GLOBALS[__FUNCTION__];
110 // "Getter" for beg_timeout
111 function getBegTimeout () {
113 if (!isset($GLOBALS[__FUNCTION__])) {
115 $GLOBALS[__FUNCTION__] = getConfig('beg_timeout');
119 return $GLOBALS[__FUNCTION__];
122 // "Getter" for beg_userid_timeout
123 function getBegUseridTimeout () {
125 if (!isset($GLOBALS[__FUNCTION__])) {
127 $GLOBALS[__FUNCTION__] = getConfig('beg_userid_timeout');
131 return $GLOBALS[__FUNCTION__];
134 // "Getter" for beg_ip_timeout
135 function getBegIpTimeout () {
137 if (!isset($GLOBALS[__FUNCTION__])) {
139 $GLOBALS[__FUNCTION__] = getConfig('beg_ip_timeout');
143 return $GLOBALS[__FUNCTION__];
146 // "Getter" for beg_ranks
147 function getBegRanks () {
149 if (!isset($GLOBALS[__FUNCTION__])) {
151 $GLOBALS[__FUNCTION__] = getConfig('beg_ranks');
155 return $GLOBALS[__FUNCTION__];
158 // "Getter" for beg_points_max
159 function getBegPointsMax () {
161 if (!isset($GLOBALS[__FUNCTION__])) {
163 $GLOBALS[__FUNCTION__] = getConfig('beg_points_max');
167 return $GLOBALS[__FUNCTION__];
170 // "Getter" for beg_points
171 function getBegPoints () {
173 if (!isset($GLOBALS[__FUNCTION__])) {
175 $GLOBALS[__FUNCTION__] = getConfig('beg_points');
179 return $GLOBALS[__FUNCTION__];
182 // "Getter" for beg_notify_bonus
183 function getBegNotifyBonus () {
185 if (!isset($GLOBALS[__FUNCTION__])) {
187 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_bonus');
191 return $GLOBALS[__FUNCTION__];
194 // "Getter" for beg_notify_wait
195 function getBegNotifyWait () {
197 if (!isset($GLOBALS[__FUNCTION__])) {
199 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_wait');
203 return $GLOBALS[__FUNCTION__];
206 // "Getter" for beg_pay_mode
207 function getBegPayMode () {
209 if (!isset($GLOBALS[__FUNCTION__])) {
211 $GLOBALS[__FUNCTION__] = getConfig('beg_pay_mode');
215 return $GLOBALS[__FUNCTION__];
218 // "Getter" for beg_mode
219 function getBegMode () {
221 if (!isset($GLOBALS[__FUNCTION__])) {
223 $GLOBALS[__FUNCTION__] = getConfig('beg_mode');
227 return $GLOBALS[__FUNCTION__];
230 // "Getter" for beg_include_own
231 function getBegIncludeOwn () {
233 if (!isset($GLOBALS[__FUNCTION__])) {
235 $GLOBALS[__FUNCTION__] = getConfig('beg_include_own');
239 return $GLOBALS[__FUNCTION__];
242 // Checks wether beg_include_own is "Y"
243 function isBegIncludeOwnEnabled () {
245 if (!isset($GLOBALS[__FUNCTION__])) {
247 $GLOBALS[__FUNCTION__] = (getBegIncludeOwn() == 'Y');
251 return $GLOBALS[__FUNCTION__];
254 // "Getter" for beg_active
255 function getBegActive () {
257 if (!isset($GLOBALS[__FUNCTION__])) {
259 $GLOBALS[__FUNCTION__] = getConfig('beg_active');
263 return $GLOBALS[__FUNCTION__];
266 // Checks wether beg_active is "Y"
267 function isBegActiveEnabled () {
269 if (!isset($GLOBALS[__FUNCTION__])) {
271 $GLOBALS[__FUNCTION__] = (getBegActive() == 'Y');
275 return $GLOBALS[__FUNCTION__];
278 // "Getter" for beg_rallye
279 function getBegRallye () {
281 if (!isset($GLOBALS[__FUNCTION__])) {
283 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye');
287 return $GLOBALS[__FUNCTION__];
290 // Checks wether beg_rallye is "Y"
291 function isBegRallyeEnabled () {
293 if (!isset($GLOBALS[__FUNCTION__])) {
295 $GLOBALS[__FUNCTION__] = (getBegRallye() == 'Y');
299 return $GLOBALS[__FUNCTION__];
302 // "Getter" for beg_rallye_enable_notify
303 function getBegRallyeEnableNotify () {
305 if (!isset($GLOBALS[__FUNCTION__])) {
307 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_enable_notify');
311 return $GLOBALS[__FUNCTION__];
314 // Checks wether beg_rallye_enable_notify is "Y"
315 function isBegRallyeEnableNotifyEnabled () {
317 if (!isset($GLOBALS[__FUNCTION__])) {
319 $GLOBALS[__FUNCTION__] = (getBegRallyeEnableNotify() == 'Y');
323 return $GLOBALS[__FUNCTION__];
326 // "Getter" for beg_rallye_disable_notify
327 function getBegRallyeDisableNotify () {
329 if (!isset($GLOBALS[__FUNCTION__])) {
331 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_disable_notify');
335 return $GLOBALS[__FUNCTION__];
338 // Checks wether beg_rallye_disable_notify is "Y"
339 function isBegRallyeDisableNotifyEnabled () {
341 if (!isset($GLOBALS[__FUNCTION__])) {
343 $GLOBALS[__FUNCTION__] = (getBegRallyeDisableNotify() == 'Y');
347 return $GLOBALS[__FUNCTION__];