Opps, not all elements for sprintf() has been set.
[mailer.git] / inc / libs / autopurge_functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 05/30/2004 *
4  * ===================                          Last change: 08/09/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : autopurge_functions.php                          *
8  * -------------------------------------------------------------------- *
9  * Short description : Special functions                                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Spezielle Funktionen                             *
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 - 2013 by Mailer Developer Team                   *
20  * For more information visit: http://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 in autopurge-mode
44 function addPointsAutoPurge ($userid, $points) {
45         // Is the userid valid?
46         if ((!isValidId($userid)) || ($points <= 0)) {
47                 // Please report all these bugs
48                 reportBug(__FUNCTION__, __LINE__, 'Invalid call. userid=' . $userid . ',points=' . $points);
49         } // END - if
50
51         // Add points over the ref system directly now
52         initReferralSystem();
53         addPointsThroughReferralSystem('autopurge_add', $userid, $points);
54
55         // Send out mail to user
56         $message = loadEmailTemplate('member_autopurge_points', array('points' => $points), $userid);
57         sendEmail($userid, '{--MEMBER_AUTOPURGE_SUBJECT--}', $message);
58 }
59
60 // ----------------------------------------------------------------------------
61 //                     Wrapper for configuration entries
62 // ----------------------------------------------------------------------------
63
64 // Checks whether auto-purging is enabled
65 function isAutoPurgingActive () {
66         // Is there cache?
67         if (!isset($GLOBALS[__FUNCTION__])) {
68                 // Determine it
69                 $GLOBALS[__FUNCTION__] = (getConfig('auto_purge_active') == 'Y');
70         } // END - if
71
72         // Return cache
73         return $GLOBALS[__FUNCTION__];
74 }
75
76 // Wrapper for 'autopurge_inactive
77 function getAutopurgeInactive () {
78         // Is there cache?
79         if (!isset($GLOBALS[__FUNCTION__])) {
80                 // Determine it
81                 $GLOBALS[__FUNCTION__] = (getConfig('autopurge_inactive') == 'Y');
82         } // END - if
83
84         // Return cache
85         return $GLOBALS[__FUNCTION__];
86 }
87
88 // Checks whether purging of inactive accounts is enabled
89 function isAutopurgeInactiveEnabled () {
90         // Is there cache?
91         if (!isset($GLOBALS[__FUNCTION__])) {
92                 // Determine it
93                 $GLOBALS[__FUNCTION__] = (getAutopurgeInactive() == 'Y');
94         } // END - if
95
96         // Return cache
97         return $GLOBALS[__FUNCTION__];
98 }
99
100 // "Getter" for ap_inactive_time
101 function getApInactiveTime () {
102         // Is there cache?
103         if (!isset($GLOBALS[__FUNCTION__])) {
104                 // Determine it
105                 $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_time');
106         } // END - if
107
108         // Return cache
109         return $GLOBALS[__FUNCTION__];
110 }
111
112 // "Getter" for auto_purge
113 function getAutoPurge () {
114         // Is there cache?
115         if (!isset($GLOBALS[__FUNCTION__])) {
116                 // Determine it
117                 $GLOBALS[__FUNCTION__] = getConfig('auto_purge');
118         } // END - if
119
120         // Return cache
121         return $GLOBALS[__FUNCTION__];
122 }
123
124 // "Getter" for ap_dm_timeout
125 function getApDmTimeout () {
126         // Is there cache?
127         if (!isset($GLOBALS[__FUNCTION__])) {
128                 // Determine it
129                 $GLOBALS[__FUNCTION__] = getConfig('ap_dm_timeout');
130         } // END - if
131
132         // Return cache
133         return $GLOBALS[__FUNCTION__];
134 }
135
136 // "Getter" for ap_tasks_time
137 function getApTasksTime () {
138         // Is there cache?
139         if (!isset($GLOBALS[__FUNCTION__])) {
140                 // Determine it
141                 $GLOBALS[__FUNCTION__] = getConfig('ap_tasks_time');
142         } // END - if
143
144         // Return cache
145         return $GLOBALS[__FUNCTION__];
146 }
147
148 // "Getter" for ap_unconfirmed_time
149 function getApUnconfirmedTime () {
150         // Is there cache?
151         if (!isset($GLOBALS[__FUNCTION__])) {
152                 // Determine it
153                 $GLOBALS[__FUNCTION__] = getConfig('ap_unconfirmed_time');
154         } // END - if
155
156         // Return cache
157         return $GLOBALS[__FUNCTION__];
158 }
159
160 // [EOF]
161 ?>