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 // Is begging rallye active?
46 if (isBegRallyeEnabled()) {
47 // Add points to rallye account
48 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1",
49 array($points, $userid), __FUNCTION__, __LINE__);
51 // Add points to account
52 // @TODO Try to rewrite the following unset()
53 unset($GLOBALS['ref_level']);
54 addPointsThroughReferalSystem('beg', $userid, $points, false, 0, strtolower(getConfig('beg_mode')));
57 // Subtract begged points from member account if the admin has selected one
58 if (getConfig('beg_userid') > 0) {
59 // Subtract from this account
60 subtractPoints('beg_payout', getConfig('beg_userid'), $points);
64 // Checks wether beg_rallye is enabled
65 function isBegRallyeEnabled () {
67 if (!isset($GLOBALS[__FUNCTION__])) {
69 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y'));
73 return $GLOBALS[__FUNCTION__];
76 // Checks wether beg_rallye is enabled
77 function isBegNewMemberNotifyEnabled () {
79 if (!isset($GLOBALS[__FUNCTION__])) {
81 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getConfig('beg_new_member_notify') == 'Y'));
85 return $GLOBALS[__FUNCTION__];
88 // "Getter" for beg_userid
89 function getBegUserid () {
91 if (!isset($GLOBALS[__FUNCTION__])) {
93 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
97 return $GLOBALS[__FUNCTION__];