X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_wernis.php;h=95b848394f753b7e7c5d64f80ae5e517592a3c04;hb=095f5ab59b539834d2c67e5d409d01820e10d8be;hp=cc482bf93271512fa0dcbcfa087e742defddb427;hpb=e8ca54fe91872ab95a6ffdc4f1268bf18889021d;p=mailer.git diff --git a/inc/modules/admin/what-config_wernis.php b/inc/modules/admin/what-config_wernis.php index cc482bf932..95b848394f 100644 --- a/inc/modules/admin/what-config_wernis.php +++ b/inc/modules/admin/what-config_wernis.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2016 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -43,43 +43,42 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addYouAreHereLink('admin', __FILE__); -if (isFormSent()) { - // First merge temporarily the new API data into the current config - mergeConfig(postRequestArray()); +// Form sent? +if (isFormSent('save_config')) { + // Is wernis_pass set? + if (isPostRequestElementSet('wernis_pass')) { + // Hash the password and remove clear-text + setPostRequestElement('wernis_pass_md5', hashSha256(postRequestElement('wernis_pass'))); - // Let's test the API first (hold your horses here, cowboy! Thank you. :) ) - if (WERNIS_TEST_API()) { - // Revert german commata - foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) { - setPostRequestParameter('wernis_' . $revert, postRequestParameter('wernis_' . $revert)); - } // END - if + // First merge temporarily the new API data into the current config + mergeConfig(postRequestArray()); - // Hash the password and remove clear-text - setPostRequestParameter('wernis_pass_md5', md5(postRequestParameter('wernis_pass'))); - unsetPostRequestParameter('wernis_pass'); + // Let's test the API first (hold your horses here, cowboy! Thank you. :) ) + if (doAdminTestWernisApi()) { + // Revert german commata + foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) { + setPostRequestElement('wernis_' . $revert, postRequestElement('wernis_' . $revert)); + } // END - if - // Save settings - adminSaveSettingsFromPostData(); - } else { - // Failed to test the API! - loadTemplate('admin_settings_saved', false, GET_WERNIS_ERROR_MESSAGE()); - } -} else { - // Prepare data for template output - $content = array( - 'wernis_payout_active_y' => '', - 'wernis_payout_active_n' => '', - 'wernis_withdraw_active_y' => '', - 'wernis_withdraw_active_n' => '', - ); + // Remove clear password + unsetPostRequestElement('wernis_pass'); - // Prepare payout Y/N selection - foreach (array('wernis_payout_active', 'wernis_withdraw_active') as $entry) { - $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"'; - } // END - foreach + // Save settings + adminSaveSettingsFromPostData(); + } else { + // Failed to test the API! + displayMessage(getWernisErrorMessage()); + } + } else { + // Remove clear password + unsetPostRequestElement('wernis_pass'); + // Save it, anyway + adminSaveSettingsFromPostData(); + } +} else { // Load template - loadTemplate('admin_config_wernis', false, $content); + loadTemplate('admin_config_wernis'); } // [EOF]