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 - 2012 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 = addPointsThroughReferralSystem('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 //-----------------------------------------------------------------------------
74 //-----------------------------------------------------------------------------
76 // Outputs points which a member can get
77 function doTemplateOutputBegPoints ($templateName, $clear = FALSE) {
78 // Default is not the same
79 $return = '{--BEG_POINTS_MIN_MAX--}';
81 // Is min/max points the same?
82 if (getBegPoints() == getBegPointsMax()) {
83 // Is the same, output different message
84 $return = '{--BEG_POINTS_FIXED--}';
91 //-----------------------------------------------------------------------------
92 // Wrapper functions for ext-beg
93 //-----------------------------------------------------------------------------
95 // "Getter" for beg_new_member_notify
96 function getBegNewMemberNotify () {
98 if (!isset($GLOBALS[__FUNCTION__])) {
100 $GLOBALS[__FUNCTION__] = getConfig('beg_new_member_notify');
104 return $GLOBALS[__FUNCTION__];
107 // Checks whether beg_new_member_notify is enabled
108 function isBegNewMemberNotifyEnabled () {
110 if (!isset($GLOBALS[__FUNCTION__])) {
112 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getBegNewMemberNotify() == 'Y'));
116 return $GLOBALS[__FUNCTION__];
119 // "Getter" for beg_userid
120 function getBegUserid () {
122 if (!isset($GLOBALS[__FUNCTION__])) {
124 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
128 return $GLOBALS[__FUNCTION__];
131 // "Getter" for beg_timeout
132 function getBegTimeout () {
134 if (!isset($GLOBALS[__FUNCTION__])) {
136 $GLOBALS[__FUNCTION__] = getConfig('beg_timeout');
140 return $GLOBALS[__FUNCTION__];
143 // "Getter" for beg_userid_timeout
144 function getBegUseridTimeout () {
146 if (!isset($GLOBALS[__FUNCTION__])) {
148 $GLOBALS[__FUNCTION__] = getConfig('beg_userid_timeout');
152 return $GLOBALS[__FUNCTION__];
155 // "Getter" for beg_ip_timeout
156 function getBegIpTimeout () {
158 if (!isset($GLOBALS[__FUNCTION__])) {
160 $GLOBALS[__FUNCTION__] = getConfig('beg_ip_timeout');
164 return $GLOBALS[__FUNCTION__];
167 // "Getter" for beg_ranks
168 function getBegRanks () {
170 if (!isset($GLOBALS[__FUNCTION__])) {
172 $GLOBALS[__FUNCTION__] = getConfig('beg_ranks');
176 return $GLOBALS[__FUNCTION__];
179 // "Getter" for beg_points_max
180 function getBegPointsMax () {
182 if (!isset($GLOBALS[__FUNCTION__])) {
184 $GLOBALS[__FUNCTION__] = getConfig('beg_points_max');
188 return $GLOBALS[__FUNCTION__];
191 // "Getter" for beg_points
192 function getBegPoints () {
194 if (!isset($GLOBALS[__FUNCTION__])) {
196 $GLOBALS[__FUNCTION__] = getConfig('beg_points');
200 return $GLOBALS[__FUNCTION__];
203 // "Getter" for beg_notify_bonus
204 function getBegNotifyBonus () {
206 if (!isset($GLOBALS[__FUNCTION__])) {
208 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_bonus');
212 return $GLOBALS[__FUNCTION__];
215 // "Getter" for beg_notify_wait
216 function getBegNotifyWait () {
218 if (!isset($GLOBALS[__FUNCTION__])) {
220 $GLOBALS[__FUNCTION__] = getConfig('beg_notify_wait');
224 return $GLOBALS[__FUNCTION__];
227 // "Getter" for beg_pay_mode
228 function getBegPayMode () {
230 if (!isset($GLOBALS[__FUNCTION__])) {
232 $GLOBALS[__FUNCTION__] = getConfig('beg_pay_mode');
236 return $GLOBALS[__FUNCTION__];
239 // "Getter" for beg_include_own
240 function getBegIncludeOwn () {
242 if (!isset($GLOBALS[__FUNCTION__])) {
244 $GLOBALS[__FUNCTION__] = getConfig('beg_include_own');
248 return $GLOBALS[__FUNCTION__];
251 // Checks whether beg_include_own is "Y"
252 function isBegIncludeOwnEnabled () {
254 if (!isset($GLOBALS[__FUNCTION__])) {
256 $GLOBALS[__FUNCTION__] = (getBegIncludeOwn() == 'Y');
260 return $GLOBALS[__FUNCTION__];
263 // "Getter" for beg_active
264 function getBegActive () {
266 if (!isset($GLOBALS[__FUNCTION__])) {
268 $GLOBALS[__FUNCTION__] = getConfig('beg_active');
272 return $GLOBALS[__FUNCTION__];
275 // Checks whether beg_active is "Y"
276 function isBegActiveEnabled () {
278 if (!isset($GLOBALS[__FUNCTION__])) {
280 $GLOBALS[__FUNCTION__] = (getBegActive() == 'Y');
284 return $GLOBALS[__FUNCTION__];
287 // "Getter" for beg_rallye
288 function getBegRallye () {
290 if (!isset($GLOBALS[__FUNCTION__])) {
292 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye');
296 return $GLOBALS[__FUNCTION__];
299 // Checks whether beg_rallye is "Y"
300 function isBegRallyeEnabled () {
302 if (!isset($GLOBALS[__FUNCTION__])) {
304 $GLOBALS[__FUNCTION__] = (getBegRallye() == 'Y');
308 return $GLOBALS[__FUNCTION__];
311 // "Getter" for beg_rallye_enable_notify
312 function getBegRallyeEnableNotify () {
314 if (!isset($GLOBALS[__FUNCTION__])) {
316 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_enable_notify');
320 return $GLOBALS[__FUNCTION__];
323 // Checks whether beg_rallye_enable_notify is "Y"
324 function isBegRallyeEnableNotifyEnabled () {
326 if (!isset($GLOBALS[__FUNCTION__])) {
328 $GLOBALS[__FUNCTION__] = (getBegRallyeEnableNotify() == 'Y');
332 return $GLOBALS[__FUNCTION__];
335 // "Getter" for beg_rallye_disable_notify
336 function getBegRallyeDisableNotify () {
338 if (!isset($GLOBALS[__FUNCTION__])) {
340 $GLOBALS[__FUNCTION__] = getConfig('beg_rallye_disable_notify');
344 return $GLOBALS[__FUNCTION__];
347 // Checks whether beg_rallye_disable_notify is "Y"
348 function isBegRallyeDisableNotifyEnabled () {
350 if (!isset($GLOBALS[__FUNCTION__])) {
352 $GLOBALS[__FUNCTION__] = (getBegRallyeDisableNotify() == 'Y');
356 return $GLOBALS[__FUNCTION__];