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 // Did it went smoothly?
272 if (isHttpResponseStatusOkay($return)) {
277 logWernisTransfer($wdsId, $amount, 'WITHDRAW');
279 // Status failure text
280 setWernisStatusMessage($return['message'], $return['status']);
283 logWernisTransfer($wdsId, $amount, 'FAILED', $return['message'], $return['status']);
290 // Payout this amount
291 function executeWernisApiPayout ($wdsId, $amount) {
292 // Default is failed attempt
295 // Prepare the request data
296 $requestData = array(
297 'sub_request' => 'send',
298 't_uid' => getWernisRefid(),
299 't_md5' => getWernisPassMd5(),
300 'r_uid' => bigintval($wdsId),
301 'amount' => bigintval($amount),
302 'purpose' => getMaskedMessage('WERNIS_API_PURPOSE_PAYOUT', getMemberId())
305 // Return the result from the lower functions
306 $return = sendWernisApiRequest('book.php', $requestData);
308 if (isHttpResponseStatusOkay($return)) {
313 logWernisTransfer($wdsId, $amount, 'PAYOUT');
315 // Status failure text
316 setWernisStatusMessage($return['message'], $return['status']);
319 logWernisTransfer($wdsId, $amount, 'FAILED', $return['message'], $return['status']);
326 // Execute auth.php request
327 function executeWernisApiAuth ($wernisId, $wernisPassword) {
328 // Prepare request data
329 $requestData = array(
330 't_uid' => bigintval($wernisId),
331 't_md5' => hashSha256($wernisPassword),
335 $return = sendWernisApiRequest('auth.php', $requestData);
341 // Execute get.php reguest with given auth data (not all are used)
342 function executeWernisApiGet ($authData, $subRequest, $fields) {
343 // It must be an array
344 assert(is_array($authData));
346 // Check required array elements
347 assert(isset($authData['wernis_userid']));
348 assert(isset($authData['api_auth_key']));
349 assert(isset($authData['api_redirect_challenge']));
351 // Then create request array
352 $requestData = array(
353 'sub_request' => $subRequest,
355 't_uid' => bigintval($authData['wernis_userid']),
356 'auth_key' => $authData['api_auth_key'],
357 'challenge' => $authData['api_redirect_challenge']
361 $return = sendWernisApiRequest('get.php', $requestData);
367 // Translate the status IN/OUT
368 function translateWernisTransferStatus ($status) {
369 // Default status is unknown
370 $return = '{%message,WERNIS_STATUS_UNKNWOWN=' . $status . '%}';
372 // Construct message id
373 $messageId = 'WERNIS_STATUS_' . $status;
376 if (isMessageIdValid($messageId)) {
377 // Then use it as message string
378 $return = '{--' . $messageId . '--}';
386 function logWernisTransfer ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') {
387 // Register this wernis movement
388 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')",
396 ), __FUNCTION__, __LINE__);
399 // Calulcate fees and factor
400 function calculateWernisFee ($points, $mode) {
401 // Payout or withdraw are allowed modes!
402 //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
403 if (!in_array($mode, array('payout', 'withdraw'))) {
404 // Log error and abort
405 logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points . ' - unknown mode detected.');
409 // Is there a percentage or fixed fee?
410 if (getConfig('wernis_' . $mode . '_fee_percent') > 0) {
412 $points -= $points * getConfig('wernis_'.$mode.'_fee_percent') / 100;
413 } elseif (getConfig('wernis_' . $mode . '_fee_fix') > 0) {
415 $points -= getConfig('wernis_' . $mode . '_fee_fix');
418 // Divide/multiply the factor
419 if ($mode == 'payout') {
421 $points = $points / getWernisPayoutFactor();
423 // Multiply for withdraw
424 $points = $points * getWernisWithdrawFactor();
428 //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
432 // Add withdraw fees and factor
434 function calulcateWernisWithdrawFee ($points) {
435 // Is there a percentage or fixed fee?
436 if (getWernisWithdrawFeePercent() > 0) {
438 $points += $points * getWernisWithdrawFeePercent() / 100;
439 } elseif (getWernisWithdrawFeeFix() > 0) {
441 $points += getWernisWithdrawFeeFix();
448 // Displays registration form for WDS66 registration
449 function doDisplayWernisUserRegistrationForm () {
451 if (isFormSent('register')) {
453 if (!isPostRequestElementSet('wernis_id')) {
455 displayMessage('{--GUEST_WERNIS_REGISTRATION_ID_NOT_SET--}');
456 } elseif (!isPostRequestElementSet('wernis_password')) {
458 displayMessage('{--GUEST_WERNIS_REGISTRATION_PASSWORD_NOT_SET--}');
460 // So far, all fine, then let's do the call-back on auth.php ...
461 $response = executeWernisApiAuth(postRequestElement('wernis_id'), postRequestElement('wernis_password'));
463 // Was the status okay?
464 if (isHttpResponseStatusOkay($response)) {
465 // All fine, then analyze API response
466 $args = convertApiResponseToArray($response['response'], '&', '=');
469 assert(isset($args['auth_status']));
472 $args['wernis_userid'] = postRequestElement('wernis_id');
474 // "Detect" auth status
475 $callbackFunction = 'doWernisAuth' . capitalizeUnderscoreString($args['auth_status']);
477 // Is the call-back there?
478 if (!is_callable($callbackFunction, FALSE, $callableName)) {
479 // Not there, could be bad. :(
480 reportBug(__FUNCTION__, __LINE__, 'Unsupported auth_status=' . $args['auth_status'] . ',args()=' . count($args) . ',callbackFunction=' . $callbackFunction . ' detected.');
484 $status = call_user_func($callbackFunction, $args);
486 // @TODO Something more to do here?
487 die(__FUNCTION__ . ':' . __LINE__ . ': status[' . gettype($status) . ']=' . $status . ' - Unfinished.');
489 // Something bad happened
490 displayMessage($response['message']);
495 // Is there a challenge + response?
496 if ((isGetRequestElementSet('status')) && (isGetRequestElementSet('challenge')) && (isGetRequestElementSet('__challenge_response'))) {
497 // Redirect from modules.php?module=auth, so validate challenge response ...
498 // 1) Get first 24 characters = salt
499 $salt = substr(getRequestElement('__challenge_response'), 0, 24);
501 // 2) Generate hash for challenge response
502 $challengeResponse = $salt . hashSha256($salt . getWernisApiMd5() . getRequestElement('challenge'));
504 // Is the response valid?
505 if ($challengeResponse != getRequestElement('__challenge_response')) {
507 displayMessage('{--GUEST_WERNIS_REGISTRATION_INVALID_CHALLENGE_RESPONSE--}');
512 * Now, that the challenge-response is the same, the challenge itself
513 * is also the same. Next get the data from wernis_regs table by
514 * challenge. There is currently no other way to get the data as there
515 * is no Wernis user id provided. Later on the stored challenge response
516 * can be compared with provided.
518 $return = doWernisFinishUserRegistration(getRequestElement('challenge'), getRequestElement('__challenge_response'), getRequestElement('status'));
520 // Is the registration finished?
521 if ($return === FALSE) {
522 // No, then abort here silently as the function should have already displayed a message
525 } elseif (!isFormSent('register')) {
526 // Form not send, so load form template
527 loadTemplate('guest_wernis_registration_rpc_form');
531 // Finish user registration with WDS66 API
532 function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status) {
533 // Is the status 1? (= all fine with API call)
534 if ($status == '1') {
535 // Get mapped data based on challenge
536 $return = getWernisMappedDataFromApiByChallenge($challenge, $status);
538 // Is the array filled?
539 if ((count($return['mapped_data']) > 0) && (empty($return['message']))) {
540 // Set must-fillout fields
541 $return['mapped_data'] = runFilterChain('register_must_fillout', $return['mapped_data']);
543 // Add missing elements
544 $return['mapped_data']['gender'] = NULL;
545 $return['mapped_data']['birthday_selection'] = generateDayMonthYearSelectionBox($return['mapped_data']['birth_day'], $return['mapped_data']['birth_month'], $return['mapped_data']['birth_year']);
546 $return['mapped_data']['challenge'] = getRequestElement('challenge');
547 $return['mapped_data']['__challenge_response'] = getRequestElement('__challenge_response');
550 loadTemplate('guest_wernis_registration_form', FALSE, $return['mapped_data']);
555 // Something unexpected happened (e.g. no API requests left)
556 displayMessage($return['message']);
560 // Status does not need to be changed
561 die(__FUNCTION__ . ':' . __LINE__ . ': Reached!');
565 // "Getter" for mapped data by calling the API and given challenge and status
566 function getWernisMappedDataFromApiByChallenge ($challenge, $status) {
567 // Get stored registration data
568 $rows = getWernisRegistrationDataByKey('api_redirect_challenge', $challenge);
570 // Zero result found?
571 if (count($rows) == 0) {
573 displayMessage('{--GUEST_WERNIS_REGISTRATION_ZERO_ROWS_FOUND--}');
576 loadTemplate('guest_wernis_registration_rpc_form');
583 'mapped_data' => array(),
584 // Any error message from API
588 // Has the auth status changed?
589 if ($rows[0]['api_auth_status'] != 'ACCEPTED') {
591 * The authorization of this application has been accepted, so
592 * update it and ignore result from function because the update
595 updateWernisRegistrationDataByKey('api_auth_status', 'api_redirect_challenge', $challenge, 'ACCEPTED');
598 // Now call "get.php"
599 $response = executeWernisApiGet($rows[0], 'data', 'vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email|werber');
601 // Was the status okay?
602 if (isHttpResponseStatusOkay($response)) {
603 // API returned non-errous response, 'data=' must be found
604 assert(substr($response['response'], 0, 5) == 'data=');
606 // And remove it, this is now BASE64-encoded
607 $encodedData = urldecode(substr($response['response'], 5));
609 // And decode it (all steps separated to later "easily" debug them)
610 $decodedData = base64_decode($encodedData);
613 * Do some checks on the decoded string, it should be a
614 * serialized array with 10 entries (see above
615 * executeWernisApiGet() call).
617 assert(substr($decodedData, 0, 6) == 'a:10:{');
618 assert(substr($decodedData, -1, 1) == '}');
620 // The array seems to be fine, unserialize it
621 $userData = unserialize($decodedData);
623 // All mappings WDS66->mailer
625 'vorname' => 'surname',
627 'strasse' => 'street_nr',
631 'birth_day' => 'birth_day',
632 'birth_month' => 'birth_month',
633 'birth_year' => 'birth_year',
634 'werber' => 'wernis_refid'
637 // Map all WDS66 entries into mailer entries
638 foreach ($mappings as $from => $to) {
640 if (!isset($userData[$from])) {
641 // Element $from does not exist
642 reportBug(__FUNCTION__, __LINE__, 'Cannot map from=' . $from . ' -> to=' . $to . ': element does not exist.');
646 $return['mapped_data'][$to] = convertEmptyToNull($userData[$from]);
649 // Both arrays must have same size
650 assert(count($userData) == count($return['mapped_data']));
652 // Now add userid from WDS66
653 $return['mapped_data']['wernis_userid'] = bigintval($rows[0]['wernis_userid']);
655 // Something bad happened so copy the message
656 $return['message'] = $response['message'];
659 // Return mapped data array
663 // Updates auth status by given key/value pair
664 function updateWernisRegistrationDataByKey ($updatedColumn, $key, $oldValue, $newValue) {
666 sqlQueryEscaped("UPDATE
667 `{?_MYSQL_PREFIX?}_wernis_regs`
680 ), __FUNCTION__, __LINE__
683 // Check if rows as been affected
684 return ifSqlHasZeroAffectedRows();
687 // "Getter" for Wernis registration data by given key and value
688 function getWernisRegistrationDataByKey ($key, $value, $limit = 1) {
693 $result = sqlQueryEscaped("SELECT
698 `api_redirect_challenge`,
699 UNIX_TIMESTAMP(`record_inserted`) AS `record_inserted`
701 `{?_MYSQL_PREFIX?}_wernis_regs`
711 ), __FUNCTION__, __LINE__
714 // Is there an entry?
715 if (sqlNumRows($result) > 0) {
716 // At least one entry has been found, so loop through all
717 while ($row = sqlFetchArray($result)) {
719 array_push($rows, $row);
724 sqlFreeResult($result);
726 // Return found entries
730 // Do local user registration with data from WDS66 API
731 function doWernisUserRegistration () {
732 // Call generic registration function
733 $status = doGenericUserRegistration();
735 // Does this went fine?
736 if ($status === FALSE) {
737 // No, then abort here silently
741 // Make sure the user id is valid
742 assert(isset($GLOBALS['register_userid']));
743 assert(isValidId($GLOBALS['register_userid']));
745 // Generic registration is finished, so add more data:
748 //-----------------------------------------------------------------------------
749 // Auth status callback functions
750 //-----------------------------------------------------------------------------
752 // Handler for auth_status=PENDING
753 function doWernisAuthPending ($args) {
754 // $args must always be an array
755 assert(is_array($args));
757 // auth_key and wernis_userid must be set
758 assert(isset($args['auth_key']));
759 assert(isset($args['wernis_userid']));
761 // Generate a challenge that will be added to the URL
762 $challenge = hashSha256(generatePassword(128));
764 // Search entry in database by auth_key
765 if (countSumTotalData($args['auth_key'], 'wernis_regs', 'id', 'api_auth_key', TRUE) == 0) {
766 // "Register" this call
767 sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_wernis_regs` (
771 `api_redirect_challenge`
779 bigintval($args['wernis_userid']),
782 ), __FUNCTION__, __LINE__
786 sqlQueryEscaped("UPDATE
787 `{?_MYSQL_PREFIX?}_wernis_regs`
789 `api_redirect_challenge`='%s'
791 `api_auth_key`='%s' AND
793 `api_auth_status`='PENDING'
798 bigintval($args['wernis_userid'])
799 ), __FUNCTION__, __LINE__
803 // Should always update/insert
804 assert(sqlAffectedRows() == 1);
806 // Redirect to WDS66 module=auth ...
807 redirectToUrl(getWernisBaseUrl() . '/modules.php?module=auth&auth_key=' . $args['auth_key'] . '&params=' . urlencode(base64_encode('&module=' . getModule() . '&what=' . getWhat())) . '&challenge=' . $challenge);
810 // Handler for auth_status=ACCEPTED
811 function doWernisAuthAccepted ($args) {
812 // $args must always be an array
813 assert(is_array($args));
815 // auth_key and wernis_userid must be set
816 assert(isset($args['auth_key']));
817 assert(isset($args['wernis_userid']));
818 die(__FUNCTION__ . ':' . __LINE__ . '<pre>' . print_r($args, TRUE) . '</pre>');
821 //-----------------------------------------------------------------------------
823 //-----------------------------------------------------------------------------
825 // Wrapper function for 'wernis_refid'
826 function getWernisRefid () {
828 if (!isset($GLOBALS[__FUNCTION__])) {
830 $GLOBALS[__FUNCTION__] = getConfig('wernis_refid');
834 return $GLOBALS[__FUNCTION__];
837 // Wrapper function for 'wernis_pass_md5'
838 function getWernisPassMd5 () {
840 if (!isset($GLOBALS[__FUNCTION__])) {
842 $GLOBALS[__FUNCTION__] = getConfig('wernis_pass_md5');
846 return $GLOBALS[__FUNCTION__];
849 // Wrapper function for 'wernis_api_id'
850 function getWernisApiId () {
852 if (!isset($GLOBALS[__FUNCTION__])) {
854 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_id');
858 return $GLOBALS[__FUNCTION__];
861 // Wrapper function for 'wernis_api_md5'
862 function getWernisApiMd5 () {
864 if (!isset($GLOBALS[__FUNCTION__])) {
866 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_md5');
870 return $GLOBALS[__FUNCTION__];
873 // Wrapper function for 'wernis_api_url'
874 function getWernisApiUrl () {
876 if (!isset($GLOBALS[__FUNCTION__])) {
878 $GLOBALS[__FUNCTION__] = getConfig('wernis_api_url');
882 return $GLOBALS[__FUNCTION__];
885 // Wrapper function for 'wernis_withdraw_active'
886 function getWernisWithdrawActive () {
888 if (!isset($GLOBALS[__FUNCTION__])) {
890 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_active');
894 return $GLOBALS[__FUNCTION__];
897 // Wrapper function for 'wernis_payout_active'
898 function getWernisPayoutActive () {
900 if (!isset($GLOBALS[__FUNCTION__])) {
902 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_active');
906 return $GLOBALS[__FUNCTION__];
909 // Wrapper function for 'wernis_withdraw_active'
910 function isWernisWithdrawActive () {
912 if (!isset($GLOBALS[__FUNCTION__])) {
914 $GLOBALS[__FUNCTION__] = (getConfig('wernis_withdraw_active') == 'Y');
918 return $GLOBALS[__FUNCTION__];
921 // Wrapper function for 'wernis_payout_active'
922 function isWernisPayoutActive () {
924 if (!isset($GLOBALS[__FUNCTION__])) {
926 $GLOBALS[__FUNCTION__] = (getConfig('wernis_payout_active') == 'Y');
930 return $GLOBALS[__FUNCTION__];
933 // Wrapper function for 'wernis_withdraw_factor'
934 function getWernisWithdrawFactor () {
936 if (!isset($GLOBALS[__FUNCTION__])) {
938 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_factor');
942 return $GLOBALS[__FUNCTION__];
945 // Wrapper function for 'wernis_payout_factor'
946 function getWernisPayoutFactor () {
948 if (!isset($GLOBALS[__FUNCTION__])) {
950 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_factor');
954 return $GLOBALS[__FUNCTION__];
957 // Wrapper function for 'wernis_withdraw_fee_percent'
958 function getWernisWithdrawFeePercent () {
960 if (!isset($GLOBALS[__FUNCTION__])) {
962 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_fee_percent');
966 return $GLOBALS[__FUNCTION__];
969 // Wrapper function for 'wernis_withdraw_fee_fix'
970 function getWernisWithdrawFeeFix () {
972 if (!isset($GLOBALS[__FUNCTION__])) {
974 $GLOBALS[__FUNCTION__] = getConfig('wernis_withdraw_fee_fix');
978 return $GLOBALS[__FUNCTION__];
981 // Wrapper function for 'wernis_payout_fee_percent'
982 function getWernisPayoutFeePercent () {
984 if (!isset($GLOBALS[__FUNCTION__])) {
986 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_fee_percent');
990 return $GLOBALS[__FUNCTION__];
993 // Wrapper function for 'wernis_payout_fee_fix'
994 function getWernisPayoutFeeFix () {
996 if (!isset($GLOBALS[__FUNCTION__])) {
998 $GLOBALS[__FUNCTION__] = getConfig('wernis_payout_fee_fix');
1002 return $GLOBALS[__FUNCTION__];
1005 // Wrapper function for 'wernis_min_payout'
1006 function getWernisMinPayout () {
1008 if (!isset($GLOBALS[__FUNCTION__])) {
1010 $GLOBALS[__FUNCTION__] = getConfig('wernis_min_payout');
1014 return $GLOBALS[__FUNCTION__];
1017 // Wrapper function for 'wernis_min_withdraw'
1018 function getWernisMinWithdraw () {
1020 if (!isset($GLOBALS[__FUNCTION__])) {
1022 $GLOBALS[__FUNCTION__] = getConfig('wernis_min_withdraw');
1026 return $GLOBALS[__FUNCTION__];
1029 // Wrapper function for 'wernis_base_url'
1030 function getWernisBaseUrl () {
1032 if (!isset($GLOBALS[__FUNCTION__])) {
1034 $GLOBALS[__FUNCTION__] = getConfig('wernis_base_url');
1038 return $GLOBALS[__FUNCTION__];