X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-wernis.php;h=60809e91dd54a4150c5e5ff0a3c7ff2bf4e907fe;hp=108be32022b2b27605a2f4f40e9801dc7fdec047;hb=0f3a135204757cc8750262871c8e62c42300acb4;hpb=1c62a6c2a4ed2bb170e0f1888899625e67a27947 diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index 108be32022..60809e91dd 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -44,17 +44,17 @@ if (!defined('__SECURITY')) { } // Add description as navigation point -addMenuDescription('member', __FILE__); +addYouAreHereLink('member', __FILE__); if ((!isExtensionActive('wernis')) && (!isAdmin())) { - loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('wernis')); + displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=wernis%}'); return; } // END - if // Check if the admin has entered the data -if ((getConfig('wernis_api_id') == '') || (getConfig('wernis_api_md5') == '')) { +if ((getWernisApiId() == '') || (getWernisApiMd5() == '')) { // Something important is missing... - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_API_DATA_MISSING--}'); + displayMessage('{--MEMBER_WERNIS_API_DATA_MISSING--}'); return; } // END - if @@ -72,7 +72,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo setGetRequestParameter('mode', 'list'); // And load all rows! - $result = SQL_QUERY_ESC("SELECT `id`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type` FROM `{?_MYSQL_PREFIX?}_user_wernis` WHERE `userid`=%s ORDER BY `wernis_timestamp` DESC", + $result = SQL_QUERY_ESC("SELECT `id`,`wernis_account`,`wernis_amount`,`wernis_timestamp`,`wernis_type` FROM `{?_MYSQL_PREFIX?}_user_wernis` WHERE `userid`=%s ORDER BY `wernis_timestamp` DESC", array(getMemberId()), __FILE__, __LINE__); // Load all rows @@ -104,7 +104,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo } // END - if // Is the withdraw mode active? - if (getConfig('wernis_withdraw_active') == 'Y') { + if (isWernisWithdrawActive()) { // Add link $content['withdraw_link'] = '
{--MEMBER_WERNIS_MODE_WITHDRAW--}
'; } // END - if @@ -122,7 +122,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo // Is this enougth for a payout? if ($points < getConfig('wernis_min_payout')) { // No, then abort here - loadTemplate('admin_settings_saved', false, '{%message,MEMBER_WERNIS_MIN_PAYOUT=' . $points . '%}'); + displayMessage('{%message,MEMBER_WERNIS_MIN_PAYOUT=' . $points . '%}'); return; } // END - if @@ -132,7 +132,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo // Add points to content array $content['points'] = $points; -} elseif ((getRequestParameter('mode') == 'withdraw') && (getConfig('wernis_withdraw_active') == 'Y')) { +} elseif ((getRequestParameter('mode') == 'withdraw') && (isWernisWithdrawActive())) { // Prepare data for the template $content['points'] = getTotalPoints(getMemberId()); $content['wernis_userid'] = ''; @@ -141,7 +141,7 @@ if ((!isGetRequestParameterSet('mode')) || (getRequestParameter('mode') == 'choo $content['wernis_userid'] = getUserData('wernis_userid'); } else { // Invalid mode! - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_WERNIS_MODE_INVALID', getRequestParameter('mode'))); + displayMessage('{%message,MEMBER_WERNIS_MODE_INVALID=' . getRequestParameter('mode') . '%}'); return; } @@ -150,46 +150,47 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { // Is the user id and password set? if (!isPostRequestParameterSet('wernis_userid')) { // Nothing entered in WDS66 user id - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_USERNAME--}'); + displayMessage('{--MEMBER_WERNIS_EMPTY_USERNAME--}'); } elseif (!isPostRequestParameterSet('wds66_password')) { // Nothing entered in WDS66 password - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_PASSWORD--}'); + displayMessage('{--MEMBER_WERNIS_EMPTY_PASSWORD--}'); } elseif (!isPostRequestParameterSet('amount')) { // Nothing entered in amount - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_EMPTY_AMOUNT--}'); + displayMessage('{--MEMBER_WERNIS_EMPTY_AMOUNT--}'); } elseif (postRequestParameter('wernis_userid') != bigintval(postRequestParameter('wernis_userid'))) { // Only numbers in account id! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_INVALID_USERNAME'); + displayMessage('{--MEMBER_WERNIS_INVALID_USERNAME'); } elseif (postRequestParameter('amount') != bigintval(postRequestParameter('amount'))) { // Only numbers in amount! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_INVALID_AMOUNT--}'); + displayMessage('{--MEMBER_WERNIS_INVALID_AMOUNT--}'); } else { // Check input data depending on the mode and execute the requested mode switch (getRequestParameter('mode')) { case 'withdraw': // Widthdraws WDS66 -> This exchange if (postRequestParameter('amount') < getConfig('wernis_min_withdraw')) { // Not enougth entered! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_WITHDRAW_AMOUNT_SMALLER_MIN--}'); + displayMessage('{--MEMBER_WERNIS_WITHDRAW_AMOUNT_SMALLER_MIN--}'); } else { // All is fine here so do the withdraw $success = WERNIS_EXECUTE_WITHDRAW(postRequestParameter('wernis_userid'), md5(postRequestParameter('wds66_password')), postRequestParameter('amount')); if ($success === true) { // Add it to this amount - addPointsDirectly('wernis_withdraw', getMemberId(), bigintval(postRequestParameter('amount'))); + initReferalSystem(); + addPointsThroughReferalSystem('wernis_withdraw', getMemberId(), bigintval(postRequestParameter('amount'))); // Update the user data as well.. SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `wernis_userid`=%s WHERE `userid`=%s LIMIT 1", array(bigintval(postRequestParameter('wernis_userid')), getMemberId()), __FILE__, __LINE__); // All done! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_WITHDRAW_DONE--}'); + displayMessage('{--MEMBER_WERNIS_WITHDRAW_DONE--}'); return; } 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()); + displayMessage(GET_WERNIS_ERROR_MESSAGE()); } else { // Something went wrong - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_WERNIS_WITHDRAW_FAILED', GET_WERNIS_ERROR_MESSAGE())); + displayMessage('{--MEMBER_WERNIS_WITHDRAW_FAILED--}'); } } break; @@ -197,15 +198,15 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { case 'payout': // Payout this exchange -> WDS66 if (postRequestParameter('amount') < getConfig('wernis_min_payout')) { // Not enougth entered! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_PAYOUT_AMOUNT_SMALLER_MIN--}'); + displayMessage('{--MEMBER_WERNIS_PAYOUT_AMOUNT_SMALLER_MIN--}'); } elseif (postRequestParameter('amount') > $points) { // Not enougth points left! - loadTemplate('admin_settings_saved', false, sprintf(getMessage('MEMBER_WERNIS_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestParameter('amount')), bigintval($points))); + displayMessage(sprintf(getMessage('MEMBER_WERNIS_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestParameter('amount')), bigintval($points))); } else { // All is fine here so do the withdraw $success = WERNIS_EXECUTE_PAYOUT(postRequestParameter('wernis_userid'), postRequestParameter('amount')); if ($success === true) { - // Sub points + // Sub points and ignore return status subtractPoints('wernis_payout', getMemberId(), postRequestParameter('amount')); // Update WDS66 id @@ -213,21 +214,21 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { array(bigintval(postRequestParameter('wernis_userid')), getMemberId()), __FILE__, __LINE__); // All done! - loadTemplate('admin_settings_saved', false, '{--MEMBER_WERNIS_PAYOUT_DONE--}'); + displayMessage('{--MEMBER_WERNIS_PAYOUT_DONE--}'); return; } elseif ((GET_WERNIS_ERROR_CODE() == 'user_failed') || (GET_WERNIS_ERROR_CODE() == 'own_failed') || (GET_WERNIS_ERROR_CODE() == 'amount_failed') || (GET_WERNIS_ERROR_CODE() == 'api_amount_failed')) { // Wrong login data - loadTemplate('admin_settings_saved', false, GET_WERNIS_ERROR_MESSAGE()); + displayMessage(GET_WERNIS_ERROR_MESSAGE()); } else { // Something went wrong - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_WERNIS_WITHDRAW_FAILED', GET_WERNIS_ERROR_MESSAGE())); + displayMessage('{--MEMBER_WERNIS_PAYOUT_FAILED--}'); } } break; default: // Invalid mode! logDebugMessage(__FILE__, __LINE__, sprintf("Invalid mode %s detected.", getRequestParameter('mode'))); - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_WERNIS_MODE_INVALID', getRequestParameter('mode'))); + displayMessage('{%message,MEMBER_WERNIS_MODE_INVALID=' . getRequestParameter('mode') . '%}'); return; } // END - switch }