cfa9132c55b6c6f2cb16a2fd33c4035f48eeff51
[mailer.git] / inc / modules / admin / what-config_wernis.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 12/26/2007 *
4  * ================                             Last change: 12/26/2007 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_wernis.php                           *
8  * -------------------------------------------------------------------- *
9  * Short description : Configure wernis sub-system                      *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Auszahlungensarten editieren                     *
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')) || (!IS_ADMIN())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
42
43 if (isset($_POST['ok'])) {
44         // First merge temporarily the new API data into the current config
45         global $_CONFIG;
46         $_CONFIG = merge_array($_CONFIG, $_POST);
47
48         // Let's test the API first (hold your horses here, cowboy! Thank you. :) )
49         if (WERNIS_TEST_API()) {
50                 // Revert german commata
51                 foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
52                         $_POST['wernis_'.$revert] = REVERT_COMMA($_POST['wernis_'.$revert]);
53                 } // END - if
54
55                 // Hash the password and remove clear-text
56                 $_POST['wernis_pass_md5'] = md5($_POST['wernis_pass']);
57                 unset($_POST['wernis_pass']);
58
59                 // Save settings
60                 ADMIN_SAVE_SETTINGS($_POST);
61         } else {
62                 // Failed to test the API!
63                 LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE());
64         }
65 }  else {
66         // Prepare data for template output
67         $content = array(
68                 'min_payout'           => bigintval(getConfig('wernis_min_payout')),
69                 'min_withdraw'         => bigintval(getConfig('wernis_min_withdraw')),
70                 'api_id'               => bigintval(getConfig('wernis_api_id')),
71                 'api_md5'              => getConfig('wernis_api_md5'),
72                 'api_url'              => getConfig('wernis_api_url'),
73                 'refid'                => bigintval(getConfig('wernis_refid')),
74                 'payout_factor'        => TRANSLATE_COMMA(getConfig('wernis_payout_factor')),
75                 'withdraw_factor'      => TRANSLATE_COMMA(getConfig('wernis_withdraw_factor')),
76                 'payout_fee_percent'   => TRANSLATE_COMMA(getConfig('wernis_payout_fee_percent')),
77                 'withdraw_fee_percent' => TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_percent')),
78                 'payout_fee_fix'       => bigintval(getConfig('wernis_payout_fee_fix')),
79                 'withdraw_fee_fix'     => bigintval(getConfig('wernis_withdraw_fee_fix'))
80         );
81
82         // Prepare payout Y/N selection
83         if (getConfig('wernis_payout_active') == "Y") {
84                 // Payout allowed
85                 define('__CFG_WERNIS_PAYOUT_ACTIVE_Y', " checked=\"checked\"");
86                 define('__CFG_WERNIS_PAYOUT_ACTIVE_N', "");
87         } else {
88                 // Payout disabled
89                 define('__CFG_WERNIS_PAYOUT_ACTIVE_Y', "");
90                 define('__CFG_WERNIS_PAYOUT_ACTIVE_N', " checked=\"checked\"");
91         }
92
93         // Prepare withdraw Y/N selection
94         if (getConfig('wernis_withdraw_active') == "Y") {
95                 // Payout allowed
96                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_Y', " checked=\"checked\"");
97                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_N', "");
98         } else {
99                 // Payout disabled
100                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_Y', "");
101                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_N', " checked=\"checked\"");
102         }
103
104         // Load template
105         LOAD_TEMPLATE("admin_config_wernis", false, $content);
106 }
107
108 //
109 ?>