* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
$userid = bigintval($urlData['url_userid']);
// Is the id set?
- if (empty($userid)) $userid = '0';
+ if (empty($userid)) {
+ $userid = 'NULL';
+ } // END - if
// Just run the insert query for now
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_urls` (`url_userid`,`url`,`url_status`,`url_views_max`,`url_views_allowed`,`url_fixed_reload`) VALUES (%s,'%s','%s',%s,%s,%s)",
$templateName = 'surfbar_frameset';
// Any frame set? ;-)
- if (isGetRequestParameterSet('frame')) {
+ if (isGetRequestElementSet('frame')) {
// Use the frame as a template name part... ;-)
$templateName = sprintf("surfbar_frame_%s",
- getRequestParameter('frame')
+ getRequestElement('frame')
);
} // END - if
}
// 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 = NULL) {
// Determine depleted user account
$userids = SURFBAR_DETERMINE_DEPLETED_USERIDS();
}
// 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 = NULL) {
// 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')) < getSurfbarMaxOrder()));
+ return (((is_null($userid)) && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array('REJECTED')) < getSurfbarMaxOrder()));
}
// 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 = NULL, $status = '', $exclude = '') {
// Is the user 0 and user is logged in?
- if (($userid == '0') && (isMember())) {
+ if ((is_null($userid)) && (isMember())) {
// Then use this userid
$userid = getMemberId();
- } elseif ($userid == '0') {
+ } elseif (is_null($userid)) {
// Error!
return (getSurfbarMaxOrder() + 1);
}
// Is the status set?
if (is_array($status)) {
// Only URLs with these status
- $add = sprintf(" AND `url_status` IN('%s')", implode("','", $status));
+ $add = sprintf(" WHERE `url_status` IN('%s')", implode("','", $status));
} elseif (!empty($status)) {
// Only URLs with this status
- $add = sprintf(" AND `url_status`='%s'", $status);
+ $add = sprintf(" WHERE `url_status`='%s'", $status);
} elseif (is_array($exclude)) {
// Exclude URLs with these status
- $add = sprintf(" AND `url_status` NOT IN('%s')", implode("','", $exclude));
+ $add = sprintf(" WHERE `url_status` NOT IN('%s')", implode("','", $exclude));
} elseif (!empty($exclude)) {
// Exclude URLs with this status
- $add = sprintf(" AND `url_status` != '%s'", $exclude);
+ $add = sprintf(" WHERE `url_status` != '%s'", $exclude);
}
// Get amount from database
// Do we have no record?
if ($countLock == 0) {
// Just add it to the database
- SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`, `locks_url_id`) VALUES (%s, %s)',
+ SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_locks` (`locks_userid`,`locks_url_id`) VALUES (%s, %s)',
array(
getMemberId(),
bigintval($urlId)
// Remove it from the URL owner
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.SURFBAR_GET_USERID().',costs='.SURFBAR_GET_COSTS() . ' - ENTERED!');
if (isValidUserId(SURFBAR_GET_USERID())) {
+ // Subtract points and ignore return status
subtractPoints(sprintf("surfbar_%s", getSurfbarPaymentModel()), SURFBAR_GET_USERID(), SURFBAR_GET_COSTS());
} // END - if
// Init referal system here
initReferalSystem();
- // Book it to the user
- addPointsThroughReferalSystem(sprintf("surfbar_%s", getSurfbarPaymentModel()), getMemberId(), SURFBAR_GET_REWARD());
+ // Book it to the user and ignore return status
+ addPointsThroughReferalSystem(sprintf("surfbar:%s", getSurfbarPaymentModel()), getMemberId(), SURFBAR_GET_REWARD());
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid='.SURFBAR_GET_USERID().',costs='.SURFBAR_GET_COSTS() . ' - EXIT!');
}
// Was that update okay?
if (SQL_HASZEROAFFECTED()) {
// No, then insert entry
- SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`, `stats_url_id`, `stats_count`) VALUES (%s,%s,1)',
+ SQL_QUERY_ESC('INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_stats` (`stats_userid`,`stats_url_id`,`stats_count`) VALUES (%s,%s,1)',
array(
getMemberId(),
SURFBAR_GET_ID()
// Was that okay?
if (SQL_HASZEROAFFECTED()) {
// Insert missing entry!
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`salts_url_id`, `salts_userid`, `salts_last_salt`) VALUES (%s, %s, '%s')",
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_salts` (`salts_url_id`,`salts_userid`,`salts_last_salt`) VALUES (%s, %s, '%s')",
array(
SURFBAR_GET_ID(),
getMemberId(),
}
// Changes the status of an URL from given to other
-function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) {
+function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data = array()) {
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ',prevStatus=' . $prevStatus . ',newStatus=' . $newStatus . ' - ENTERED!');
// Make new status always lower-case
$newStatus = strtolower($newStatus);
// 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 = NULL) {
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'urlId=' . $urlId . ' - ENTERED!');
// Default is no id and no random number
$nextId = '0';
$randNum = '0';
// Is the id set?
- if ($urlId == '0') {
+ if (is_null($urlId)) {
// Get array with lock ids
$USE = SURFBAR_GET_LOCK_IDS();
/* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ' - ENTERED!');
// Default is null
- $data = null;
+ $data = NULL;
// Is the entry there?
if (isset($GLOBALS['surfbar_cache'][$element])) {