if (!isAdmin()) {
// Not an admin
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Not admin.", $url, $limit, $reload));
- return false;
+ return FALSE;
} elseif (!isUrlValid($url)) {
// URL invalid
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid URL.", $url, $limit, $reload));
- return false;
+ return FALSE;
} elseif (ifSurfbarHasUrlUserId($url, 0)) {
// URL already found in surfbar!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Already added.", $url, $limit, $reload));
- return false;
+ return FALSE;
} elseif (!ifSurfbarMemberAllowedMoreUrls()) {
// No more allowed!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: No more URLs allowed.", $url, $limit, $reload));
- return false;
+ return FALSE;
} elseif ('' . ($limit + 0) . '' != '' . $limit . '') {
// Invalid limit entered
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid limit entered.", $url, $limit, $reload));
- return false;
+ return FALSE;
} elseif ('' . ($reload + 0) . '' != '' . $reload . '') {
// Invalid amount entered
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Cannot add URL=%s,limit=%s,reload=%s: Invalid reload entered.", $url, $limit, $reload));
- return false;
+ return FALSE;
}
// Register the new URL
if (!isAdmin()) {
// Not an admin
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Not admin, url=' . $url . ',userid=' . $userid);
- return false;
+ return FALSE;
} elseif (!isUrlValid($url)) {
// URL invalid
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Invalid URL, url=' . $url . ',userid=' . $userid);
- return false;
+ return FALSE;
} elseif (ifSurfbarHasUrlUserId($url, $userid)) {
// URL already found in surfbar!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Already added, url=' . $url . ',userid=' . $userid);
- return false;
+ return FALSE;
} elseif (!ifSurfbarMemberAllowedMoreUrls($userid)) {
// No more allowed!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot migrate URL: Maximum exceeded, url=' . $url . ',userid=' . $userid);
- return false;
+ return FALSE;
}
// Register the new URL
if (!isAdmin()) {
// Not admin or invalid ids array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin');
- return false;
+ return FALSE;
} elseif (!is_array($IDs)) {
// No array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array');
- return false;
+ return FALSE;
} elseif (count($IDs) == 0) {
// Empty array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty');
- return false;
+ return FALSE;
}
// Set to true to make AND expression valid if first URL got unlocked
- $done = true;
+ $done = TRUE;
// Update the status for all ids
foreach ($IDs as $id => $dummy) {
if (!isAdmin()) {
// Not admin or invalid ids array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Not admin');
- return false;
+ return FALSE;
} elseif (!is_array($IDs)) {
// No array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs type ' . gettype($IDs) . '!=array');
- return false;
+ return FALSE;
} elseif (count($IDs) == 0) {
// Empty array
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: IDs is empty');
- return false;
+ return FALSE;
}
// Set to true to make AND expression valid if first URL got unlocked
- $done = true;
+ $done = TRUE;
// Update the status for all ids
foreach ($IDs as $id => $dummy) {
if (!isMember()) {
// Not a member
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: isMember()=false');
- return false;
+ return FALSE;
} elseif ((!isUrlValid($url)) && (!isAdmin())) {
// URL invalid
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid, url=' . $url . ',limit=' . $limit);
- return false;
+ return FALSE;
} elseif (ifSurfbarHasUrlUserId($url, getMemberId())) {
// URL already found in surfbar!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Already found, url=' . $url . ',limit=' . $limit);
- return false;
+ return FALSE;
} elseif (!ifSurfbarMemberAllowedMoreUrls(getMemberId())) {
// No more allowed!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Maximum exceeded, url=' . $url . ',limit=' . $limit);
- return false;
+ return FALSE;
} elseif (''.($limit + 0).'' != ''.$limit.'') {
// Invalid amount entered
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Invalid limit, url=' . $url . ',limit=' . $limit);
- return false;
+ return FALSE;
}
// Register the new URL
$OUT = '';
foreach ($actionArray as $actionId => $action) {
// Add form for this action
- $OUT .= loadTemplate('member_list_surfbar_form', true, array(
+ $OUT .= loadTemplate('member_list_surfbar_form', TRUE, array(
'width' => $width,
'url_id' => bigintval($urlId),
'action' => strtolower($action)
} // END - foreach
// Load main template
- $output = loadTemplate('member_list_surfbar_table', true, $OUT);
+ $output = loadTemplate('member_list_surfbar_table', TRUE, $OUT);
// Return code
return $output;
// Do the member form request
function doSurfbarMemberByFormData ($formData, $urlArray) {
// By default no action is performed
- $performed = false;
+ $performed = FALSE;
// Is this a member?
if (!isMember()) {
// No member!
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: isMember()=false');
- return false;
+ return FALSE;
} elseif ((!isset($formData['url_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;
+ return FALSE;
} elseif (!isset($urlArray[$formData['url_id']])) {
// Id not found in cache
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot add URL: Field url_id not found in cache');
- return false;
+ return FALSE;
} elseif (!isSurfbarMemberActionStatusValid($formData['action'], $urlArray[$formData['url_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['url_id']]['url_status'] . ',url_id=' . $formData['url_id']);
- return false;
+ return FALSE;
}
// Secure action
// Has it changed?
if ($action != $formData['action']) {
// Invalid data in action found
- return false;
+ return FALSE;
} // END - if
// Create the function name for selected action
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'action=' . $action . ',status=' . $status . ',isValid=' . intval($isValid));
// Fetch the new status if found
- if ($isValid === true) {
+ if ($isValid === TRUE) {
// Load new status
list($GLOBALS['surfbar_cache']['new_status']) = SQL_FETCHROW($result);
} // END - if
} // END - if
// Load the form and display it
- loadTemplate(sprintf("member_surfbar_%s_action_form", $action), false, $urlData);
+ loadTemplate(sprintf("member_surfbar_%s_action_form", $action), FALSE, $urlData);
// All fine by default ... ;-)
- return true;
+ return TRUE;
}
// Execute choosen action
function executeSurfbarMemberAction ($action, $urlData) {
// By default nothing is executed
- $executed = false;
+ $executed = FALSE;
// Is limitation "no" and "limit" is > 0?
if ((isset($urlData[$action]['limited'])) && ($urlData[$action]['limited'] != 'Y') && ((isset($urlData[$action]['limit'])) && ($urlData[$action]['limit'] > 0)) || (!isset($urlData[$action]['limit']))) {
// Is that function there?
if (function_exists($functionName)) {
// Execute the function
- if (call_user_func_array($functionName, array($urlData)) == true) {
+ if (call_user_func_array($functionName, array($urlData)) == TRUE) {
// Update status as well
$executed = changeSurfbarUrlStatus($urlData['url_id'], $urlData['url_status'], $urlData['new_status'], array($urlData['url_id'] => $urlData));
} // END - if
// "Execute edit" function: Update changed data
function executeSurfbarMemberEditAction ($urlData) {
// Default is nothing done
- $status = false;
+ $status = FALSE;
// Has the URL or limit changed?
- if (true) {
+ if (TRUE) {
//if (($urlData['url_views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
// Run the query
SQL_QUERY_ESC("UPDATE
), __FUNCTION__, __LINE__);
// All fine
- $status = true;
+ $status = TRUE;
} // END - if
// Return status
// "Execute delete" function: Does nothing...
function executeSurfbarMemberDeleteAction ($urlData) {
// Nothing special to do (see above function for such "special actions" to perform)
- return true;
+ return TRUE;
}
//------------------------------------------------------------------------------
// Is this id valid?
if ($content['insert_id'] == '0') {
// INSERT did not insert any data!
- return false;
+ return FALSE;
} // END - if
// If in reg-mode we notify admin
function doSurfbarNotifyMember ($messageType, $content) {
// Skip notification if userid is zero
if ($content['url_userid'] == '0') {
- return false;
+ return FALSE;
} // END - if
// Prepare template name
}
// Determine reward
-function determineSurfbarReward ($onlyMin = false) {
+function determineSurfbarReward ($onlyMin = FALSE) {
// Static values are default
$reward = getConfig('surfbar_static_reward');
// Is there static or dynamic?
if (getSurfbarPaymentModel() == 'DYNAMIC') {
// "Calculate" dynamic reward
- if ($onlyMin === true) {
+ if ($onlyMin === TRUE) {
$reward += calculateSurfbarDynamicMininumValue();
} else {
$reward += calculateSurfbarDynamicAddValue();
function isSurfbarReloadFull () {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Fixed surf lock is ' . getConfig('surfbar_static_lock') . ' - ENTERED!');
// Default is full!
- $isFull = true;
+ $isFull = TRUE;
// Cache static reload lock
$GLOBALS['surfbar_cache']['surf_lock'] = getConfig('surfbar_static_lock');
}
// Get amount from database
- $count = countSumTotalData($userid, 'surfbar_urls', 'url_id', 'url_userid', true, $add);
+ $count = countSumTotalData($userid, 'surfbar_urls', 'url_id', 'url_userid', TRUE, $add);
// Return result
return $count;
if (empty($salt)) {
// Generate random hashed string
$GLOBALS['surfbar_cache']['salt'] = sha1(generatePassword(mt_rand(200, 255)));
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newSalt='.gerSurfbarSalt().'', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newSalt='.gerSurfbarSalt().'', FALSE);
} else {
// Use this as salt!
$GLOBALS['surfbar_cache']['salt'] = $salt;
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'oldSalt='.gerSurfbarSalt().'', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'oldSalt='.gerSurfbarSalt().'', FALSE);
}
// Hash it with md5() and salt it with the random string
function addSurfbarReloadLockById ($urlId) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',getMemberId()=' . getMemberId() . ' - ENTERED!');
// Search for an entry
- $countLock = countSumTotalData(getMemberId(), 'surfbar_locks', 'locks_id', 'locks_userid', true, ' AND `locks_url_id`=' . bigintval($urlId));
+ $countLock = countSumTotalData(getMemberId(), 'surfbar_locks', 'locks_id', 'locks_userid', TRUE, ' AND `locks_url_id`=' . bigintval($urlId));
// Is there no record?
if ($countLock == 0) {
// ---------- Comment out for debugging/developing member actions! ---------
if (SQL_AFFECTEDROWS() != 1) {
// No, something went wrong
- return false;
+ return FALSE;
} // END - if
// ---------- Comment out for debugging/developing member actions! ---------
// All done!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',prevStatus=' . $prevStatus . ',newStatus=' . $newStatus . ' - EXIT!');
- return true;
+ return TRUE;
}
// Calculate minimum value for dynamic payment model
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'lastQuery='.getConfig('db_last_query').'|numRows='.SQL_NUMROWS($result).'|Affected='.SQL_AFFECTEDROWS());
if (SQL_NUMROWS($result) == 1) {
// Load/cache data
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - BEFORE', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - BEFORE', FALSE);
$GLOBALS['surfbar_cache'] = merge_array($GLOBALS['surfbar_cache'], SQL_FETCHARRAY($result));
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - AFTER', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count('.count($GLOBALS['surfbar_cache']).') - AFTER', FALSE);
// Determine waiting time
$GLOBALS['surfbar_cache']['time'] = determineSurfbarWaitingTime();
// Is the last salt there?
if (is_null($GLOBALS['surfbar_cache']['salts_last_salt'])) {
// Then repair it wit the static!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'last_salt - FIXED!', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'last_salt - FIXED!', FALSE);
$GLOBALS['surfbar_cache']['salts_last_salt'] = '';
} // END - if
// Fix missing last_surfed
if ((!isset($GLOBALS['surfbar_cache']['last_surfed'])) || (is_null($GLOBALS['surfbar_cache']['last_surfed']))) {
// Fix it here
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'last_surfed - FIXED!', false);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'last_surfed - FIXED!', FALSE);
$GLOBALS['surfbar_cache']['last_surfed'] = '0';
} // END - if
//------------------------------------------------------------------------------
// Template helper to generate a selection box for surfbar actions
-function doTemplateSurfbarActionsActionSelectionBox ($templateName, $clear = false, $default = NULL) {
+function doTemplateSurfbarActionsActionSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
// Init array
$actionsAction = array(
0 => array('actions_action' => 'EDIT'),
);
// Handle it over to generateSelectionBoxFromArray()
- $content = generateSelectionBoxFromArray($actionsAction, 'surfbar_actions_action', 'actions_action', '', '', '', $default, '', false, true);
+ $content = generateSelectionBoxFromArray($actionsAction, 'surfbar_actions_action', 'actions_action', '', '', '', $default, '', FALSE, TRUE);
// Return prepared content
return $content;
}
// Template helper to generate a selection box for surfbar status
-function doTemplateSurfbarActionsStatusSelectionBox ($templateName, $clear = false, $default = NULL) {
+function doTemplateSurfbarActionsStatusSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
// Init array
$status = array(
0 => array('actions_status' => 'PENDING'),
);
// Handle it over to generateSelectionBoxFromArray()
- $content = generateSelectionBoxFromArray($status, 'surfbar_actions_status', 'actions_status', '', '', '', $default, '', false, true);
+ $content = generateSelectionBoxFromArray($status, 'surfbar_actions_status', 'actions_status', '', '', '', $default, '', FALSE, TRUE);
// Return prepared content
return $content;
}
// Template helper to generate a selection box for surfbar status
-function doTemplateSurfbarActionsNewStatusSelectionBox ($templateName, $clear = false, $default = NULL) {
+function doTemplateSurfbarActionsNewStatusSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
// Init array
$status = array(
0 => array('actions_new_status' => 'PENDING'),
);
// Handle it over to generateSelectionBoxFromArray()
- $content = generateSelectionBoxFromArray($status, 'surfbar_actions_new_status', 'actions_new_status', '', '', '', $default, '', true, true);
+ $content = generateSelectionBoxFromArray($status, 'surfbar_actions_new_status', 'actions_new_status', '', '', '', $default, '', TRUE, TRUE);
// Return prepared content
return $content;