function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
// Create the data array for next function call
$data = array(
- $urlData['id'] => $urlData
+ $urlData['id'] => $urlData
);
// Simply change the status here
$content = SURFBAR_PREPARE_CONTENT_FOR_TEMPLATE($content);
// Is the lock reason empty?
- if (empty($urlData['lock_reason'])) {
+ if (empty($urlData['url_lock_reason'])) {
// Fix it to three dashes
- $urlData['lock_reason'] = '---';
+ $urlData['url_lock_reason'] = '---';
} // END - if
// Include fields only for action 'edit'
$userids = SURFBAR_DETERMINE_DEPLETED_USERIDS(getConfig('surfbar_warn_low_points'));
// "Walk" through all URLs
- foreach ($userids['userid'] as $userid => $dummy) {
+ foreach ($userids['url_userid'] as $userid => $dummy) {
// Is the last notification far enougth away to notify again?
if ((time() - $userids['notified'][$userid]) >= getConfig('surfbar_low_interval')) {
// Prepare content
$content = array(
- 'userid' => $userid,
- 'low' => translateComma(getConfig('surfbar_warn_low_points')),
- 'points' => translateComma($userids['points'][$userid]),
- 'notified' => generateDateTime($userids['notified'][$userid]),
- 'interval' => createFancyTime(getConfig('surfbar_low_interval'))
+ 'url_userid' => $userid,
+ 'points' => $userids['points'][$userid],
+ 'notified' => $userids['notified'][$userid]
);
// Notify this user
$content = SURFBAR_PREPARE_CONTENT_FOR_TEMPLATE($content);
// Send the notification out
- return sendAdminNotification($subject, $templateName, $content, $content['userid']);
+ return sendAdminNotification($subject, $templateName, $content, $content['url_userid']);
}
// Notify the user about the performed action
function SURFBAR_NOTIFY_USER ($messageType, $content) {
// Skip notification if userid is zero
- if ($content['userid'] == '0') {
+ if ($content['url_userid'] == '0') {
return false;
} // END - if
$content = SURFBAR_PREPARE_CONTENT_FOR_TEMPLATE($content);
// Load template
- $mailText = loadEmailTemplate($templateName, $content, $content['userid']);
+ $mailText = loadEmailTemplate($templateName, $content, $content['url_userid']);
// Send the email
- return sendEmail($content['userid'], $subject, $mailText);
+ return sendEmail($content['url_userid'], $subject, $mailText);
}
// Translates some data for template usage
$userids = SURFBAR_DETERMINE_DEPLETED_USERIDS();
// If we dont get any user ids back, there are no URLs
- if (count($userids['userid']) == 0) {
+ if (count($userids['url_userid']) == 0) {
// No user ids found, no URLs!
return 0;
} // END - if
// Is the exlude userid set?
if ($excludeUserId > 0) {
// Then add it
- $userids['userid'][$excludeUserId] = $excludeUserId;
+ $userids['url_userid'][$excludeUserId] = $excludeUserId;
} // END - if
// Get amount from database
FROM
`{?_MYSQL_PREFIX?}_surfbar_urls`
WHERE
- `url_userid` NOT IN (".implode(', ', $userids['userid']).") AND
+ `url_userid` NOT IN (".implode(', ', $userids['url_userid']).") AND
`url_status`='%s'
LIMIT 1",
array($status), __FUNCTION__, __LINE__
// Lockdown the userid/id combination (reload lock)
function SURFBAR_LOCKDOWN_ID ($urlId) {
- //* DEBUG: */ outputHtml('LOCK!');
+ //* DEBUG: */ debugOutput('LOCK!');
///* DEBUG: */ return;
// Just add it to the database
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`, `locks_url_id`) VALUES (%s, %s)",
function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
// Init array
$userids = array(
- 'userid' => array(),
- 'points' => array(),
- 'notified' => array(),
+ 'url_userid' => array(),
+ 'points' => array(),
+ 'notified' => array(),
);
// Do we have a current user id?
if ((isMember()) && ($limit == '0')) {
// Then add this as well
- $userids['userid'][getMemberId()] = getMemberId();
+ $userids['url_userid'][getMemberId()] = getMemberId();
$userids['points'][getMemberId()] = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
$userids['notified'][getMemberId()] = '0';
// Load all userid
while ($content = SQL_FETCHARRAY($result)) {
// Get total points
- $points = countSumTotalData($content['userid'], 'user_points', 'points') - countSumTotalData($content['userid'], 'user_data', 'used_points');
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['userid']},points={$points}", false);
+ $points = countSumTotalData($content['url_userid'], 'user_points', 'points') - countSumTotalData($content['url_userid'], 'user_data', 'used_points');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']},points={$points}", false);
// Shall we add this to ignore?
if ($points <= $limit) {
// Ignore this one!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['userid']} has depleted points amount!", false);
- $userids['userid'][$content['userid']] = $content['userid'];
- $userids['points'][$content['userid']] = $points;
- $userids['notified'][$content['userid']] = $content['notified'];
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']} has depleted points amount!", false);
+ $userids['url_userid'][$content['url_userid']] = $content['url_userid'];
+ $userids['points'][$content['url_userid']] = $points;
+ $userids['notified'][$content['url_userid']] = $content['notified'];
} // END - if
} // END - while
// Update the status now
// ---------- Comment out for debugging/developing member actions! ---------
- //SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `status`='%s' WHERE `id`=%s LIMIT 1",
+ //SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `status`='%s' WHERE `url_id`=%s LIMIT 1",
// array($newStatus, bigintval($urlId)), __FUNCTION__, __LINE__);
// ---------- Comment out for debugging/developing member actions! ---------
// ---------- Comment out for debugging/developing member actions! ---------
// Prepare content for notification routines
- $data[$urlId]['userid'] = $data[$urlId]['userid'];
+ $data[$urlId]['url_userid'] = $data[$urlId]['url_userid'];
$data[$urlId]['frametester'] = generateFrametesterUrl($data[$urlId]['url']);
$data[$urlId]['reward'] = translateComma(getConfig('surfbar_static_reward'));
$data[$urlId]['costs'] = translateComma(getConfig('surfbar_static_costs'));
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true);
+ $totalUsers = getTotalConfirmedUser();
// Get online users
$onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Get total users
- $totalUsers = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true);
+ $totalUsers = getTotalConfirmedUser();
// Calculate addon
$addon += abs($max * $percent * $totalUsers);
$userids = SURFBAR_DETERMINE_DEPLETED_USERIDS();
// Get maximum randomness factor
- $maxRand = SURFBAR_GET_MAX_RANDOM($userids['userid'], $add);
+ $maxRand = SURFBAR_GET_MAX_RANDOM($userids['url_userid'], $add);
// If more than one URL can be called generate the random number!
if ($maxRand > 1) {
ON
sbu.url_id=l.locks_url_id
WHERE
- sbu.url_userid NOT IN (".implode(',', $userids['userid']).") AND
+ sbu.url_userid NOT IN (".implode(',', $userids['url_userid']).") AND
sbu.url_status='ACTIVE' AND
(sbu.url_views_allowed=0 OR (sbu.url_views_allowed > 0 AND sbu.url_views_max > 0))
".$add."
print('<pre>');
print_r($GLOBALS['surfbar_cache']);
print('</pre>');
- debug_report_bug('Element ' . $element . ' not found.');
+ debug_report_bug(__FUNCTION__, __LINE__, 'Element ' . $element . ' not found.');
}
// Return result