X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-primera.php;h=2a1322dbee11f5106ae0d3a870aa66bec457b8d9;hp=e95ef39dff942442ab06395c9c1947e7ed31c56e;hb=e2148142f8b1a8f40fd6e7ca32185569c5a9083e;hpb=c2e17d983fcbc0c3bd1dd37908d87c678f0367df diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index e95ef39dff..2a1322dbee 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -1,7 +1,7 @@ generateDateTime($data['primera_timestamp'], 2), - 'points' => translateComma($data['primera_amount']), - 'acc' => SQL_ESCAPE($data['primera_account']), - 'status' => PRIMERA_TRANSFER_STATUS($data['primera_type']), - 'raw_type' => strtolower($data['primera_type']), - 'sw' => $SW, + '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, ); // Load row template @@ -119,7 +112,7 @@ if (!isGetRequestElementSet('mode')) { if (getRequestElement('mode') == 'pay') { // Get total points and check if the user can request a payout - $points = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points'); + $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points'); // No dots here... $points = explode('.', $points); @@ -141,17 +134,12 @@ if (getRequestElement('mode') == 'pay') { // Get Primera id $content['primera_nickname'] = ''; - $result = SQL_QUERY_ESC("SELECT `primera_userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1", - array(getUserId()), __FILE__, __LINE__); - - // Are there some entries? - if (SQL_NUMROWS($result) == 1) { - // Fetch ID - list($content['primera_nickname']) = SQL_FETCHROW($result); - } - // Free result - SQL_FREERESULT($result); + // Do we have a user account? (should be!) + if (fetchUserData(getMemberId())) { + // Fetch id + $content['primera_nickname'] = getUserData('primera_nickname'); + } // END - if } else { // Invalid mode! loadTemplate('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MODE_INVALID'), getRequestElement('mode'))); @@ -163,7 +151,7 @@ if ((isFormSent()) && (isGetRequestElementSet('mode'))) { // Check input data depending on the mode and execute the requested mode switch (getRequestElement('mode')) { case 'pay': // Payout this exchange -> Primus - // Is the user ID and password set? + // Is the user id and password set? if (!isPostRequestElementSet(('primera_nickname'))) { // Nothing entered in Primus nickname loadTemplate('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_EMPTY_USERNAME')); @@ -190,17 +178,17 @@ if ((isFormSent()) && (isGetRequestElementSet('mode'))) { $locked = true; // Shall I 'pay' the referal points imidiately? - if (getConfig('ref_payout') == 0) { + if (getConfig('ref_payout') == '0') { // Yes, 'pay' it now $locked = false; } // END - if // Remove points from account - subtractPoints('primera_payout', getUserId(), postRequestElement('amount')); + subtractPoints('primera_payout', getMemberId(), postRequestElement('amount')); // Update primera nickname - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `primera_userid`=%s WHERE `userid`=%s LIMIT 1", - array(postRequestElement('primera_nickname'), getUserId()), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `primera_nickname`=%s WHERE `userid`=%s LIMIT 1", + array(postRequestElement('primera_nickname'), getMemberId()), __FILE__, __LINE__); // All done! loadTemplate('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_PAYOUT_DONE'));