X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-transfer.php;h=a141f3009a907bc2e0cbd3e6180508b89802c91f;hb=34db702d004b245e5528b0ba20c6de441f61820a;hp=0d4ba2e0fa31bd56981eefb11cf290821b8a6878;hpb=1ebf518b9552f71ee95de6f4b80e6de3a27716d1;p=mailer.git
diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php
index 0d4ba2e0fa..a141f3009a 100644
--- a/inc/modules/member/what-transfer.php
+++ b/inc/modules/member/what-transfer.php
@@ -1,7 +1,7 @@
0) {
// Check for code
- $code = generateRandomCode(getConfig('transfer_code'), postRequestElement('code_chk'), getUserId(), $content['max_transferable']);
- $valid_code = ($code == postRequestElement('code'));
+ $code = generateRandomCode(getConfig('transfer_code'), postRequestParameter('code_chk'), getMemberId(), $content['max_transferable']);
+ $valid_code = ($code == postRequestParameter('code'));
} else {
// Zero length (= disabled) is always valid!
$valid_code = true;
}
// Test password
- $valid_pass = ($pass == generateHash(postRequestElement('password'), $pass));
+ $valid_pass = ($pass == generateHash(postRequestParameter('password'), $pass));
// Test transfer amount
- $valid_amount = ((isPostRequestElementSet('points')) && (postRequestElement('points') <= $content['max_transferable']));
+ $valid_amount = ((isPostRequestParameterSet('points')) && (postRequestParameter('points') <= $content['max_transferable']));
// Test reason for transfer
- $valid_reason = (isPostRequestElementSet('reason'));
+ $valid_reason = (isPostRequestParameterSet('reason'));
// Test if a recipient is selected
- $valid_recipient = (postRequestElement('to_userid') > 0);
+ $valid_recipient = isValidUserId(postRequestParameter('to_userid'));
// Check for nickname extension and set additional data
// @TODO Rewrite this to a filter
@@ -107,8 +100,8 @@ switch ($mode) {
// Re-check receivers and own personal data
$result = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email`".$add." FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid` IN ('%s','%s') AND `status`='CONFIRMED' LIMIT 2",
array(
- getUserId(),
- bigintval(postRequestElement('to_userid'))
+ getMemberId(),
+ bigintval(postRequestParameter('to_userid'))
), __FILE__, __LINE__);
// Do we have two entries?
@@ -127,87 +120,83 @@ switch ($mode) {
$content['recipient']['nickname'] = '';
} // END - if
- // Translate some data
- $content['sender']['gender'] = translateGender($content['sender']['gender']);
- $content['recipient']['gender'] = translateGender($content['recipient']['gender']);
-
// Prepare variables for testing
$TEST_NICK_SENDER = $content['sender']['nickname'];
$TEST_NICK_REC = $content['recipient']['nickname'];
// Default is userids for subject line
- $SENDER = getUserId();
- $RECIPIENT = bigintval(postRequestElement('to_userid'));
+ $SENDER = getMemberId();
+ $RECIPIENT = bigintval(postRequestParameter('to_userid'));
// If nickname is installed we can set the nickname
// @TODO Rewrite this to a filter
if (isExtensionActive('nickname')) {
- if (($TEST_NICK_SENDER != getUserId()) && (!empty($TEST_NICK_SENDER))) {
+ if (($TEST_NICK_SENDER != getMemberId()) && (!empty($TEST_NICK_SENDER))) {
$SENDER = $content['sender']['nickname'];
}
- if (($TEST_NICK_REC != postRequestElement('to_userid')) && (!empty($TEST_NICK_REC))) {
+ if (($TEST_NICK_REC != postRequestParameter('to_userid')) && (!empty($TEST_NICK_REC))) {
$RECIPIENT = $content['recipient']['nickname'];
}
} // END - if
// Remember transfer reason and fancy date/time in constants
- $content['reason'] = secureString(postRequestElement('reason'));
+ $content['reason'] = secureString(postRequestParameter('reason'));
$content['expires'] = createFancyTime(getConfig('transfer_age'));
// Generate tranafer id
- $content['trans_id'] = bigintval(generateRandomCode('10', mt_rand(0, 99999), getUserId(), postRequestElement('reason')));
+ $content['trans_id'] = bigintval(generateRandomCode('10', mt_rand(0, 99999), getMemberId(), postRequestParameter('reason')));
// Add entries to both tables
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_in` (`userid`, `from_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
- array(bigintval(postRequestElement('to_userid')), getUserId(), bigintval(postRequestElement('points')), postRequestElement('reason'), $content['trans_id']), __FILE__, __LINE__);
+ array(bigintval(postRequestParameter('to_userid')), getMemberId(), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__);
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_transfers_out` (`userid`, `to_userid`, `points`, `reason`, `time_trans`, `trans_id`) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
- array(getUserId(), bigintval(postRequestElement('to_userid')), bigintval(postRequestElement('points')), postRequestElement('reason'), $content['trans_id']), __FILE__, __LINE__);
+ array(getMemberId(), bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')), postRequestParameter('reason'), $content['trans_id']), __FILE__, __LINE__);
// Add points to account *directly* ...
- addPointsDirectly('member_transfer', bigintval(postRequestElement('to_userid')), bigintval(postRequestElement('points')));
+ addPointsDirectly('member_transfer', bigintval(postRequestParameter('to_userid')), bigintval(postRequestParameter('points')));
// ... and add it to current user's used points
- subtractPoints('transfer', getUserId(), postRequestElement('points'));
+ subtractPoints('transfer', getMemberId(), postRequestParameter('points'));
// First send email to recipient
- $message = loadEmailTemplate('member_transfer_recipient', $content, postRequestElement('to_userid'));
- sendEmail($content['recipient']['email'], getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $message);
+ $message = loadEmailTemplate('member_transfer_recipient', $content, postRequestParameter('to_userid'));
+ sendEmail($content['recipient']['email'], '{--TRANSFER_MEMBER_RECIPIENT_SUBJECT--}' . ': ' . $SENDER, $message);
// Second send email to sender
- $message = loadEmailTemplate('member_transfer_sender', $content, getUserId());
- sendEmail($content['sender']['email'], getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $message);
+ $message = loadEmailTemplate('member_transfer_sender', $content, getMemberId());
+ sendEmail($content['sender']['email'], '{--TRANSFER_MEMBER_SENDER_SUBJECT--}' . ': ' . $RECIPIENT, $message);
// At last send admin mail(s)
- $ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
- sendAdminNotification($ADMIN_SUBJ, 'admin_transfer_points', $content);
+ $adminSubject = sprintf("%s (%s->%s)", '{--TRANSFER_ADMIN_SUBJECT--}', $SENDER, $RECIPIENT);
+ sendAdminNotification($adminSubject, 'admin_transfer_points', $content);
// Transfer is completed
- loadTemplate('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED') . "
{--TRANSFER_CONTINUE_OVERVIEW--}");
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_COMPLETED--}' . '
{--TRANSFER_CONTINUE_OVERVIEW--}');
} elseif ($valid_code === false) {
// Invalid Touring code!
- loadTemplate('admin_settings_saved', false, "
{--TRANSFER_INVALID_CODE--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_CODE--}
');
+ unsetPostRequestParameter('ok');
} elseif ($valid_pass === false) {
// Wrong password entered
- loadTemplate('admin_settings_saved', false, "{--TRANSFER_INVALID_PASSWORD--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_PASSWORD--}
');
+ unsetPostRequestParameter('ok');
} elseif ($valid_amount === false) {
// Too much points entered
- loadTemplate('admin_settings_saved', false, "{--TRANSFER_INVALID_POINTS--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_POINTS--}
');
+ unsetPostRequestParameter('ok');
} elseif ($valid_reason === false) {
// No transfer reason entered
- loadTemplate('admin_settings_saved', false, "{--TRANSFER_INVALID_REASON--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_REASON--}
');
+ unsetPostRequestParameter('ok');
} elseif ($valid_recipient === false) {
// No recipient selected
- loadTemplate('admin_settings_saved', false, "{--TRANSFER_INVALID_RECIPIENT--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_RECIPIENT--}
');
+ unsetPostRequestParameter('ok');
} elseif ($valid_data === false) {
// No recipient/sender selected
- loadTemplate('admin_settings_saved', false, "{--TRANSFER_INVALID_DATA--}
");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '{--TRANSFER_INVALID_DATA--}
');
+ unsetPostRequestParameter('ok');
}
// Free result
@@ -219,22 +208,22 @@ switch ($mode) {
if (isExtensionActive('nickname')) {
// Load userid and nickname
$result = SQL_QUERY_ESC("SELECT `userid`, `nickname` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' AND `opt_in`='Y' AND `userid` != '%s' ORDER BY `userid` ASC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
} else {
// Load only userid
$result = SQL_QUERY_ESC("SELECT `userid`, `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' AND `opt_in`='Y' AND `userid` != '%s' ORDER BY `userid` ASC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
}
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Load list
- $OUT = "