Fixed logfile writing in installation phase, .revision is now ignored
[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:: 856                                                    $ *
14  * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: stelzi                                                   $ *
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 - 2008 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')) || (!IS_ADMIN())) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42         require($INC);
43 }
44
45 // Add description as navigation point
46 ADD_DESCR("admin", __FILE__);
47
48 if (IS_FORM_SENT()) {
49         // First merge temporarily the new API data into the current config
50         mergeConfig(REQUEST_POST_ARRAY());
51
52         // Let's test the API first (hold your horses here, cowboy! Thank you. :) )
53         if (WERNIS_TEST_API()) {
54                 // Revert german commata
55                 foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
56                         REQUEST_SET_POST('wernis_'.$revert, REVERT_COMMA(REQUEST_POST('wernis_'.$revert)));
57                 } // END - if
58
59                 // Hash the password and remove clear-text
60                 REQUEST_SET_POST('wernis_pass_md5', md5(REQUEST_POST('wernis_pass')));
61                 REQUEST_UNSET_POST(('wernis_pass'));
62
63                 // Save settings
64                 ADMIN_SAVE_SETTINGS_POST();
65         } else {
66                 // Failed to test the API!
67                 LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE());
68         }
69 }  else {
70         // Prepare data for template output
71         $content = array(
72                 'min_payout'           => getConfig(('wernis_min_payout')),
73                 'min_withdraw'         => getConfig(('wernis_min_withdraw')),
74                 'api_id'               => getConfig(('wernis_api_id')),
75                 'api_md5'              => getConfig('wernis_api_md5'),
76                 'api_url'              => getConfig('wernis_api_url'),
77                 'refid'                => getConfig(('wernis_refid')),
78                 'payout_factor'        => TRANSLATE_COMMA(getConfig('wernis_payout_factor')),
79                 'withdraw_factor'      => TRANSLATE_COMMA(getConfig('wernis_withdraw_factor')),
80                 'payout_fee_percent'   => TRANSLATE_COMMA(getConfig('wernis_payout_fee_percent')),
81                 'withdraw_fee_percent' => TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_percent')),
82                 'payout_fee_fix'       => getConfig(('wernis_payout_fee_fix')),
83                 'withdraw_fee_fix'     => getConfig(('wernis_withdraw_fee_fix'))
84         );
85
86         // Prepare payout Y/N selection
87         if (getConfig('wernis_payout_active') == "Y") {
88                 // Payout allowed
89                 define('__CFG_WERNIS_PAYOUT_ACTIVE_Y', " checked=\"checked\"");
90                 define('__CFG_WERNIS_PAYOUT_ACTIVE_N', "");
91         } else {
92                 // Payout disabled
93                 define('__CFG_WERNIS_PAYOUT_ACTIVE_Y', "");
94                 define('__CFG_WERNIS_PAYOUT_ACTIVE_N', " checked=\"checked\"");
95         }
96
97         // Prepare withdraw Y/N selection
98         if (getConfig('wernis_withdraw_active') == "Y") {
99                 // Payout allowed
100                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_Y', " checked=\"checked\"");
101                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_N', "");
102         } else {
103                 // Payout disabled
104                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_Y', "");
105                 define('__CFG_WERNIS_WITHDRAW_ACTIVE_N', " checked=\"checked\"");
106         }
107
108         // Load template
109         LOAD_TEMPLATE("admin_config_wernis", false, $content);
110 }
111
112 //
113 ?>