2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/19/2003 *
4 * =================== Last change: 08/12/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-points.php *
8 * -------------------------------------------------------------------- *
9 * Short description : All your collected points... *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Ihrer gesammelten Punkte *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Sets a status message and code
44 function setWernisStatusMessage ($message, $status) {
45 $GLOBALS['wernis_data']['message'] = $message;
46 $GLOBALS['wernis_data']['status'] = $status;
49 // Get the status message
50 function getWernisErrorMessage () {
51 if (isset($GLOBALS['wernis_data']['message'])) {
53 return $GLOBALS['wernis_data']['message'];
54 } elseif (isset($GLOBALS['wernis_data']['status'])) {
55 // Fall-back to status
56 return '{%message,WERNIS_ERROR_STATUS=' . $GLOBALS['wernis_data']['status'] . '%}';
58 // Something bad happend
59 return '{--WERNIS_UNKNOWN_ERROR--}';
63 // Get the status code
64 function getWernisErrorCode () {
65 if (isset($GLOBALS['wernis_data']['status'])) {
67 return $GLOBALS['wernis_data']['status'];
69 // Something bad happend
70 return '{--WERNIS_UNKNOWN_ERROR--}';
74 // Sends out a request to the API and returns it's result
75 function sendWernisApiRequest ($scriptName, $requestData = array()) {
76 // Is the requestData an array?
77 if (!is_array($requestData)) {
80 'status' => 'failed_general',
81 'message' => '{--WERNIS_API_REQUEST_DATA_INVALID--}'
85 // Is the API id and MD5 hash there?
86 if ((getWernisApiId() == '') || (getWernisApiMd5() == '')) {
89 'status' => 'failed_general',
90 'message' => '{--WERNIS_API_REQUEST_DATA_MISSING--}'
94 // Add more request data
95 $requestData['api_id'] = getWernisApiId();
96 $requestData['api_key'] = getWernisApiMd5();
98 // Is a purpose there?
99 if (!empty($requestData['purpose'])) {
101 eval('$purpose = "' . doFinalCompilation($requestData['purpose'], FALSE) . '";');
103 // Prepare the purpose, it needs encoding
104 $requestData['purpose'] = encodeString($purpose);
107 // Construct the request string
108 $requestString = getWernisApiUrl() . $scriptName;
110 // Get the raw response from the lower function
111 $response = sendHttpPostRequest($requestString, $requestData);
113 // Check the response header if all is fine
114 if (!isHttpStatusOkay($response[0])) {
115 // Something bad happend... :(
117 'status' => 'request_error',
118 'message' => '{%message,WERNIS_API_REQUEST_ERROR=' . $response[0] . '%}'
122 // All (maybe) fine so remove the response header from server
123 $responseLine = '*INVALID*';
124 for ($idx = (count($response) - 1); $idx > 1; $idx--) {
125 $line = trim($response[$idx]);
127 $responseLine = $line;
132 // Is the response leaded by a & symbol?
133 if (substr($responseLine, 0, 1) != '&') {
134 // Something badly happened on server-side
136 'status' => 'request_problem',
137 'message' => sprintf(getMessage('WERNIS_API_REQUEST_PROBLEM'), $response[0], secureString($responseLine))
141 // Remove the leading & (which can be used in Flash)
142 $responseLine = substr($responseLine, 1);
144 // Bring back the response
145 $data = explode('=', $responseLine);
147 // Default return array (should not stay empty)
150 // We use only the first two entries (which shall be fine)
151 if ($data[0] === 'error') {
152 // The request has failed... :(
154 case '404': // Invalid API id
155 case 'AUTH': // Authorization has failed
157 'status' => 'auth_failed',
158 'message' => '{--WERNIS_API_REQUEST_FAILED_AUTH--}'
162 case 'LOCKED': // User account is locked!
163 case 'PASS': // Bad passphrase entered
164 case 'USER': // Missing account or invalid password
166 'status' => 'user_failed',
167 'message' => '{--WERNIS_API_REQUEST_FAILED_USER--}'
171 case 'OWN': // Transfer to own account
173 'status' => 'own_failed',
174 'message' => '{--WERNIS_API_REQUEST_FAILED_OWN--}'
178 case 'AMOUNT': // Amount is depleted
180 'status' => 'amount_failed',
181 'message' => '{--WERNIS_API_REQUEST_FAILED_AMOUNT--}'
185 case 'AMOUNT-SEND': // API amount is depleted
187 'status' => 'api_amount_failed',
188 'message' => '{--WERNIS_API_REQUEST_FAILED_API_AMOUNT--}'
192 default: // Unknown error (maybe new?)
193 logDebugMessage(__FUNCTION__, __LINE__, sprintf('Unknown error %s from WDS66 API received.', $data[1]));
195 'status' => 'request_failed',
196 'message' => '{%message,WERNIS_API_REQUEST_FAILED=' . $data[1] . '%}'
204 'response' => $responseLine
212 // Tests the function by calling balance.php on the API
213 function doAdminTestWernisApi () {
217 // Result is always failed
220 // Prepare the request data
221 $requestData = array(
222 't_uid' => getWernisRefid(),
223 't_md5' => getWernisPassMd5()
226 // Return the result from the lower functions
227 $return = sendWernisApiRequest('balance.php', $requestData);
229 // Did it went smoothly?
230 if (isHttpResponseStatusOkay($return)) {
234 // Status failure text
235 setWernisStatusMessage($return['message'], $return['status']);
242 // Widthdraw this amount
243 function executeWernisApiWithdraw ($wdsId, $userMd5, $amount) {
244 // Is the sponsor extension installed?
245 if (!isWernisWithdrawActive()) {
246 if (!isExtensionActive('sponsor')) {
249 } elseif (!isSponsor()) {
250 // No sponsor, not allowed to withdraw!
255 // Default is failed attempt
258 // Prepare the request data
259 $requestData = array(
260 'sub_request' => 'receive',
261 't_uid' => bigintval($wdsId),
263 'r_uid' => getWernisRefid(),
264 'amount' => bigintval($amount),
265 'purpose' => getMaskedMessage('WERNIS_API_PURPOSE_WITHDRAW', getMemberId())
268 // Return the result from the lower functions
269 $return = sendWernisApiRequest('book.php', $requestData);
271 if (isHttpResponseStatusOkay($return)) {
276 logWernisTransfer($wdsId, $amount, 'WITHDRAW');
278 // Status failure text
279 setWernisStatusMessage($return['message'], $return['status']);
282 logWernisTransfer($wdsId, $amount, 'FAILED', $return['message'], $return['status']);
289 // Payout this amount
290 function executeWernisApiPayout ($wdsId, $amount) {
291 // Default is failed attempt
294 // Prepare the request data
295 $requestData = array(
296 'sub_request' => 'send',
297 't_uid' => getWernisRefid(),
298 't_md5' => getWernisPassMd5(),
299 'r_uid' => bigintval($wdsId),
300 'amount' => bigintval($amount),
301 'purpose' => getMaskedMessage('WERNIS_API_PURPOSE_PAYOUT', getMemberId())
304 // Return the result from the lower functions
305 $return = sendWernisApiRequest('book.php', $requestData);
307 if (isHttpResponseStatusOkay($return)) {
312 logWernisTransfer($wdsId, $amount, 'PAYOUT');
314 // Status failure text
315 setWernisStatusMessage($return['message'], $return['status']);
318 logWernisTransfer($wdsId, $amount, 'FAILED', $return['message'], $return['status']);
325 // Execute auth.php request
326 function executeWernisApiAuth ($wernisId, $wernisPassword) {
327 // Prepare request data
328 $requestData = array(
329 't_uid' => bigintval($wernisId),
330 't_md5' => hashSha256($wernisPassword),
334 $return = sendWernisApiRequest('auth.php', $requestData);
340 // Execute get.php reguest with given auth data (not all are used)
341 function executeWernisApiGet ($authData, $subRequest, $fields) {
342 // It must be an array
343 assert(is_array($authData));
345 // Check required array elements
346 assert(isset($authData['wernis_userid']));
347 assert(isset($authData['api_auth_key']));
348 assert(isset($authData['api_redirect_challenge']));
350 // Then create request array
351 $requestData = array(
352 'sub_request' => $subRequest,
354 't_uid' => bigintval($authData['wernis_userid']),
355 'auth_key' => $authData['api_auth_key'],
356 'challenge' => $authData['api_redirect_challenge']
360 $return = sendWernisApiRequest('get.php', $requestData);
366 // Translate the status IN/OUT
367 function translateWernisTransferStatus ($status) {
368 // Default status is unknown
369 $return = '{%message,WERNIS_STATUS_UNKNWOWN=' . $status . '%}';
371 // Construct message id
372 $messageId = 'WERNIS_STATUS_' . $status;
375 if (isMessageIdValid($messageId)) {
376 // Then use it as message string
377 $return = '{--' . $messageId . '--}';
385 function logWernisTransfer ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') {
386 // Register this wernis movement
387 sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_wernis` (`userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`, `wernis_api_message`, `wernis_api_status`) VALUES (%s, %s, %s, UNIX_TIMESTAMP(), '%s', '%s', '%s')",
395 ), __FUNCTION__, __LINE__);
398 // Calulcate fees and factor
399 function calculateWernisFee ($points, $mode) {
400 // Payout or withdraw are allowed modes!
401 //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
402 if (!in_array($mode, array('payout', 'withdraw'))) {
403 // Log error and abort
404 logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points . ' - unknown mode detected.');
408 // Is there a percentage or fixed fee?
409 if (getConfig('wernis_' . $mode . '_fee_percent') > 0) {
411 $points -= $points * getConfig('wernis_'.$mode.'_fee_percent') / 100;
412 } elseif (getConfig('wernis_' . $mode . '_fee_fix') > 0) {
414 $points -= getConfig('wernis_' . $mode . '_fee_fix');
417 // Divide/multiply the factor
418 if ($mode == 'payout') {
420 $points = $points / getWernisPayoutFactor();
422 // Multiply for withdraw
423 $points = $points * getWernisWithdrawFactor();
427 //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
431 // Add withdraw fees and factor
433 function calulcateWernisWithdrawFee ($points) {
434 // Is there a percentage or fixed fee?
435 if (getWernisWithdrawFeePercent() > 0) {
437 $points += $points * getWernisWithdrawFeePercent() / 100;
438 } elseif (getWernisWithdrawFeeFix() > 0) {
440 $points += getWernisWithdrawFeeFix();
447 // Displays registration form for WDS66 registration
448 function doDisplayWernisUserRegistrationForm () {
450 if (isFormSent('register')) {
452 if (!isPostRequestElementSet('wernis_id')) {
454 displayMessage('{--GUEST_WERNIS_REGISTRATION_ID_NOT_SET--}');
455 } elseif (!isPostRequestElementSet('wernis_password')) {
457 displayMessage('{--GUEST_WERNIS_REGISTRATION_PASSWORD_NOT_SET--}');
459 // So far, all fine, then let's do the call-back on auth.php ...
460 $response = executeWernisApiAuth(postRequestElement('wernis_id'), postRequestElement('wernis_password'));
462 // Was the status okay?
463 if (isHttpResponseStatusOkay($response)) {
464 // All fine, then analyze API response
465 $args = convertApiResponseToArray($response['response'], '&', '=');
468 assert(isset($args['auth_status']));
471 $args['wernis_userid'] = postRequestElement('wernis_id');
473 // "Detect" auth status
474 $callbackFunction = 'doWernisAuth' . capitalizeUnderscoreString($args['auth_status']);
476 // Is the call-back there?
477 if (!is_callable($callbackFunction, FALSE, $callableName)) {
478 // Not there, could be bad. :(
479 reportBug(__FUNCTION__, __LINE__, 'Unsupported auth_status=' . $args['auth_status'] . ',args()=' . count($args) . ',callbackFunction=' . $callbackFunction . ' detected.');
483 $status = call_user_func($callbackFunction, $args);
485 // @TODO Something more to do here?
486 die(__FUNCTION__ . ':' . __LINE__ . ': status[' . gettype($status) . ']=' . $status . ' - Unfinished.');
488 // Something bad happened
489 displayMessage($response['message']);
494 // Is there a challenge + response?
495 if ((isGetRequestElementSet('status')) && (isGetRequestElementSet('challenge')) && (isGetRequestElementSet('__challenge_response'))) {
496 // Redirect from modules.php?module=auth, so validate challenge response ...
497 // 1) Get first 24 characters = salt
498 $salt = substr(getRequestElement('__challenge_response'), 0, 24);
500 // 2) Generate hash for challenge response
501 $challengeResponse = $salt . hashSha256($salt . getWernisApiMd5() . getRequestElement('challenge'));
503 // Is the response valid?
504 if ($challengeResponse != getRequestElement('__challenge_response')) {
506 displayMessage('{--GUEST_WERNIS_REGISTRATION_INVALID_CHALLENGE_RESPONSE--}');
511 * Now, that the challenge-response is the same, the challenge itself
512 * is also the same. Next get the data from wernis_regs table by
513 * challenge. There is currently no other way to get the data as there
514 * is no Wernis user id provided. Later on the stored challenge response
515 * can be compared with provided.
517 $return = doWernisFinishUserRegistration(getRequestElement('challenge'), getRequestElement('__challenge_response'), getRequestElement('status'));
519 // Is the registration finished?
520 if ($return === FALSE) {
521 // No, then abort here silently as the function should have already displayed a message
524 } elseif (!isFormSent('register')) {
525 // Form not send, so load form template
526 loadTemplate('guest_wernis_registration_form');
530 // Finish user registration with WDS66 API
531 function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status) {
532 // Get stored registration data
533 $rows = getWernisRegistrationDataByKey('api_redirect_challenge', $challenge);
535 // Zero result found?
536 if (count($rows) == 0) {
538 displayMessage('{--GUEST_WERNIS_REGISTRATION_ZERO_ROWS_FOUND--}');
541 loadTemplate('guest_wernis_registration_form');
545 // Check status from GET parameters and stored value
546 if ($status == '1') {
547 // Has the auth status changed?
548 if ($rows[0]['api_auth_status'] != 'ACCEPTED') {
550 * The authorization of this application has been accepted, so
551 * update it and ignore result from function because the update
554 updateWernisRegistrationStatusByKey('api_redirect_challenge', $challenge, 'ACCEPTED');
557 // Now call "get.php"
558 // @TODO Hard-coded value (anrede, etc.)
559 $response = executeWernisApiGet($rows[0], 'data', 'anrede|vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email');
561 // Was the status okay?
562 if (isHttpResponseStatusOkay($response)) {
563 // API returned non-errous response, 'data=' must be found
564 assert(substr($response['response'], 0, 5) == 'data=');
566 // And remove it, this is now BASE64-encoded
567 $encodedData = urldecode(substr($response['response'], 5));
569 // And decode it (all steps separated to later "easily" debug them)
570 $decodedData = base64_decode($encodedData);
573 * Do some checks on the decoded string, it should be a
574 * serialized array with 10 entries (see above
575 * executeWernisApiGet() call).
577 assert(substr($decodedData, 0, 6) == 'a:10:{');
578 assert(substr($decodedData, -1, 1) == '}');
580 // The array seems to be fine, unserialize it
581 $userData = unserialize($decodedData);
582 die(__FUNCTION__.'<pre>'.print_r($userData, TRUE).'</pre>');
584 // Something bad happened
585 displayMessage($response['message']);
589 // Status does not need to be changed
593 // Updates auth status by given key/value pair
594 function updateWernisRegistrationStatusByKey ($key, $value, $newStatus) {
596 sqlQueryEscaped("UPDATE
597 `{?_MYSQL_PREFIX?}_wernis_regs`
599 `api_auth_status`='%s'
602 `api_auth_status` != '%s'
609 ), __FUNCTION__, __LINE__
612 // Check if rows as been affected
613 return ifSqlHasZeroAffectedRows();
616 // "Getter" for Wernis registration data by given key and value
617 function getWernisRegistrationDataByKey ($key, $value, $limit = 1) {
622 $result = sqlQueryEscaped("SELECT
627 `api_redirect_challenge`,
628 UNIX_TIMESTAMP(`record_inserted`) AS `record_inserted`
630 `{?_MYSQL_PREFIX?}_wernis_regs`
640 ), __FUNCTION__, __LINE__
643 // Is there an entry?
644 if (sqlNumRows($result) > 0) {
645 // At least one entry has been found, so loop through all
646 while ($row = sqlFetchArray($result)) {
648 array_push($rows, $row);
653 sqlFreeResult($result);
655 // Return found entries
659 //-----------------------------------------------------------------------------
660 // Auth status callback functions
661 //-----------------------------------------------------------------------------
663 // Handler for auth_status=PENDING
664 function doWernisAuthPending ($args) {
665 // $args must always be an array
666 assert(is_array($args));
668 // auth_key and wernis_userid must be set
669 assert(isset($args['auth_key']));
670 assert(isset($args['wernis_userid']));
672 // Generate a challenge that will be added to the URL
673 $challenge = hashSha256(generatePassword(128));
675 // Search entry in database by auth_key
676 if (countSumTotalData($args['auth_key'], 'wernis_regs', 'id', 'api_auth_key', TRUE) == 0) {
677 // "Register" this call
678 sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_wernis_regs` (
682 `api_redirect_challenge`
690 bigintval($args['wernis_userid']),
693 ), __FUNCTION__, __LINE__
696 // Should be inserted
697 assert(sqlAffectedRows() == 1);
700 sqlQueryEscaped("UPDATE
701 `{?_MYSQL_PREFIX?}_wernis_regs`
703 `api_redirect_challenge`='%s'
705 `api_auth_key`='%s' AND
707 `api_auth_status`='PENDING'
712 bigintval($args['wernis_userid'])
713 ), __FUNCTION__, __LINE__
716 // Should always be updated
717 assert(sqlAffectedRows() == 1);
720 // Redirect to WDS66 module=auth ...
721 redirectToUrl(getWernisBaseUrl() . '/modules.php?module=auth&auth_key=' . $args['auth_key'] . '&params=' . urlencode(base64_encode('&module=' . getModule() . '&what=' . getWhat())) . '&challenge=' . $challenge);
724 // Handler for auth_status=ACCEPTED
725 function doWernisAuthAccepted ($args) {
726 // $args must always be an array
727 assert(is_array($args));
729 // auth_key and wernis_userid must be set
730 assert(isset($args['auth_key']));
731 assert(isset($args['wernis_userid']));
733 die(__FUNCTION__ . '<pre>'.print_r($args, TRUE).'</pre>');
736 //-----------------------------------------------------------------------------
738 //-----------------------------------------------------------------------------
740 // Wrapper function for 'wernis_refid'
741 function getWernisRefid () {
743 if (!isset($GLOBALS[__FUNCTION__])) {
745 $GLOBALS[__FUNCTION__] = getConfig('wernis_refid');
749 return $GLOBALS[__FUNCTION__];
752 // Wrapper function for 'wernis_pass_md5'
753 function getWernisPassMd5 () {
755 if (!isset($GLOBALS[__FUNCTION__])) {
757 $GLOBALS[__FUNCTION__] = getConfig('wernis_pass_md5');
761 return $GLOBALS[__FUNCTION__];
764 // Wrapper function for 'wernis_api_id'
765 function getWernisApiId () {
767 if (!isset($GLOBALS[__FUNCTION__])) {
769 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_id');
773 return $GLOBALS[__FUNCTION__];
776 // Wrapper function for 'wernis_api_md5'
777 function getWernisApiMd5 () {
779 if (!isset($GLOBALS[__FUNCTION__])) {
781 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_md5');
785 return $GLOBALS[__FUNCTION__];
788 // Wrapper function for 'wernis_api_url'
789 function getWernisApiUrl () {
791 if (!isset($GLOBALS[__FUNCTION__])) {
793 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_url');
797 return $GLOBALS[__FUNCTION__];
800 // Wrapper function for 'wernis_withdraw_active'
801 function getWernisWithdrawActive () {
803 if (!isset($GLOBALS[__FUNCTION__])) {
805 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_active');
809 return $GLOBALS[__FUNCTION__];
812 // Wrapper function for 'wernis_payout_active'
813 function getWernisPayoutActive () {
815 if (!isset($GLOBALS[__FUNCTION__])) {
817 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_active');
821 return $GLOBALS[__FUNCTION__];
824 // Wrapper function for 'wernis_withdraw_active'
825 function isWernisWithdrawActive () {
827 if (!isset($GLOBALS[__FUNCTION__])) {
829 $GLOBALS[__FUNCTION__] = (getConfig('wernis_withdraw_active') == 'Y');
833 return $GLOBALS[__FUNCTION__];
836 // Wrapper function for 'wernis_payout_active'
837 function isWernisPayoutActive () {
839 if (!isset($GLOBALS[__FUNCTION__])) {
841 $GLOBALS[__FUNCTION__] = (getConfig('wernis_payout_active') == 'Y');
845 return $GLOBALS[__FUNCTION__];
848 // Wrapper function for 'wernis_withdraw_factor'
849 function getWernisWithdrawFactor () {
851 if (!isset($GLOBALS[__FUNCTION__])) {
853 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_factor');
857 return $GLOBALS[__FUNCTION__];
860 // Wrapper function for 'wernis_payout_factor'
861 function getWernisPayoutFactor () {
863 if (!isset($GLOBALS[__FUNCTION__])) {
865 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_factor');
869 return $GLOBALS[__FUNCTION__];
872 // Wrapper function for 'wernis_withdraw_fee_percent'
873 function getWernisWithdrawFeePercent () {
875 if (!isset($GLOBALS[__FUNCTION__])) {
877 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_fee_percent');
881 return $GLOBALS[__FUNCTION__];
884 // Wrapper function for 'wernis_withdraw_fee_fix'
885 function getWernisWithdrawFeeFix () {
887 if (!isset($GLOBALS[__FUNCTION__])) {
889 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_fee_fix');
893 return $GLOBALS[__FUNCTION__];
896 // Wrapper function for 'wernis_payout_fee_percent'
897 function getWernisPayoutFeePercent () {
899 if (!isset($GLOBALS[__FUNCTION__])) {
901 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_fee_percent');
905 return $GLOBALS[__FUNCTION__];
908 // Wrapper function for 'wernis_payout_fee_fix'
909 function getWernisPayoutFeeFix () {
911 if (!isset($GLOBALS[__FUNCTION__])) {
913 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_fee_fix');
917 return $GLOBALS[__FUNCTION__];
920 // Wrapper function for 'wernis_min_payout'
921 function getWernisMinPayout () {
923 if (!isset($GLOBALS[__FUNCTION__])) {
925 $GLOBALS[__FUNCTION__] = getConfig('wernis_min_payout');
929 return $GLOBALS[__FUNCTION__];
932 // Wrapper function for 'wernis_min_withdraw'
933 function getWernisMinWithdraw () {
935 if (!isset($GLOBALS[__FUNCTION__])) {
937 $GLOBALS[__FUNCTION__] = getConfig('wernis_min_withdraw');
941 return $GLOBALS[__FUNCTION__];
944 // Wrapper function for 'wernis_base_url'
945 function getWernisBaseUrl () {
947 if (!isset($GLOBALS[__FUNCTION__])) {
949 $GLOBALS[__FUNCTION__] = getConfig('wernis_base_url');
953 return $GLOBALS[__FUNCTION__];