if (!isMember()) return false;
// Secure user id
- setUserId(getSession('userid'));
+ setMemberId(getSession('userid'));
// Found a userid?
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Load last module and online time
$content = getUserDataArray();
array(
getWhat(),
detectRemoteAddr(),
- getUserId()
+ getMemberId()
), __FUNCTION__, __LINE__);
} else {
// Destroy session, we cannot update!
- destroyUserSession();
+ destroyMemberSession();
}
}
// Check if logged in
if (isMember()) {
// Is still logged in so we welcome him with his name
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Load surname and family's name and build the username
$content = getUserDataArray();
setUsername('<em>{--USERNAME_UNKNOWN--}</em>');
// Destroy session
- destroyUserSession();
-
- // Kill userid
- setUserId(0);
+ destroyMemberSession();
}
} elseif (isAdmin()) {
// Admin is there
// Is the extension sql_patches installed and at least 0.3.6?
if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && (isExtensionInstalledAndNewer('other', '0.2.5'))) {
// Generate random number
- setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getUserId(), ''));
+ setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getMemberId(), ''));
} else {
// Generate weak (!!!) code
setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999));
$data .= getConfig('ENCRYPT_SEPERATOR') . determineReferalId();
$data .= getConfig('ENCRYPT_SEPERATOR') . getLanguage();
$data .= getConfig('ENCRYPT_SEPERATOR') . getCurrentTheme();
- $data .= getConfig('ENCRYPT_SEPERATOR') . getUserId();
+ $data .= getConfig('ENCRYPT_SEPERATOR') . getMemberId();
// Calculate number for generating the code
$a = $code + getConfig('_ADD') - 1;
exit;
}
-// Setter for userid
-function setUserId ($userid) {
- // We should not set userid to zero
- if ($userid == 0) debug_report_bug('Userid should not be set zero.');
+// Init member id
+function initMemberId () {
+ $GLOBALS['member_id'] = 0;
+}
+
+// Setter for member id
+function setMemberId ($memberid) {
+ // We should not set member id to zero
+ if ($memberid == 0) debug_report_bug('Userid should not be set zero.');
// Set it secured
- $GLOBALS['userid'] = bigintval($userid);
+ $GLOBALS['member_id'] = bigintval($memberid);
}
-// Getter for userid or returns zero
-function getUserId () {
- // Default userid
- $userid = 0;
+// Getter for member id or returns zero
+function getMemberId () {
+ // Default member id
+ $memberid = 0;
- // Is the userid set?
- if (isUserIdSet()) {
+ // Is the member id set?
+ if (isMemberIdSet()) {
// Then use it
- $userid = $GLOBALS['userid'];
+ $memberid = $GLOBALS['member_id'];
} // END - if
// Return it
- return $userid;
+ return $memberid;
}
-// Checks ether the userid is set
-function isUserIdSet () {
- return (isset($GLOBALS['userid']));
+// Checks ether the member id is set
+function isMemberIdSet () {
+ return (isset($GLOBALS['member_id']));
}
// Handle message codes from URL
$ADMIN = 'N';
// Valid userid?
- if ((isUserIdSet()) && (getUserId() > 0) && (isMember())) {
+ if ((isMemberIdSet()) && (getMemberId() > 0) && (isMember())) {
// Is valid user
- $userid = getUserId();
+ $userid = getMemberId();
$MEM = 'Y';
} // END - if
$api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5'));
// Prepare purpose
- eval("\$purpose = \"".compileRawCode(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getMemberId()))."\";");
// Pay the Primera
return $api->payPrimera($primusNick, $amount, $purpose);
// Get entry from database
$result = SQL_QUERY_ESC("SELECT `id`, `refid`, `refback`, `level` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `id`=%s AND `userid`=%s LIMIT 1",
- array($id, getUserId()), __FUNCTION__, __LINE__);
+ array($id, getMemberId()), __FUNCTION__, __LINE__);
// Is there an entry?
if (SQL_NUMROWS($result) == 1) {
// Update entry
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_refs` SET `refback`='%s' WHERE `id`=%s AND `userid`=%s LIMIT 1",
- array($percents, $id, getUserId()), __FUNCTION__, __LINE__);
+ array($percents, $id, getMemberId()), __FUNCTION__, __LINE__);
// Entry updated?
if (SQL_AFFECTEDROWS() < 1) {
);
// Load member email template
- $mail = loadEmailTemplate('member_refback', $content, getUserId());
+ $mail = loadEmailTemplate('member_refback', $content, getMemberId());
// Send email to user
sendEmail($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
// Send admin notification
- sendAdminNotification(getMessage('ADMIN_REFBACK_SUBJECT'), 'admin_refback', $content, getUserId());
+ sendAdminNotification(getMessage('ADMIN_REFBACK_SUBJECT'), 'admin_refback', $content, getMemberId());
// All fine!
$status['ok'] = true;
} elseif ((!isUrlValid($url)) && (!isAdmin())) {
// URL invalid
return false;
- } elseif (SURFBAR_LOOKUP_BY_URL($url, getUserId())) {
+ } elseif (SURFBAR_LOOKUP_BY_URL($url, getMemberId())) {
// URL already found in surfbar!
return false;
- } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getUserId())) {
+ } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getMemberId())) {
// No more allowed!
return false;
} elseif (''.($limit + 0).'' != ''.$limit.'') {
}
// Register the new URL
- return SURFBAR_REGISTER_URL($url, getUserId(), 'PENDING', 'reg', array('limit' => $limit));
+ return SURFBAR_REGISTER_URL($url, getMemberId(), 'PENDING', 'reg', array('limit' => $limit));
}
// Create list of actions depending on status for the user
WHERE
l.userid=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(l.last_surfed) AND (((UNIX_TIMESTAMP(l.last_surfed) - u.fixed_reload) < 0 AND u.fixed_reload > 0) OR u.fixed_reload = 0)
LIMIT 1",
- array(getUserId()), __FUNCTION__, __LINE__
+ array(getMemberId()), __FUNCTION__, __LINE__
);
// Fetch row
// Is the user 0 and user is logged in?
if (($userid == 0) && (isMember())) {
// Then use this userid
- $userid = getUserId();
+ $userid = getMemberId();
} elseif ($userid == 0) {
// Error!
return (getConfig('surfbar_max_order') + 1);
}
// ... and now the validation code
- $valCode = generateRandomCode($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getUserId());
+ $valCode = generateRandomCode($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getMemberId());
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'valCode='.valCode.'', false);
} // END - while
///* DEBUG: */ return;
// Just add it to the database
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`userid`, `url_id`) VALUES (%s, %s)",
- array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
+ array(getMemberId(), bigintval($urlId)), __FUNCTION__, __LINE__);
// Remove the salt from database
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_surfbar_salts` WHERE `url_id`=%s AND `userid`=%s LIMIT 1",
- array(bigintval($urlId), getUserId()), __FUNCTION__, __LINE__);
+ array(bigintval($urlId), getMemberId()), __FUNCTION__, __LINE__);
}
// Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
} // END - if
// Book it to the user
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.getUserId().',reward='.SURFBAR_GET_REWARD().'', false);
- addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getUserId(), SURFBAR_GET_DATA('reward'));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.getMemberId().',reward='.SURFBAR_GET_REWARD().'', false);
+ addPointsThroughReferalSystem(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getMemberId(), SURFBAR_GET_DATA('reward'));
}
// Updates the statistics of current URL/userid
// Update the stats entry
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_stats` SET `count`=`count`+1 WHERE `userid`=%s AND `url_id`=%s LIMIT 1",
- array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+ array(getMemberId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
// Was that update okay?
if (SQL_AFFECTEDROWS() < 1) {
// No, then insert entry
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (userid,url_id,count) VALUES (%s,%s,1)",
- array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+ array(getMemberId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
} // END - if
// Update total/daily/weekly/monthly counter
// Simply store the salt from cache away in database...
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_salts` SET `last_salt`='%s' WHERE `url_id`=%s AND `userid`=%s LIMIT 1",
- array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
+ array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getMemberId()), __FUNCTION__, __LINE__);
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt='.SURFBAR_GET_SALT().',id='.SURFBAR_GET_ID().',userid='.getUserId().'', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'salt='.SURFBAR_GET_SALT().',id='.SURFBAR_GET_ID().',userid='.getMemberId().'', false);
// Was that okay?
if (SQL_AFFECTEDROWS() < 1) {
// Insert missing entry!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`url_id`, `userid`, `last_salt`) VALUES (%s, %s, '%s')",
- array(SURFBAR_GET_ID(), getUserId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
+ array(SURFBAR_GET_ID(), getMemberId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
} // END - if
// Debug message
ORDER BY
`last_surfed` ASC
LIMIT 1",
- array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
+ array(getMemberId(), bigintval($urlId)), __FUNCTION__, __LINE__
);
// Fetch counter
// Do we have a current user id?
if ((isMember()) && ($limit == 0)) {
// Then add this as well
- $UIDs['userid'][getUserId()] = getUserId();
- $UIDs['points'][getUserId()] = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points');
- $UIDs['notified'][getUserId()] = 0;
+ $UIDs['userid'][getMemberId()] = getMemberId();
+ $UIDs['points'][getMemberId()] = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
+ $UIDs['notified'][getMemberId()] = 0;
// Get all userid except logged in one
$result = SQL_QUERY_ESC("SELECT
u.userid
ORDER BY
u.userid ASC",
- array(getUserId()), __FUNCTION__, __LINE__);
+ array(getMemberId()), __FUNCTION__, __LINE__);
} else {
// Get all userid
$result = SQL_QUERY("SELECT
SQL_FREERESULT($result);
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".getUserId().')', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".getMemberId().')', false);
// Return result
return $UIDs;
WHERE
`userid`=%s
ORDER BY
- `id` ASC", array(getUserId()),
+ `id` ASC", array(getMemberId()),
__FUNCTION__, __LINE__);
// Load all entries
FROM `{?_MYSQL_PREFIX?}_surfbar_urls` AS u
WHERE u.userid=%s AND u.status != 'DELETED'
ORDER BY u.id ASC",
- array(getUserId()), __FUNCTION__, __LINE__);
+ array(getMemberId()), __FUNCTION__, __LINE__);
// Are there entries?
if (SQL_NUMROWS($result) > 0) {
ON sbu.id=l.url_id
WHERE sbu.userid != %s AND sbu.`status`='ACTIVE' AND sbu.id=%s AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))
LIMIT 1",
- array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
+ array(getMemberId(), bigintval($urlId)), __FUNCTION__, __LINE__
);
}
// Update global array
// @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
- setUserId($userid);
+ setMemberId($userid);
// Try to set session data (which shall normally always work!)
if ((setSession('userid', $userid )) && (setSession('u_hash', $content['hash']))) {
$result = false;
// Prepare the purpose
- eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_WITHDRAW'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_WITHDRAW'), getMemberId()))."\";");
// Prepare the request data
$requestData = array(
$result = false;
// Prepare the purpose
- eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), getUserId()))."\";");
+ eval("\$purpose = \"".compileRawCode(sprintf(getMessage('WERNIS_API_PURPOSE_PAYOUT'), getMemberId()))."\";");
// Prepare the request data
$requestData = array(
function WERNIS_LOG_TRANSFER ($wdsId, $amount, $type = 'FAILED', $message = '', $status = '') {
// Register this wernis movement
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_wernis` (`userid`,`wernis_account`,`wernis_amount`,`wernis_timestamp`,`wernis_type`,`wernis_api_message`,`wernis_api_status`) VALUES (%d, %d, %d, UNIX_TIMESTAMP(), '%s', '%s', '%s')",
- array(getUserId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
+ array(getMemberId(), bigintval($wdsId), bigintval($amount), $type, $message, $status), __FUNCTION__, __LINE__);
}
// Take fees and factor
//* DEBUG: */ outputHtml("mode={$mode},points={$points}<br />");
if (!in_array($mode, array('payout', 'withdraw'))) {
// Log error and abort
- logDebugMessage(__FUNCTION__, __LINE__, "userid={getUserId()},mode={$mode},points={$points}");
+ logDebugMessage(__FUNCTION__, __LINE__, "userid={getMemberId()},mode={$mode},points={$points}");
return false;
} // END - if
// Initial message part
$message = "<strong>{--VALIDATING_LOGIN--}</strong>";
-if (isUserIdSet() && (isSessionVariableSet('u_hash'))) {
+if (isMemberIdSet() && (isSessionVariableSet('u_hash'))) {
// Is 'theme' installed and activated?
if (isExtensionActive('theme')) {
// Get theme from profile
- if (!fetchUserData(getUserId())) {
+ if (!fetchUserData(getMemberId())) {
// Userid is not valid
- debug_report_bug('User id '.getUserId() . ' is invalid.');
+ debug_report_bug('User id '.getMemberId() . ' is invalid.');
} // END - if
// Load data
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Store it in session
setSession('mxchange_member_failures', $data['login_failures']);
`last_login` < (UNIX_TIMESTAMP() - %s)
LIMIT 1",
array(
- getUserId(),
+ getMemberId(),
getConfig('login_timeout')
), __FILE__, __LINE__
);
if (isMember()) {
// Ok, test passed... :)
$result = SQL_QUERY_ESC("SELECT `subject`, `url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s AND `data_type`='TEMP' LIMIT 1",
- array(bigintval(getRequestElement('order')), getUserId()), __FILE__, __LINE__);
+ array(bigintval(getRequestElement('order')), getMemberId()), __FILE__, __LINE__);
// Finally is the entry valid?
if (SQL_NUMROWS($result) == 1) {
$add = '';
// Already logged in?
-if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
+if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
// Maybe, then continue with it
- $userid = getUserId();
+ $userid = getMemberId();
} elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) {
// Set userid and crypt password when login data was submitted
if ((isExtensionActive('nickname')) && (isNicknameOrUserid(postRequestElement('id')))) {
$content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
} else {
$content['prices'] = addReferalRallyePrices($id, 'html');
- $content['top_users'] = addReferalRallyeTopUsers($id, getUserId());
+ $content['top_users'] = addReferalRallyeTopUsers($id, getMemberId());
$content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
}
} // END - if
// Get userid
-$userid = getUserId();
+$userid = getMemberId();
if (isExtensionActive('nickname')) {
// Load nickname
// Set user id when no nickname was found
$nickname = true;
-if (empty($userid)) { $userid = getUserId(); $nickname = false; }
+if (empty($userid)) { $userid = getMemberId(); $nickname = false; }
// Prepare constants
$content['userid'] = $userid;
// Add description as navigation point
addMenuDescription('member', __FILE__);
-$UID = getUserId();
+$UID = getMemberId();
$whereStatement = " WHERE `visible`='Y'";
if (isAdmin()) $whereStatement = '';
$content['max'] = translateComma(getConfig('doubler_max'));
// Default refid is the userid
-$content['userid'] = getUserId();
+$content['userid'] = getMemberId();
// Transfer referal id
if (isExtensionActive('nickname')) {
// Load nickname from DB
- $nick = getNickname(getUserId());
+ $nick = getNickname(getMemberId());
if (!empty($nick)) {
// Set nickname
$content['payout_time'] = getMessage('DOUBLER_PAYOUT_TIME_' . getConfig('doubler_send_mode'));
// Generate table with already payed out doubles
-$content['payout_history'] = generateDoublerTable(getUserId(), 'Y', 'N', 'DESC');
+$content['payout_history'] = generateDoublerTable(getMemberId(), 'Y', 'N', 'DESC');
// Generate table with next-to-run payouts
-$content['next_table'] = generateDoublerTable(getUserId());
+$content['next_table'] = generateDoublerTable(getMemberId());
// Generate table with refferal payouts
-$content['payout_ref'] = generateDoublerTable(getUserId(), 'N', 'Y', 'DESC');
+$content['payout_ref'] = generateDoublerTable(getMemberId(), 'N', 'Y', 'DESC');
// Generate timemark
$content['timeout_mark'] = createFancyTime(getConfig('doubler_timeout'));
`sender`=%s
ORDER BY
`timestamp` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
// Check for sent mail orders in stats
$result2 = SQL_QUERY_ESC("SELECT
`userid`=%s
ORDER BY
`timestamp_ordered` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
// Mail order found!
} else {
// Everything went okay so let's store his request and send mails
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
- array(getUserId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
+ array(getMemberId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
// Activate holiday system
SQL_QUERY_ESC("UPDATE
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Prepare constants
$content['start_day'] = bigintval(postRequestElement('start_day'));
$content['comments'] = secureString(postRequestElement('comments'));
// Send mail to member
- $message = loadEmailTemplate('member_holiday_request', $content, getUserId());
- sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
+ $message = loadEmailTemplate('member_holiday_request', $content, getMemberId());
+ sendEmail(getMemberId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
// Send mail to all admins
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getUserId());
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getMemberId());
// Create task
- createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getUserId());
+ createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getMemberId());
// Display message
loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
$content = merge_array($content, SQL_FETCHARRAY($result));
SQL_FREERESULT($result);
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Data was found
$content = merge_array($content, SQL_FETCHARRAY($result));
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Remove entry
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Send email to admin
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getUserId());
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getMemberId());
// Display message to user
loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
$content = SQL_FETCHARRAY($result);
SQL_FREERESULT($result);
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Data was found
$content = merge_array($content, SQL_FETCHARRAY($result));
`holiday_active`='N'
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
redirectToUrl('modules.php?module=login&what=holiday');
return;
}
if (isFormSent()) {
// Save settings
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `html`='%s' WHERE `userid`=%s LIMIT 1",
- array(postRequestElement('html'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('html'), getMemberId()), __FILE__, __LINE__);
loadTemplate('admin_settings_saved', false, getMessage('MEMBER_SETTINGS_SAVED'));
} else {
// Load template for changing settings
- if (!fetchUserData(getUserId())) {
+ if (!fetchUserData(getMemberId())) {
// Something really bad happened
- debug_report_bug('No user account ' . getUserId() . ' found.');
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
} // END - if
// Prepare it
// Base URL for redirection (both cases)
$URL = 'modules.php?module=index&code=';
-if (destroyUserSession()) {
+if (destroyMemberSession()) {
// Remove theme cookie as well
setTheme('');
// Add userid
$content = array(
- 'userid' => getUserId()
+ 'userid' => getMemberId()
);
// Init variable to prevent notices
switch ($mode) {
case 'show': // Show his data
// Get user data
- if (!fetchUserData(getUserId())) {
+ if (!fetchUserData(getMemberId())) {
// Something really bad happended
- debug_report_bug('No user account ' . getUserId() . ' found.');
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
} // END - if
// Get line
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
} else {
// Old way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
$result = SQL_QUERY_ESC("SELECT `surname`, `family`, `street_nr`, `country`, `zip`, `city`, `email`, `birth_day`, `birth_month`, `birth_year`, `gender`, `max_mails`, `receive_mails`, `last_update`
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
}
// Get line
case 'save': // Save entered data
// Load old email / password
- if (!fetchUserData(getUserId())) {
+ if (!fetchUserData(getMemberId())) {
// Something really bad happened
- debug_report_bug('No user account ' . getUserId() . ' found.');
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
} // END - if
// Get line
bigintval(postRequestElement('month')),
bigintval(postRequestElement('year')),
bigintval(postRequestElement('max_mails')),
- getUserId()
+ getMemberId()
), __FILE__, __LINE__);
} else {
// Old way
bigintval(postRequestElement('month')),
bigintval(postRequestElement('year')),
bigintval(postRequestElement('max_mails')),
- getUserId()
+ getMemberId()
), __FILE__, __LINE__);
}
case 'notify': // Switch off notfication
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `notified`='N', `last_update`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
$URL = 'modules.php?module=login&what=welcome&code=' . urlencode(getMessage('PROFILE_UPDATED'));
break;
} // END - switch
if ($isValid === true) {
// Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !)
$result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' AND `userid` != '%s' LIMIT 1",
- array(postRequestElement('nickname'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('nickname'), getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Nickname not in use, so set it now
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1",
- array(postRequestElement('nickname'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('nickname'), getMemberId()), __FILE__, __LINE__);
$content = getMessage('NICKNAME_SAVED');
} else {
// Free result
} // END - if
// Load Template
- loadTemplate('member_nickname_form', false, getNickname(getUserId()));
+ loadTemplate('member_nickname_form', false, getNickname(getMemberId()));
}
// [EOF]
if (isAdmin()) $whereStatement = '';
// Count unconfirmed mails
-$links = countSumTotalData(getUserId(), 'user_links', 'id', 'userid', true);
+$links = countSumTotalData(getMemberId(), 'user_links', 'id', 'userid', true);
// Do we have ext-holiday installed?
$HOLIDAY = 'serid';
$result_mmails = SQL_QUERY_ESC("SELECT `userid`, `receive_mails`, `mail_orders`, `".$HOLIDAY."`
FROM `{?_MYSQL_PREFIX?}_user_data`
WHERE `userid`=%s AND `max_mails` > 0 LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
$mmails = SQL_NUMROWS($result_mmails);
list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
if (getConfig('order_max_full') == 'MAX') $ALLOWED = $MAXI;
// Now check his points amount
-$total = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points');;
+$total = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');;
if (($HOLIDAY == 'Y') && (getExtensionVersion('holiday') >= '0.1.3')) {
// Holiday is active!
`timestamp` > (UNIX_TIMESTAMP() - %s)
LIMIT 1",
array(
- getUserId(),
+ getMemberId(),
postRequestElement('url'),
getConfig('url_tlock')
), __FILE__, __LINE__);
d.%s %s",
array(
bigintval(postRequestElement('cat')),
- getUserId(),
+ getMemberId(),
getConfig('order_select'),
getConfig('order_mode'),
), __FILE__, __LINE__);
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_pool` (`sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `zip`, `html_msg`)
VALUES ('%s','%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s','%s','%s','%s','%s')",
array(
- getUserId(),
+ getMemberId(),
postRequestElement('subject'),
postRequestElement('text'),
$RECEIVER,
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_pool` (`sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `zip`)
VALUES ('%s','%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
array(
- getUserId(),
+ getMemberId(),
postRequestElement('subject'),
postRequestElement('text'),
$RECEIVER,
// Order is placed as temporary. We need to get it's id for the frametester
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s AND `subject`='%s' AND `payment_id`=%s AND `data_type`='TEMP' AND `timestamp`=UNIX_TIMESTAMP() LIMIT 1",
array(
- getUserId(),
+ getMemberId(),
postRequestElement('subject'),
bigintval(postRequestElement('type'))
), __FILE__, __LINE__);
// Select users in current category
$result_userids = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `cat_id`=%s AND `userid` != '%s' ORDER BY `userid` ASC",
- array(bigintval($categoriesContent['id']), getUserId()), __FILE__, __LINE__);
+ array(bigintval($categoriesContent['id']), getMemberId()), __FILE__, __LINE__);
$userid_cnt = 0;
while (list($ucat) = SQL_FETCHROW($result_userids)) {
`sender`=%s AND
`data_type`='TEMP'
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Old order found
while ($content = SQL_FETCHARRAY($result_depths)) {
// Load referal points
$result_points = SQL_QUERY_ESC("SELECT `points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1",
- array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
+ array(getMemberId(), bigintval($content['level'])), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result_points) == 1) {
SQL_FREERESULT($result_depths);
// Get used points
-$usedPoints = countSumTotalData(getUserId(), 'user_data', 'used_points');
+$usedPoints = countSumTotalData(getMemberId(), 'user_data', 'used_points');
// Translate point into comma
$totalPoints = ($totalPoints - $usedPoints);
p.userid = %s
ORDER BY
p.payout_timestamp DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result_payouts) > 0) {
// List all his requests
$OUT = ''; $SW = 2;
setRequestPostElement('type' , $content['type']);
// Subtract points from member's account
- subtractPoints('payout', getUserId(), $points);
+ subtractPoints('payout', getMemberId(), $points);
// Add entry to his tranfer history
if ($content['allow'] == 'Y') {
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_payouts` (`userid`, `payout_total`, `payout_id`, `payout_timestamp`, `status`, `target_url`, `link_text`, `banner_url`)
VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
array(
- getUserId(),
+ getMemberId(),
bigintval(postRequestElement('payout')),
bigintval(getRequestElement('payout')),
postRequestElement('turl'),
), __FILE__, __LINE__);
// Load templates
- $message_mem = loadEmailTemplate('member_payout_request_banner', postRequestArray(), getUserId());
+ $message_mem = loadEmailTemplate('member_payout_request_banner', postRequestArray(), getMemberId());
if (getExtensionVersion('admins') >= '0.4.1') {
$adm_tpl = 'admin_payout_request_banner';
} else {
- $message_adm = loadEmailTemplate('admin_payout_request_banner', postRequestArray(), getUserId());
+ $message_adm = loadEmailTemplate('admin_payout_request_banner', postRequestArray(), getMemberId());
}
} else {
// e-currency payout requested
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_payouts` (`userid`, `payout_total`, `target_account`, `target_bank`, `payout_id`, `payout_timestamp`, `status`, `password`)
VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
array(
- getUserId(),
+ getMemberId(),
bigintval(postRequestElement('payout')),
bigintval(postRequestElement('account')),
postRequestElement('bank'),
), __FILE__, __LINE__);
// Load templates
- $message_mem = loadEmailTemplate('member_payout_request', postRequestArray(), getUserId());
- $message_adm = loadEmailTemplate('admin_payout_request', postRequestArray(), getUserId());
+ $message_mem = loadEmailTemplate('member_payout_request', postRequestArray(), getMemberId());
+ $message_adm = loadEmailTemplate('admin_payout_request', postRequestArray(), getMemberId());
$admin_tpl = '';
// @TODO Rewrite this to a filter
}
// Generate task
- createNewTask('[payout:] {--PAYOUT_REQUEST_ADMIN--}', $message_adm, 'PAYOUT_REQUEST', getUserId());
+ createNewTask('[payout:] {--PAYOUT_REQUEST_ADMIN--}', $message_adm, 'PAYOUT_REQUEST', getMemberId());
// Send out mails
- sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $message_mem);
+ sendEmail(getMemberId(), getMessage('PAYOUT_REQUEST_MEMBER'), $message_mem);
// To admin(s)
- sendAdminNotification(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, postRequestArray(), getUserId());
+ sendAdminNotification(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, postRequestArray(), getMemberId());
// Load template and output it
loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_REQUEST_SENT'));
$REFS = 0;
// Load referal points
- $result_points = SQL_QUERY_ESC("SELECT `points`, `locked_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
+ $result_points = SQL_QUERY_ESC("SELECT `points`, `locked_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getMemberId(), bigintval($content['level'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_points) == 1) {
list($points, $locked) = SQL_FETCHROW($result_points);
// Also count locked points
// Load referal counts
$result_refs = SQL_QUERY_ESC("SELECT `counter` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `userid`=%s AND `level`='%s' LIMIT 1",
- array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
+ array(getMemberId(), bigintval($content['level'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_refs) == 1) {
list($REFS) = SQL_FETCHROW($result_refs);
$TREF += $REFS;
$content['rows'] = $OUT;
// Fetch user account
-if (!fetchUserData(getUserId())) {
+if (!fetchUserData(getMemberId())) {
// Something really bad happened
- debug_report_bug('User account ' . getUserId() . ' not found.');
+ debug_report_bug('User account ' . getMemberId() . ' not found.');
} // END - if
// Initialize variables
$content['refid'] = getConfig(('primera_refid'));
// Are there some entries?
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Fetch id
$content['primera_nickname'] = getUserData('primera_nickname');
} // END - if
// 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(getMemberId()), __FILE__, __LINE__);
// Load all rows
$content['rows'] = ''; $SW = 2;
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);
$content['primera_nickname'] = '';
// Do we have a user account? (should be!)
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Fetch id
$content['primera_nickname'] = getUserData('primera_nickname');
} // END - if
} // 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_nickname`=%s WHERE `userid`=%s LIMIT 1",
- array(postRequestElement('primera_nickname'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('primera_nickname'), getMemberId()), __FILE__, __LINE__);
// All done!
loadTemplate('admin_settings_saved', false, getMessage('PRIMERA_MEMBER_PAYOUT_DONE'));
$content['can_win_this'] = getMessage('RALLYE_OUR_WINNERS_ARE');
} else {
$content['prices'] = addReferalRallyePrices($content['id'], 'html');
- $content['top_users'] = addReferalRallyeTopUsers($content['id'], getUserId());
+ $content['top_users'] = addReferalRallyeTopUsers($content['id'], getMemberId());
$content['can_win_this'] = getMessage('RALLYE_YOU_CAN_WIN');
}
FROM `{?_MYSQL_PREFIX?}_refdepths` AS r
WHERE r.level > 0
ORDER BY r.level ASC",
-array(getUserId()), __FILE__, __LINE__);
+array(getMemberId()), __FILE__, __LINE__);
// Are there some entries? (Shall be!)
if (SQL_NUMROWS($result) > 0) {
$SW = 2;
// Check for users ref in this level
- foreach (getArrayFromRefbackUserRefs(getUserId(), $content['level']) as $refRow) {
+ foreach (getArrayFromRefbackUserRefs(getMemberId(), $content['level']) as $refRow) {
// Not-deleted account is default
$deleted = false;
if (is_null($refRow['status'])) $deleted = true;
addMenuDescription('member', __FILE__);
// Load current referal clicks
-if (!fetchUserData(getUserId())) {
+if (!fetchUserData(getMemberId())) {
// Something really bad happened
- debug_report_bug('No user account ' . getUserId() . ' found.');
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
} // END - if
// Prepare some data
$content['ref_clicks'] = getUserData('ref_clicks');
-$content['userid'] = getUserId();
+$content['userid'] = getMemberId();
// @TODO Move this into a filter
if (isExtensionActive('nickname')) {
// Add nickname link when nickname is entered
- $nick = getNickname(getUserId());
+ $nick = getNickname(getMemberId());
if (!empty($nick)) {
// Display nickname link
// Add some more data
$row['sw'] = $SW;
- $row['userid'] = getUserId();
+ $row['userid'] = getMemberId();
// Add row
$OUT .= loadTemplate('member_reflinks_row', true, $row);
FROM `{?_MYSQL_PREFIX?}_refdepths` AS r
WHERE r.level > 0
ORDER BY r.level ASC",
-array(getUserId()), __FILE__, __LINE__);
+array(getMemberId()), __FILE__, __LINE__);
// Are there some entries? (Shall be!)
if (SQL_NUMROWS($result) > 0) {
$SW = 2;
// Check for users ref in this level
- foreach (getUserReferalPoints(getUserId(), $content['level']) as $refRow) {
+ foreach (getUserReferalPoints(getMemberId(), $content['level']) as $refRow) {
// Add/"translate" more content
$refRow['sw'] = $SW;
$refRow['points'] = translateComma($refRow['points']);
`sender`=%s AND `data_type` != 'SEND'
ORDER BY
`timestamp` DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Are there mails left in pool?
if (SQL_NUMROWS($result) > 0) {
`userid`=%s
ORDER BY
`timestamp_ordered` DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Mail orders are in pool so we can display them
if (getExtensionVersion('admins') >= '0.4.1') {
$a_tpl = 'admin_support-' . postRequestElement('qsummary');
} else {
- $message_a = loadEmailTemplate('admin_support-' . postRequestElement('qsummary'), array('text' => postRequestElement('qdetails')), getUserId());
+ $message_a = loadEmailTemplate('admin_support-' . postRequestElement('qsummary'), array('text' => postRequestElement('qdetails')), getMemberId());
}
- $message_m = loadEmailTemplate('member_support-' . postRequestElement('qsummary'), array('text' => postRequestElement('qdetails')), getUserId());
+ $message_m = loadEmailTemplate('member_support-' . postRequestElement('qsummary'), array('text' => postRequestElement('qdetails')), getMemberId());
// Select right subject
switch (postRequestElement('qsummary')) {
} // END - switch
// Send mail to admin
- sendAdminNotification($subj_a, $a_tpl, array('text' => postRequestElement('qdetails')), getUserId());
+ sendAdminNotification($subj_a, $a_tpl, array('text' => postRequestElement('qdetails')), getMemberId());
// Send mail to user
- sendEmail(getUserId(), $subj_m, $message_m);
+ sendEmail(getMemberId(), $subj_m, $message_m);
// Drop a message in the admin's area
- createNewTask($subj_a, postRequestElement('qsummary') . ' : ' . postRequestElement('qdetails'), 'SUPPORT_MEMBER', getUserId());
+ createNewTask($subj_a, postRequestElement('qsummary') . ' : ' . postRequestElement('qdetails'), 'SUPPORT_MEMBER', getMemberId());
// Form sent
loadTemplate('member_support_contcted');
if (isPostRequestElementSet('member_theme')) {
// Save theme to member's profile
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `curr_theme`='%s' WHERE `userid`=%s LIMIT 1",
- array(postRequestElement('member_theme'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('member_theme'), getMemberId()), __FILE__, __LINE__);
// Set new theme for guests
$newTheme = SQL_ESCAPE(postRequestElement('member_theme'));
} // END - if
// Load data
-if (!fetchUserData(getUserId())) {
+if (!fetchUserData(getMemberId())) {
// Something really bad happened
- debug_report_bug('No user account ' . getUserId() . ' found.');
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
} // END - if
// Check for mode in GET
switch ($mode) {
case 'new': // Start new transfer
// Get total points and subtract the balance amount from it = maximum transferable points
- $total = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points');
+ $total = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
// Remember maximum value for template
$content['max_transferable'] = round($total - getConfig('transfer_balance') - 0.5);
// Add new transfer
if (getConfig('transfer_code') > 0) {
// Check for code
- $code = generateRandomCode(getConfig('transfer_code'), postRequestElement('code_chk'), getUserId(), $content['max_transferable']);
+ $code = generateRandomCode(getConfig('transfer_code'), postRequestElement('code_chk'), getMemberId(), $content['max_transferable']);
$valid_code = ($code == postRequestElement('code'));
} else {
// Zero length (= disabled) is always valid!
// 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(),
+ getMemberId(),
bigintval(postRequestElement('to_userid'))
), __FILE__, __LINE__);
$TEST_NICK_REC = $content['recipient']['nickname'];
// Default is userids for subject line
- $SENDER = getUserId();
+ $SENDER = getMemberId();
$RECIPIENT = bigintval(postRequestElement('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'];
}
$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(), postRequestElement('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(postRequestElement('to_userid')), getMemberId(), bigintval(postRequestElement('points')), postRequestElement('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(postRequestElement('to_userid')), bigintval(postRequestElement('points')), postRequestElement('reason'), $content['trans_id']), __FILE__, __LINE__);
// Add points to account *directly* ...
addPointsDirectly('member_transfer', bigintval(postRequestElement('to_userid')), bigintval(postRequestElement('points')));
// ... and add it to current user's used points
- subtractPoints('transfer', getUserId(), postRequestElement('points'));
+ subtractPoints('transfer', getMemberId(), postRequestElement('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);
// Second send email to sender
- $message = loadEmailTemplate('member_transfer_sender', $content, getUserId());
+ $message = loadEmailTemplate('member_transfer_sender', $content, getMemberId());
sendEmail($content['sender']['email'], getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $message);
// At last send admin mail(s)
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) {
// Generate Code
if (getConfig('transfer_code') > 0) {
$rand = mt_rand(0, 99999);
- $code = generateRandomCode(getConfig('transfer_code'), $rand, getUserId(), $content['max_transferable']);
+ $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;
} else {
// Run the SQL command and set total points to zero
$totalPoints = 0;
- $result = SQL_QUERY_ESC($sql, array(getUserId()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC($sql, array(getMemberId()), __FILE__, __LINE__);
// Do we have entries?
if (SQL_NUMROWS($result) > 0) {
// 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(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__);
+ array(getMemberId(), getConfig('transfer_max')), __FILE__, __LINE__);
while ($DATA = SQL_FETCHROW($result)) {
$DATA[] = 'IN';
$DATA = implode("','", $DATA);
// As the last table transfer data from outgoing table to temporary
$result = SQL_QUERY_ESC("SELECT `trans_id`, `to_userid`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `userid`=%s ORDER BY `id` LIMIT {?transfer_max?}",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
while ($DATA = SQL_FETCHROW($result)) {
$DATA[] = 'OUT';
$DATA = implode("','", $DATA);
default: // Overview page
// Check incoming transfers
- $total = countSumTotalData(getUserId(), 'user_transfers_in', 'id', 'userid', true);
+ $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>";
} // END - if
// Check outgoing transfers
- $dmy = countSumTotalData(getUserId(), 'user_transfers_out', 'id', 'userid', true);
+ $dmy = countSumTotalData(getMemberId(), 'user_transfers_out', 'id', 'userid', true);
// Add to total amount
$total += $dmy;
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'), getUserId()), __FILE__, __LINE__);
+ array(postRequestElement('opt_in'), getMemberId()), __FILE__, __LINE__);
// Rember for next switch() command
getUserData('opt_in') = substr(postRequestElement('opt_in'), 0, 1);
LIMIT 1",
array(
getConfig('transfer_timeout'),
- getUserId()
+ getMemberId()
), __FILE__, __LINE__);
// Do we have an entry?
$content['is_notify'] = translateYesNo($content['is_notify']);
$content['sender'] = getMessage('USERNAME_ADMIN_SHORT');
$content['time'] = createFancyTime($content['time']);
- $content['userid'] = getUserId();
+ $content['userid'] = getMemberId();
// Get timestamp from insert
$content['user_status'] = sprintf(getMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON'),
$content['category'] = getCategory($content['cat_id']);
$content['points'] = translateComma($content['points']);
$content['time'] = createFancyTime($content['time']);
- $content['userid'] = getUserId();
+ $content['userid'] = getMemberId();
// Get timestamp from insert
$content['user_status'] = sprintf(getMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON'),
if (isExtensionActive('bonus')) {
// Load bonus id
$result = SQL_QUERY_ESC("SELECT `stats_id`, `bonus_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `bonus_id` DESC, stats_id DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
} else {
// Don't load bonus id
$result = SQL_QUERY_ESC("SELECT `stats_id`, `stats_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `stats_id` DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
}
// Mails left for confirmation?
// Prepare data for template
$content = array(
'sw' => $SW,
- 'userid' => getUserId(),
+ 'userid' => getMemberId(),
'data' => bigintval($DATA),
'type' => $type,
'subject' => $subject,
// Chedk if he is returning from a profile update notification
$result = SQL_QUERY_ESC("SELECT userid FROM `{?_MYSQL_PREFIX?}_user_data` WHERE notified='Y' AND `userid`=%s LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('profile'))) {
// Yes, he is so let's place him his wanted buttons
$content['wernis_userid'] = 0;
// Are there some entries?
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Fetch id
$content['wernis_userid'] = getUserData('wernis_userid');
} // END - if
// And load all rows!
$result = SQL_QUERY_ESC("SELECT `id`,`wernis_account`,`wernis_amount`,`wernis_timestamp`,`wernis_type` FROM `{?_MYSQL_PREFIX?}_user_wernis` WHERE `userid`=%s ORDER BY `wernis_timestamp` DESC",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Load all rows
$content['rows'] = ''; $SW = 2;
}
} elseif ((getRequestElement('mode') == 'payout') && (getConfig('wernis_payout_active') == 'Y')) {
// 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');
// Remove the registration fee
$points = $points - getConfig('points_register');
$content['wernis_userid'] = '';
// Are there some entries?
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Fetch id
$content['wernis_userid'] = getUserData('wernis_userid');
} // END - if
} elseif ((getRequestElement('mode') == 'withdraw') && (getConfig('wernis_withdraw_active') == 'Y')) {
// Get total points for just displaying them
- $points = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points');
+ $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
// Prepare data for the template
$content['points'] = translateComma($points);
WERNIS_ADD_FEES_TO_ARRAY($content);
// Get WDS66 id
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Fetch id
$content['wernis_userid'] = getUserData('wernis_userid');
} // END - if
$success = WERNIS_EXECUTE_WITHDRAW(postRequestElement('wernis_userid'), md5(postRequestElement('wds66_password')), postRequestElement('amount'));
if ($success === true) {
// Add it to this amount
- addPointsDirectly('wernis_withdraw', getUserId(), bigintval(postRequestElement('amount')));
+ addPointsDirectly('wernis_withdraw', getMemberId(), bigintval(postRequestElement('amount')));
// Update the user data as well..
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `wernis_userid`=%s WHERE `userid`=%s LIMIT 1",
- array(bigintval(postRequestElement('wernis_userid')), getUserId()), __FILE__, __LINE__);
+ array(bigintval(postRequestElement('wernis_userid')), getMemberId()), __FILE__, __LINE__);
// All done!
loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_WITHDRAW_DONE'));
$success = WERNIS_EXECUTE_PAYOUT(postRequestElement('wernis_userid'), postRequestElement('amount'));
if ($success === true) {
// Sub points
- subtractPoints('wernis_payout', getUserId(), postRequestElement('amount'));
+ subtractPoints('wernis_payout', getMemberId(), postRequestElement('amount'));
// Update WDS66 id
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `wernis_userid`=%s WHERE `userid`=%s LIMIT 1",
- array(bigintval(postRequestElement('wernis_userid')), getUserId()), __FILE__, __LINE__);
+ array(bigintval(postRequestElement('wernis_userid')), getMemberId()), __FILE__, __LINE__);
// All done!
loadTemplate('admin_settings_saved', false, getMessage('WERNIS_MEMBER_PAYOUT_DONE'));
// Update sending pool
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='%s' WHERE `id`=%s AND `sender`=%s AND `data_type`='TEMP' LIMIT 1",
- array($type, bigintval(getRequestElement('order')), getUserId()), __FILE__, __LINE__);
+ array($type, bigintval(getRequestElement('order')), getMemberId()), __FILE__, __LINE__);
// Finally is the entry valid?
if (SQL_AFFECTEDROWS() == 1) {
// @TODO Unused: 2,4
// Load mail again... 0 1 2 3 4 5 6 7
$result = SQL_QUERY_ESC("SELECT `subject`, `text`, `receivers`, `payment_id`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s LIMIT 1",
- array(bigintval(getRequestElement('order')), getUserId()), __FILE__, __LINE__);
+ array(bigintval(getRequestElement('order')), getMemberId()), __FILE__, __LINE__);
$content = merge_array($content, SQL_FETCHARRAY($result));
SQL_FREERESULT($result);
if (empty($content['subject'])) $content['subject'] = getMessage('DEFAULT_SUBJECT_LINE');
// Update used points
$add = '';
if (getConfig('order_max_full') == 'ORDER') $add = ', mail_orders=mail_orders+1';
- subtractPoints('order', getUserId(), $usedPoints);
+ subtractPoints('order', getMemberId(), $usedPoints);
// Compile content
$content['payment'] = getPaymentTitlePrice($content['payment_id']);
$content['category'] = getCategory($content['cat_id']);
// Send an email to the user
- $message_mem = loadEmailTemplate('order-member', $content, getUserId());
- sendEmail(getUserId(), getMessage('MEMBER_NEW_QUEUE'), $message_mem);
+ $message_mem = loadEmailTemplate('order-member', $content, getMemberId());
+ sendEmail(getMemberId(), getMessage('MEMBER_NEW_QUEUE'), $message_mem);
// Notify admins about this
- sendAdminNotification(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getUserId());
+ sendAdminNotification(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getMemberId());
// Create new task
createNewTask(
'{--ADMIN_NEW_QUEUE--}',
- '<pre>'.loadEmailTemplate('order-admin', $content, getUserId()).'</pre>',
+ '<pre>'.loadEmailTemplate('order-admin', $content, getMemberId()).'</pre>',
'MEMBER_ORDER',
- getUserId(),
+ getMemberId(),
0,
false
);
// Init request
initRequest();
+// Init userid
+initMemberId();
+
// Set important header_sent
if (!isset($GLOBALS['header_sent'])) $GLOBALS['header_sent'] = 0;
if (isset($GLOBALS['is_member'])) {
// Then return it
return $GLOBALS['is_member'];
- } elseif (getUserId() == 0) {
+ } elseif (getMemberId() == 0) {
// No member
return false;
} else {
// Transfer userid=>current
- setCurrentUserid(getUserId());
+ setCurrentUserid(getMemberId());
}
// Init global user data array
fixDeletedCookies(array('userid', 'u_hash'));
// Are cookies set?
- if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
+ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
// Cookies are set with values, but are they valid?
- if (fetchUserData(getUserId()) === true) {
+ if (fetchUserData(getMemberId()) === true) {
// Validate password by created the difference of it and the secret key
$valPass = generatePassString(getUserData('password'));
} else {
// Maybe got locked etc.
//* DEBUG: */ print(__LINE__."!!!<br />");
- destroyUserSession();
+ destroyMemberSession();
}
} else {
// Cookie data is invalid!
//* DEBUG: */ print(__LINE__."***<br />");
- destroyUserSession();
+ destroyMemberSession();
}
} else {
// Cookie data is invalid!
//* DEBUG: */ print(__LINE__."///<br />");
- destroyUserSession();
+ destroyMemberSession();
}
// Cache status
// @TODO Lame description for this function
function sendModeMails ($mod, $modes) {
// Load hash
- if (fetchUserData(getUserId())) {
+ if (fetchUserData(getMemberId())) {
// Extract salt from cookie
$salt = substr(getSession('u_hash'), 0, -40);
if (($hash == getSession('u_hash')) || (postRequestElement('pass1') == postRequestElement('pass2'))) {
// Load user's data 0 1 2 3 4 5 6 7
$result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, country, zip, city, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s AND password='%s' LIMIT 1",
- array(getUserId(), getUserData('password')), __FUNCTION__, __LINE__);
+ array(getMemberId(), getUserData('password')), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load the data
$content = SQL_FETCHARRAY($result, 0, false);
$content = merge_array($content, postRequestArray());
// Load template
- $message = loadEmailTemplate('member_mydata_notify', $content, getUserId());
+ $message = loadEmailTemplate('member_mydata_notify', $content, getMemberId());
if (getConfig('admin_notify') == 'Y') {
// The admin needs to be notified about a profile change
if (empty($content)) {
if ((!empty($sub_adm)) && (!empty($message_admin))) {
// Send admin mail
- sendAdminNotification($sub_adm, $message_admin, $content, getUserId());
+ sendAdminNotification($sub_adm, $message_admin, $content, getMemberId());
} elseif (getConfig('admin_notify') == 'Y') {
// Cannot send mails to admin!
$content = getMessage('CANNOT_SEND_ADMIN_MAILS');
$stamp = 0;
// User id set?
- if ((isUserIdSet()) && ($userid == 0)) {
- $userid = getUserId();
+ if ((isMemberIdSet()) && ($userid == 0)) {
+ $userid = getMemberId();
} // END - if
// Is the extension installed and updated?
}
// Destroy user session
-function destroyUserSession () {
+function destroyMemberSession () {
// Reset userid
- setUserId(0);
+ initMemberId();
// Remove all user data from session
return ((setSession('userid', '')) && (setSession('u_hash', '')));
// Transfer userid from session and validate it
if (isSessionVariableSet('userid')) {
// Get it secured from session
- setUserId(getSession('userid'));
+ setMemberId(getSession('userid'));
// Is it valid?
if (!isMember()) {
// Then destroy the user id
- destroyUserSession();
+ destroyMemberSession();
} // END - if
} // END - if
if ($ltype == 'BONUS') $sender = 0;
// Is the user id valid?
- if (fetchUserData($url_userId) === true) {
+ if (fetchUserData($url_userid) === true) {
// Is the user status CONFIRMED?
if (getUserData('status') == 'CONFIRMED') {
// User has confirmed his account so we can procede...
unsetGetRequestElement('frame');
} elseif ((isGetRequestElementSet('frame')) && (getRequestElement('frame') == 'stats')) {
// Get total points amount
- $points = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotalData(getUserId(), 'user_data', 'used_points');
+ $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
// Prepare content
$content = array(