X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fsurfbar_functions.php;h=932259cc4087a93641850e22ff85c106936f8a77;hp=35b8b1d199558fef113ce2c836885da85b983b21;hb=f928ad2bed60fa256d0641eaf6d2c027a2944688;hpb=9d3b6045b267bd17eb017f458f24122918df132c;ds=sidebyside diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 35b8b1d199..932259cc40 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -518,7 +518,7 @@ function SURFBAR_HANDLE_LOW_POINTS () { SURFBAR_NOTIFY_USER('low_points', $content); // Update last notified - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE userid=%s LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE `userid`=%s LIMIT 1", array($uid), __FUNCTION__, __LINE__); } // END - if } // END - foreach @@ -837,12 +837,18 @@ function SURFBAR_CHECK_RELOAD_FULL() { } // END - if // Ask the database - $result = SQL_QUERY_ESC("SELECT COUNT(l.id) AS cnt FROM `{!_MYSQL_PREFIX!}_surfbar_locks` AS l -INNER JOIN `{!_MYSQL_PREFIX!}_surfbar_urls` AS u -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) + $result = SQL_QUERY_ESC("SELECT + COUNT(l.id) AS cnt +FROM + `{!_MYSQL_PREFIX!}_surfbar_locks` AS l +INNER JOIN + `{!_MYSQL_PREFIX!}_surfbar_urls` AS u +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) LIMIT 1", - array(getUserId()), __FUNCTION__, __LINE__ + array(getUserId()), __FUNCTION__, __LINE__ ); // Fetch row @@ -919,31 +925,20 @@ function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status = '',$exclude = '') { // Is the status set? if (is_array($status)) { // Only URLs with these status - $add = sprintf(" AND status IN('%s')", implode("','", $status)); + $add = sprintf(" AND `status` IN('%s')", implode("','", $status)); } elseif (!empty($status)) { // Only URLs with this status $add = sprintf(" AND `status`='%s'", $status); } elseif (is_array($exclude)) { // Exclude URLs with these status - $add = sprintf(" AND status NOT IN('%s')", implode("','", $exclude)); + $add = sprintf(" AND `status` NOT IN('%s')", implode("','", $exclude)); } elseif (!empty($exclude)) { // Exclude URLs with this status - $add = sprintf(" AND status != '%s'", $exclude); + $add = sprintf(" AND `status` != '%s'", $exclude); } // Get amount from database - $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt -FROM `{!_MYSQL_PREFIX!}_surfbar_urls` -WHERE `userid`=%s".$add." -LIMIT %s", - array($uid, getConfig('surfbar_max_order')), __FUNCTION__, __LINE__ - ); - - // Fetch row - list($cnt) = SQL_FETCHROW($result); - - // Free result - SQL_FREERESULT($result); + $cnt = GET_TOTAL_DATA($uid, 'surfbar_urls', 'id', 'userid', true, $add); // Return result return $cnt; @@ -1099,12 +1094,15 @@ function SURFBAR_UPDATE_SALT_STATS () { function SURFBAR_CHECK_RELOAD_LOCK ($urlId) { //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}", false); // Ask the database - $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt -FROM `{!_MYSQL_PREFIX!}_surfbar_locks` -WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(last_surfed) -ORDER BY last_surfed ASC + $result = SQL_QUERY_ESC("SELECT COUNT(`id`) AS cnt +FROM + `{!_MYSQL_PREFIX!}_surfbar_locks` +WHERE + `userid`=%s AND `url_id`=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(`last_surfed`) +ORDER BY + `last_surfed` ASC LIMIT 1", - array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__ + array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__ ); // Fetch counter