]> git.mxchange.org Git - mailer.git/blob - inc/libs/beg_functions.php
6536b44c3d6b47e1047132c74b0bb92e173e62e1
[mailer.git] / inc / libs / beg_functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/15/2008 *
4  * ===================                          Last change: 10/15/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : beg_functions.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Beg link functions                               *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Funktionen fuer den Bettel-Link                  *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
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__);
50         } else {
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')));
55         }
56
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);
61         } // END - if
62 }
63
64 // Checks wether beg_rallye is enabled
65 function isBegRallyeEnabled () {
66         // Do we have cache?
67         if (!isset($GLOBALS[__FUNCTION__])) {
68                 // Determine it
69                 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.8')) && (getConfig('beg_rallye') == 'Y'));
70         } // END - if
71
72         // Return cache
73         return $GLOBALS[__FUNCTION__];
74 }
75
76 // Checks wether beg_rallye is enabled
77 function isBegNewMemberNotifyEnabled () {
78         // Do we have cache?
79         if (!isset($GLOBALS[__FUNCTION__])) {
80                 // Determine it
81                 $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getConfig('beg_new_member_notify') == 'Y'));
82         } // END - if
83
84         // Return cache
85         return $GLOBALS[__FUNCTION__];
86 }
87
88 // "Getter" for beg_userid
89 function getBegUserid () {
90         // Do we have cache?
91         if (!isset($GLOBALS[__FUNCTION__])) {
92                 // Get it
93                 $GLOBALS[__FUNCTION__] = getConfig('beg_userid');
94         } // END - if
95
96         // Return cache
97         return $GLOBALS[__FUNCTION__];
98 }
99
100 // [EOF]
101 ?>