login bonus will no longer be payed when turned off, "Y/N" rewritten to 'Y/N'
[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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40  elseif (!IS_LOGGED_IN())
41 {
42         LOAD_URL(URL."/modules.php[5~?module=index");
43 }
44  elseif ((!EXT_IS_ACTIVE("doubler")) && (!IS_ADMIN()))
45 {
46         ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "doubler");
47         return;
48 }
49
50 // Add description as navigation point
51 ADD_DESCR("member", basename(__FILE__));
52
53 // Percent values etc.
54 define('__CHARGE_VALUE', TRANSLATE_COMMA($CONFIG['doubler_charge'] * 100));
55 define('__REF_VALUE'   , TRANSLATE_COMMA($CONFIG['doubler_ref'] * 100));
56 define('__TOTAL_VALUE' , TRANSLATE_COMMA($CONFIG['doubler_points']));
57 define('__MIN_VALUE'   , TRANSLATE_COMMA($CONFIG['doubler_min']));
58 define('__MAX_VALUE'   , TRANSLATE_COMMA($CONFIG['doubler_max']));
59
60 // Transfer referral ID
61 if (EXT_IS_ACTIVE("nickname"))
62 {
63         // Load nickname from DB
64         $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
65
66         if (!empty($nick))
67         {
68                 // Set nickname
69                 define('__USERID', $nick);
70         }
71          else
72         {
73                 // Use direct userid
74                 define('__USERID', $GLOBALS['userid']);
75         }
76 }
77  else
78 {
79         // Use direct userid
80         define('__USERID', $GLOBALS['userid']);
81 }
82
83 // Usage counter
84 define('__DOUBLER_COUNTER', $CONFIG['doubler_counter']);
85
86 // Which mail-send-mode did the admin setup?
87 switch ($CONFIG['doubler_send_mode'])
88 {
89 case "DIRECT":
90         define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_DIRECT);
91         break;
92
93 case "RESET":
94         define('DOUBLER_PAYOUT_TIME', DOUBLER_PAYOUT_TIME_RESET);
95         break;
96 }
97
98 // Generate table with already payed out doubles
99 define('__DOUBLER_PAYOUT_HISTORY', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], 'Y', 'N', "DESC"));
100
101 // Generate table with next-to-run payouts
102 define('__DOUBLER_PAYOUT_NEXT', DOUBLER_GENERATE_TABLE($GLOBALS['userid']));
103
104 // Generate table with refferal payouts
105 define('__DOUBLER_PAYOUT_REF', DOUBLER_GENERATE_TABLE($GLOBALS['userid'], 'N', 'Y', "DESC"));
106
107 // Generate timemark
108 define('__TIMEOUT_MARK', CREATE_FANCY_TIME($CONFIG['doubler_timeout']));
109
110 // Points left to double
111 define('__LEFT_VALUE', DOUBLER_GET_TOTAL_POINTS_LEFT());
112
113 // Load template
114 LOAD_TEMPLATE("member_doubler");
115
116 //
117 ?>