// Do some pre-checks
if (!isAdmin()) {
// Not an admin
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Not admin.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Not admin.", $url, $limit, $reload));
return false;
} elseif (!isUrlValid($url)) {
// URL invalid
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid URL.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid URL.", $url, $limit, $reload));
return false;
} elseif (SURFBAR_LOOKUP_BY_URL($url, 0)) {
// URL already found in surfbar!
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Already added.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Already added.", $url, $limit, $reload));
return false;
} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
// No more allowed!
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : No more URLs allowed.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: No more URLs allowed.", $url, $limit, $reload));
return false;
} elseif ('' . ($limit + 0) . '' != '' . $limit . '') {
// Invalid limit entered
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid limit entered.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid limit entered.", $url, $limit, $reload));
return false;
} elseif ('' . ($reload + 0) . '' != '' . $reload . '') {
// Invalid amount entered
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s : Invalid reload entered.", $url, $limit, $reload));
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid reload entered.", $url, $limit, $reload));
return false;
}
// Do some pre-checks
if (!isAdmin()) {
// Not an admin
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Not admin, url=' . $url . ',userid=' . $userid);
return false;
} elseif (!isUrlValid($url)) {
// URL invalid
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Invalid URL, url=' . $url . ',userid=' . $userid);
return false;
} elseif (SURFBAR_LOOKUP_BY_URL($url, $userid)) {
// URL already found in surfbar!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Already added, url=' . $url . ',userid=' . $userid);
return false;
} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($userid)) {
// No more allowed!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Maximum exceeded, url=' . $url . ',userid=' . $userid);
return false;
}
// Is this an admin or invalid array?
if (!isAdmin()) {
// Not admin or invalid ids array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin');
return false;
} elseif (!is_array($IDs)) {
// No array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array');
return false;
} elseif (count($IDs) == 0) {
// Empty array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty');
return false;
}
// Is this an admin or invalid array?
if (!isAdmin()) {
// Not admin or invalid ids array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin');
return false;
} elseif (!is_array($IDs)) {
// No array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array');
return false;
} elseif (count($IDs) == 0) {
// Empty array
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty');
return false;
}
// Do some pre-checks
if (!isMember()) {
// Not a member
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not member');
return false;
} elseif ((!isUrlValid($url)) && (!isAdmin())) {
// URL invalid
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid, url=' . $url . ',limit=' . $limit);
return false;
} elseif (SURFBAR_LOOKUP_BY_URL($url, getMemberId())) {
// URL already found in surfbar!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Already found, url=' . $url . ',limit=' . $limit);
return false;
} elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getMemberId())) {
// No more allowed!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Maximum exceeded, url=' . $url . ',limit=' . $limit);
return false;
} elseif (''.($limit + 0).'' != ''.$limit.'') {
// Invalid amount entered
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid limit, url=' . $url . ',limit=' . $limit);
return false;
}
// Is this a member?
if (!isMember()) {
// No member!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not member');
return false;
} elseif ((!isset($formData['id'])) || (!isset($formData['action']))) {
// Important form elements are missing!
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid form data, required field id/action not found');
return false;
} elseif (!isset($urlArray[$formData['id']])) {
- // id not found in cache
+ // Id not found in cache
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Field id not found in cache');
return false;
} elseif (!SURFBAR_VALIDATE_MEMBER_ACTION_STATUS($formData['action'], $urlArray[$formData['id']]['url_status'])) {
// Action not allowed for current URL status
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Action not allowed to perform. action=' . $formData['action'] . ',url_status=' . $urlArray[$formData['id']]['url_status'] . 'id=' . $formData['id']);
return false;
}
$performed = call_user_func_array($functionName, $urlData);
} else {
// Log invalid request
- logDebugMessage(__FUNCTION__, __LINE__, "action={$formData['action']},id={$formData['id']},function={$functionName}");
- addFatalMessage(__FUNCTION__, __LINE__, "Invalid member action! action=%s,id=%s,function=%s", array($formData['action'], $formData['id'], $functionName));
+ debug_report_bug(__FUNCTION__, __LINE__, 'Invalid member action! action=' . $formData['action'] . ',id=' . $formData['id'] . ',function=' . $functionName);
}
// Return status
} // END - if
} else {
// Not found
- addFatalMessage(__FUNCTION__, __LINE__, '{--MEMBER_SURFBAR_EXECUTE_ACTION_404--}', $functionName);
+ debug_report_bug(__FUNCTION__, __LINE__, 'Callback function ' . $functionName . ' not found.');
}
// Return status
$total = SURFBAR_GET_TOTAL_URLS();
// Do we have some URLs in lock? Admins can always surf on own URLs!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userLocks=".SURFBAR_GET_USER_LOCKS().",total={$total}", false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userLocks=' . SURFBAR_GET_USER_LOCKS() . ',total=' . $total);
$isFull = ((SURFBAR_GET_USER_LOCKS() == $total) && ($total > 0));
// Return result
while ($content = SQL_FETCHARRAY($result)) {
// Get total points
$points = getTotalPoints($content['url_userid']);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']},points={$points}", false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $content['url_userid'] . ',points=' . $points);
// Shall we add this to ignore?
if ($points <= $limit) {
// Ignore this one!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "userid={$content['url_userid']} has depleted points amount!", false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $content['url_userid'] . ' has depleted points amount!');
$userids['url_userid'][$content['url_userid']] = $content['url_userid'];
$userids['points'][$content['url_userid']] = $points;
$userids['notified'][$content['url_userid']] = $content['notified'];
SQL_FREERESULT($result);
// Debug message
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "UIDs::count=".count($userids)." (with own userid=".getMemberId().')', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UIDs::count=' . count($userids) . ' (with own userid=' . getMemberId() . ')');
// Return result
return $userids;
// Private getter for data elements
function SURFBAR_GET_DATA ($element) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "element={$element}", false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ' - CALLED!');
// Default is null
$data = null;
}
// Return result
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . $element . ']=[' . gettype($data) . ']' . $data, false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element[' . $element . ']=[' . gettype($data) . ']' . $data . ' - EXIT!');
return $data;
}