'WERNIS_API_REQUEST_DATA_INVALID' => "Interner Fehler: Abfragedaten sind defekt!",
'WERNIS_API_REQUEST_DATA_MISSING' => "Interner Fehler: Abfragedaten sind nicht komplett!",
'WERNIS_API_REQUEST_ERROR' => "Abfragefehler: <span class=\"data\">%s</span>",
+ 'WERNIS_API_REQUEST_PROBLEM' => "Abfrageproblem: Status=<span class=\"data\">%s</span>, Rückmeldung=<span class=\"data\">%s</span>",
'WERNIS_API_REQUEST_FAILED' => "Unbekannter Fehler <span class=\"data\">%s</span> von API erhalten! Bitte im [<a href=\"http://bugs.mxchange.org\" target=\"_blank\" title=\"Direktlink zum Bug-Tracker\">Bug-Tracker posten</a>], den Fehlercode nennen und wie es dazu gekommen ist.",
'WERNIS_API_REQUEST_FAILED_AUTH' => "Authorisierung an API fehlgeschlagen! Bitte API-ID und Key überprüfen. [<a href=\"http://www.wds66.com/modules.php?module=export\" target=\"_blank\" title=\"Direkt zum WDS66-Exportaccount\">Hier</a>] direkt zum Export-Account. Sie benötigen Ihren Usernamen und Passwort!",
'WERNIS_API_REQUEST_FAILED_USER' => "Useraccount nicht gefunden oder Wernis-Passwort ist ungültig!",
'MEMBER_WERNIS_MODE_CHOOSE2' => "Hier klicken um neue Überweisung zu starten...",
'WERNIS_MEMBER_NO_ACCOUNT' => "Noch kein WDS66-Account? Hier entlang!",
'WERNIS_MEMBER_API_DATA_MISSING' => "Diese Funktion kann derzeit nicht genutzt werden, da wir sie noch einrichten müssen.",
- 'WERNIS_MEMBER_MIN_PAYOUT' => "Sie haben nicht genügend Wernis zum Auszahlen! Mindestens: <span class=\"data\">%s</span> Wernis.",
+ 'WERNIS_MEMBER_MIN_PAYOUT' => "Sie haben nicht genügend Wernis zum Auszahlen! Mindestens: <span class=\"data\">%s</span>, Ihr Guthaben: <span class=\"data\">%s</span> Wernis.",
'WERNIS_MEMBER_WITHDRAW_TITLE' => "Wernis bei {?MAIN_TITLE?} einzahlen:",
'WERNIS_MEMBER_WITHDRAW_POINTS_ACCOUNT' => "Wernis hier im Account:",
'WERNIS_MEMBER_WITHDRAW_MIN_POINTS' => "Mindest einzuzahlendes Wernis-Guthaben:",
} // END - if
// All (maybe) fine so remove the response header from server
+ $responseLine = '*INVALID*';
for ($idx = (count($response) - 1); $idx > 1; $idx--) {
$line = trim($response[$idx]);
if (!empty($line)) {
- $response = $line;
+ $responseLine = $line;
break;
- }
- }
+ } // END - if
+ } // END - for
- // Prepare the returning result for higher functions
- if (substr($response, 0, 1) == '&') {
- // Remove the leading & (which can be used in Flash)
- $response = substr($response, 1);
+ // Is the response leaded by a & symbol?
+ if (substr($responseLine, 0, 1) != '&') {
+ // Something badly happened on server-side
+ return array(
+ 'status' => 'request_problem',
+ 'message' => sprintf(getMessage('WERNIS_API_REQUEST_PROBLEM'), $response[0], htmlentities($responseLine))
+ );
} // END - if
+ // Remove the leading & (which can be used in Flash)
+ $responseLine = substr($responseLine, 1);
+
// Bring back the response
- $data = explode('=', $response);
+ $data = explode('=', $responseLine);
// Default return array (should not stay empty)
$return = array();
// All fine here
$return = array(
'status' => 'OK',
- 'response' => $response
+ 'response' => $responseLine
);
}
// Prepare the request data
$requestData = array(
'sub_request' => 'receive',
- 't_userid' => bigintval($wdsId),
+ 't_uid' => bigintval($wdsId),
't_md5' => $userMd5,
- 'r_userid' => getConfig('wernis_refid'),
+ 'r_uid' => getConfig('wernis_refid'),
'amount' => bigintval($amount),
'purpose' => encodeString($purpose, false)
);
// Prepare the request data
$requestData = array(
'sub_request' => 'send',
- 't_userid' => getConfig('wernis_refid'),
+ 't_uid' => getConfig('wernis_refid'),
't_md5' => getConfig('wernis_pass_md5'),
- 'r_userid' => bigintval($wdsId),
+ 'r_uid' => bigintval($wdsId),
'amount' => bigintval($amount),
'purpose' => encodeString($purpose, false)
);
}
// Wrapper for $_POST and adminSaveSettings
-function adminSaveSettingsFromPostData ($tableName = "_config", $whereStatement = "config=0", $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = 'config=0', $translateComma = array(), $alwaysAdd = false) {
// Get the array
$postData = postRequestArray();
}
// Save settings to the database
-function adminSaveSettings (&$postData, $tableName = "_config", $whereStatement = "config=0", $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = 'config=0', $translateComma = array(), $alwaysAdd = false) {
// Prepare all arrays, variables
$DATA = array();
$skip = false;
if (WERNIS_TEST_API()) {
// Revert german commata
foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) {
- setRequestPostElement('wernis_'.$revert, convertCommaToDot(postRequestElement('wernis_'.$revert)));
+ setRequestPostElement('wernis_' . $revert, postRequestElement('wernis_' . $revert));
} // END - if
// Hash the password and remove clear-text
} else {
// Prepare data for template output
$content = array(
- 'payout_factor' => translateComma(getConfig('wernis_payout_factor')),
- 'withdraw_factor' => translateComma(getConfig('wernis_withdraw_factor')),
- 'payout_fee_percent' => translateComma(getConfig('wernis_payout_fee_percent')),
- 'withdraw_fee_percent' => translateComma(getConfig('wernis_withdraw_fee_percent')),
'wernis_payout_active_y' => '',
'wernis_payout_active_n' => '',
'wernis_withdraw_active_y' => '',
// Is this enougth for a payout?
if ($points < getConfig('wernis_min_payout')) {
// No, then abort here
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_MIN_PAYOUT'), translateComma(getConfig('wernis_min_payout'))));
+ loadTemplate('admin_settings_saved', false, sprintf(
+ getMessage('WERNIS_MEMBER_MIN_PAYOUT'),
+ translateComma(getConfig('wernis_min_payout')),
+ translateComma($points)
+ ));
return;
} // END - if
} else {
// Check input data depending on the mode and execute the requested mode
switch (getRequestElement('mode')) {
- case "withdraw": // Widthdraws WDS66 -> This exchange
+ case 'withdraw': // Widthdraws WDS66 -> This exchange
if (postRequestElement('amount') < getConfig('wernis_min_withdraw')) {
// Not enougth entered!
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), getConfig(('wernis_min_withdraw'))));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), translateComma(getConfig('wernis_min_withdraw'))));
} else {
// All is fine here so do the withdraw
$success = WERNIS_EXECUTE_WITHDRAW(postRequestElement('wds66_id'), md5(postRequestElement('wds66_password')), postRequestElement('amount'));
// All done!
loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_WITHDRAW_DONE'));
return;
- } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed")) {
+ } elseif ((GET_WERNIS_ERROR_CODE() == 'user_failed') || (GET_WERNIS_ERROR_CODE() == 'own_failed') || (GET_WERNIS_ERROR_CODE() == 'amount_failed')) {
// Wrong login data
loadTemplate('admin_settings_saved', false, GET_WERNIS_ERROR_MESSAGE());
} else {
case 'payout': // Payout this exchange -> WDS66
if (postRequestElement('amount') < getConfig('wernis_min_payout')) {
// Not enougth entered!
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), getConfig(('wernis_min_payout'))));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), translateComma(getConfig('wernis_min_payout'))));
} elseif (postRequestElement('amount') > $points) {
// Not enougth points left!
loadTemplate('admin_settings_saved', false, sprintf(getMessage('WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestElement('amount')), bigintval($points)));