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://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
56 $added = addPointsThroughReferalSystem('beg', $userid, $points);
59 // Subtract begged points from member account if the admin has selected one
60 if (isValidUserId(getBegUserid())) {
61 // Subtract from this account
62 subtractPoints('beg_payout', getBegUserid(), $points);
69 //-----------------------------------------------------------------------------
70 // Wrapper functions for ext-beg
71 //-----------------------------------------------------------------------------
73 // "Getter" for beg_new_member_notify
74 function getBegNewMemberNotify () {
76 if (!isset($GLOBALS[__FUNCTION__])) {
78 $GLOBALS[__FUNCTION__] = getConfig('beg_new_member_notify');
82 return $GLOBALS[__FUNCTION__];
85 // Checks wether beg_new_member_notify is enabled
86 function isBegNewMemberNotifyEnabled () {
88 if (!isset($GLOBALS[__FUNCTION__])) {
90 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y'));
94 return $GLOBALS[__FUNCTION__];
97 // "Getter" for beg_userid
98 function getBegUserid () {
100 if (!isset($GLOBALS[__FUNCTION__])) {
102 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
106 return $GLOBALS[__FUNCTION__];
109 // "Getter" for beg_timeout
110 function getBegTimeout () {
112 if (!isset($GLOBALS[__FUNCTION__])) {
114 $GLOBALS[__FUNCTION__] = getConfig('beg_timeout');
118 return $GLOBALS[__FUNCTION__];
121 // "Getter" for beg_userid_timeout
122 function getBegUseridTimeout () {
124 if (!isset($GLOBALS[__FUNCTION__])) {
126 $GLOBALS[__FUNCTION__] = getConfig('beg_userid_timeout');
130 return $GLOBALS[__FUNCTION__];
133 // "Getter" for beg_ip_timeout
134 function getBegIpTimeout () {
136 if (!isset($GLOBALS[__FUNCTION__])) {
138 $GLOBALS[__FUNCTION__] = getConfig('beg_ip_timeout');
142 return $GLOBALS[__FUNCTION__];
145 // "Getter" for beg_ranks
146 function getBegRanks () {
148 if (!isset($GLOBALS[__FUNCTION__])) {
150 $GLOBALS[__FUNCTION__] = getConfig('beg_ranks');
154 return $GLOBALS[__FUNCTION__];
157 // "Getter" for beg_points_max
158 function getBegPointsMax () {
160 if (!isset($GLOBALS[__FUNCTION__])) {
162 $GLOBALS[__FUNCTION__] = getConfig('beg_points_max');
166 return $GLOBALS[__FUNCTION__];
169 // "Getter" for beg_points
170 function getBegPoints () {
172 if (!isset($GLOBALS[__FUNCTION__])) {
174 $GLOBALS[__FUNCTION__] = getConfig('beg_points');
178 return $GLOBALS[__FUNCTION__];
181 // "Getter" for beg_notify_bonus
182 function getBegNotifyBonus () {
184 if (!isset($GLOBALS[__FUNCTION__])) {
186 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_bonus');
190 return $GLOBALS[__FUNCTION__];
193 // "Getter" for beg_notify_wait
194 function getBegNotifyWait () {
196 if (!isset($GLOBALS[__FUNCTION__])) {
198 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_wait');
202 return $GLOBALS[__FUNCTION__];
205 // "Getter" for beg_pay_mode
206 function getBegPayMode () {
208 if (!isset($GLOBALS[__FUNCTION__])) {
210 $GLOBALS[__FUNCTION__] = getConfig('beg_pay_mode');
214 return $GLOBALS[__FUNCTION__];
217 // "Getter" for beg_include_own
218 function getBegIncludeOwn () {
220 if (!isset($GLOBALS[__FUNCTION__])) {
222 $GLOBALS[__FUNCTION__] = getConfig('beg_include_own');
226 return $GLOBALS[__FUNCTION__];
229 // Checks wether beg_include_own is "Y"
230 function isBegIncludeOwnEnabled () {
232 if (!isset($GLOBALS[__FUNCTION__])) {
234 $GLOBALS[__FUNCTION__] = (getBegIncludeOwn() == 'Y');
238 return $GLOBALS[__FUNCTION__];
241 // "Getter" for beg_active
242 function getBegActive () {
244 if (!isset($GLOBALS[__FUNCTION__])) {
246 $GLOBALS[__FUNCTION__] = getConfig('beg_active');
250 return $GLOBALS[__FUNCTION__];
253 // Checks wether beg_active is "Y"
254 function isBegActiveEnabled () {
256 if (!isset($GLOBALS[__FUNCTION__])) {
258 $GLOBALS[__FUNCTION__] = (getBegActive() == 'Y');
262 return $GLOBALS[__FUNCTION__];
265 // "Getter" for beg_rallye
266 function getBegRallye () {
268 if (!isset($GLOBALS[__FUNCTION__])) {
270 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye');
274 return $GLOBALS[__FUNCTION__];
277 // Checks wether beg_rallye is "Y"
278 function isBegRallyeEnabled () {
280 if (!isset($GLOBALS[__FUNCTION__])) {
282 $GLOBALS[__FUNCTION__] = (getBegRallye() == 'Y');
286 return $GLOBALS[__FUNCTION__];
289 // "Getter" for beg_rallye_enable_notify
290 function getBegRallyeEnableNotify () {
292 if (!isset($GLOBALS[__FUNCTION__])) {
294 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_enable_notify');
298 return $GLOBALS[__FUNCTION__];
301 // Checks wether beg_rallye_enable_notify is "Y"
302 function isBegRallyeEnableNotifyEnabled () {
304 if (!isset($GLOBALS[__FUNCTION__])) {
306 $GLOBALS[__FUNCTION__] = (getBegRallyeEnableNotify() == 'Y');
310 return $GLOBALS[__FUNCTION__];
313 // "Getter" for beg_rallye_disable_notify
314 function getBegRallyeDisableNotify () {
316 if (!isset($GLOBALS[__FUNCTION__])) {
318 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_disable_notify');
322 return $GLOBALS[__FUNCTION__];
325 // Checks wether beg_rallye_disable_notify is "Y"
326 function isBegRallyeDisableNotifyEnabled () {
328 if (!isset($GLOBALS[__FUNCTION__])) {
330 $GLOBALS[__FUNCTION__] = (getBegRallyeDisableNotify() == 'Y');
334 return $GLOBALS[__FUNCTION__];