ADD_DESCR("admin", basename(__FILE__));
if (isset($_POST['ok'])) {
- // Save settings
- ADMIN_SAVE_SETTINGS($_POST, "_config", "config='0'");
+ // First merge temporarily the new API data into the current config
+ $_CONFIG = array_merge($_CONFIG, $_POST);
+
+ // Let's test the API first (hold your horses here, cowboy! Thanks. :) )
+ if (WERNIS_TEST_API()) {
+ // Save settings
+ ADMIN_SAVE_SETTINGS($_POST);
+ } else {
+ // Failed to test the API!
+ LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE());
+ }
} else {
// Prepare data for template output
$content = array(
- 'min_amount' => $CONFIG['wernis_min_amount'],
- 'api_id' => $CONFIG['wernis_api_id'],
- 'api_md5' => $CONFIG['wernis_api_md5']
+ 'min_payout' => bigintval($_CONFIG['wernis_min_payout']),
+ 'min_withdraw' => bigintval($_CONFIG['wernis_min_withdraw']),
+ 'api_id' => bigintval($_CONFIG['wernis_api_id']),
+ 'api_md5' => $_CONFIG['wernis_api_md5'],
+ 'api_url' => $_CONFIG['wernis_api_url'],
+ 'refid' => bigintval($_CONFIG['wernis_refid'])
);
// Load template