X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-primera.php;h=a1770d8fd52fe3845598fffe03d29f93ae5c233c;hb=d1637dad0b2ca0e5fb411ee0843f01bfb4cc94e0;hp=7cc98acb71a6f46b791335a32508740a72fab479;hpb=1e2a4228e071a67a2d79e970a843e3e30476cfb8;p=mailer.git diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index 7cc98acb71..a1770d8fd5 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -57,19 +57,20 @@ if ((getConfig('primera_api_name') == '') || (getConfig('primera_api_md5') == '' // Something important is missing... LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_API_DATA_MISSING')); return; -} +} // END - if // Init the content array and points -$content = array(); $points = false; +$content = array(); +$points = false; // Is the mode set (payout only) -if (!REQUEST_ISSET_GET(('mode'))) { +if (!REQUEST_ISSET_GET('mode')) { // Get referal id $content['refid'] = getConfig(('primera_refid')); // Get Primus id - $result = SQL_QUERY_ESC("SELECT primera_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(getUserId()), __FILE__, __LINE__); + $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) { @@ -81,13 +82,13 @@ if (!REQUEST_ISSET_GET(('mode'))) { SQL_FREERESULT($result); // Is there an ID? - if ((!empty($content['primera_nickname'])) && (!REQUEST_ISSET_GET(('mode')))) { + if ((!empty($content['primera_nickname'])) && (!REQUEST_ISSET_GET('mode'))) { // Then use an other "mode" - REQUEST_SET_GET('mode', "list"); + REQUEST_SET_GET('mode', 'list'); // And load all rows! $result = SQL_QUERY_ESC("SELECT `id`,`primera_account`,`primera_amount`,`primera_timestamp`,`primera_type` FROM `{!_MYSQL_PREFIX!}_user_primera` WHERE `userid` = %s ORDER BY `primera_timestamp` DESC", - array(getUserId()), __FILE__, __LINE__); + array(getUserId()), __FILE__, __LINE__); // Load all rows $content['rows'] = ''; $SW = 2; @@ -103,7 +104,7 @@ if (!REQUEST_ISSET_GET(('mode'))) { ); // Load row template - $content['rows'] .= LOAD_TEMPLATE("member_primera_mode_list_row", true, $rowContent); + $content['rows'] .= LOAD_TEMPLATE('member_primera_mode_list_row', true, $rowContent); $SW = 3 - $SW; } @@ -111,12 +112,13 @@ if (!REQUEST_ISSET_GET(('mode'))) { SQL_FREERESULT($result); } else { // Mode pay - REQUEST_SET_GET('mode', "pay"); + REQUEST_SET_GET('mode', 'pay'); } } // END - if -if (REQUEST_GET('mode') == "pay") { + +if (REQUEST_GET('mode') == 'pay') { // Get total points and check if the user can request a payout - $points = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points"); + $points = GET_TOTAL_DATA(getUserId(), 'user_points', 'points') - GET_TOTAL_DATA(getUserId(), 'user_data', 'used_points'); // No dots here... $points = explode('.', $points); @@ -133,13 +135,13 @@ if (REQUEST_GET('mode') == "pay") { } // Add points to content array - $content['points'] = $points; - $content['min_points'] = translateComma(getConfig('primera_min_payout')); + $content['points'] = $points; + $content['min_points'] = translateComma(getConfig('primera_min_payout')); // 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__); + $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) { @@ -151,15 +153,15 @@ if (REQUEST_GET('mode') == "pay") { SQL_FREERESULT($result); } else { // Invalid mode! - LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MODE_INVALID'), REQUEST_GET(('mode')))); + LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MODE_INVALID'), REQUEST_GET('mode'))); return; } // Is the formular sent? -if ((isFormSent()) && (REQUEST_ISSET_GET(('mode')))) { +if ((isFormSent()) && (REQUEST_ISSET_GET('mode'))) { // Check input data depending on the mode and execute the requested mode switch (REQUEST_GET('mode')) { - case "pay": // Payout this exchange -> Primus + case 'pay': // Payout this exchange -> Primus // Is the user ID and password set? if (!REQUEST_ISSET_POST(('primera_nickname'))) { // Nothing entered in Primus nickname @@ -186,23 +188,23 @@ if ((isFormSent()) && (REQUEST_ISSET_GET(('mode')))) { // Default is locked! $locked = true; - // Shall I "pay" the referal points imidiately? + // Shall I 'pay' the referal points imidiately? if (getConfig('ref_payout') == '0') { - // Yes, "pay" it now + // Yes, 'pay' it now $locked = false; } // END - if // Remove points from account - SUB_POINTS("primera_payout", getUserId(), REQUEST_POST('amount')); + SUB_POINTS('primera_payout', getUserId(), REQUEST_POST('amount')); // Update primera nickname - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `primera_userid`=%s WHERE userid=%s LIMIT 1", - array(REQUEST_POST('primera_nickname'), getUserId()), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `primera_userid`=%s WHERE `userid`=%s LIMIT 1", + array(REQUEST_POST('primera_nickname'), getUserId()), __FILE__, __LINE__); // All done! LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_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")) { + } 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 LOAD_TEMPLATE('admin_settings_saved', false, GET_PRIMERA_ERROR_MESSAGE()); } else { @@ -214,13 +216,13 @@ if ((isFormSent()) && (REQUEST_ISSET_GET(('mode')))) { default: // Invalid mode! DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid mode %s detected.", REQUEST_GET('mode'))); - LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MODE_INVALID'), REQUEST_GET(('mode')))); + LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('PRIMERA_MEMBER_MODE_INVALID'), REQUEST_GET('mode'))); return; } } // END - if // Prepare mode for template name -$mode = sprintf("member_primera_mode_%s", REQUEST_GET(('mode'))); +$mode = sprintf("member_primera_mode_%s", REQUEST_GET('mode')); // Load the template LOAD_TEMPLATE($mode, false, $content);