090fa4348ac6551de87b9777ca931edc53a8b120
[mailer.git] / inc / modules / member / what-doubler.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 02/17/2005 *
4  * ================                             Last change: 02/17/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-doubler.php                                 *
8  * -------------------------------------------------------------------- *
9  * Short description : General doubling informations                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Allgemeine Informationen zum Verdoppen           *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } elseif (!IS_MEMBER()) {
39         LOAD_URL("modules.php[5~?module=index");
40 } elseif ((!EXT_IS_ACTIVE("doubler")) && (!IS_ADMIN())) {
41         addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "doubler");
42         return;
43 }
44
45 // Add description as navigation point
46 ADD_DESCR("member", __FILE__);
47
48 // Percent values etc.
49 define('__CHARGE_VALUE', TRANSLATE_COMMA(getConfig('doubler_charge') * 100));
50 define('__REF_VALUE'   , TRANSLATE_COMMA(getConfig('doubler_ref') * 100));
51 define('__TOTAL_VALUE' , TRANSLATE_COMMA(getConfig('doubler_points')));
52 define('__MIN_VALUE'   , TRANSLATE_COMMA(getConfig('doubler_min')));
53 define('__MAX_VALUE'   , TRANSLATE_COMMA(getConfig('doubler_max')));
54
55 // Transfer referal ID
56 if (EXT_IS_ACTIVE("nickname")) {
57         // Load nickname from DB
58         $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
59
60         if (!empty($nick)) {
61                 // Set nickname
62                 define('__USERID', $nick);
63         } else {
64                 // Use direct userid
65                 define('__USERID', $GLOBALS['userid']);
66         }
67 } else {
68         // Use direct userid
69         define('__USERID', $GLOBALS['userid']);
70 }
71
72 // Usage counter
73 define('__DOUBLER_COUNTER', TRANSLATE_COMMA(getConfig('doubler_counter')));
74
75 // Which mail-send-mode did the admin setup?
76 switch (getConfig('doubler_send_mode')) {
77 case "DIRECT":
78         define('DOUBLER_PAYOUT_TIME', getMessage('DOUBLER_PAYOUT_TIME_DIRECT'));
79         break;
80
81 case "RESET":
82         define('DOUBLER_PAYOUT_TIME', getMessage('DOUBLER_PAYOUT_TIME_RESET'));
83         break;
84
85 default:
86         define('DOUBLER_PAYOUT_TIME', sprintf(getMessage('DOUBLER_PAYOUT_TIME_UNKNOWN'), getConfig('doubler_send_mode')));
87         DEBUG_LOG(__FILE__, __LINE__, constant('DOUBLER_PAYOUT_TIME'));
88         break;
89 }
90
91 // Generate table with already payed out doubles
92 define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], "Y", "N", "DESC"));
93
94 // Generate table with next-to-run payouts
95 define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE($GLOBALS['userid']));
96
97 // Generate table with refferal payouts
98 define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], "N", "Y", "DESC"));
99
100 // Generate timemark
101 define('__TIMEOUT_MARK', CREATE_FANCY_TIME(getConfig('doubler_timeout')));
102
103 // Points left to double
104 define('__LEFT_VALUE', TRANSLATE_COMMA(DOUBLER_GET_TOTAL_POINTS_LEFT()));
105
106 // Load template
107 LOAD_TEMPLATE("member_doubler");
108
109 //
110 ?>