]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_wernis.php
Rewrote 2 str_replace() calls to one with array()
[mailer.git] / inc / modules / admin / what-config_wernis.php
index 7acf89891c3005189802e1f4a4ec270992c34425..a5fb7df05470ad43fe3c5983070aebacefd97659 100644 (file)
@@ -43,30 +43,40 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
+// Form sent?
 if (isFormSent('save_config')) {
-       // Hash the password and remove clear-text
-       setPostRequestElement('wernis_pass_md5', hashSha256(postRequestElement('wernis_pass')));
+       // Is wernis_pass set?
+       if (isPostRequestElementSet('wernis_pass')) {
+               // Hash the password and remove clear-text
+               setPostRequestElement('wernis_pass_md5', hashSha256(postRequestElement('wernis_pass')));
 
-       // First merge temporarily the new API data into the current config
-       mergeConfig(postRequestArray());
+               // First merge temporarily the new API data into the current config
+               mergeConfig(postRequestArray());
 
-       // 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) {
-                       setPostRequestElement('wernis_' . $revert, postRequestElement('wernis_' . $revert));
-               } // END - if
+               // 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
 
+                       // Remove clear password
+                       unsetPostRequestElement('wernis_pass');
+
+                       // Save settings
+                       adminSaveSettingsFromPostData();
+               } else {
+                       // Failed to test the API!
+                       displayMessage(getWernisErrorMessage());
+               }
+       } else {
                // Remove clear password
                unsetPostRequestElement('wernis_pass');
 
-               // Save settings
+               // Save it, anyway
                adminSaveSettingsFromPostData();
-       } else {
-               // Failed to test the API!
-               displayMessage(GET_WERNIS_ERROR_MESSAGE());
        }
-}  else {
+} else {
        // Load template
        loadTemplate('admin_config_wernis');
 }