WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
array(getUserId(), REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__);
- $type = "TEMP"; $id = 0;
+ $type = 'TEMP'; $id = 0;
if (SQL_NUMROWS($result) == 1) {
// Load id and mail type
list($id, $type) = SQL_FETCHROW($result);
// Free result
SQL_FREERESULT($result);
- if ($type == "TEMP") {
+ if ($type == 'TEMP') {
// No entry found, so we need to check out the stats table as well... :)
// We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
$URL = '';
if (getConfig('url_blacklist') == 'Y') {
// Ok, I do that for you know...
$result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS tstamp FROM `{!_MYSQL_PREFIX!}_url_blacklist` WHERE `url`='%s' LIMIT 1",
- array(REQUEST_POST('url')), __FILE__, __LINE__);
+ array(REQUEST_POST('url')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Jupp, we got one listed
if (!REQUEST_ISSET_POST(('text'))) $URL = 'modules.php?module=login&what=order&msg=' . getCode('INVALID_TAGS')."&id=".$id;
} else {
// Remove any HTML code
- REQUEST_SET_POST('text', str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", REQUEST_POST('text'))));
+ REQUEST_SET_POST('text', str_replace('<', '{OPEN_HTML}', str_replace('>', '{CLOSE_HTML}', REQUEST_POST('text'))));
}
}
} elseif (!IS_ADMIN()) {
// He has already sent a mail within a specific time
- $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_TLOCK')."&id=".$id;
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_TLOCK') . '&id=' . $id;
}
// Still no error?
if (($USED > 0) && ($USED <= $total) && ($MAX_SEND > 0)) {
// Gettings points is okay, so we can add $USED later from
$TIME = time();
- if (($id == '0') || ($type != "TEMP")) {
+ if (($id == '0') || ($type != 'TEMP')) {
// New order
$id = 0;
if (EXT_IS_ACTIVE('html_mail')) {
$message = getMessage('MEMBER_ENTER_INVALID_URL');
break;
- case "": // When no error code is included in the URL we do not need to output an error message as well...
+ case '': // When no error code is included in the URL we do not need to output an error message as well...
break;
default:
// Add new transfer
if (getConfig('transfer_code') > 0) {
// Check for code
- $code = generateRandomCodde(getConfig('transfer_code'), REQUEST_POST('code_chk'), getUserId(), constant('__TRANSFER_MAX_VALUE'));
+ $code = generateRandomCode(getConfig('transfer_code'), REQUEST_POST('code_chk'), getUserId(), constant('__TRANSFER_MAX_VALUE'));
$valid_code = ($code == REQUEST_POST('code'));
} else {
// Zero length (= disabled) is always valid!
define('__TRANSFER_EXPIRES', createFancyTime(getConfig('transfer_age')));
// Generate tranafer id
- define('__TRANS_ID', bigintval(generateRandomCodde("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason'))));
+ define('__TRANS_ID', bigintval(generateRandomCode("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason'))));
// Add entries to both tables
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_transfers_in` (userid, from_uid, points, reason, time_trans, trans_id) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')",
SUB_POINTS('transfer', getUserId(), REQUEST_POST('points'));
// First send email to recipient
- $msg = LOAD_EMAIL_TEMPLATE("member_transfer_recipient", '', constant('__RECIPIENT_UID'));
- sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ').": ".$SENDER, $msg);
+ $msg = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID'));
+ sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $msg);
// Second send email to sender
- $msg = LOAD_EMAIL_TEMPLATE("member_transfer_sender", '', constant('__SENDER_UID'));
- sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ').": ".$RECIPIENT, $msg);
+ $msg = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID'));
+ sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $msg);
// At last send admin mail(s)
$ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
- sendAdminNotification($ADMIN_SUBJ, "admin_transfer_points");
+ sendAdminNotification($ADMIN_SUBJ, 'admin_transfer_points');
// Transfer is completed
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED')."<br /><a href=\"{!URL!}/modules.php?module=login&what=transfer\">{--TRANSFER_CONTINUE_OVERVIEW--}</a>");
if (EXT_IS_ACTIVE('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(getUserId()), __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(getUserId()), __FILE__, __LINE__);
}
if (SQL_NUMROWS($result) > 0) {
} else {
// No one else is opt-in
$OUT = getMessage('TRANSFER_NO_ONE_ELSE_OPT_IN');
- define('__TRANSFER_TO_DISABLED', " disabled");
+ define('__TRANSFER_TO_DISABLED', ' disabled="disabled"');
}
// Transfer output to constant for the template
// Generate Code
if (getConfig('transfer_code') > 0) {
$rand = mt_rand(0, 99999);
- $code = generateRandomCodde(getConfig('transfer_code'), $rand, getUserId(), constant('__TRANSFER_MAX_VALUE'));
+ $code = generateRandomCode(getConfig('transfer_code'), $rand, getUserId(), constant('__TRANSFER_MAX_VALUE'));
$img = GENERATE_IMAGE($code, false);
define('__TRANSFER_IMAGE_INPUT', "<input type=\"hidden\" name=\"code_chk\" value=\"".$rand."\" /><input type=\"text\" name=\"code\" class=\"member_normal\" size=\"5\" maxlength=\"7\"{!__TRANSFER_TO_DISABLED!} /> ".$img);
} else {
- $code = "00000";
+ $code = '00000';
define('__TRANSFER_IMAGE_INPUT', getMessage('TRANSFER_NO_CODE'));
}
}
// Output form
- LOAD_TEMPLATE("member_transfer_new");
+ LOAD_TEMPLATE('member_transfer_new');
}
break;
- case "list_in": // List only incoming transactions
- case "list_out": // List only outgoing transactions
+ case 'list_in': // List only incoming transactions
+ case 'list_out': // List only outgoing transactions
// As you can see I put list_in and list_out together. I now do a switch() again on it for the right SQL command
switch ($mode)
{
- case "list_in":
+ case 'list_in':
$sql = "SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
// @TODO Rewrite these constants
$NOTHING = getMessage('TRANSFER_NO_INCOMING_TRANSFERS');
define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_INCOMING'));
break;
- case "list_out":
+ case 'list_out':
$sql = "SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
// @TODO Rewrite these constants
$NOTHING = getMessage('TRANSFER_NO_OUTGOING_TRANSFERS');
// @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
while (list($tid, $uid, $points, $reason, $stamp) = SQL_FETCHROW($result)) {
// Rewrite points
- if ($type == "OUT") $points = $points.'-';
+ if ($type == 'OUT') $points = $points.'-';
// Prepare content for template
$content = array(
);
// Load row template
- $OUT .= LOAD_TEMPLATE("member_transfer_row2", true, $content);
+ $OUT .= LOAD_TEMPLATE('member_transfer_row2', true, $content);
// Add points and switch color
$total += $points;
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
define('__TRANSFER_TOTAL_VALUE', $total);
// Load final template
- LOAD_TEMPLATE("member_transfer_list");
+ LOAD_TEMPLATE('member_transfer_list');
break;
- case "list_all": // List all transactions
+ case 'list_all': // List all transactions
// We fill a temporary table with data from both tables. This is much easier
// to code and unstand by you as sub-SELECT queries. I know this is not the
// fastest way but it shall be fine for now.
$result = SQL_QUERY_ESC("SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY `id` LIMIT %s",
array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
while ($DATA = SQL_FETCHROW($result)) {
- $DATA[] = "IN";
+ $DATA[] = 'IN';
$DATA = implode("','", $DATA);
$res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (trans_id, party_uid, points, reason, time_trans, trans_type) VALUES ('".$DATA."')", __FILE__, __LINE__);
}
$result = SQL_QUERY_ESC("SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY `id` LIMIT %s",
array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
while ($DATA = SQL_FETCHROW($result)) {
- $DATA[] = "OUT";
+ $DATA[] = 'OUT';
$DATA = implode("','", $DATA);
$res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (trans_id, party_uid, points, reason, time_trans, trans_type) VALUES ('".$DATA."')", __FILE__, __LINE__);
}
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Rewrite points
- if ($content['trans_type'] == "OUT") $content['points'] = '-'.$content['points']."";
+ if ($content['trans_type'] == 'OUT') $content['points'] = '-'.$content['points']."";
// Prepare content for template
$content['sw'] = $SW;
// Add points and switch color
$total += $content['points'];
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_BALANCE'));
// Load final template
- LOAD_TEMPLATE("member_transfer_list");
+ LOAD_TEMPLATE('member_transfer_list');
// At the end we don't need a temporary table in memory
$result = SQL_QUERY("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_transfers_tmp`", __FILE__, __LINE__);
SQL_FREERESULT($result);
break;
- case "": // Overview page
+ case '': // Overview page
// Check incoming transfers
$result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s", array(getUserId()), __FILE__, __LINE__);
list($dmy) = SQL_FETCHROW($result);
// "Settings saved..."
LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"member_done\">{--SETTINGS_SAVED--}</div>");
- }
+ } // END - if
- switch ($opt_in)
- {
+ switch ($opt_in) {
case 'Y':
define('__TRANSFER_ALLOW_Y', ' checked="checked"');
define('__TRANSFER_ALLOW_N', '');
define('__TRANSFER_ALLOW_N', ' checked="checked"');
define('__TRANSFER_NEW_LINK', getMessage('TRANSFER_PLEASE_ALLOW_OPT_IN'));
break;
- }
+ } // END - switch
// Check for latest out-transfers
$result = SQL_QUERY_ESC("SELECT time_trans
FROM `{!_MYSQL_PREFIX!}_user_transfers_out`
WHERE time_trans > (UNIX_TIMESTAMP() - %s) AND `userid`=%s
ORDER BY time_trans DESC
-LIMIT 1", array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__);
+LIMIT 1",
+ array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Load template
define('__TRANSFER_SETTINGS_CONTENT', LOAD_TEMPLATE("member_transfer_settings", true));