<?php
/************************************************************************
- * MXChange v0.2.1 Start: 10/07/2004 *
- * ================ Last change: 10/07/2004 *
+ * Mailer v0.2.1-FINAL Start: 10/07/2004 *
+ * =================== Last change: 10/07/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-transfer.php *
return;
} // END - if
-// Load data
-if (!fetchUserData(getMemberId())) {
- // Something really bad happened
- debug_report_bug('No user account ' . getMemberId() . ' found.');
-} // END - if
-
// Check for mode in GET
$mode = '';
-if (isGetRequestElementSet('mode')) $mode = getRequestElement('mode');
+if (isGetRequestParameterSet('mode')) $mode = getRequestParameter('mode');
// Check for "faker"
if ((getUserData('opt_in') != 'Y') && ($mode == 'new')) $mode = '';
// Add new transfer
if (getConfig('transfer_code') > 0) {
// Check for code
- $code = generateRandomCode(getConfig('transfer_code'), postRequestElement('code_chk'), getMemberId(), $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 = (postRequestParameter('to_userid') > 0);
// Check for nickname extension and set additional data
// @TODO Rewrite this to a filter
$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(
getMemberId(),
- bigintval(postRequestElement('to_userid'))
+ bigintval(postRequestParameter('to_userid'))
), __FILE__, __LINE__);
// Do we have two entries?
// Default is userids for subject line
$SENDER = getMemberId();
- $RECIPIENT = bigintval(postRequestElement('to_userid'));
+ $RECIPIENT = bigintval(postRequestParameter('to_userid'));
// If nickname is installed we can set the nickname
// @TODO Rewrite this to a filter
$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), getMemberId(), 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')), getMemberId(), 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(getMemberId(), 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', getMemberId(), postRequestElement('points'));
+ subtractPoints('transfer', getMemberId(), postRequestParameter('points'));
// First send email to recipient
- $message = loadEmailTemplate('member_transfer_recipient', $content, postRequestElement('to_userid'));
+ $message = loadEmailTemplate('member_transfer_recipient', $content, postRequestParameter('to_userid'));
sendEmail($content['recipient']['email'], getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $message);
// Second send email to sender
sendEmail($content['sender']['email'], getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $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)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
+ sendAdminNotification($adminSubject, 'admin_transfer_points', $content);
// Transfer is completed
- loadTemplate('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED') . "<br /><a href=\"{?URL?}/modules.php?module=login&what=transfer\">{--TRANSFER_CONTINUE_OVERVIEW--}</a>");
+ loadTemplate('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED') . "<br /><a href=\"{%url=modules.php?module=login&what=transfer%}\">{--TRANSFER_CONTINUE_OVERVIEW--}</a>");
} elseif ($valid_code === false) {
// Invalid Touring code!
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_CODE--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_CODE--}</div>');
+ unsetPostRequestParameter('ok');
} elseif ($valid_pass === false) {
// Wrong password entered
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_PASSWORD--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_PASSWORD--}</div>');
+ unsetPostRequestParameter('ok');
} elseif ($valid_amount === false) {
// Too much points entered
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_POINTS--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_POINTS--}</div>');
+ unsetPostRequestParameter('ok');
} elseif ($valid_reason === false) {
// No transfer reason entered
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_REASON--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_REASON--}</div>');
+ unsetPostRequestParameter('ok');
} elseif ($valid_recipient === false) {
// No recipient selected
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_RECIPIENT--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_RECIPIENT--}</div>');
+ unsetPostRequestParameter('ok');
} elseif ($valid_data === false) {
// No recipient/sender selected
- loadTemplate('admin_settings_saved', false, "<div class=\"member_note\">{--TRANSFER_INVALID_DATA--}</div>");
- unsetPostRequestElement('ok');
+ loadTemplate('admin_settings_saved', false, '<div class="member_note">{--TRANSFER_INVALID_DATA--}</div>');
+ unsetPostRequestParameter('ok');
}
// Free result
// @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
while (list($userid, $nick) = SQL_FETCHROW($result)) {
$OUT .= " <option value=\"".$userid."\"";
- if ((isPostRequestElementSet(('to_userid'))) && (postRequestElement('to_userid') == $userid)) $OUT .= ' selected="selected"';
+ if ((isPostRequestParameterSet(('to_userid'))) && (postRequestParameter('to_userid') == $userid)) $OUT .= ' selected="selected"';
$OUT .= ">";
if (($nick != $userid) && (!empty($nick))) {
// Output nickname
$rand = mt_rand(0, 99999);
$code = generateRandomCode(getConfig('transfer_code'), $rand, getMemberId(), $content['max_transferable']);
$img = generateImageOrCode($code, false);
- $content['captcha_code'] = "<input type=\"hidden\" name=\"code_chk\" value=\"".$rand."\" /><input type=\"text\" name=\"code\" class=\"member_normal\" size=\"5\" maxlength=\"7\"".$content['to_disabled']." /> " . $img;
+ $content['captcha_code'] = '<input type="hidden" name="code_chk" value="' . $rand . '" /><input type="text" name="code" class="member_normal" size="5" maxlength="7"' . $content['to_disabled'] . ' /> ' . $img;
} else {
$code = '00000';
$content['captcha_code'] = loadTemplate('admin_settings_saved', true, getMessage('TRANSFER_NO_CODE'));
$content['reason'] = '';
// Transfer maybe already entered valued'
- if (isGetRequestElementSet('ok')) {
+ if (isGetRequestParameterSet('ok')) {
// Get values from form
- $content['points'] = bigintval(postRequestElement('points'));
- $content['reason'] = secureString(postRequestElement('reason'));
+ $content['points'] = bigintval(postRequestParameter('points'));
+ $content['reason'] = secureString(postRequestParameter('reason'));
} // END - if
// Translate some array elements for template
// Prepare content for template
// @TODO Rewrite: tid->trans_id,stamp->time_trans
$row = array(
- 'sw' => $SW,
- 'tid' => $tid,
- 'stamp' => generateDateTime($stamp, 3),
- 'userid' => $userid,
- 'reason' => $reason,
- 'points' => translateComma($points)
+ 'sw' => $SW,
+ 'trans_id' => $tid,
+ 'stamp' => generateDateTime($stamp, 3),
+ 'userid' => $userid,
+ 'reason' => $reason,
+ 'points' => translateComma($points)
);
// Load row template
} else {
// Nothing for in or out
$OUT = "<tr>
- <td colspan=\"5\" align=\"center\" class=\"bottom2\" height=\"70\">
+ <td colspan=\"5\" align=\"center\" class=\"bottom\">
".loadTemplate('admin_settings_saved', true, $nothingMessage)."
</td>
</tr>";
) TYPE=HEAP", __FILE__, __LINE__);
// Let's begin with the incoming list
- $result = SQL_QUERY_ESC("SELECT `trans_id`, `from_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `id` ASC LIMIT %s",
- array(getMemberId(), getConfig('transfer_max')), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `trans_id`, `from_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `userid`=%s ORDER BY `id` ASC LIMIT {?transfer_max?}",
+ array(getMemberId()), __FILE__, __LINE__);
while ($DATA = SQL_FETCHROW($result)) {
$DATA[] = 'IN';
$DATA = implode("','", $DATA);
} else {
// Nothing for in and out
$OUT = "<tr>
- <td colspan=\"5\" align=\"center\" class=\"bottom2\" height=\"70\">
+ <td colspan=\"5\" align=\"center\" class=\"bottom\">
".loadTemplate('admin_settings_saved', true, getMessage('TRANSFER_NO_INOUT_TRANSFERS'))."
</td>
</tr>";
$total = countSumTotalData(getMemberId(), 'user_transfers_in', 'id', 'userid', true);
$content['in_link'] = $total;
if ($total > 0) {
- $content['in_link'] = "<a href=\"{?URL?}/modules.php?module=login&what=transfer&mode=list_in\">".$total."</a>";
+ $content['in_link'] = '<a href="{%url=modules.php?module=login&what=transfer&mode=list_in%}">' . $total . '</a>';
} // END - if
// Check outgoing transfers
$content['out_link'] = $dmy;
if ($dmy > 0) {
- $content['out_link'] = "<a href=\"{?URL?}/modules.php?module=login&what=transfer&mode=list_out\">".$dmy."</a>";
+ $content['out_link'] = '<a href="{%url=modules.php?module=login&what=transfer&mode=list_out%}">' . $dmy . '</a>';
} // END - if
// Total transactions
$content['all_link'] = $total;
if ($total > 0) {
- $content['all_link'] = "<a href=\"{?URL?}/modules.php?module=login&what=transfer&mode=list_all\">".$total."</a>";
+ $content['all_link'] = '<a href="{%url=modules.php?module=login&what=transfer&mode=list_all%}">' . $total . '</a>';
} // END - if
if (isFormSent()) {
// Save settings
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `opt_in`='%s' WHERE `userid`=%s LIMIT 1",
- array(postRequestElement('opt_in'), getMemberId()), __FILE__, __LINE__);
+ array(postRequestParameter('opt_in'), getMemberId()), __FILE__, __LINE__);
// Rember for next switch() command
- getUserData('opt_in') = substr(postRequestElement('opt_in'), 0, 1);
+ getUserData('opt_in') = substr(postRequestParameter('opt_in'), 0, 1);
// "Settings saved..."
- loadTemplate('admin_settings_saved', false, "<div class=\"member_done\">{--SETTINGS_SAVED--}</div>");
+ loadTemplate('admin_settings_saved', false, '<div class="member_done">{--SETTINGS_SAVED--}</div>');
} // END - if
// Init entries
// Set 'new transfer' link according to above option
switch (getUserData('opt_in')) {
case 'Y':
- $content['new_link'] = "<a href=\"{?URL?}/modules.php?module=login&what=transfer&mode=new\">{--TRANSFER_NOW_LINK--}</a>";
+ $content['new_link'] = '<a href="{%url=modules.php?module=login&what=transfer&mode=new%}" title="{--TRANSFER_NOW_TITLE--}">{--TRANSFER_NOW_LINK--}</a>';
break;
case 'N':
if (SQL_NUMROWS($result) == 1) {
// Load newest transaction
list($newest) = SQL_FETCHROW($result);
- $content['settings'] = sprintf(getMessage('TRANSFER_LATEST_IS'), generateDateTime($newest, 3));
+ $content['settings'] = getMaskedMessage('TRANSFER_LATEST_IS', generateDateTime($newest, 3));
} else {
// Load template
$content['settings'] = loadTemplate('member_transfer_settings', true, $content);