51f3f158006be7c720109620d365db4cc2b6f772
[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  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
41         die();
42 }
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 if (isFormSent()) {
48         // First merge temporarily the new API data into the current config
49         mergeConfig(postRequestArray());
50
51         // Let's test the API first (hold your horses here, cowboy! Thank you. :) )
52         if (WERNIS_TEST_API()) {
53                 // Revert german commata
54                 foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
55                         setRequestPostElement('wernis_'.$revert, convertCommaToDot(postRequestElement('wernis_'.$revert)));
56                 } // END - if
57
58                 // Hash the password and remove clear-text
59                 setRequestPostElement('wernis_pass_md5', md5(postRequestElement('wernis_pass')));
60                 unsetPostRequestElement('wernis_pass');
61
62                 // Save settings
63                 adminSaveSettingsFromPostData();
64         } else {
65                 // Failed to test the API!
66                 loadTemplate('admin_settings_saved', false, GET_WERNIS_ERROR_MESSAGE());
67         }
68 }  else {
69         // Prepare data for template output
70         $content = array(
71                 'payout_factor'            => translateComma(getConfig('wernis_payout_factor')),
72                 'withdraw_factor'          => translateComma(getConfig('wernis_withdraw_factor')),
73                 'payout_fee_percent'       => translateComma(getConfig('wernis_payout_fee_percent')),
74                 'withdraw_fee_percent'     => translateComma(getConfig('wernis_withdraw_fee_percent')),
75                 'wernis_payout_active_y'   => '',
76                 'wernis_payout_active_n'   => '',
77                 'wernis_withdraw_active_y' => '',
78                 'wernis_withdraw_active_n' => '',
79         );
80
81         // Prepare payout Y/N selection
82         foreach (array('wernis_payout_active', 'wernis_withdraw_active') as $entry) {
83                 $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
84         } // END - foreach
85
86         // Load template
87         loadTemplate('admin_config_wernis', false, $content);
88 }
89
90 // [EOF]
91 ?>