} elseif (!is_array($IDs)) {
// No array
return false;
- } elseif (count($IDs) == 0) {
+ } elseif (count($IDs) == '0') {
// Empty array
return false;
}
} elseif (!is_array($IDs)) {
// No array
return false;
- } elseif (count($IDs) == 0) {
+ } elseif (count($IDs) == '0') {
// Empty array
return 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']))) {
// Set it to unlimited
- $urlData[$action]['limit'] = 0;
+ $urlData[$action]['limit'] = '0';
} // END - if
// Construct function name
// Is limit/reload set?
if (!isset($config['limit'])) {
- $content['limit'] = 0;
+ $content['limit'] = '0';
} // END - if
if (!isset($config['reload'])) {
- $content['reload'] = 0;
+ $content['reload'] = '0';
} // END - if
// Insert the URL into database
$content['insert_id'] = SURFBAR_INSERT_URL_BY_ARRAY($content);
// Is this id valid?
- if ($content['insert_id'] == 0) {
+ if ($content['insert_id'] == '0') {
// INSERT did not insert any data!
return false;
} // END - if
$userid = bigintval($urlData['userid']);
// Is the id set?
- if (empty($userid)) $userid = 0;
+ if (empty($userid)) $userid = '0';
// Just run the insert query for now
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_urls` (userid,url,status,views_max,views_allowed,fixed_reload) VALUES (%s,'%s','%s',%s,%s,%s)",
// 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['userid'] == '0') {
return false;
} // END - if
// Translates the limit
function translateSurfbarLimit ($limit) {
// Is this zero?
- if ($limit == 0) {
+ if ($limit == '0') {
// Unlimited!
$return = getMessage('MEMBER_SURFBAR_UNLIMITED_VIEWS');
} else {
ON
u.id=l.url_id
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)
+ 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(getMemberId()), __FUNCTION__, __LINE__
);
// Is it null?
if (is_null($GLOBALS['surfbar_cache']['user_locks'])) {
// Then fix it to zero!
- $GLOBALS['surfbar_cache']['user_locks'] = 0;
+ $GLOBALS['surfbar_cache']['user_locks'] = '0';
} // END - if
// Free result
}
// Get total amount of URLs of given status for current user or of ACTIVE URLs by default
-function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = 0) {
+function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = '0') {
// Determine depleted user account
$UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
// If we dont get any user ids back, there are no URLs
- if (count($UIDs['userid']) == 0) {
+ if (count($UIDs['userid']) == '0') {
// No user ids found, no URLs!
return 0;
} // END - if
}
// Check wether the user is allowed to book more URLs
-function SURFBAR_IF_USER_BOOK_MORE_URLS ($userid = 0) {
+function SURFBAR_IF_USER_BOOK_MORE_URLS ($userid = '0') {
// Is this admin and userid is zero or does the user has some URLs left to book?
- return ((($userid == 0) && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
+ return ((($userid == '0') && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
}
// Get total amount of URLs of given status for current user
-function SURFBAR_GET_TOTAL_USER_URLS ($userid = 0, $status = '',$exclude = '') {
+function SURFBAR_GET_TOTAL_USER_URLS ($userid = '0', $status = '',$exclude = '') {
// Is the user 0 and user is logged in?
- if (($userid == 0) && (isMember())) {
+ if (($userid == '0') && (isMember())) {
// Then use this userid
$userid = getMemberId();
- } elseif ($userid == 0) {
+ } elseif ($userid == '0') {
// Error!
return (getConfig('surfbar_max_order') + 1);
}
$length = getConfig('code_length');
// Fix length to 10
- if ($length == 0) $length = 10;
+ if ($length == '0') $length = 10;
// Generate a code until the length matches
$valCode = '';
);
// Do we have a current user id?
- if ((isMember()) && ($limit == 0)) {
+ if ((isMember()) && ($limit == '0')) {
// Then add this as well
$UIDs['userid'][getMemberId()] = getMemberId();
$UIDs['points'][getMemberId()] = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
- $UIDs['notified'][getMemberId()] = 0;
+ $UIDs['notified'][getMemberId()] = '0';
// Get all userid except logged in one
$result = SQL_QUERY_ESC("SELECT
$newStatus = strtolower($newStatus);
// Get URL data for status comparison if missing
- if ((!is_array($data)) || (count($data) == 0)) {
+ if ((!is_array($data)) || (count($data) == '0')) {
// Fetch missing URL data
$data = SURFBAR_GET_URL_DATA($urlId);
} // END - if
// Calculate minimum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
// Addon is zero by default
- $addon = 0;
+ $addon = '0';
// Percentage part
$percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
// Calculate maximum value for dynamic payment model
function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
// Addon is zero by default
- $addon = 0;
+ $addon = '0';
// Maximum value
$max = log(2);
// Determine next id for surfbar or get data for given id, always call this before you call other
// getters below this function!!!
-function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) {
+function SURFBAR_DETERMINE_NEXT_ID ($urlId = '0') {
// Default is no id and no random number
- $nextId = 0;
- $randNum = 0;
+ $nextId = '0';
+ $randNum = '0';
// Is the id set?
- if ($urlId == 0) {
+ if ($urlId == '0') {
// Get array with lock ids
$USE = SURFBAR_GET_LOCK_IDS();
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);
- $GLOBALS['surfbar_cache']['last_surfed'] = 0;
+ $GLOBALS['surfbar_cache']['last_surfed'] = '0';
} // END - if
// Get base/fixed reward and costs