]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_wernis.php
introduced isSqlResult() which encapsulates checking MySQL/i results
[mailer.git] / inc / modules / admin / what-config_wernis.php
index 7acf89891c3005189802e1f4a4ec270992c34425..95b848394f753b7e7c5d64f80ae5e517592a3c04 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
+ * 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 *
@@ -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');
 }