X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-primera.php;h=eb627aa0a5572ce79708808c5d31484c1acd51cb;hb=180f978ebe21d5fcec3a51be8405028e7523e6a9;hp=8bfda643bb6c1f808b7e1d7cfd96f8020b6eb9f6;hpb=a28637f0eb7975f2240c42d349e5f08a9722d9bb;p=mailer.git diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index 8bfda643bb..eb627aa0a5 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -14,10 +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 - 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 * @@ -45,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(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, getMessage('MEMBER_PRIMERA_API_DATA_MISSING')); + displayMessage('{--MEMBER_PRIMERA_API_DATA_MISSING--}'); return; } // END - if @@ -66,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" @@ -79,22 +75,14 @@ if (!isGetRequestParameterSet('mode')) { array(getMemberId()), __FILE__, __LINE__); // Load all rows - $content['rows'] = ''; $SW = 2; + $content['rows'] = ''; while ($data = SQL_FETCHARRAY($result)) { // Prepare data for output - $rowContent = array( - 'primera_timestamp' => generateDateTime($data['primera_timestamp'], 2), - 'points' => translateComma($data['primera_amount']), - 'primera_account' => SQL_ESCAPE($data['primera_account']), - 'status' => PRIMERA_TRANSFER_STATUS($data['primera_type']), - 'raw_type' => strtolower($data['primera_type']), - 'sw' => $SW, - ); + $rowContent['primera_timestamp'] = generateDateTime($data['primera_timestamp'], 2); // Load row template $content['rows'] .= loadTemplate('member_primera_mode_list_row', true, $rowContent); - $SW = 3 - $SW; - } + } // END - while // Free result SQL_FREERESULT($result); @@ -106,27 +94,27 @@ 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); $points = bigintval($points[0]); // Remove the registration fee - $points = $points - getConfig('points_register'); + $points = $points - getPointsRegister(); // Is this enougth for a payout? if ($points < getConfig('primera_min_payout')) { // No, then abort here - loadTemplate('admin_settings_saved', false, getMessage('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(getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode'))); return; } @@ -136,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, getMessage('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, getMessage('MEMBER_PRIMERA_EMPTY_PASSWORD')); - } elseif (!isPostRequestParameterSet(('amount'))) { + displayMessage('{--MEMBER_PRIMERA_EMPTY_PASSWORD--}'); + } elseif (!isPostRequestParameterSet('amount')) { // Nothing entered in amount - loadTemplate('admin_settings_saved', false, getMessage('MEMBER_PRIMERA_EMPTY_AMOUNT')); + displayMessage('{--MEMBER_PRIMERA_EMPTY_AMOUNT--}'); } elseif (postRequestParameter('amount') != bigintval(postRequestParameter('amount'))) { // Only numbers in amount! - loadTemplate('admin_settings_saved', false, getMessage('MEMBER_PRIMERA_INVALID_AMOUNT')); + displayMessage('{--MEMBER_PRIMERA_INVALID_AMOUNT--}'); } elseif (postRequestParameter('amount') < getConfig('primera_min_payout')) { // Not enougth entered! - loadTemplate('admin_settings_saved', false, getMessage('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')); @@ -175,21 +163,21 @@ if ((isFormSent()) && (isGetRequestParameterSet('mode'))) { array(postRequestParameter('primera_nickname'), getMemberId()), __FILE__, __LINE__); // All done! - loadTemplate('admin_settings_saved', false, getMessage('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(getMaskedMessage('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(getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode'))); return; } } // END - if