X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-primera.php;h=684bd1e2c39efdde01642193e73707f3b9205cf8;hb=387a99be2a05128c307013cb7ed27628a46c27f4;hp=f38dfd5b9b099e22308544203a6882ffa39a25db;hpb=0f9bc55be42f9851cc87a06f3971c853a83425a7;p=mailer.git diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index f38dfd5b9b..684bd1e2c3 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * 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 * @@ -46,18 +44,18 @@ if (!defined('__SECURITY')) { } // Add description as navigation point -addMenuDescription('member', __FILE__); +addYouAreHereLink('member', __FILE__); if ((!isExtensionActive('primera')) && (!isAdmin())) { // Extension 'primera' is not activated - loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('primera')); + displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=primera%}'); return; } // END - if // Check if the admin has entered the data if ((getConfig('primera_api_name') == '') || (getConfig('primera_api_md5') == '')) { // Something important is missing... - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_API_DATA_MISSING--}'); + displayMessage('{--MEMBER_PRIMERA_API_DATA_MISSING--}'); return; } // END - if @@ -67,9 +65,6 @@ $points = false; // Is the mode set (payout only) if (!isGetRequestParameterSet('mode')) { - // Get referal id - $content['refid'] = getConfig(('primera_refid')); - // Is there an id? if ((!empty($content['primera_nickname'])) && (!isGetRequestParameterSet('mode'))) { // Then use an other "mode" @@ -99,7 +94,7 @@ if (!isGetRequestParameterSet('mode')) { if (getRequestParameter('mode') == 'pay') { // Get total points and check if the user can request a payout - $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points'); + $points = getTotalPoints(getMemberId()); // No dots here... $points = explode('.', $points); @@ -111,15 +106,15 @@ if (getRequestParameter('mode') == 'pay') { // Is this enougth for a payout? if ($points < getConfig('primera_min_payout')) { // No, then abort here - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_MIN_PAYOUT_PAYOUT--}'); + displayMessage('{--MEMBER_PRIMERA_MIN_PAYOUT_PAYOUT--}'); return; - } + } // END - if // Add points to content array $content['points'] = $points; } else { // Invalid mode! - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode'))); + displayMessage('{%message,MEMBER_PRIMERA_MODE_INVALID=' . getRequestParameter('mode') . '%}'); return; } @@ -129,24 +124,24 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { switch (getRequestParameter('mode')) { case 'pay': // Payout this exchange -> Primus // Is the user id and password set? - if (!isPostRequestParameterSet(('primera_nickname'))) { + if (!isPostRequestParameterSet('primera_nickname')) { // Nothing entered in Primus nickname - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_USERNAME--}'); - } elseif (!isPostRequestParameterSet(('primera_password'))) { + displayMessage('{--MEMBER_PRIMERA_EMPTY_USERNAME--}'); + } elseif (!isPostRequestParameterSet('primera_password')) { // Nothing entered in Primera password - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_PASSWORD--}'); - } elseif (!isPostRequestParameterSet(('amount'))) { + displayMessage('{--MEMBER_PRIMERA_EMPTY_PASSWORD--}'); + } elseif (!isPostRequestParameterSet('amount')) { // Nothing entered in amount - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_AMOUNT--}'); + displayMessage('{--MEMBER_PRIMERA_EMPTY_AMOUNT--}'); } elseif (postRequestParameter('amount') != bigintval(postRequestParameter('amount'))) { // Only numbers in amount! - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_INVALID_AMOUNT--}'); + displayMessage('{--MEMBER_PRIMERA_INVALID_AMOUNT--}'); } elseif (postRequestParameter('amount') < getConfig('primera_min_payout')) { // Not enougth entered! - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_AMOUNT_SMALLER_MIN--}'); + displayMessage('{--MEMBER_PRIMERA_AMOUNT_SMALLER_MIN--}'); } elseif (postRequestParameter('amount') > $points) { // Not enougth points left! - loadTemplate('admin_settings_saved', false, sprintf(getMessage('MEMBER_PRIMERA_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestParameter('amount')), bigintval($points))); + displayMessage(sprintf(getMessage('MEMBER_PRIMERA_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestParameter('amount')), bigintval($points))); } else { // All is fine here so do the payout $success = executePrimeraPayout(postRequestParameter('primera_nickname'), md5(postRequestParameter('primera_password')), postRequestParameter('amount')); @@ -168,21 +163,21 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { array(postRequestParameter('primera_nickname'), getMemberId()), __FILE__, __LINE__); // All done! - loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_PAYOUT_DONE--}'); + displayMessage('{--MEMBER_PRIMERA_PAYOUT_DONE--}'); return; } elseif ((GET_PRIMERA_ERROR_CODE() == 'user_failed') || (GET_PRIMERA_ERROR_CODE() == 'own_failed') || (GET_PRIMERA_ERROR_CODE() == 'amount_failed') || (GET_PRIMERA_ERROR_CODE() == 'api_amount_failed')) { // Wrong login data - loadTemplate('admin_settings_saved', false, GET_PRIMERA_ERROR_MESSAGE()); + displayMessage(GET_PRIMERA_ERROR_MESSAGE()); } else { // Something went wrong - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_PAYOUT_FAILED', GET_PRIMERA_ERROR_MESSAGE())); + displayMessage('{%message,MEMBER_PRIMERA_PAYOUT_FAILED=' . GET_PRIMERA_ERROR_MESSAGE() . '%}'); } } break; default: // Invalid mode! logDebugMessage(__FILE__, __LINE__, sprintf("Invalid mode %s detected.", getRequestParameter('mode'))); - loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode'))); + displayMessage('{%message,MEMBER_PRIMERA_MODE_INVALID=' . getRequestParameter('mode') . '%}'); return; } } // END - if